Skip to content

Commit

Permalink
Clockwork 0.95.2
Browse files Browse the repository at this point in the history
* Added BackSword 2, a reworked SWEP base made for Clockwork that
includes ironsights variables.
* *Contributed by Zigalishous.*
* Added ironsights that can be used with any weapon that uses the
ironsight variable format that M9K, BS2 and RealCS use.
Just press middle mouse while your weapon is raised to use the
ironsights, it will slow movement and reduce spread.
* *Contributed by NightAngel.*
* Added cwToggleIronSights concommand so that players can bind a key to
this to toggle their ironsights instead of middle mouse.
* *Contributed by NightAngel.*
* Fixed displaytyping text not drawing over translucent surfaces after
recent changes.
* *Contributed by NightAngel.*
* Small optimizations to some functions in cl_kernel.
* *Contributed by NightAngel.*
* Added viewmodel hands info to Combine animations tables to make any
added models use the Combine viewmodel hands.
* *Contributed by NightAngel.*
* Added rudimentary zombie animation table for Half-Life 2 classic
zombie animations.
* *Contributed by NightAngel.*
* Added player model animations so that player models will now animate
properly without tposing.
* *Contributed by NightAngel.*
* Added multiple functions to register certain models to use certain
viewmodel hand info (CSS, HL2, Combine, Citizen, etc).
* *Contributed by NightAngel.*
* Made male_01/03 as well as female_03 use the black skin for citizen
hands.
* *Contributed by NightAngel.*
* Made group03/03m models use the refugee hands model with the gloves
bodygroup on.
* *Contributed by NightAngel.*
* Made HL2 zombie models use zombie skin for refugee arms model.
* *Contributed by NightAngel.*
* Removed redundant male/female human model animation registering (They
get set to these automatically anyways).
* *Contributed by NightAngel.*
* Small edit to codebase to make it write its documentation findings to
seperate files to avoid this huge text file containing all the
documentation.
* *Contributed by NightAngel.*
* Added 'CanDrawCrosshair' plugin hook that gets called to determine if
a player's crosshair should be drawn, ironsights will force crosshair to
draw if they are used in third person.
* *Contributed by NightAngel.*
* Added two configs to modify how much ironsights will reduce the
spread, as well as how much they will reduce walk speed of the player.
* *Contributed by NightAngel.*
* Added edited Half-Life Universe entity menus that can be toggled on or
off via convar 'cwEntityMenuType', or alternatively forced via config.
* *Contributed by Spencer Sharkey and modified by NightAngel.*
  • Loading branch information
Skiastra committed Feb 3, 2016
1 parent 87edd33 commit f3f9738
Show file tree
Hide file tree
Showing 45 changed files with 2,904 additions and 243 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,45 @@ Changelog
---------
The following changes have been made for each official Clockwork build.

0.95.2
-------

* Added BackSword 2, a reworked SWEP base made for Clockwork that includes ironsights variables.
* *Contributed by Zigalishous.*
* Added ironsights that can be used with any weapon that uses the ironsight variable format that M9K, BS2 and RealCS use.
Just press middle mouse while your weapon is raised to use the ironsights, it will slow movement and reduce spread.
* *Contributed by NightAngel.*
* Added cwToggleIronSights concommand so that players can bind a key to this to toggle their ironsights instead of middle mouse.
* *Contributed by NightAngel.*
* Fixed displaytyping text not drawing over translucent surfaces after recent changes.
* *Contributed by NightAngel.*
* Small optimizations to some functions in cl_kernel.
* *Contributed by NightAngel.*
* Added viewmodel hands info to Combine animations tables to make any added models use the Combine viewmodel hands.
* *Contributed by NightAngel.*
* Added rudimentary zombie animation table for Half-Life 2 classic zombie animations.
* *Contributed by NightAngel.*
* Added player model animations so that player models will now animate properly without tposing.
* *Contributed by NightAngel.*
* Added multiple functions to register certain models to use certain viewmodel hand info (CSS, HL2, Combine, Citizen, etc).
* *Contributed by NightAngel.*
* Made male_01/03 as well as female_03 use the black skin for citizen hands.
* *Contributed by NightAngel.*
* Made group03/03m models use the refugee hands model with the gloves bodygroup on.
* *Contributed by NightAngel.*
* Made HL2 zombie models use zombie skin for refugee arms model.
* *Contributed by NightAngel.*
* Removed redundant male/female human model animation registering (They get set to these automatically anyways).
* *Contributed by NightAngel.*
* Small edit to codebase to make it write its documentation findings to seperate files to avoid this huge text file containing all the documentation.
* *Contributed by NightAngel.*
* Added 'CanDrawCrosshair' plugin hook that gets called to determine if a player's crosshair should be drawn, ironsights will force crosshair to draw if they are used in third person.
* *Contributed by NightAngel.*
* Added two configs to modify how much ironsights will reduce the spread, as well as how much they will reduce walk speed of the player.
* *Contributed by NightAngel.*
* Added edited Half-Life Universe entity menus that can be toggled on or off via convar 'cwEntityMenuType', or alternatively forced via config.
* *Contributed by Spencer Sharkey and modified by NightAngel.*

0.95.1
-------

Expand Down
2 changes: 1 addition & 1 deletion Clockwork/garrysmod/gamemodes/clockwork/clockwork.txt
Expand Up @@ -5,7 +5,7 @@
"settings"
{
}
"version" "0.95.1"
"version" "0.95.2"
"author" "Cloud Sixteen"
"description" "A roleplaying framework developed by Cloud Sixteen for the people."
"workshopid" "474315121"
Expand Down
164 changes: 114 additions & 50 deletions Clockwork/garrysmod/gamemodes/clockwork/framework/cl_kernel.lua
Expand Up @@ -676,6 +676,13 @@ function Clockwork:ClockworkConfigInitialized(key, value)
end;
end;
local checkTable = {
["cwTextColorR"] = true,
["cwTextColorG"] = true,
["cwTextColorB"] = true,
["cwTextColorA"] = true
}
--[[
@codebase Client
@details Called when one of the client's console variables have been changed.
Expand All @@ -684,13 +691,6 @@ end;
@param String The new value of the convar.
--]]
function Clockwork:ClockworkConVarChanged(name, previousValue, newValue)
local checkTable = {
["cwTextColorR"] = true,
["cwTextColorG"] = true,
["cwTextColorB"] = true,
["cwTextColorA"] = true
}
if (checkTable[name] and not Clockwork.theme:IsFixed()) then
cwOption:SetColor(
"information",
Expand Down Expand Up @@ -880,6 +880,8 @@ function Clockwork:Initialize()
CW_CONVAR_BACKH = cwKernel:CreateClientConVar("cwBackH", 109, true, true);
CW_CONVAR_SHOWMATERIAL = cwKernel:CreateClientConVar("cwShowMaterial", 0, true, true);
CW_CONVAR_SHOWGRADIENT = cwKernel:CreateClientConVar("cwShowGradient", 0, true, true);
CW_CONVAR_ENTITYMENU = cwKernel:CreateClientConVar("cwEntityMenuType", 0, true, true);
if (!cwChatBox.panel) then
cwChatBox:CreateDermaAll();
Expand Down Expand Up @@ -1190,15 +1192,40 @@ function Clockwork:CalcView(player, origin, angles, fov)
return view;
end;
local WEAPON_LOWERED_ANGLES = Angle(30, -30, -25)
local WEAPON_LOWERED_ANGLES = Angle(30, -30, -25);
local WEAPON_LOWERED_ORIGIN = Vector(0, 0, 0);
local DEFAULT_IRONSIGHTS_ORIGIN = Vector(-3.481, -8.242, 1.039);
local WEAPON_IRONSIGHTS = {
weapon_pistol = {
angles = Vector(0.493, -1.31, 2),
origin = Vector(-5.841, -8.643, 2.939)
},
weapon_ar2 = {
angles = Vector(0, 0, 0),
origin = Vector(-3.481, -8.242, 1.039)
},
weapon_smg1 = {
angles = Vector(1.208, 0, 0),
origin = Vector(-6.422, -5.85, 0.8)
},
weapon_357 = {
angles = Vector(0, -0.25, 1),
origin = Vector(-4.7, -2, 0.65)
},
weapon_shotgun = {
angles = Vector(0, 0, 0),
origin = Vector(-8.961, -6.633, 4.239)
}
};
function Clockwork:CalcViewModelView(weapon, viewModel, oldEyePos, oldEyeAngles, eyePos, eyeAngles)
if (!IsValid(weapon)) then return; end;
local weaponRaised = cwPly:GetWeaponRaised(cwClient);
if (!cwClient:HasInitialized() or !cwConfig:HasInitialized()
or cwClient:GetMoveType() == MOVETYPE_OBSERVER) then
local weaponRaised = Clockwork.player:GetWeaponRaised(Clockwork.Client);
local isIronSights = Clockwork.ironsights:GetIronSights();
if (!Clockwork.Client:HasInitialized() or !Clockwork.config:HasInitialized()
or Clockwork.Client:GetMoveType() == MOVETYPE_OBSERVER) then
weaponRaised = nil;
end;
Expand All @@ -1208,39 +1235,74 @@ function Clockwork:CalcViewModelView(weapon, viewModel, oldEyePos, oldEyeAngles,
targetValue = 0;
end;
local fraction = (cwClient.cwRaisedFraction or 100) / 100;
local itemTable = cwItem:GetByWeapon(weapon);
local originMod = Vector(-3.0451, -1.6419, -0.5771);
local fraction = (Clockwork.Client.cwRaisedFraction or 100) / 100;
local itemTable = Clockwork.item:GetByWeapon(weapon);
local originMod = weapon.LoweredOrigin or WEAPON_LOWERED_ORIGIN;
local anglesMod = weapon.LoweredAngles or WEAPON_LOWERED_ANGLES;
if (itemTable and itemTable("loweredAngles")) then
anglesMod = itemTable("loweredAngles");
elseif (weapon.LoweredAngles) then
anglesMod = weapon.LoweredAngles;
end;
local viewInfo = {
origin = originMod,
angles = anglesMod
};
cwPlugin:Call("GetWeaponLoweredViewInfo", itemTable, weapon, viewInfo);
--[[
if (itemTable and itemTable("loweredOrigin")) then
originMod = itemTable("loweredOrigin");
elseif (weapon.LoweredOrigin) then
originMod = weapon.LoweredOrigin;
end;
--]]
local viewInfo = {
origin = originMod,
angles = anglesMod
};
Clockwork.plugin:Call("GetWeaponLoweredViewInfo", itemTable, weapon, viewInfo);
eyeAngles:RotateAroundAxis(eyeAngles:Up(), viewInfo.angles.p * fraction);
eyeAngles:RotateAroundAxis(eyeAngles:Forward(), viewInfo.angles.y * fraction);
eyeAngles:RotateAroundAxis(eyeAngles:Right(), viewInfo.angles.r * fraction);
cwClient.cwRaisedFraction = Lerp(FrameTime() * 2, cwClient.cwRaisedFraction or 100, targetValue)
--viewModel:SetAngles(eyeAngles)
oldEyePos = oldEyePos + ((eyeAngles:Forward() * viewInfo.origin.y) + (eyeAngles:Right() * viewInfo.origin.x) + (eyeAngles:Up() * viewInfo.origin.z)) * fraction;
Clockwork.Client.cwRaisedFraction = Lerp(FrameTime() * 2, Clockwork.Client.cwRaisedFraction or 100, targetValue)
--Ironsights.
local viewTable = WEAPON_IRONSIGHTS[weapon:GetClass()] or {};
Clockwork.plugin:Call("GetWeaponIronsightsViewInfo", itemTable, weapon, viewTable);
local ironAnglesMod = viewTable.angles;
local ironOriginMod = viewTable.origin or DEFAULT_IRONSIGHTS_ORIGIN;
local ironTargetValue = 0;
if ((ironAnglesMod or ironOriginMod) and isIronSights) then
ironTargetValue = 100;
end;
local fraction = (Clockwork.ironsights.ironFraction or 100) / 100;
if (ironAnglesMod) then
eyeAngles:RotateAroundAxis(eyeAngles:Up(), ironAnglesMod.y * fraction);
eyeAngles:RotateAroundAxis(eyeAngles:Forward(), ironAnglesMod.z * fraction);
eyeAngles:RotateAroundAxis(eyeAngles:Right(), ironAnglesMod.x * fraction);
end;
if (ironOriginMod) then
oldEyePos = oldEyePos + ((eyeAngles:Forward() * ironOriginMod.y) + (eyeAngles:Right() * ironOriginMod.x) + (eyeAngles:Up() * ironOriginMod.z)) * fraction;
end;
local bLerp = true;
if (Clockwork.ironsights.ironFraction <= 1 and ironTargetValue == 0) then
bLerp = false;
end;
if (bLerp) then
Clockwork.ironsights.ironFraction = Lerp(FrameTime() * 5, Clockwork.ironsights.ironFraction or 100, ironTargetValue);
end;
--Return the edited angle and position.
return oldEyePos, eyeAngles;
end;
Expand All @@ -1259,25 +1321,24 @@ function Clockwork:PlayerLimbTakeDamage(hitGroup, damage) end;
-- Called when a weapon's lowered view info is needed.
function Clockwork:GetWeaponLoweredViewInfo(itemTable, weapon, viewInfo) end;
local blockedElements = {
CHudSecondaryAmmo = true,
CHudVoiceStatus = true,
CHudSuitPower = true,
CHudCrosshair = true,
CHudBattery = true,
CHudHealth = true,
CHudAmmo = true,
CHudChat = true
};
-- Called when a HUD element should be drawn.
function Clockwork:HUDShouldDraw(name)
local blockedElements = {
"CHudSecondaryAmmo",
"CHudVoiceStatus",
"CHudSuitPower",
"CHudBattery",
"CHudHealth",
"CHudAmmo",
"CHudChat"
};
if (!IsValid(cwClient) or !cwClient:HasInitialized() or cwKernel:IsChoosingCharacter()) then
if (name != "CHudGMod") then
return false;
end;
elseif (name == "CHudCrosshair") then
return false;
elseif (table.HasValue(blockedElements, name)) then
elseif (blockedElements[name]) then
return false;
end;
Expand Down Expand Up @@ -1535,18 +1596,15 @@ end;
function Clockwork:InitPostEntity()
self.Client = LocalPlayer();
cwClient = self.Client;
if (IsValid(self.Client)) then
cwPlugin:Call("LocalPlayerCreated");
cwDatastream:Start("LocalPlayerCreated", true);
end;
end;
-- Called each frame.
function Clockwork:Think()
if (!self.CreatedLocalPlayer) then
if (IsValid(self.Client)) then
cwPlugin:Call("LocalPlayerCreated");
cwDatastream:Start("LocalPlayerCreated", true);
self.CreatedLocalPlayer = true;
end;
end;
cwKernel:CallTimerThink(CurTime());
cwKernel:CalculateHints();
Expand Down Expand Up @@ -3251,8 +3309,9 @@ function Clockwork:HUDPaint()
cwKernel:DrawHints();
end;
if ((cwConfig:Get("enable_crosshair"):Get() or cwKernel:IsDefaultWeapon(weapon))
and (IsValid(weapon) and weapon.DrawCrosshair != false)) then
-- if ((cwConfig:Get("enable_crosshair"):Get() or cwKernel:IsDefaultWeapon(weapon))
-- and (IsValid(weapon) and weapon.DrawCrosshair != false)) then
if (cwPlugin:Call("CanDrawCrosshair", weapon)) then
local info = {
color = Color(255, 255, 255, 255),
x = ScrW() / 2,
Expand All @@ -3267,6 +3326,11 @@ function Clockwork:HUDPaint()
end;
end;
function Clockwork:CanDrawCrosshair(weapon)
return (cwConfig:Get("enable_crosshair"):Get() or cwKernel:IsDefaultWeapon(weapon))
and (IsValid(weapon) and weapon.DrawCrosshair != false);
end;
-- Called when the local player's crosshair info is needed.
function Clockwork:GetPlayerCrosshairInfo(info)
if (cwConfig:Get("use_free_aiming"):Get()) then
Expand Down
Expand Up @@ -96,6 +96,11 @@ Clockwork.config:AddToSystem("Steam API Key", "steam_api_key", "Some non-essenti
Clockwork.config:AddToSystem("Enable Map Props Physgrab", "enable_map_props_physgrab", "Whether or not players will be able to grab map props and doors with physguns.");
Clockwork.config:AddToSystem("Entity Use Cooldown", "entity_handle_time", "The amount of time between entity uses a player has to wait.", 0, 1, 3);
Clockwork.config:AddToSystem("Enable Smooth Sprint", "player_should_smooth_sprint", "Whether or not smooth sprinting will be used.");
Clockwork.config:AddToSystem("Force Entity Menu Type", "force_entity_menus", "Either force 3D entity menus (2), 2D (1), or let the user decide (0).", 0, 2, 0);
Clockwork.config:AddToSystem("Enable Ironsights", "enable_ironsights", "Whether or not players can use ironsights on their weapons when available.");
Clockwork.config:AddToSystem("Ironsights Spread Reduction", "ironsights_spread", "The amount that ironsights will reduce bullet spread by.", 0, 1, 3);
Clockwork.config:AddToSystem("Ironsights Slow Amount", "ironsights_slow", "The amount that using ironsights will decrease a player's movement speed by.", 0, 1, 3);
Clockwork.config:AddToSystem("Crafting Description", "crafting_description", "The description of what the crafting menu does.");
Clockwork.config:AddToSystem("Crafting Enabled", "crafting_menu_enabled", "Whether or not the crafting menu is enabled.");
Expand Down
Expand Up @@ -113,6 +113,11 @@ Clockwork.config:Add("enable_map_props_physgrab", false);
Clockwork.config:Add("translate_api_key", "");
Clockwork.config:Add("entity_handle_time", 0.1);
Clockwork.config:Add("player_should_smooth_sprint", true);
Clockwork.config:Add("force_entity_menus", 1, true);
Clockwork.config:Add("enable_ironsights", true, true);
Clockwork.config:Add("ironsights_spread", 0.5, true);
Clockwork.config:Add("ironsights_slow", 0.5, true);
Clockwork.config:Add("crafting_description", "Combine various items to make new items.", true);
Clockwork.config:Add("crafting_menu_enabled", false, true);
Expand Down

0 comments on commit f3f9738

Please sign in to comment.