diff --git a/CHANGELOG.md b/CHANGELOG.md index 948fac99..28aa2f97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ------- diff --git a/Clockwork/garrysmod/gamemodes/clockwork/clockwork.txt b/Clockwork/garrysmod/gamemodes/clockwork/clockwork.txt index 2c3532ab..b52beb42 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/clockwork.txt +++ b/Clockwork/garrysmod/gamemodes/clockwork/clockwork.txt @@ -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" diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/cl_kernel.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/cl_kernel.lua index fbd6e106..13f31142 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/cl_kernel.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/cl_kernel.lua @@ -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. @@ -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", @@ -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(); @@ -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; @@ -1208,9 +1235,9 @@ 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 @@ -1218,29 +1245,64 @@ function Clockwork:CalcViewModelView(weapon, viewModel, oldEyePos, oldEyeAngles, 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; @@ -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; @@ -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(); @@ -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, @@ -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 diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/config/cl_config.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/config/cl_config.lua index 27f8a92c..19c51617 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/config/cl_config.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/config/cl_config.lua @@ -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."); diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/config/sv_config.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/config/sv_config.lua index 94efa738..5b07a9bb 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/config/sv_config.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/config/sv_config.lua @@ -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); diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_animation.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_animation.lua index d0a0d560..7989d7ca 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_animation.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_animation.lua @@ -144,7 +144,12 @@ Clockwork.animation.stored.combineOverwatch = { ["smg_reload"] = ACT_GESTURE_RELOAD, ["stand_run"] = ACT_RUN_RIFLE, ["jump"] = ACT_GLIDE, - ["sit"] = ACT_COVER_LOW + ["sit"] = ACT_COVER_LOW, + ["hands"] = { + body = 0000000, + model = "models/weapons/c_arms_combine.mdl", + skin = 0 + } }; Clockwork.animation.stored.civilProtection = { @@ -233,7 +238,12 @@ Clockwork.animation.stored.civilProtection = { ["smg_reload"] = ACT_GESTURE_RELOAD_SMG1, ["stand_run"] = ACT_RUN, ["jump"] = ACT_GLIDE, - ["sit"] = ACT_COVER_PISTOL_LOW + ["sit"] = ACT_COVER_PISTOL_LOW, + ["hands"] = { + body = 0000000, + model = "models/weapons/c_arms_combine.mdl", + skin = 0 + } }; Clockwork.animation.stored.femaleHuman = { @@ -414,6 +424,95 @@ Clockwork.animation.stored.maleHuman = { ["sit"] = ACT_BUSY_SIT_CHAIR }; +Clockwork.animation.stored.zombie = { + ["crouch_grenade_aim_idle"] = ACT_COVER_LOW, + ["crouch_grenade_aim_walk"] = ACT_WALK, + ["stand_grenade_aim_idle"] = ACT_IDLE, + ["crouch_pistol_aim_idle"] = ACT_RANGE_ATTACK_PISTOL_LOW, + ["stand_grenade_aim_walk"] = ACT_WALK, + ["crouch_pistol_aim_walk"] = ACT_WALK, + ["crouch_heavy_aim_idle"] = ACT_RANGE_AIM_SMG1_LOW, + ["crouch_blunt_aim_idle"] = ACT_COWER, + ["stand_grenade_aim_run"] = ACT_RUN, + ["crouch_blunt_aim_walk"] = ACT_WALK, + ["crouch_heavy_aim_walk"] = ACT_WALK, + ["stand_pistol_aim_walk"] = ACT_WALK, + ["stand_pistol_aim_idle"] = ACT_RANGE_ATTACK_PISTOL, + ["crouch_fist_aim_walk"] = ACT_WALK, + ["crouch_slam_aim_walk"] = ACT_WALK, + ["stand_pistol_aim_run"] = ACT_RUN_AIM_RIFLE_STIMULATED, + ["crouch_fist_aim_idle"] = ACT_RANGE_AIM_SMG1_LOW, + ["stand_heavy_aim_idle"] = ACT_IDLE_ANGRY_RPG, + ["stand_blunt_aim_idle"] = ACT_IDLE_MANNEDGUN, + ["crouch_slam_aim_idle"] = ACT_COVER_LOW_RPG, + ["stand_blunt_aim_walk"] = ACT_WALK, + ["stand_heavy_aim_walk"] = ACT_WALK, + ["stand_fist_aim_idle"] = ACT_RANGE_ATTACK_SMG1, + ["crouch_smg_aim_walk"] = ACT_WALK, + ["crouch_smg_aim_idle"] = ACT_RANGE_AIM_SMG1_LOW, + ["stand_fist_aim_walk"] = ACT_WALK, + ["stand_blunt_aim_run"] = ACT_RUN, + ["stand_heavy_aim_run"] = ACT_RUN_AIM_RIFLE_STIMULATED, + ["crouch_grenade_walk"] = ACT_WALK, + ["crouch_grenade_idle"] = ACT_COVER_LOW, + ["stand_slam_aim_idle"] = ACT_IDLE_PACKAGE, + ["stand_slam_aim_walk"] = ACT_WALK, + ["stand_slam_aim_run"] = ACT_RUN_RPG, + ["stand_smg_aim_idle"] = ACT_RANGE_ATTACK_SMG1, + ["stand_smg_aim_walk"] = ACT_WALK, + ["stand_fist_aim_run"] = ACT_RUN_AIM_RIFLE_STIMULATED, + ["crouch_pistol_idle"] = ACT_COVER_LOW, + ["stand_grenade_walk"] = ACT_WALK, + ["crouch_pistol_walk"] = ACT_WALK, + ["stand_grenade_idle"] = ACT_IDLE, + ["stand_grenade_run"] = ACT_RUN, + ["crouch_blunt_idle"] = ACT_COVER_LOW, + ["stand_pistol_walk"] = ACT_WALK, + ["crouch_blunt_walk"] = ACT_WALK, + ["crouch_heavy_walk"] = ACT_WALK, + ["stand_pistol_idle"] = ACT_IDLE, + ["crouch_heavy_idle"] = ACT_COVER_LOW_RPG, + ["stand_smg_aim_run"] = ACT_RUN_AIM_RIFLE_STIMULATED, + ["stand_heavy_walk"] = ACT_WALK, + ["stand_blunt_walk"] = ACT_WALK, + ["stand_blunt_idle"] = ACT_IDLE, + ["crouch_fist_idle"] = ACT_COVER_LOW, + ["crouch_fist_walk"] = ACT_WALK, + ["crouch_slam_idle"] = ACT_COVER, + ["stand_pistol_run"] = ACT_RUN, + ["stand_heavy_idle"] = ACT_IDLE_SHOTGUN_AGITATED, + ["crouch_slam_walk"] = ACT_WALK, + ["stand_heavy_run"] = ACT_RUN_RPG_RELAXED, + ["stand_slam_idle"] = ACT_IDLE_SUITCASE, + ["stand_fist_walk"] = ACT_WALK, + ["stand_slam_walk"] = ACT_WALK, + ["stand_blunt_run"] = ACT_RUN, + ["crouch_smg_walk"] = ACT_WALK, + ["crouch_smg_idle"] = ACT_COVER_LOW_RPG, + ["stand_fist_idle"] = ACT_IDLE, + ["stand_slam_run"] = ACT_RUN, + ["grenade_attack"] = ACT_RANGE_ATTACK_THROW, + ["stand_smg_idle"] = ACT_IDLE_RPG, + ["stand_fist_run"] = ACT_RUN, + ["stand_smg_walk"] = ACT_WALK, + ["pistol_attack"] = ACT_GESTURE_RANGE_ATTACK_SMG1, + ["stand_smg_run"] = ACT_RUN_RPG_RELAXED, + ["pistol_reload"] = ACT_GESTURE_RELOAD_SMG1, + ["heavy_reload"] = ACT_GESTURE_RELOAD_SMG1, + ["heavy_attack"] = ACT_GESTURE_RANGE_ATTACK_AR2, + ["blunt_attack"] = ACT_MELEE_ATTACK_SWING, + ["crouch_idle"] = ACT_COVER_LOW, + ["crouch_walk"] = ACT_WALK, + ["slam_attack"] = ACT_PICKUP_GROUND, + ["stand_idle"] = ACT_IDLE, + ["stand_walk"] = ACT_WALK, + ["smg_attack"] = ACT_GESTURE_RANGE_ATTACK_SMG1, + ["smg_reload"] = ACT_GESTURE_RELOAD_SMG1, + ["stand_run"] = ACT_RUN, + ["jump"] = ACT_GLIDE, + ["sit"] = ACT_BUSY_SIT_CHAIR +}; + Clockwork.animation.stored.vortigaunt = { ["crouch_grenade_aim_idle"] = "CrouchIdle", ["crouch_grenade_aim_walk"] = ACT_WALK, @@ -494,6 +593,95 @@ Clockwork.animation.stored.vortigaunt = { ["sit"] = "chess_wait" }; +Clockwork.animation.stored.player = { + ["crouch_grenade_aim_idle"] = "cidle_grenade", + ["crouch_grenade_aim_walk"] = "cwalk_grenade", + ["stand_grenade_aim_idle"] = "idle_grenade", + ["crouch_pistol_aim_idle"] = "cidle_revolver", + ["stand_grenade_aim_walk"] = "walk_grenade", + ["crouch_pistol_aim_walk"] = "cwalk_revolver", + ["crouch_heavy_aim_idle"] = ACT_RANGE_AIM_SMG1_LOW, + ["crouch_blunt_aim_idle"] = "cidle_melee", + ["stand_grenade_aim_run"] = "run_grenade", + ["crouch_blunt_aim_walk"] = "cwalk_melee", + ["crouch_heavy_aim_walk"] = ACT_WALK, + ["stand_pistol_aim_walk"] = "walk_revolver", + ["stand_pistol_aim_idle"] = "idle_revolver", + ["crouch_fist_aim_walk"] = "cwalk_fist", + ["crouch_slam_aim_walk"] = "cwalk_slam", + ["stand_pistol_aim_run"] = "run_revolver", + ["crouch_fist_aim_idle"] = "cidle_fist", + ["stand_heavy_aim_idle"] = ACT_IDLE_ANGRY_RPG, + ["stand_blunt_aim_idle"] = "idle_melee", + ["crouch_slam_aim_idle"] = "cidle_slam", + ["stand_blunt_aim_walk"] = "walk_melee", + ["stand_heavy_aim_walk"] = ACT_WALK, + ["stand_fist_aim_idle"] = "idle_fist", + ["crouch_smg_aim_walk"] = "cwalk_smg1", + ["crouch_smg_aim_idle"] = "cidle_smg1", + ["stand_fist_aim_walk"] = "walk_fist", + ["stand_blunt_aim_run"] = "run_melee", + ["stand_heavy_aim_run"] = ACT_RUN_AIM_RIFLE_STIMULATED, + ["crouch_grenade_walk"] = "cwalk_all", + ["crouch_grenade_idle"] = "cidle_all", + ["stand_slam_aim_idle"] = "idle_slam", + ["stand_slam_aim_walk"] = "walk_slam", + ["stand_slam_aim_run"] = "run_slam", + ["stand_smg_aim_idle"] = "idle_smg1", + ["stand_smg_aim_walk"] = "walk_smg1", + ["stand_fist_aim_run"] = ACT_MP_RUN, + ["crouch_pistol_idle"] = ACT_MP_CROUCH_IDLE, + ["stand_grenade_walk"] = ACT_MP_WALK, + ["crouch_pistol_walk"] = ACT_MP_CROUCHWALK, + ["stand_grenade_idle"] = ACT_MP_STAND_IDLE, + ["stand_grenade_run"] = ACT_MP_RUN, + ["crouch_blunt_idle"] = ACT_MP_CROUCH_IDLE, + ["stand_pistol_walk"] = ACT_MP_WALK, + ["crouch_blunt_walk"] = "cwalk_all", + ["crouch_heavy_walk"] = ACT_WALK, + ["stand_pistol_idle"] = ACT_MP_STAND_IDLE, + ["crouch_heavy_idle"] = ACT_COVER_LOW_RPG, + ["stand_smg_aim_run"] = "run_smg1", + ["stand_heavy_walk"] = ACT_WALK, + ["stand_blunt_walk"] = ACT_MP_WALK, + ["stand_blunt_idle"] = ACT_MP_STAND_IDLE, + ["crouch_fist_idle"] = ACT_MP_CROUCH_IDLE, + ["crouch_fist_walk"] = "cwalk_all", + ["crouch_slam_idle"] = ACT_MP_CROUCH_IDLE, + ["stand_pistol_run"] = ACT_MP_RUN, + ["stand_heavy_idle"] = ACT_IDLE_SHOTGUN_AGITATED, + ["crouch_slam_walk"] = "cwalk_all", + ["stand_heavy_run"] = ACT_RUN_RPG_RELAXED, + ["stand_slam_idle"] = ACT_MP_STAND_IDLE, + ["stand_fist_walk"] = ACT_MP_WALK, + ["stand_slam_walk"] = ACT_MP_WALK, + ["stand_blunt_run"] = ACT_MP_RUN, + ["crouch_smg_walk"] = "cwalk_all", + ["crouch_smg_idle"] = ACT_MP_CROUCH_IDLE, + ["stand_fist_idle"] = ACT_MP_STAND_IDLE, + ["stand_slam_run"] = ACT_MP_RUN, + ["grenade_attack"] = ACT_RANGE_ATTACK_THROW, + ["stand_smg_idle"] = "idle_passive", + ["stand_fist_run"] = ACT_MP_RUN, + ["stand_smg_walk"] = "walk_passive", + ["pistol_attack"] = ACT_GESTURE_RANGE_ATTACK_PISTOL, + ["stand_smg_run"] = "run_passive", + ["pistol_reload"] = ACT_GESTURE_RELOAD_PISTOL, + ["heavy_reload"] = ACT_GESTURE_RELOAD_SMG1, + ["heavy_attack"] = ACT_GESTURE_RANGE_ATTACK_AR2, + ["blunt_attack"] = ACT_MELEE_ATTACK_SWING, + ["crouch_idle"] = ACT_COVER_LOW, + ["crouch_walk"] = ACT_WALK, + ["slam_attack"] = ACT_PICKUP_GROUND, + ["stand_idle"] = ACT_MP_STAND_IDLE, + ["stand_walk"] = ACT_WALK, + ["smg_attack"] = ACT_GESTURE_RANGE_ATTACK_SMG1, + ["smg_reload"] = ACT_GESTURE_RELOAD_SMG1, + ["stand_run"] = ACT_MP_RUN, + ["jump"] = ACT_MP_JUMP, + ["sit"] = ACT_BUSY_SIT_CHAIR +}; + -- A function to set a model's menu sequence. function Clockwork.animation:SetMenuSequence(model, sequence) self.sequences[string.lower(model)] = sequence; @@ -625,6 +813,8 @@ function Clockwork.animation:GetTable(model) if (class and self.stored[class]) then return self.stored[class]; + elseif (string.find(lowerModel, "/player/")) then + return self.stored.player; elseif (string.find(lowerModel, "female")) then return self.stored.femaleHuman; else @@ -632,6 +822,121 @@ function Clockwork.animation:GetTable(model) end; end; +local handsModels = {}; +local blackModels = {}; + +-- A function to add viewmodel c_arms info to a model. +function Clockwork.animation:AddHandsModel(model, hands) + handsModels[string.lower(model)] = hands; +end; + +-- A function to make a model use the black skin for hands viewmodels. +function Clockwork.animation:AddBlackModel(model) + blackModels[model] = true; +end; + +-- A function to make a model use the zombie skin for citizen hands. +function Clockwork.animation:AddZombieHands(model) + self:AddHandsModel(model, { + body = 0000000, + model = "models/weapons/c_arms_citizen.mdl", + skin = 2 + }); +end; + +-- A function to make a model use the HL2 HEV viewmodel hands. +function Clockwork.animation:AddHEVHands(model) + self:AddHandsModel(model, { + body = 0000000, + model = "models/weapons/c_arms_hev.mdl", + skin = 0 + }); +end; + +-- A function to make a model use the combine viewmodel hands. +function Clockwork.animation:AddCombineHands(model) + self:AddHandsModel(model, { + body = 0000000, + model = "models/weapons/c_arms_combine.mdl", + skin = 0 + }); +end; + +-- A function to make a model use the CSS viewmodel hands. +function Clockwork.animation:AddCSSHands(model) + self:AddHandsModel(model, { + body = 0000000, + model = "models/weapons/c_arms_cstrike.mdl", + skin = 0 + }); +end; + +-- A function to make a model use the refugee viewmodel hands. +function Clockwork.animation:AddRefugeeHands(model) + self:AddHandsModel(model, { + body = 11, + model = "models/weapons/c_arms_refugee.mdl", + skin = 0 + }); +end; + +-- a function to make a model use the refugee viewmodel hands with a zombie skin. +function Clockwork.animation:AddZombieRefugeeHands(model) + self:AddHandsModel(model, { + body = 0000000, + model = "models/weapons/c_arms_refugee.mdl", + skin = 2 + }); +end; + +-- A function to check for stored hands info by model. +function Clockwork.animation:CheckHands(model, animTable) + local info = animTable.hands or { + body = 0000000, + model = "models/weapons/c_arms_citizen.mdl", + skin = 0 + }; + + for k, v in pairs(handsModels) do + if (string.find(model, k)) then + info = v; + + break; + end; + end; + + self:AdjustHandsInfo(model, info); + + return info; +end; + +-- A function to adjust the hands info with checks for if a model is set to use the black skin. +function Clockwork.animation:AdjustHandsInfo(model, info) + for k, v in pairs(blackModels) do + if (string.find(model, k)) then + info.skin = 1; + end; + end; + + Clockwork.plugin:Call("AdjustCModelHandsInfo", model, info); +end; + +-- A function to get the c_model hands based on model. +function Clockwork.animation:GetHandsInfo(model) + local animTable = self:GetTable(model); + + return self:CheckHands(string.lower(model), animTable); +end; + +Clockwork.animation:AddBlackModel("/male_01.mdl"); +Clockwork.animation:AddBlackModel("/male_03.mdl"); +Clockwork.animation:AddBlackModel("/female_03.mdl"); + +Clockwork.animation:AddRefugeeHands("/group03/"); +Clockwork.animation:AddRefugeeHands("/group03m/"); + +Clockwork.animation:AddZombieRefugeeHands("/Zombie/"); + Clockwork.animation:AddVortigauntModel("models/vortigaunt.mdl"); Clockwork.animation:AddVortigauntModel("models/vortigaunt_slave.mdl"); Clockwork.animation:AddVortigauntModel("models/vortigaunt_doctor.mdl"); @@ -640,66 +945,4 @@ Clockwork.animation:AddCombineOverwatchModel("models/combine_soldier_prisonguard Clockwork.animation:AddCombineOverwatchModel("models/combine_super_soldier.mdl"); Clockwork.animation:AddCombineOverwatchModel("models/combine_soldier.mdl"); -Clockwork.animation:AddCivilProtectionModel("models/police.mdl"); - -Clockwork.animation:AddFemaleHumanModel("models/humans/group01/female_01.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group01/female_02.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group01/female_03.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group01/female_04.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group01/female_06.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group01/female_07.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group02/female_01.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group02/female_02.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group02/female_03.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group02/female_04.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group02/female_06.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group02/female_07.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03/female_01.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03/female_02.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03/female_03.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03/female_04.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03/female_06.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03/female_07.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03m/female_01.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03m/female_02.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03m/female_03.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03m/female_04.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03m/female_06.mdl"); -Clockwork.animation:AddFemaleHumanModel("models/humans/group03m/female_07.mdl"); - -Clockwork.animation:AddMaleHumanModel("models/humans/group01/male_01.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group01/male_02.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group01/male_03.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group01/male_04.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group01/male_05.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group01/male_06.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group01/male_07.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group01/male_08.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group01/male_09.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group02/male_01.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group02/male_02.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group02/male_03.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group02/male_04.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group02/male_05.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group02/male_06.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group02/male_07.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group02/male_08.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group02/male_09.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03/male_01.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03/male_02.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03/male_03.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03/male_04.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03/male_05.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03/male_06.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03/male_07.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03/male_08.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03/male_09.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03m/male_01.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03m/male_02.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03m/male_03.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03m/male_04.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03m/male_05.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03m/male_06.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03m/male_07.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03m/male_08.mdl"); -Clockwork.animation:AddMaleHumanModel("models/humans/group03m/male_09.mdl"); \ No newline at end of file +Clockwork.animation:AddCivilProtectionModel("models/police.mdl"); \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_ironsights.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_ironsights.lua new file mode 100644 index 00000000..38fcd78f --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_ironsights.lua @@ -0,0 +1,193 @@ +--[[ + © 2015 CloudSixteen.com do not share, re-distribute or modify + without permission of its author (kurozael@gmail.com). + + Clockwork was created by Conna Wiles (also known as kurozael.) + http://cloudsixteen.com/license/clockwork.html +--]] + +--[[ + We need the datastream and plugin libraries. +--]] +if (!Clockwork.datastream) then include("sh_datastream.lua"); end; +if (!Clockwork.plugin) then include("sh_plugin.lua"); end; + +--[[ + Micro Optimizations because local variables are faster than table + lookups and global variables (which are table lookups). +--]] +local Clockwork = Clockwork; +local cwDatastream = Clockwork.datastream; +local cwConfig = Clockwork.config; +local cwPlugin = Clockwork.plugin; +local cwPly = Clockwork.player; +local CurTime = CurTime; +local Vector = Vector; +local IsValid = IsValid; + +Clockwork.ironsights = Clockwork.ironsights or Clockwork.kernel:NewLibrary("CW Ironsights"); + +local nextIronSights = nil; + +function Clockwork.ironsights:GetIronSights(player) + if (cwConfig:Get("enable_ironsights"):Get()) then + if (CLIENT) then + return cwPlugin:Call("PlayerCanSeeIronSights", Clockwork.Client, Clockwork.Client.cwIronSights); + else + return player.cwIronSights; + end; + else + return false; + end; +end; + +function Clockwork.ironsights:SetIronSights(player, bValue) + player.cwIronSights = bValue; + + if (SERVER) then + cwDatastream:Start(player, "SetClockworkIronSights", {bValue}); + else + cwDatastream:Start("SetClockworkIronSights", {bValue}); + end; +end; + +function Clockwork.ironsights:ToggleIronSights(player) + if (SERVER) then + if (IsValid(player) and player:IsValid()) then + local bIronSights = self:GetIronSights(player); + + if (cwConfig:Get("enable_ironsights"):Get() and cwPlugin:Call("PlayerCanToggleIronSights", player, bIronSights)) then + local curTime = CurTime(); + + if (!nextIronSights or nextIronSights <= curTime) then + self:SetIronSights(player, !bIronSights); + nextIronSights = curTime + 0.4; + end; + end; + end; + else + cwDatastream:Start("ToggleClockworkIronSights"); + end; +end; + +function Clockwork.ironsights:PlayerCanToggleIronSights(player, bIronSights) + return (cwPly:GetWeaponRaised(player) or bIronSights); +end; + +function Clockwork.ironsights:EntityFireBullets(player, bulletInfo) + if (IsValid(player) and player:IsValid() and player:IsPlayer()) then + if (self:GetIronSights(player)) then + local spread = bulletInfo.Spread; + local spreadReduction = cwConfig:Get("ironsights_spread"):Get() or 1; + + bulletInfo.Spread = Vector(spread.x * spreadReduction, spread.y * spreadReduction, spread.z * spreadReduction); + + return true; + end; + end; +end; + +if (SERVER) then + cwDatastream:Hook("ToggleClockworkIronSights", function(player) + Clockwork.ironsights:ToggleIronSights(player); + end); + + cwDatastream:Hook("SetClockworkIronSights", function(player, data) + player.cwIronSights = data[1]; + end); + + function Clockwork.ironsights:PlayerThink(player, curTime, infoTable) + if (self:GetIronSights(player) and cwPly:GetWeaponRaised(player)) then + infoTable.walkSpeed = infoTable.walkSpeed * cwConfig:Get("ironsights_spread"):Get() or 0.5; + end; + end; + + function Clockwork.ironsights:PlayerSwitchWeapon(player, oldWep, newWep) + self:SetIronSights(player, false); + end; +else + --[[ + Ironsights hooks. + --]] + cwDatastream:Hook("SetClockworkIronSights", function(data) + Clockwork.Client.cwIronSights = data[1]; + end); + + Clockwork.ironsights.ironFraction = 0; + + function Clockwork.ironsights:PlayerCanSeeIronSights(player, bIronSights) + if (bIronSights) then + return !player:IsRunning() and cwPly:GetWeaponRaised(player); + end; + + return false; + end; + + function Clockwork.ironsights:PlayerAdjustHeadbobInfo(info) + if (self:GetIronSights()) then + info.speed = 0; + info.yaw = 0; + info.roll = 0; + end; + end; + + function Clockwork.ironsights:CanDrawCrosshair(weapon) + if (!cwConfig:Get("enable_crosshair"):Get()) then + if (self:GetIronSights() and Clockwork.Client:GetThirdPerson()) then + return true; + end; + end; + end; + + function Clockwork.ironsights:PlayerBindPress(ply, bind, bPressed) + if (bind == "+reload") then + self:SetIronSights(Clockwork.Client, false); + end; + end; + + function Clockwork.ironsights:PlayerButtonDown(ply, key) + if (key == MOUSE_MIDDLE) then + self:ToggleIronSights(Clockwork.Client); + end; + end; + + function Clockwork.ironsights:GetWeaponIronsightsViewInfo(itemTable, weapon, viewTable) + if (weapon) then + local pos = weapon.IronSightsPos or weapon.SightsPos; + local ang = weapon.IronSightsAng or weapon.SightsAng; + + if (pos) then + viewTable.origin = pos; + end; + + if (ang) then + viewTable.angles = ang; + end; + end; + + if (itemTable) then + local pos = itemTable.IronSightsPos; + local ang = itemTable.IronSightsAng; + + if (pos) then + viewTable.origin = pos; + end; + + if (ang) then + viewTable.angles = ang; + end; + end; + end; + + function Clockwork.ironsights:CalcViewAdjustTable(view) + if (Clockwork.ironsights:GetIronSights() or Clockwork.ironsights.ironFraction > 1) then + view.fov = view.fov - (10 * (Clockwork.ironsights.ironFraction/100)); + end; + end; + + concommand.Add("cwToggleIronSights", function(ply, cmd, args, argStr) + Clockwork.ironsights:ToggleIronSights(); + end); +end; + +cwPlugin:Add("Ironsights_Module", Clockwork.ironsights); \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_boot.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_boot.lua index 4bf72147..2fb40533 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_boot.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_boot.lua @@ -28,8 +28,8 @@ end; Clockwork.ClockworkFolder = Clockwork.ClockworkFolder or GM.Folder; Clockwork.SchemaFolder = Clockwork.SchemaFolder or GM.Folder; -Clockwork.KernelVersion = "0.95.1"; -Clockwork.KernelBuild = "beta" +Clockwork.KernelVersion = "0.95.2"; +Clockwork.KernelBuild = "beta"; Clockwork.DeveloperVersion = true; Clockwork.Website = "http://kurozael.com"; Clockwork.Author = "kurozael"; diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_kernel.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_kernel.lua index 924129c9..4232a371 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_kernel.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_kernel.lua @@ -557,14 +557,42 @@ function Clockwork:UpdateAnimation(player, velocity, maxSeqGroundSpeed) end; end; --- Called when the main activity should be calculated. -function Clockwork:CalcMainActivity(player, velocity) +local IdleActivity = ACT_HL2MP_IDLE; +local IdleActivityTranslate = { + [ACT_MP_ATTACK_CROUCH_PRIMARYFIRE] = IdleActivity + 5, + [ACT_MP_ATTACK_STAND_PRIMARYFIRE] = IdleActivity + 5, + [ACT_MP_RELOAD_CROUCH] = IdleActivity + 6, + [ACT_MP_RELOAD_STAND] = IdleActivity + 6, + [ACT_MP_CROUCH_IDLE] = IdleActivity + 3, + [ACT_MP_STAND_IDLE] = IdleActivity, + [ACT_MP_CROUCHWALK] = IdleActivity + 4, + [ACT_MP_JUMP] = ACT_HL2MP_JUMP_SLAM, + [ACT_MP_WALK] = IdleActivity + 1, + [ACT_MP_RUN] = IdleActivity + 2, +}; + +-- Called when a player's activity is supposed to be translated. +function Clockwork:TranslateActivity(player, act) local model = player:GetModel(); + local bIsRaised = self.player:GetWeaponRaised(player, true); - if (stringFind(model, "/player/")) then - return self.BaseClass:CalcMainActivity(player, velocity); + if (string.find(model, "/player/")) then + local newAct = player:TranslateWeaponActivity(act); + + if (!bIsRaised or act == newAct) then + return IdleActivityTranslate[act]; + else + return newAct; + end; end; + return act; +end; + +-- Called when the main activity should be calculated. +function Clockwork:CalcMainActivity(player, velocity) + local model = player:GetModel(); + ANIMATION_PLAYER = player; local weapon = player:GetActiveWeapon(); @@ -631,40 +659,8 @@ function Clockwork:CalcMainActivity(player, velocity) local normalized = mathNormalize(yaw - eyeAngles.y); player:SetPoseParameter("move_yaw", normalized); - - return player.CalcIdeal, player.CalcSeqOverride; -end; -local IdleActivity = ACT_HL2MP_IDLE; -local IdleActivityTranslate = { - ACT_MP_ATTACK_CROUCH_PRIMARYFIRE = IdleActivity + 5, - ACT_MP_ATTACK_STAND_PRIMARYFIRE = IdleActivity + 5, - ACT_MP_RELOAD_CROUCH = IdleActivity + 6, - ACT_MP_RELOAD_STAND = IdleActivity + 6, - ACT_MP_CROUCH_IDLE = IdleActivity + 3, - ACT_MP_STAND_IDLE = IdleActivity, - ACT_MP_CROUCHWALK = IdleActivity + 4, - ACT_MP_JUMP = ACT_HL2MP_JUMP_SLAM, - ACT_MP_WALK = IdleActivity + 1, - ACT_MP_RUN = IdleActivity + 2, -}; - --- Called when a player's activity is supposed to be translated. -function Clockwork:TranslateActivity(player, act) - local model = player:GetModel(); - local bIsRaised = self.player:GetWeaponRaised(player, true); - - if (string.find(model, "/player/")) then - local newAct = player:TranslateWeaponActivity(act); - - if (!bIsRaised or act == newAct) then - return IdleActivityTranslate[act]; - else - return newAct; - end; - end; - - return act; + return player.CalcIdeal, player.CalcSeqOverride; end; -- Called when the animation event is supposed to be done. @@ -1644,73 +1640,143 @@ else if (table.Count(options) == 0) then return; end; - local menuPanel = self:AddMenuFromData(nil, options, function(menuPanel, option, arguments) - if (itemTable and type(arguments) == "table" and arguments.isOptionTable) then - menuPanel:AddOption(arguments.title, function() - if (itemTable.HandleOptions) then - local transmit, data = itemTable:HandleOptions(arguments.name, nil, nil, entity); - - if (transmit) then - Clockwork.datastream:Start("MenuOption", { - option = arguments.name, - data = data, - item = itemTable("itemID"), - entity = entity - }); + if (self:GetEntityMenuType()) then + local menuPanel = self:AddMenuFromData(nil, options, function(menuPanel, option, arguments) + if (itemTable and type(arguments) == "table" and arguments.isOptionTable) then + menuPanel:AddOption(arguments.title, function() + if (itemTable.HandleOptions) then + local transmit, data = itemTable:HandleOptions(arguments.name, nil, nil, entity); + + if (transmit) then + Clockwork.datastream:Start("MenuOption", { + option = arguments.name, + data = data, + item = itemTable("itemID"), + entity = entity + }); + end; end; - end; - end) - else - menuPanel:AddOption(option, function() - if (type(arguments) == "table" and arguments.isArgTable) then - if (arguments.Callback) then - arguments.Callback(function(arguments) + end) + else + menuPanel:AddOption(option, function() + if (type(arguments) == "table" and arguments.isArgTable) then + if (arguments.Callback) then + arguments.Callback(function(arguments) + Clockwork.entity:ForceMenuOption( + entity, option, arguments + ); + end); + else Clockwork.entity:ForceMenuOption( - entity, option, arguments + entity, option, arguments.arguments ); - end); + end; else Clockwork.entity:ForceMenuOption( - entity, option, arguments.arguments + entity, option, arguments ); end; - else - Clockwork.entity:ForceMenuOption( - entity, option, arguments - ); - end; - - timer.Simple(FrameTime(), function() - self:RemoveActiveToolTip(); + + timer.Simple(FrameTime(), function() + self:RemoveActiveToolTip(); + end); end); - end); - end; - - menuPanel.Items = menuPanel:GetChildren(); - local panel = menuPanel.Items[#menuPanel.Items]; - - if (IsValid(panel)) then - if (type(arguments) == "table") then - if (arguments.isOrdered) then - menuPanel.Items[#menuPanel.Items] = nil; - table.insert(menuPanel.Items, 1, panel); - end; - - if (arguments.toolTip) then - self:CreateMarkupToolTip(panel); - panel:SetMarkupToolTip(arguments.toolTip); + end; + + menuPanel.Items = menuPanel:GetChildren(); + local panel = menuPanel.Items[#menuPanel.Items]; + + if (IsValid(panel)) then + if (type(arguments) == "table") then + if (arguments.isOrdered) then + menuPanel.Items[#menuPanel.Items] = nil; + table.insert(menuPanel.Items, 1, panel); + end; + + if (arguments.toolTip) then + self:CreateMarkupToolTip(panel); + panel:SetMarkupToolTip(arguments.toolTip); + end; end; end; - end; - end); + end); + + self:RegisterBackgroundBlur(menuPanel, SysTime()); + self:SetTitledMenu(menuPanel, "INTERACT WITH THIS ENTITY"); + menuPanel.entity = entity; + + return menuPanel; + else + local menu = Clockwork.entityMenu:AddMenuFromData(entity, options, nil, function(menu, option, arguments) + table.insert(menu.options, {text = option, callback = function() + if (type(arguments) == "table" and arguments.isArgTable) then + if (arguments.Callback) then + arguments.Callback(function(arguments) + Clockwork.entity:ForceMenuOption(entity, option, arguments) + end) + else + Clockwork.entity:ForceMenuOption(entity, option, arguments.arguments) + end + else + Clockwork.entity:ForceMenuOption(entity, option, arguments) + end + end}) + end) + + return menu + end; + end; + +--[[ + -- A function to handle an entity's menu. + function Clockwork.kernel:HandleEntityMenu(entity) + local options = {} + Clockwork.plugin:Call("GetEntityMenuOptions", entity, options) + + if (table.Count(options) == 0) then return end - self:RegisterBackgroundBlur(menuPanel, SysTime()); - self:SetTitledMenu(menuPanel, "INTERACT WITH THIS ENTITY"); - menuPanel.entity = entity; + if (table.Count(options) == 1) then + Clockwork.entity:ForceMenuOption(entity, table.GetFirstKey(options), table.GetFirstValue(options)) + return + end + + local menu = Clockwork.entityMenu:AddMenuFromData(entity, options, nil, function(menu, option, arguments) + table.insert(menu.options, {text = option, callback = function() + if (type(arguments) == "table" and arguments.isArgTable) then + if (arguments.Callback) then + arguments.Callback(function(arguments) + Clockwork.entity:ForceMenuOption(entity, option, arguments) + end) + else + Clockwork.entity:ForceMenuOption(entity, option, arguments.arguments) + end + else + Clockwork.entity:ForceMenuOption(entity, option, arguments) + end + end}) + end) - return menuPanel; + return menu end; +--]] + -- A function to get what type of entity menu to use. + function Clockwork.kernel:GetEntityMenuType() + local forceMenus = Clockwork.config:Get("force_entity_menus"):Get(); + + if (forceMenus == 0) then -- Config says use both according to player setting. + if (CW_CONVAR_ENTITYMENU:GetInt() == 0) then -- Setting says use 2D menu. + return true + else -- Setting says use 3D menu. + return false; + end; + elseif (forceMenus == 1) then -- Config says use 2D menu. + return true; + else -- Config says use 3D menu. + return false; + end; + end; + -- A function to get the gradient texture. function Clockwork.kernel:GetGradientTexture() return Clockwork.GradientTexture; diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/sv_kernel.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/sv_kernel.lua index a1984c5d..bf3c987a 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/sv_kernel.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/sv_kernel.lua @@ -449,7 +449,13 @@ function Clockwork:PlayerBanned(player, duration, reason) end; function Clockwork:PlayerSkinChanged(player, skin) end; -- Called when a player's model has changed. -function Clockwork:PlayerModelChanged(player, model) end; +function Clockwork:PlayerModelChanged(player, model) + local hands = player:GetHands(); + + if (IsValid(hands) and hands:IsValid()) then + self:PlayerSetHandsModel(player, player:GetHands()); + end; +end; -- Called when a player's saved inventory should be added to. function Clockwork:PlayerAddToSavedInventory(player, character, Callback) @@ -1155,14 +1161,26 @@ end; -- Choose the model for hands according to their player model. function Clockwork:PlayerSetHandsModel(player, entity) - local simpleModel = player_manager.TranslateToPlayerModelName(player:GetModel()) - local info = player_manager.TranslatePlayerHands(simpleModel); + local model = player:GetModel(); + local simpleModel = player_manager.TranslateToPlayerModelName(model) + local info = self.animation:GetHandsInfo(model) or player_manager.TranslatePlayerHands(simpleModel); if (info) then entity:SetModel(info.model); entity:SetSkin(info.skin); - entity:SetBodyGroups(info.body); + + local bodyGroups = tostring(info.body); + + if (bodyGroups) then + bodyGroups = string.Explode("", bodyGroups); + + for k, v in pairs(bodyGroups) do + entity:SetBodygroup(k, tonumber(v)); + end; + end; end; + + Clockwork.plugin:Call("PostCModelHandsSet", player, model, entity, info); end; -- Called every frame. diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin.ini b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin.ini deleted file mode 100644 index 6fd250dd..00000000 --- a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin.ini +++ /dev/null @@ -1,5 +0,0 @@ -[Plugin] -name="Backsword"; -author="kurozael"; -description="A weapon base made for the Clockwork framework."; -compatibility="0.93"; \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin.ini b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin.ini new file mode 100644 index 00000000..07c55d8b --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin.ini @@ -0,0 +1,5 @@ +[Plugin] +name="Backsword 2"; +author="Zig"; +description="An updated weapon base including CSS and HL2 weapons made for the Clockwork framework."; +compatibility="0.95"; \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin/cl_plugin.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/cl_plugin.lua similarity index 100% rename from Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin/cl_plugin.lua rename to Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/cl_plugin.lua diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin/entities/weapons/bs_base/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_base/shared.lua similarity index 79% rename from Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin/entities/weapons/bs_base/shared.lua rename to Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_base/shared.lua index 9b066ffe..dcf2b260 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin/entities/weapons/bs_base/shared.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_base/shared.lua @@ -1,11 +1,15 @@ --[[ - © 2011 CloudSixteen.com do not share, re-distribute or modify + © 2015 CloudSixteen.com do not share, re-distribute or modify without permission of its author (kurozael@gmail.com). Clockwork was created by Conna Wiles (also known as kurozael.) http://cloudsixteen.com/license/clockwork.html --]] +--[[ + This is an updated and supported version of Backsword I'll be updating from now on with Kurozael's permission. +--]] + if (SERVER) then AddCSLuaFile("shared.lua"); SWEP.Weight = 5; @@ -15,11 +19,15 @@ end; if (CLIENT) then SWEP.DrawAmmo = true; -- Draw our own ammo display? - SWEP.IconLetter = "a"; -- The icon letter of the font. + SWEP.IconLetter = "SMG"; -- The icon letter of the font. SWEP.DrawCrosshair = false; -- Draw the crosshair, or draw our own? SWEP.ViewModelFOV = 82; SWEP.ViewModelFlip = true; -- Some view models are incorrectly flipped. SWEP.CSMuzzleFlashes = true; -- Use Counter-Strike muzzle flashes? + SWEP.PrintName = "SMG" + SWEP.Slot = 2 + SWEP.SlotPos = 1 + SWEP.IconLetter = "SMG" --[[ The font used for the killicons. --]] surface.CreateFont("CSKillIcons", @@ -41,10 +49,10 @@ if (CLIENT) then end; --[[ Basic SWEP information to display to the client. --]] -SWEP.Author = "kurozael" -SWEP.Contact = "kurozael@gmail.com" -SWEP.Purpose = "A weapon base designed for use with Clockwork." -SWEP.Instructions = "Derive from this base when creating a weapon." +SWEP.Author = "" +SWEP.Contact = "" +SWEP.Purpose = "" +SWEP.Instructions = "" --[[ Set whether the SWEP is spawnable (by users or by admins). --]] SWEP.Spawnable = false; @@ -77,6 +85,14 @@ SWEP.BulletForce = 30; SWEP.IronSightsPos = nil; SWEP.IronSightsAng = nil; +--[[Set up the accuracy for the weapon. --]] +SWEP.CrouchCone = 0.01 -- Accuracy when we're crouching +SWEP.CrouchWalkCone = 0.02 -- Accuracy when we're crouching and walking +SWEP.WalkCone = 0.025 -- Accuracy when we're walking +SWEP.AirCone = 0.1 -- Accuracy when we're in air +SWEP.StandCone = 0.015 -- Accuracy when we're standing still +SWEP.IronSightsCone = 0.006 -- Accuracy when we're aiming + --[[ AR2, AlyxGun, Pistol, SMG1, 357, XBowBolt, Buckshot, RPG_Round, SMG1_Grenade, SniperRound, SniperPenetratedRound, @@ -118,7 +134,7 @@ function SWEP:Initialize() self:SetNPCMinBurst(30); self:SetNPCMaxBurst(30); self:SetNPCFireRate(0.01); - end + end; self:SetWeaponHoldType(self.HoldType); @@ -139,10 +155,17 @@ end; -- Called when when the SWEP is being reloaded. function SWEP:Reload() + + if self.Owner:KeyDown(IN_ATTACK) then return end; + if( self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 || self.Weapon:Clip1() >= self.Primary.ClipSize) then return end; if (!self.OnReload or self:OnReload() != true) then self.Weapon:DefaultReload(ACT_VM_RELOAD); self:SetIronSights(false); - end + + if (self.ReloadSound) then + self.Weapon:EmitSound(self.Primary.Reload) + end; + end; end; -- Called every frame. @@ -150,22 +173,26 @@ function SWEP:Think() if (self.OnThink) then self:OnThink(); end; -end +end; + +function SWEP:Deploy() + self:SendWeaponAnim( ACT_VM_DRAW ) + self:SetNextPrimaryFire( CurTime() + self:SequenceDuration() ) + return true +end; -- Called when the SWEP's primary attack is fired. function SWEP:PrimaryAttack() self.Weapon:SetNextSecondaryFire(CurTime() + self.Primary.Delay); self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay); - if (!self:CanPrimaryAttack()) then return; end; + if (!self:CanPrimaryAttack()) then return; end; self.Weapon:EmitSound(self.Primary.Sound); - --[[ Fire the bullet(s) and take some ammo as a consequence. --]] self:HandleBullets(self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone); self:TakePrimaryAmmo(1); - --[[ NPCs don't require a view punch, that's just silly! --]] if (self.Owner:IsNPC()) then return; end; self.Owner:ViewPunch( @@ -288,4 +315,28 @@ function SWEP:SetIronSights(bEnabled) if (self.OnIronSightsChanged) then self.OnIronSightsChanged(bEnabled); end; +end; + +-- A function for spreading. +function SWEP:SpreadSystem() + + if self.Owner:OnGround() and (self.Owner:KeyDown(IN_FORWARD) or self.Owner:KeyDown(IN_BACK) or self.Owner:KeyDown(IN_MOVERIGHT) or self.Owner:KeyDown(IN_MOVELEFT)) then + if self.Owner:KeyDown(IN_DUCK) then + self.Primary.Cone = self.CrouchWalkCone + elseif self.Owner:KeyDown(IN_SPEED) then + self.Primary.Cone = self.AirCone + else + self.Primary.Cone = self.WalkCone + end; + elseif self.Owner:OnGround() and self.Owner:KeyDown(IN_DUCK) then + self.Primary.Cone = self.CrouchCone + elseif not self.Owner:OnGround() then + self.Primary.Cone = self.AirCone + else + self.Primary.Cone = self.StandCone + end; + end; + +function SWEP:Think() + self:SpreadSystem(); end; \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_ak47/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_ak47/shared.lua new file mode 100644 index 00000000..cb2fe9ef --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_ak47/shared.lua @@ -0,0 +1,51 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "AK-47" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "ar2" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 60 + +SWEP.Spawnable = true +SWEP.AdminSpawnable = true +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/cstrike/c_rif_ak47.mdl" +SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl" + +SWEP.Primary.Sound = Sound( "weapon_ak47.single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 34 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.02 +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Delay = 0.1 +SWEP.Primary.DefaultClip = 120 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "smg1" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +SWEP.IronSightsPos = Vector(-6.6, -10.117, 2.599) +SWEP.IronSightsAng = Vector(2.076, 0.134, 0) + +SWEP.CrouchCone = 0.01 +SWEP.CrouchWalkCone = 0.02 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.015 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_aug/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_aug/shared.lua new file mode 100644 index 00000000..1ab5431d --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_aug/shared.lua @@ -0,0 +1,52 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "AUG" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "smg" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" +SWEP.ViewModelFOV = 60 +SWEP.ViewModelFlip = false + +SWEP.Spawnable = true +SWEP.AdminSpawnable = true +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/cstrike/c_rif_aug.mdl" +SWEP.WorldModel = "models/weapons/w_rif_aug.mdl" + +SWEP.Primary.Sound = Sound( "weapon_aug.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.01 +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Delay = 0.09 +SWEP.Primary.DefaultClip = 150 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "smg1" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + + +SWEP.IronSightsPos = Vector(-3.641, -6.031, 2.519) +SWEP.IronSightsAng = Vector(2.321, 0, 0) + +SWEP.CrouchCone = 0.01 +SWEP.CrouchWalkCone = 0.02 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.015 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_autoshotgun/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_autoshotgun/shared.lua new file mode 100644 index 00000000..f4447386 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_autoshotgun/shared.lua @@ -0,0 +1,40 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "XM1014" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "shotgun" +SWEP.Base = "bs_shotgun_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true +SWEP.AdminSpawnable = true + +SWEP.ViewModel = "models/weapons/cstrike/c_shot_xm1014.mdl" +SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl" +SWEP.UseHands = true +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = true + +SWEP.Primary.Sound = Sound( "Weapon_xm1014.Single" ) +SWEP.Primary.Recoil = 2 +SWEP.Primary.Damage = 10 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Cone = 0.05 +SWEP.Primary.ClipSize = 7 +SWEP.Primary.Delay = 0.2 +SWEP.Primary.DefaultClip = 39 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "buckshot" + +SWEP.IronSightsPos = Vector(-6.933, -6.433, 2.641) +SWEP.IronSightsAng = Vector(0.324, -0.726, 0) \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_awp/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_awp/shared.lua new file mode 100644 index 00000000..0b38d70e --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_awp/shared.lua @@ -0,0 +1,48 @@ +if (SERVER) then + AddCSLuaFile("shared.lua") +end; + +if (CLIENT) then + SWEP.PrintName = "AWP" + SWEP.Slot = 4 + SWEP.Author = "Zig" + +end; + +SWEP.Category = "BackSword 2" +SWEP.Base = "bs_sniper_base" +SWEP.HoldType = "ar2" +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl" +SWEP.WorldModel = "models/weapons/w_snip_awp.mdl" +SWEP.UseHands = true; +SWEP.ViewModelFOV = 70 +SWEP.ViewModelFOV = 65 +SWEP.Primary.Sound = Sound("Weapon_awp.Single") +SWEP.Primary.Damage = 95 +SWEP.Primary.Recoil = 6 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.0001 +SWEP.Primary.ClipSize = 10 +SWEP.Primary.Delay = 1.2 +SWEP.Primary.DefaultClip = 40 +SWEP.Primary.Automatic = false; +SWEP.Primary.Ammo = "smg1" + +SWEP.IronSightsPos = Vector(-7.481, -3.619, 2.24) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.UseScope = true -- Use a scope instead of iron sights. +SWEP.ScopeScale = 0.55 -- The scale of the scope's reticle in relation to the player's screen size. +SWEP.ScopeZoom = 4 + +SWEP.Scope1 = true; +SWEP.BoltAction = true; + +SWEP.CrouchCone = 0.0001 -- Accuracy when we're crouching +SWEP.CrouchWalkCone = 0.2 -- Accuracy when we're crouching and walking +SWEP.WalkCone = 0.2 -- Accuracy when we're walking +SWEP.AirCone = 0.5 -- Accuracy when we're in air +SWEP.StandCone = 0.0001 -- Accuracy when we're standing still \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_deagle/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_deagle/shared.lua new file mode 100644 index 00000000..5569cf5f --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_deagle/shared.lua @@ -0,0 +1,47 @@ + +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "DESERT EAGLE" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "pistol" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true +SWEP.AdminSpawnable = true + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_deagle.mdl" +SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" +SWEP.UseHands = true +SWEP.ViewModelFlip = false +SWEP.ViewModelFOV = 40 + +SWEP.Primary.Sound = Sound( "Weapon_Deagle.Single" ) +SWEP.Primary.Recoil = 5 +SWEP.Primary.Damage = 60 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.015 +SWEP.Primary.ClipSize = 7 +SWEP.Primary.Delay = 0.2 +SWEP.Primary.DefaultClip = 35 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pistol" + +SWEP.IronSightsPos = Vector(-6.381, 0, 2.119) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.CrouchCone = 0.01 +SWEP.CrouchWalkCone = 0.02 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.015 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_famas/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_famas/shared.lua new file mode 100644 index 00000000..6f88edfe --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_famas/shared.lua @@ -0,0 +1,50 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "FAMAS" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "ar2" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; +SWEP.ViewModelFlip = false +SWEP.ViewModel = "models/weapons/cstrike/c_rif_famas.mdl" +SWEP.WorldModel = "models/weapons/w_rif_famas.mdl" +SWEP.UseHands = true; +SWEP.ViewModelFOV = 65 + +SWEP.Primary.Sound = Sound( "Weapon_famas.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 26 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.02 +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Delay = 0.08 +SWEP.Primary.DefaultClip = 120 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false; +SWEP.Secondary.Ammo = "none" + +SWEP.IronSightsPos = Vector(-2.641, -5.628, 1.559) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.CrouchCone = 0.01 +SWEP.CrouchWalkCone = 0.02 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.015 diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_fiveseven/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_fiveseven/shared.lua new file mode 100644 index 00000000..cd4fa330 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_fiveseven/shared.lua @@ -0,0 +1,51 @@ + + +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "FIVE SEVEN" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "pistol" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_fiveseven.mdl" +SWEP.WorldModel = "models/weapons/w_pist_fiveseven.mdl" +SWEP.ViewModelFOV = 60 +SWEP.UseHands = true; +SWEP.ViewModelFlip = false; + +SWEP.Primary.Sound = Sound( "Weapon_FiveSeven.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.02 +SWEP.Primary.ClipSize = 20 +SWEP.Primary.Delay = 0.08 +SWEP.Primary.DefaultClip = 120 +SWEP.Primary.Automatic = false; +SWEP.Primary.Ammo = "pistol" + +SWEP.IronSightsPos = Vector(-5.961, -3.619, 2.759) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.CrouchCone = 0.02 +SWEP.CrouchWalkCone = 0.025 +SWEP.WalkCone = 0.03 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.02 +SWEP.Recoil = 2.5 +SWEP.RecoilZoom = 0.7 +SWEP.Delay = 0.08 diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_g3sg1/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_g3sg1/shared.lua new file mode 100644 index 00000000..2bb06f5b --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_g3sg1/shared.lua @@ -0,0 +1,52 @@ +if (SERVER) then + AddCSLuaFile("shared.lua") +end; + +if (CLIENT) then + SWEP.PrintName = "G3SG1" + SWEP.Author = "Zig" + SWEP.ViewModelFOV = 60 + SWEP.Slot = 4 + +end; + +SWEP.Category = "BackSword 2" +SWEP.Base = "bs_sniper_base" +SWEP.HoldType = "ar2" +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_g3sg1.mdl" +SWEP.WorldModel = "models/weapons/w_snip_g3sg1.mdl" +SWEP.UseHands = true; + +SWEP.Primary.Sound = Sound("Weapon_G3SG1.Single") +SWEP.Primary.Damage = 45 +SWEP.Primary.Recoil = 1.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.001 +SWEP.Primary.ClipSize = 20 +SWEP.Primary.Delay = 0.2 +SWEP.Primary.DefaultClip = 110 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "smg1" + +SWEP.Secondary.Automatic = true + +SWEP.IronSightsPos = nil; +SWEP.IronSightsAng = nil; + +SWEP.UseScope = true; +SWEP.ScopeScale = 0.55 +SWEP.ScopeZoom = 3 + +SWEP.Scope1 = false; +SWEP.Scope2 = true; +SWEP.Scope3 = false; +SWEP.BoltAction = false; + +SWEP.CrouchCone = 0.001 +SWEP.CrouchWalkCone = 0.005 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.001 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_galil/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_galil/shared.lua new file mode 100644 index 00000000..5cc20d98 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_galil/shared.lua @@ -0,0 +1,50 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "GALIL" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "ar2" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; +SWEP.ViewModelFlip = false; +SWEP.ViewModel = "models/weapons/cstrike/c_rif_galil.mdl" +SWEP.WorldModel = "models/weapons/w_rif_galil.mdl" +SWEP.ViewModelFOV = 55 +SWEP.UseHands = true; + +SWEP.Primary.Sound = Sound( "Weapon_galil.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 27 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.017 +SWEP.Primary.ClipSize = 35 +SWEP.Primary.Delay = 0.08 +SWEP.Primary.DefaultClip = 125 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false; +SWEP.Secondary.Ammo = "none" + +SWEP.IronSightsPos = Vector(-6.391, -3.619, 2.539) +SWEP.IronSightsAng = Vector(-0.203, -0.031, 0) + +SWEP.CrouchCone = 0.01 +SWEP.CrouchWalkCone = 0.02 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.015 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_glock/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_glock/shared.lua new file mode 100644 index 00000000..1d414b3e --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_glock/shared.lua @@ -0,0 +1,51 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "GLOCK" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "pistol" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_glock18.mdl" +SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl" +SWEP.UseHands = true; +SWEP.ViewModelFlip = false; +SWEP.ViewModelFOV = 60 + +SWEP.Primary.Sound = Sound( "Weapon_Glock.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 15 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.02 +SWEP.Primary.ClipSize = 20 +SWEP.Primary.Delay = 0.1 +SWEP.Primary.DefaultClip = 500 +SWEP.Primary.Automatic = false; +SWEP.Primary.Ammo = "pistol" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false; +SWEP.Secondary.Ammo = "none" + +SWEP.IronSightsPos = Vector(-5.779, -5.755, 2.799) +SWEP.IronSightsAng = Vector(0.423, 0, 0) + +SWEP.CrouchCone = 0.02 +SWEP.CrouchWalkCone = 0.025 +SWEP.WalkCone = 0.03 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.02 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_m4/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_m4/shared.lua new file mode 100644 index 00000000..5bf8bf7f --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_m4/shared.lua @@ -0,0 +1,51 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "M4A1" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "ar2" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_rif_m4a1.mdl" +SWEP.WorldModel = "models/weapons/w_rif_m4a1.mdl" +SWEP.ViewModelFlip = false; +SWEP.ViewModelFOV = 60 +SWEP.UseHands = true; + +SWEP.Primary.Sound = Sound( "Weapon_M4A1.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 28 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.02 +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Delay = 0.08 +SWEP.Primary.DefaultClip = 120 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false; +SWEP.Secondary.Ammo = "none" + +SWEP.IronSightsPos = Vector(-4.04, -4.824, 0.839) +SWEP.IronSightsAng = Vector(1.315, 0, 0) + +SWEP.CrouchCone = 0.012 +SWEP.CrouchWalkCone = 0.02 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.015 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_mac10/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_mac10/shared.lua new file mode 100644 index 00000000..2681d966 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_mac10/shared.lua @@ -0,0 +1,46 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "MAC-10" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "smg" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_mac10.mdl" +SWEP.WorldModel = "models/weapons/w_smg_mac10.mdl" +SWEP.UseHands = true; +SWEP.ViewModelFlip = false; +SWEP.ViewModelFOV = 60 + +SWEP.Primary.Sound = Sound( "Weapon_mac10.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.03 +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Delay = 0.07 +SWEP.Primary.DefaultClip = 130 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.IronSightsPos = Vector(-3.961, -5.829, 2.119) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.CrouchCone = 0.025 +SWEP.CrouchWalkCone = 0.03 +SWEP.WalkCone = 0.04 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.04 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_mp5/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_mp5/shared.lua new file mode 100644 index 00000000..09a492a4 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_mp5/shared.lua @@ -0,0 +1,50 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "MP5" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "smg" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_mp5.mdl" +SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl" +SWEP.ViewModelFlip = false; +SWEP.ViewModelFOV = 55 +SWEP.UseHands = true; + +SWEP.Primary.Sound = Sound( "Weapon_MP5Navy.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.025 +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Delay = 0.08 +SWEP.Primary.DefaultClip = 150 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.IronSightsPos = Vector(-5.34, -4.824, 2.012) +SWEP.IronSightsAng = Vector(0.282, 0, 0.135) + +SWEP.CrouchCone = 0.02 +SWEP.CrouchWalkCone = 0.03 +SWEP.WalkCone = 0.03 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.03 +SWEP.Recoil = 2.5 +SWEP.RecoilZoom = 0.8 + + diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_p228/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_p228/shared.lua new file mode 100644 index 00000000..69a7aab8 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_p228/shared.lua @@ -0,0 +1,46 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "P228" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "pistol" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_p228.mdl" +SWEP.WorldModel = "models/weapons/w_pist_p228.mdl" +SWEP.UseHands = true; +SWEP.ViewModelFlip = false; +SWEP.ViewModelFOV = 60 + +SWEP.Primary.Sound = Sound( "Weapon_p228.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.02 +SWEP.Primary.ClipSize = 13 +SWEP.Primary.Delay = 0.08 +SWEP.Primary.DefaultClip = 65 +SWEP.Primary.Automatic = false; +SWEP.Primary.Ammo = "pistol" + +SWEP.IronSightsPos = Vector(-6, -5.226, 2.559) +SWEP.IronSightsAng = Vector(0.275, -0.13, 0) + +SWEP.CrouchCone = 0.02 +SWEP.CrouchWalkCone = 0.025 +SWEP.WalkCone = 0.03 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.02 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_p90/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_p90/shared.lua new file mode 100644 index 00000000..36f33101 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_p90/shared.lua @@ -0,0 +1,46 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "P90" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "smg" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_p90.mdl" +SWEP.WorldModel = "models/weapons/w_smg_p90.mdl" +SWEP.UseHands = true; +SWEP.ViewModelFOV = 60 +SWEP.ViewModelFlip = false; + +SWEP.Primary.Sound = Sound( "Weapon_p90.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 20 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.03 +SWEP.Primary.ClipSize = 50 +SWEP.Primary.Delay = 0.07 +SWEP.Primary.DefaultClip = 150 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.IronSightsPos = Vector(-2.52, -5.428, 2.319) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.CrouchCone = 0.025 +SWEP.CrouchWalkCone = 0.03 +SWEP.WalkCone = 0.04 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.04 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_para/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_para/shared.lua new file mode 100644 index 00000000..893a9db3 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_para/shared.lua @@ -0,0 +1,46 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "M249" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "ar2" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_mach_m249para.mdl" +SWEP.WorldModel = "models/weapons/w_mach_m249para.mdl" +SWEP.ViewModelFOV = 60 +SWEP.UseHands = true; +SWEP.ViewModelFlip = false; + +SWEP.Primary.Sound = Sound( "Weapon_m249.Single" ) +SWEP.Primary.Recoil = 1.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.05 +SWEP.Primary.ClipSize = 100 +SWEP.Primary.Delay = 0.09 +SWEP.Primary.DefaultClip = 200 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.IronSightsPos = Vector(-5.981, 0, 2.359) +SWEP.IronSightsAng = Vector(0, -0.066, 0) + +SWEP.CrouchCone = 0.02 +SWEP.CrouchWalkCone = 0.05 +SWEP.WalkCone = 0.09 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.07 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_pumpshotgun/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_pumpshotgun/shared.lua new file mode 100644 index 00000000..1174776c --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_pumpshotgun/shared.lua @@ -0,0 +1,40 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "M3 SUPER 90" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "shotgun" +SWEP.Base = "bs_shotgun_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_shot_m3super90.mdl" +SWEP.WorldModel = "models/weapons/w_shot_m3super90.mdl" +SWEP.ViewModelFlip = false; +SWEP.ViewModelFOV = 60 +SWEP.UseHands = true; + +SWEP.Primary.Sound = Sound( "Weapon_m3.Single" ) +SWEP.Primary.Recoil = 1.5 +SWEP.Primary.Damage = 15 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Cone = 0.03 +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Delay = 1.0 +SWEP.Primary.DefaultClip = 32 +SWEP.Primary.Automatic = false; +SWEP.Primary.Ammo = "buckshot" + +SWEP.IronSightsPos = Vector(-7.64, -2.412, 3.319) +SWEP.IronSightsAng = Vector(0, -0, 0) \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_scout/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_scout/shared.lua new file mode 100644 index 00000000..71ba7f1d --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_scout/shared.lua @@ -0,0 +1,51 @@ +if (SERVER) then + AddCSLuaFile("shared.lua") + +end; + +if (CLIENT) then + SWEP.PrintName = "SCOUT" + SWEP.Author = "Zig" + SWEP.Slot = 3 + SWEP.SlotPos = 1 + +end; + +SWEP.Category = "BackSword 2" +SWEP.Base = "bs_sniper_base" +SWEP.HoldType = "ar2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_scout.mdl" +SWEP.WorldModel = "models/weapons/w_snip_scout.mdl" +SWEP.ViewModelFOV = 60 +SWEP.UseHands = true; +SWEP.ViewModelFlip = false; + +SWEP.Primary.Sound = Sound("Weapon_SCOUT.Single") +SWEP.Primary.Damage = 70 +SWEP.Primary.Recoil = 1.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.0001 +SWEP.Primary.ClipSize = 10 +SWEP.Primary.Delay = 1.2 +SWEP.Primary.DefaultClip = 90 +SWEP.Primary.Automatic = false; +SWEP.Primary.Ammo = "smg1" + +SWEP.IronSightsPos = nil; +SWEP.IronSightsAng = nil; + +SWEP.UseScope = true; +SWEP.ScopeZoom = 8 + +SWEP.Scope1 = true; +SWEP.BoltAction = true; + +SWEP.CrouchCone = 0.001 +SWEP.CrouchWalkCone = 0.005 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.001 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_sg550/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_sg550/shared.lua new file mode 100644 index 00000000..12e3b9b8 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_sg550/shared.lua @@ -0,0 +1,50 @@ +if (SERVER) then + AddCSLuaFile("shared.lua") + +end; + +if (CLIENT) then + SWEP.PrintName = "SG550" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.Base = "bs_sniper_base" +SWEP.Category = "BackSword 2" +SWEP.HoldType = "ar2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_sg550.mdl" +SWEP.WorldModel = "models/weapons/w_snip_sg550.mdl" +SWEP.ViewModelFlip = false; +SWEP.UseHands = true; +SWEP.ViewModelFOV = 62 + +SWEP.Primary.Sound = Sound("Weapon_SG550.Single") +SWEP.Primary.Damage = 45 +SWEP.Primary.Recoil = 1.5 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.001 +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Delay = 0.2 +SWEP.Primary.DefaultClip = 90 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.IronSightsPos = nil; +SWEP.IronSightsAng = nil; + +SWEP.UseScope = true; +SWEP.ScopeZoom = 3 + +SWEP.Scope1 = true; +SWEP.BoltAction = false; + +SWEP.CrouchCone = 0.001 +SWEP.CrouchWalkCone = 0.005 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.001 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_sg552/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_sg552/shared.lua new file mode 100644 index 00000000..c50e5cba --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_sg552/shared.lua @@ -0,0 +1,46 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "SG552" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "ar2" +SWEP.Base = "bs_base" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; +SWEP.Category = "BackSword 2" + +SWEP.ViewModel = "models/weapons/cstrike/c_rif_sg552.mdl" +SWEP.WorldModel = "models/weapons/w_rif_sg552.mdl" +SWEP.UseHands = true; +SWEP.ViewModelFlip = false; +SWEP.ViewModelFOV = 60 + +SWEP.Primary.Sound = Sound( "Weapon_sg552.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.01 +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Delay = 0.09 +SWEP.Primary.DefaultClip = 120 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.IronSightsPos = Vector(-3.76, -6.633, 1.919) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.CrouchCone = 0.01 +SWEP.CrouchWalkCone = 0.02 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.015 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_tmp/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_tmp/shared.lua new file mode 100644 index 00000000..2ba7e673 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_tmp/shared.lua @@ -0,0 +1,46 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "TMP" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "ar2" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_tmp.mdl" +SWEP.WorldModel = "models/weapons/w_smg_tmp.mdl" +SWEP.ViewModelFOV = 60 +SWEP.UseHands = true; +SWEP.ViewModelFlip = false; + +SWEP.Primary.Sound = Sound( "Weapon_tmp.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.04 +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Delay = 0.075 +SWEP.Primary.DefaultClip = 100 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.IronSightsPos = Vector(-2.881, -6.031, 1.919) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.CrouchCone = 0.025 +SWEP.CrouchWalkCone = 0.03 +SWEP.WalkCone = 0.04 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.04 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_ump45/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_ump45/shared.lua new file mode 100644 index 00000000..2218683a --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_ump45/shared.lua @@ -0,0 +1,51 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "UMP45" + SWEP.Author = "Zig" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "smg" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_smg_ump45.mdl" +SWEP.WorldModel = "models/weapons/w_smg_ump45.mdl" +SWEP.UseHands = true; +SWEP.ViewModelFlip = false; +SWEP.ViewModelFOV = 60 + +SWEP.Primary.Sound = Sound( "Weapon_ump45.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.025 +SWEP.Primary.ClipSize = 25 +SWEP.Primary.Delay = 0.1 +SWEP.Primary.DefaultClip = 500 +SWEP.Primary.Automatic = true; +SWEP.Primary.Ammo = "smg1" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false; +SWEP.Secondary.Ammo = "none" + +SWEP.IronSightsPos = Vector(-8.778, -7.237, 4.129) +SWEP.IronSightsAng = Vector(-1.063, -0.408, -2.406) + +SWEP.CrouchCone = 0.02 +SWEP.CrouchWalkCone = 0.022 +SWEP.WalkCone = 0.025 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.025 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_usp/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_usp/shared.lua new file mode 100644 index 00000000..1c2910d6 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_cs_usp/shared.lua @@ -0,0 +1,51 @@ +if ( SERVER ) then + + AddCSLuaFile( "shared.lua" ) + +end; + +if ( CLIENT ) then + + SWEP.PrintName = "USP" + SWEP.Author = "Counter-Strike" + SWEP.Slot = 4 + +end; + +SWEP.HoldType = "pistol" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" + +SWEP.Spawnable = true; +SWEP.AdminSpawnable = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_pist_usp.mdl" +SWEP.WorldModel = "models/weapons/w_pist_usp.mdl" +SWEP.ViewModelFlip = false; +SWEP.UseHands = true; +SWEP.ViewModelFOV = 57 + +SWEP.Primary.Sound = Sound( "Weapon_usp.Single" ) +SWEP.Primary.Recoil = 1 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.02 +SWEP.Primary.ClipSize = 12 +SWEP.Primary.Delay = 0.08 +SWEP.Primary.DefaultClip = 100 +SWEP.Primary.Automatic = false; +SWEP.Primary.Ammo = "pistol" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false; +SWEP.Secondary.Ammo = "none" + +SWEP.IronSightsPos = Vector(-5.921, -6.231, 2.519) +SWEP.IronSightsAng = Vector(0, 0, 0) + +SWEP.CrouchCone = 0.02 +SWEP.CrouchWalkCone = 0.025 +SWEP.WalkCone = 0.03 +SWEP.AirCone = 0.1 +SWEP.StandCone = 0.02 \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_shotgun_base/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_shotgun_base/shared.lua new file mode 100644 index 00000000..b5166480 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_shotgun_base/shared.lua @@ -0,0 +1,242 @@ +if (SERVER) then + + AddCSLuaFile( "shared.lua" ); + +end + +if (CLIENT) then + + +--[[ Basic SWEP Information to display to the client. ]]-- + + SWEP.PrintName = "Pump Shotgun" + SWEP.Author = "Zig" + SWEP.Purpose = "" + SWEP.Instructions = "" + SWEP.Contact = "" + SWEP.CSMuzzleFlashes = true; -- Use Counter-Strike muzzle flashes? + +end; + + +--[[ Set whether the SWEP is spawnable (by users or by admins). --]] + +SWEP.Spawnable = false; +SWEP.AdminSpawnable = false; + +--[[ Misc. SWEP Content --]] + +SWEP.HoldType = "shotgun" +SWEP.Base = "bs_base" +SWEP.Category = "BackSword 2" +SWEP.ViewModelFOV = 50 +SWEP.ViewModelFlip = false; -- Some view models are incorrectly flipped. +SWEP.UseHands = true; + +SWEP.ViewModel = "models/weapons/cstrike/c_shot_m3super90.mdl" +SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl" + +SWEP.DrawAmmo = true; -- Draw our own ammo display? +SWEP.DrawCrosshair = false; -- Draw the crosshair, or draw our own? + +SWEP.Weight = 5; +SWEP.AutoSwitchTo = false; +SWEP.AutoSwitchFrom = false; + +--[[ Set the SWEP's primary fire information. --]] + +SWEP.Primary.DefaultClip = 10; +SWEP.Primary.ClipSize = 10; +SWEP.Primary.Automatic = true; +SWEP.Primary.NumShots = 7; +SWEP.Primary.Damage = 35; +SWEP.Primary.Recoil = 0.60; +SWEP.Primary.Sound = Sound("weapons/shotgun/gunfire/shotgun_fire_1.wav") +SWEP.Primary.Delay = 0.8; +SWEP.Primary.Ammo = "buckshot"; +SWEP.Primary.Cone = 0.02; + +--[[ Set the SWEP's primary fire information. --]] + +SWEP.Secondary.DefaultClip = -1; +SWEP.Secondary.ClipSize = -1; +SWEP.Secondary.Automatic = false; +SWEP.Secondary.Ammo = "none"; + +--[[ Define the bullet information for later use. --]] + +SWEP.BulletTracerFreq = 1; -- Show a tracer every x bullets. +SWEP.BulletTracerName = nil -- Use a custom effect for the tracer. +SWEP.BulletForce = 5; + +--[[ Set up the ironsight's position and angles. --]] + +SWEP.IronSightsPos = nil; +SWEP.IronSightsAng = nil; + +--[[ Set up the accuracy for the weapon. --]] + +SWEP.CrouchCone = 0.01 -- Accuracy when we're crouching +SWEP.CrouchWalkCone = 0.02 -- Accuracy when we're crouching and walking +SWEP.WalkCone = 0.025 -- Accuracy when we're walking +SWEP.AirCone = 0.1 -- Accuracy when we're in air +SWEP.StandCone = 0.015 -- Accuracy when we're standing still + + /************************** + Inner Workings + **************************/ + +--[[ These are the more deeper parts of the SWEP. It's suggested you DO NOT edit these. --]] +--[[ The only reason you should ever edit these is if you know what you're doing or if you'd like to change how long it takes to load a shell. --]] +--[[ The shell loading time is on line 181, and is set as 0.4 by default. The higher the number the longer it takes and etc.]] + + /************************** + Initialize/cache + **************************/ + +function SWEP:Initialize() +util.PrecacheSound(self.Primary.Sound) + self:SetWeaponHoldType( self.HoldType ) +end + + /************************** + Primary Attack + **************************/ + +function SWEP:PrimaryAttack() + +if ( !self:CanPrimaryAttack() ) then return end + + self.Weapon:EmitSound(self.Primary.Sound); + + self:HandleBullets(self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone); + self:TakePrimaryAmmo(1); + + self:ShootEffects() + +self:EmitSound(Sound(self.Primary.Sound)) + +self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) +self:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) +end + + /************************** + Deploy + **************************/ + +function SWEP:Deploy() + self:SendWeaponAnim( ACT_VM_DRAW ) + self:SetNextPrimaryFire( CurTime() + self:SequenceDuration() ) + + return true +end + + /************************** + Regular Reload + **************************/ + +function SWEP:Reload() + //if ( CLIENT ) then return end + + // Already reloading + if ( self.Weapon:GetNetworkedBool( "reloading", false ) ) then return end + + // Start reloading if we can + if ( self.Weapon:Clip1() < self.Primary.ClipSize && self.Owner:GetAmmoCount( self.Primary.Ammo ) > 0 ) then + + self.Weapon:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START) + + if (game.SinglePlayer() ) then + timer.Simple( 0.5, function() + self.Weapon:SetNetworkedBool( "reloading", true ) + self.Weapon:SetVar( "reloadtimer", CurTime()) + end) + else + self.Weapon:SetNetworkedBool( "reloading", true ) + end + + end +end + + /************************** + Shotgun Reload + **************************/ + + function SWEP:ShotgunReload() + + if self.Owner:KeyPressed(IN_ATTACK) then + self.Weapon:SetNetworkedBool( "reloading", false ) + end + + if ( self.Weapon:GetNetworkedBool( "reloading", false ) ) then + + if ( self.Weapon:GetVar( "reloadtimer", 0 ) < CurTime()) then + + // reload + if ( self.Weapon:Clip1() >= self.Primary.ClipSize || self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 ) then + self.Weapon:SetNetworkedBool( "reloading", false ) + return + end + + self.Weapon:SetVar( "reloadtimer", CurTime() + 0.4 ) + if not ( self.Weapon:Clip1() == self.Primary.ClipSize) then + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + end + + // Add ammo + self.Owner:RemoveAmmo( 1, self.Primary.Ammo, false ) + self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + // Finish filling, final pump. Current Clip is = to ClipSize or No more ammo in the reserve + if ( self.Weapon:Clip1() == self.Primary.ClipSize || self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0) then + self.Weapon:SetNetworkedBool( "reloading", false ) + self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + timer.Simple( 0.5, function() + if self.Weapon == nil then return end + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) + self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay) + end ) + + end + end +end +end + + /************************** + Think! + **************************/ + +function SWEP:Think() + self:ShotgunReload() + + if ( self.Weapon:GetNetworkedBool( "reloading", true ) ) then + + if ( self.Weapon:GetVar( "reloadtimer", 0 ) < CurTime() ) then + + // Finished reload - + if ( self.Weapon:Clip1() >= self.Primary.ClipSize || self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 ) then + self.Weapon:SetNetworkedBool( "reloading", false ) + return + end + + // Next cycle + self.Weapon:SetVar( "reloadtimer", CurTime() + 0.5 ) + local vm = self.Owner:GetViewModel() + + // Add ammo + self.Owner:RemoveAmmo( 1, self.Primary.Ammo, false ) + self:EmitSound(Sound("weapons/m3/m3_insertshell.wav")) + self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + // Finish filling, final pump + if ( self.Weapon:Clip1() >= self.Primary.ClipSize || self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 ) then + vm:SendViewModelMatchingSequence( vm:LookupSequence( "reload_end" ) ) + else + + end + + end + + end + +end \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_sniper_base/cl_init.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_sniper_base/cl_init.lua new file mode 100644 index 00000000..08b5f099 --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_sniper_base/cl_init.lua @@ -0,0 +1,75 @@ +--[[ TETA_BONITA MADE THE FADING EFFECT. THANKS TETA_BONITA IF YOU'RE STILL ALIVE. --]] + +include("shared.lua") + +local iScreenWidth = surface.ScreenWidth() +local iScreenHeight = surface.ScreenHeight() +local SCOPEFADE_TIME = 1 + +function SWEP:DrawHUD() + if self.UseScope then + local bScope = self.Weapon:GetNetworkedBool("Scope") + + if bScope ~= self.bLastScope then + + self.bLastScope = bScope + self.fScopeTime = CurTime() + + elseif bScope then + local fScopeZoom = self.Weapon:GetNetworkedFloat("ScopeZoom") + + if fScopeZoom ~= self.fLastScopeZoom then + + self.fLastScopeZoom = fScopeZoom + self.fScopeTime = CurTime() + end + end + + local fScopeTime = self.fScopeTime or 0 + + if fScopeTime > CurTime() - SCOPEFADE_TIME then + local Mul = 3.0 + + Mul = 1 - math.Clamp((CurTime() - fScopeTime)/SCOPEFADE_TIME, 0, 1) + + if self.Weapon:GetNetworkedBool("Scope") then + self.Owner:DrawViewModel(false) + else + self.Owner:DrawViewModel(true) + end + + surface.SetDrawColor(0, 0, 0, 255*Mul) + surface.DrawRect(0,0,iScreenWidth,iScreenHeight) + end + + if (bScope) then + + // Draw the crosshair -- Thanks for the crosshair drawing and drawrects Fonix! + if not (self.ScopeReddot or self.ScopeMs) then + surface.SetDrawColor(0, 0, 0, 255) + surface.DrawLine(self.CrossHairTable.x11, self.CrossHairTable.y11, self.CrossHairTable.x12, self.CrossHairTable.y12) + surface.DrawLine(self.CrossHairTable.x21, self.CrossHairTable.y21, self.CrossHairTable.x22, self.CrossHairTable.y22) + end + + // Put the texture + surface.SetDrawColor(0, 0, 0, 255) + + if (self.Scope1) then + surface.SetTexture(surface.GetTextureID("scope/scope_normal")) + end + + surface.DrawTexturedRect(self.LensTable.x, self.LensTable.y, self.LensTable.w, self.LensTable.h) + + // Fill in everything else + + if (self.Scope1) then + surface.SetDrawColor(10, 10, 10, 255) + surface.DrawRect(self.QuadTable.x1 - 2.5, self.QuadTable.y1 - 2.5, self.QuadTable.w1 + 5, self.QuadTable.h1 + 5) + surface.DrawRect(self.QuadTable.x2 - 2.5, self.QuadTable.y2 - 2.5, self.QuadTable.w2 + 5, self.QuadTable.h2 + 5) + surface.DrawRect(self.QuadTable.x3 - 2.5, self.QuadTable.y3 - 2.5, self.QuadTable.w3 + 5, self.QuadTable.h3 + 5) + surface.DrawRect(self.QuadTable.x4 - 2.5, self.QuadTable.y4 - 2.5, self.QuadTable.w4 + 5, self.QuadTable.h4 + 5) + + end + end + end +end \ No newline at end of file diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_sniper_base/shared.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_sniper_base/shared.lua new file mode 100644 index 00000000..3f8158ca --- /dev/null +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/entities/weapons/bs_sniper_base/shared.lua @@ -0,0 +1,525 @@ +if (SERVER) then + + AddCSLuaFile( "shared.lua" ); + AddCSLuaFile("cl_init.lua") + +end + +if (CLIENT) then + +--[[ +These comments are strictly for overviewing the base and understanding what each line does if they aren't sorta self-explanitory. +The reason for this is simply because if people want to start wanting to know what each line does and make their own they have a valid source. +It's suggested you don't put them in your shared files, but if that's how you roll, it's how you roll. +]]-- + +--[[ Basic SWEP Information to display to the client. ]]-- + + SWEP.PrintName = "AWP" -- The name of the weapon. + SWEP.Author = "Zig" -- The author. + SWEP.Purpose = "" -- The purpose of the weapon. (Optional of course.) + SWEP.Instructions = "" -- The instructions to use the weapon. (For dummies.) + SWEP.Contact = "" -- Where to go to get help. + SWEP.CSMuzzleFlashes = true; -- Use Counter-Strike muzzle flashes? + +end; + + +--[[ Set whether the SWEP is spawnable (by users or by admins). Make sure to only pick one as true. --]] + +SWEP.Spawnable = false; -- Is our weapon spawnable through the q-menu for normal players? +SWEP.AdminSpawnable = false; -- Is our weapon only spawnable to admins? + +--[[ Misc. SWEP Content --]] + +SWEP.HoldType = "smg" -- How you hold the SWEP in third person. (There are a whole bunch of holdtypes.) +SWEP.Base = "bs_base" -- The base we are using for the SWEP, a base always runs off a base unless a base! Confusing, right? +SWEP.Category = "Backsword" -- The category the weapon is listed under in the q-menu. This is pointless if you have the spawnables set to false. +SWEP.ViewModelFOV = 70 -- The FOV the viewmodel is set at. +SWEP.ViewModelFlip = false; -- Some view models are incorrectly flipped. +SWEP.UseHands = true; -- Do we want to use c_hands if they're available? + +SWEP.ViewModel = "models/weapons/cstrike/c_snip_awp.mdl" -- The view model of the SWEP. +SWEP.WorldModel = "models/weapons/w_snip_awp.mdl" -- The world model of the SWEP. + +SWEP.DrawAmmo = true; -- Draw our own ammo display? +SWEP.DrawCrosshair = false; -- Draw the crosshair, or draw our own? + +--[[ These really aren't important. Keep them at false, and the weight at five. --]] + +SWEP.Weight = 5 -- How heavy is the gun, (Player speeds etc.) +SWEP.AutoSwitchTo = false; -- Is it autoswitched when picked up? +SWEP.AutoSwitchFrom = false; -- Is it autoswitched when picked up? + +--[[ Set the SWEP's primary fire information. --]] + +SWEP.Primary.DefaultClip = 8; -- How much ammunition are you given when spawning the SWEP. (Make sure you set this to the Clipsize at minimum to not annoy people.) +SWEP.Primary.ClipSize = 8; -- How much ammo is in one magazine? +SWEP.Primary.Automatic = false; -- Is the SWEP automatic? +SWEP.Primary.NumShots = 1; -- How many bullets do you fire in one shot? +SWEP.Primary.Damage = 22; -- How much damage does the SWEP do? +SWEP.Primary.Recoil = 0.50; -- How large is the recoil? +SWEP.Primary.Sound = Sound("sound") -- What's the firing sound of the SWEP? +SWEP.ReloadHolster = 0.1 -- Irrelevant, keep at 0.1. + +SWEP.Primary.Delay = 1.3; -- Make sure we keep this at 1.3 so the bolt animation can play! (If it's a bolt action rifle, of course. This also varies on models, however this is for CS:S.) +SWEP.Primary.Ammo = "smg1"; -- What's the primary ammunition type for the SWEP? +SWEP.Primary.Cone = 0.0001; -- What's the accuracy cone? + +--[[ Basic Scope Options. ]]-- + +SWEP.UseScope = true -- Use a scope instead of iron sights. +SWEP.ScopeScale = 0.55 -- The scale of the scope's reticle in relation to the player's screen size. +SWEP.ScopeZoom = 6 -- How much is the zoom on the scope? +SWEP.IronsightTime = 0.35 -- How long does it take to zoom in? + +--Only Select one... Only one. + +SWEP.Scope1 = false +SWEP.BoltAction = true -- Is this weapon a bolt action? + +--[[ Set the SWEP's secondary fire information. --]] + +SWEP.Secondary.ClipSize = 1 -- Secondary Fire is useless, leave these be, they do nothing! +SWEP.Secondary.DefaultClip = 100 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "smg2" + +--[[ Define the bullet information for later use. --]] + +SWEP.BulletTracerFreq = 1; -- Show a tracer every x bullets. +SWEP.BulletTracerName = nil -- Use a custom effect for the tracer. +SWEP.BulletForce = 5; -- How much force does a bullet give to a prop! + +--[[ Set up the accuracy for the weapon. --]] + +SWEP.CrouchCone = 0.001 -- Accuracy when we're crouching +SWEP.CrouchWalkCone = 0.009 -- Accuracy when we're crouching and walking +SWEP.WalkCone = 0.025 -- Accuracy when we're walking +SWEP.AirCone = 0.1 -- Accuracy when we're in air +SWEP.StandCone = 0.015 -- Accuracy when we're standing still + +--[[ Below is a lot of stuff you probably shouldn't touch in order to not mess up the base. It's suggested that you really keep a lot of it alone. +Thanks xoxoxo, Zig. +]]-- + + /************************** + Deploy + **************************/ +function SWEP:Deploy() + + if self.Weapon:GetNetworkedBool("Silenced") == true then + self.Weapon:SendWeaponAnim( ACT_VM_DRAW_SILENCED ); + else + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + end; + + self.Weapon:SetNextPrimaryFire(CurTime() + 1) + self:SetScope(false, self.Owner) + self.Reloadaftershoot = CurTime() + 1 + + if timer.Exists("ReloadTimer") then + timer.Destroy("ReloadTimer") + end + //Destroy the faggot timer on deploy if its running. + + self:SetNWInt("skipthink", false) + + return true +end; + + + /************************** + SecondaryAttack + **************************/ + +function SWEP:SecondaryAttack() + + if self.Owner:KeyDown(IN_USE) then + + self:SetNWInt("skipthink", true) + timer.Simple(self.SilenceHolster, + function() + if self.Weapon == nil then return end + self:SetNWInt("skipthink", false) + end) + //Skip the entire Think Function + + self.Weapon:SetNetworkedBool( "Ironsights", false) + //Set the ironsight to false + if CLIENT or SERVER then + self.Owner:SetFOV(0, 0.35) + end + self:Silence() + end; + + if not self.Owner:OnGround() then return end + if self.Owner:KeyDown(IN_SPEED) then return end + if self.Owner:KeyDown(IN_USE) then return end + + if ( self.NextSecondaryAttack > CurTime() ) then return end + + bIronsights = !self.Weapon:GetNetworkedBool( "Ironsights", false ) + + self:SetIronsights( bIronsights ) + + self.IronSightsPos = self.AimSightsPos + self.IronSightsAng = self.AimSightsAng + + self.NextSecondaryAttack = CurTime() + 0.3 +end; + + /************************** + SetScope + **************************/ + +function SWEP:SetScope(b, player) +if CLIENT then return end + + local PlaySound = b ~= self.Weapon:GetNetworkedBool("Scope", not b) + self.CurScopeZoom = 1 + + + if self.Weapon:GetNetworkedBool("Scope") then + self.Owner:DrawViewModel(false) + else + self.Owner:DrawViewModel(true) + end + self.Weapon:SetNetworkedBool("Scope", b) +end; + + /************************** + Reload + **************************/ + +function SWEP:Reload() + + if self.Owner:KeyDown(IN_ATTACK) then return end + + if( self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 || self.Weapon:Clip1() >= self.Primary.ClipSize) then return end + + if (!self.OnReload or self:OnReload() != true) then + self.Weapon:DefaultReload(ACT_VM_RELOAD); + self:SetIronSights(false); + + if (self.ReloadSound) then + self.Weapon:EmitSound(self.Primary.Reload) + end; + end; + + timer.Simple(self.ReloadHolster + .2, + function() + if self.Weapon == nil then return end + self:SetNWInt("skipthink", false) + end) + + if ( self.Reloadaftershoot > CurTime() ) then return end + + if ( self.Weapon:Clip1() < self.Primary.ClipSize ) and self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then + + self.Weapon:SetNetworkedBool("Ironsights", false) + + self:SetScope(false, self.Owner) + + self:SetWeaponHoldType( self.HoldType ) + + if CLIENT or SERVER then + self.Owner:SetFOV( 0, 0.15 ) + end; + + self.MouseSensitivity = 1 + + if (game.SinglePlayer()) then + self:SetNWInt("skipthink", true) + timer.Create("ReloadTimer", self.ReloadHolster + .2, 1, + function() + if self.Weapon == nil then return end + self:SetNWInt("skipthink", false) + end) + end; + + if timer.Exists("BoltTimer") then + timer.Destroy("BoltTimer") + end; + + if not CLIENT then + self.Owner:DrawViewModel(true) + end; + end; + return true +end; + + /************************** + Primary Fire + **************************/ + +function SWEP:PrimaryAttack() + + if (self.BoltAction) then + self:SetIronsights(false) + if (game.SinglePlayer()) then + self:SetNWInt("skipthink", true) + timer.Create("BoltTimer", self.Primary.Delay, 1, + function() + if self.Weapon == nil then return end + self:SetNWInt("skipthink", false) + end) + + else + self:SetNWInt("skipthink", true) + timer.Simple(self.Primary.Delay, + function() + if self.Weapon == nil then return end + self:SetNWInt("skipthink", false) + end) + end; +end; + if ( self.Owner:IsNPC() ) then return end + + self.Owner:ViewPunch( Angle( math.Rand(-0.2,-0.2) * 0.5, math.Rand(-0.1,0.1) * 0.5, 0 ) ) + + if ( (game.SinglePlayer() && SERVER) || CLIENT ) then + self.Weapon:SetNetworkedFloat( "LastShootTime", CurTime() ) + end; + + self.Weapon:SetNextSecondaryFire(CurTime() + self.Primary.Delay); + self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay); + + if (!self:CanPrimaryAttack()) then return; end; + + self.Weapon:EmitSound(self.Primary.Sound); + + self:HandleBullets(self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone); + self:TakePrimaryAmmo(1); + + if (self.Owner:IsNPC()) then return; end; + + self.Owner:ViewPunch( + Angle(math.Rand(-0.2, -0.1) * self.Primary.Recoil, math.Rand(-0.1, 0.1) * self.Primary.Recoil, 0) + ); + + if ((game.SinglePlayer() and SERVER) || CLIENT) then + self.dt.LastFire = CurTime(); + end; + +end; + + /************************** + Sensability + **************************/ + +local LastViewAng = false + +local function SimilarizeAngles (ang1, ang2) + + ang1.y = math.fmod (ang1.y, 360) + ang2.y = math.fmod (ang2.y, 360) + + if math.abs (ang1.y - ang2.y) > 180 then + if ang1.y - ang2.y < 0 then + ang1.y = ang1.y + 360 + else + ang1.y = ang1.y - 360 + end; + end; +end; + +local function ReduceScopeSensitivity (uCmd) + + if LocalPlayer():GetActiveWeapon() and LocalPlayer():GetActiveWeapon():IsValid() then + local newAng = uCmd:GetViewAngles() + if LastViewAng then + SimilarizeAngles (LastViewAng, newAng) + + local diff = newAng - LastViewAng + + diff = diff * (LocalPlayer():GetActiveWeapon().MouseSensitivity or 1) + uCmd:SetViewAngles (LastViewAng + diff) + end; + end; + LastViewAng = uCmd:GetViewAngles() +end; + +hook.Add ("CreateMove", "RSS", ReduceScopeSensitivity) + + + /************************** + SetIronsights + **************************/ + +function SWEP:SetIronsights( b ) -- Thanks Fonix & Worshipper for lots of this nutty shit. + + self.Weapon:SetNetworkedBool( "Ironsights", b ) + if self.Owner:KeyDown(IN_USE) then return end + if self.Weapon:GetNetworkedBool( "Ironsights", true ) then + if CLIENT or SERVER then + self.Owner:SetFOV(65, 0.2) + timer.Simple(0.21, function() + self.Weapon:SetNetworkedBool("Scope", true) + self.Owner:SetFOV(80/self.ScopeZoom, 0) + self.Weapon:GetNetworkedBool( "Ironsights", false ) + end) + end; + self.Weapon:EmitSound("") + else + if CLIENT or SERVER then + self.Owner:SetFOV(0, 0.2) + self.Weapon:SetNetworkedBool("Scope", false) + end; + + if !self.Owner:KeyDown(IN_ATTACK) then + self.Weapon:EmitSound("") + end; + end; + +end; + + /************************** + Think + **************************/ + +function SWEP:Think() + + if CLIENT and self.Weapon:GetNetworkedBool("Scope") then + self.MouseSensitivity = self.Owner:GetFOV() / 80 + else + self.MouseSensitivity = 1 + end; + + + if not CLIENT and self.Weapon:GetNetworkedBool("Scope") and self.Owner:KeyDown(IN_ATTACK2) then + + self.Owner:DrawViewModel(true) + elseif not CLIENT then + + self.Owner:DrawViewModel(true) + end; + + self:SpreadSystem() + + end; + + /************************** + ResetVars + **************************/ + +function SWEP:ResetVars() + + self.NextSecondaryAttack = 0 + + self.bLastIron = false + self.Weapon:SetNetworkedBool("Ironsights", false) + + if self.UseScope then + self.CurScopeZoom = 1 + self.fLastScopeZoom = 1 + self.bLastScope = false + self.Weapon:SetNetworkedBool("Scope", false) + end; + + if self.Owner then + self.OwnerIsNPC = self.Owner:IsNPC() + end; + +end; + +function SWEP:Holster(wep) self:ResetVars() return true end; +function SWEP:Equip(NewOwner) self:ResetVars() return true end; +function SWEP:OnRemove() self:ResetVars() return true end; +function SWEP:OnDrop() self:ResetVars() return true end; +function SWEP:OwnerChanged() self:ResetVars() return true end; +function SWEP:OnRestore() self:ResetVars() return true end; + + /************************** + Initialize + **************************/ + +function SWEP:Initialize() + + self:SetWeaponHoldType(self.HoldType) + + if CLIENT then + + local iScreenWidth = surface.ScreenWidth() + local iScreenHeight = surface.ScreenHeight() + + self.ScopeTable = {} + self.ScopeTable.l = iScreenHeight*self.ScopeScale + self.ScopeTable.x1 = 0.5*(iScreenWidth + self.ScopeTable.l) + self.ScopeTable.y1 = 0.5*(iScreenHeight - self.ScopeTable.l) + self.ScopeTable.x2 = self.ScopeTable.x1 + self.ScopeTable.y2 = 0.5*(iScreenHeight + self.ScopeTable.l) + self.ScopeTable.x3 = 0.5*(iScreenWidth - self.ScopeTable.l) + self.ScopeTable.y3 = self.ScopeTable.y2 + self.ScopeTable.x4 = self.ScopeTable.x3 + self.ScopeTable.y4 = self.ScopeTable.y1 + + self.ParaScopeTable = {} + self.ParaScopeTable.x = 0.5*iScreenWidth - self.ScopeTable.l + self.ParaScopeTable.y = 0.5*iScreenHeight - self.ScopeTable.l + self.ParaScopeTable.w = 2*self.ScopeTable.l + self.ParaScopeTable.h = 2*self.ScopeTable.l + + self.ScopeTable.l = (iScreenHeight + 1)*self.ScopeScale + self.QuadTable = {} + self.QuadTable.x1 = 0 + self.QuadTable.y1 = 0 + self.QuadTable.w1 = iScreenWidth + self.QuadTable.h1 = 0.5*iScreenHeight - self.ScopeTable.l + self.QuadTable.x2 = 0 + self.QuadTable.y2 = 0.5*iScreenHeight + self.ScopeTable.l + self.QuadTable.w2 = self.QuadTable.w1 + self.QuadTable.h2 = self.QuadTable.h1 + self.QuadTable.x3 = 0 + self.QuadTable.y3 = 0 + self.QuadTable.w3 = 0.5*iScreenWidth - self.ScopeTable.l + self.QuadTable.h3 = iScreenHeight + self.QuadTable.x4 = 0.5*iScreenWidth + self.ScopeTable.l + self.QuadTable.y4 = 0 + self.QuadTable.w4 = self.QuadTable.w3 + self.QuadTable.h4 = self.QuadTable.h3 + + self.LensTable = {} + self.LensTable.x = 2.5+self.QuadTable.w3 + self.LensTable.y = 1+self.QuadTable.h1 + self.LensTable.w = 2*self.ScopeTable.l + self.LensTable.h = 2*self.ScopeTable.l + + self.CrossHairTable = {} + self.CrossHairTable.x11 = 0 + self.CrossHairTable.y11 = 0.5*iScreenHeight + self.CrossHairTable.x12 = iScreenWidth + self.CrossHairTable.y12 = self.CrossHairTable.y11 + self.CrossHairTable.x21 = 0.5*iScreenWidth + self.CrossHairTable.y21 = 0 + self.CrossHairTable.x22 = 0.5*iScreenWidth + self.CrossHairTable.y22 = iScreenHeight + + end; + + self.ScopeZooms = self.ScopeZooms or {5} + if self.UseScope then + self.CurScopeZoom = 1 + end; + + self:ResetVars() + self.Weapon:SetNetworkedBool("Ironsights", false) + self.Reloadaftershoot = 0 + + //Spread Change + self:SetNWInt("crouchcone", self.CrouchCone) + self:SetNWInt("crouchwalkcone", self.CrouchWalkCone) + self:SetNWInt("walkcone", self.WalkCone) + self:SetNWInt("aircone", self.AirCone) + self:SetNWInt("standcone", self.StandCone) + self:SetNWInt("ironsightscone", self.IronsightsCone) + //Recoil change + self:SetNWInt("recoil", self.Recoil) + self:SetNWInt("recoilzoom", self.RecoilZoom) + //Delay change + self:SetNWInt("delay", self.Delay) + self:SetNWInt("delayzoom", self.DelayZoom) + //ThinkSkip + self:SetNWInt("thinkskip", self.ThinkSkip) + self:SetNWInt("ironsighttoggle", false) +end; diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin/sh_plugin.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/sh_plugin.lua similarity index 100% rename from Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin/sh_plugin.lua rename to Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/sh_plugin.lua diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin/sv_plugin.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/sv_plugin.lua similarity index 100% rename from Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword/plugin/sv_plugin.lua rename to Clockwork/garrysmod/gamemodes/clockwork/plugins/backsword2/plugin/sv_plugin.lua diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/displaytyping/plugin/cl_hooks.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/displaytyping/plugin/cl_hooks.lua index 69037224..72b72de4 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/plugins/displaytyping/plugin/cl_hooks.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/displaytyping/plugin/cl_hooks.lua @@ -23,7 +23,7 @@ local string = string; local pairs = pairs; -- Called to draw the text over each player's head if needed. -function cwDisplayTyping:PreDrawOpaqueRenderables() +function cwDisplayTyping:PostDrawTranslucentRenderables() for k, player in pairs(playerGetAll()) do if (player:HasInitialized()) then local large3D2DFont = cwOption:GetFont("large_3d_2d"); @@ -138,8 +138,6 @@ function cwDisplayTyping:PreDrawOpaqueRenderables() end; end; - - -- Called when the chat box is closed. function cwDisplayTyping:ChatBoxClosed(textTyped) if (textTyped) then diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/emoteanims/plugin/cl_hooks.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/emoteanims/plugin/cl_hooks.lua index 3b71da2d..86be7bb0 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/plugins/emoteanims/plugin/cl_hooks.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/emoteanims/plugin/cl_hooks.lua @@ -8,9 +8,7 @@ -- Called when the local player should be drawn. function cwEmoteAnims:ShouldDrawLocalPlayer() - if (self:IsPlayerInStance(Clockwork.Client)) then - return true; - end; + return self:IsPlayerInStance(Clockwork.Client); end; -- Called when a player's animation is updated. diff --git a/Codebase/lua/autorun/sv_codebase.lua b/Codebase/lua/autorun/sv_codebase.lua index 8705f316..af77d8c5 100644 --- a/Codebase/lua/autorun/sv_codebase.lua +++ b/Codebase/lua/autorun/sv_codebase.lua @@ -31,6 +31,8 @@ local function ProcessFile(fileName) local bInComment = false; local codebase = nil; local counter = {classes = 0, libraries = 0, functions = 0, hooks = 0}; + + OUTPUT_TABLE[fileName] = {functions = {}, classes = {}, libraries = {}, hooks = {}}; for k, v in ipairs(fileLines) do if (string.find(v, "%-%-%[%[")) then @@ -167,11 +169,11 @@ local function ProcessFile(fileName) end if (codebase.libName == "Clockwork" and syntax == ":") then - OUTPUT_TABLE["hooks"][niceName] = codebase; + OUTPUT_TABLE[fileName]["hooks"][niceName] = codebase; counter.hooks = counter.hooks + 1; else - OUTPUT_TABLE["functions"][libName] = OUTPUT_TABLE["functions"][libName] or {}; - OUTPUT_TABLE["functions"][libName][niceName] = codebase; + OUTPUT_TABLE[fileName]["functions"][libName] = OUTPUT_TABLE[fileName]["functions"][libName] or {}; + OUTPUT_TABLE[fileName]["functions"][libName][niceName] = codebase; counter.functions = counter.functions + 1; end; end; @@ -181,14 +183,14 @@ local function ProcessFile(fileName) codebase.niceName = niceName; codebase.libName = libName; codebase.objType = "library"; - OUTPUT_TABLE["libraries"][libName] = codebase; + OUTPUT_TABLE[fileName]["libraries"][libName] = codebase; counter.libraries = counter.libraries + 1; bIsValidField = true; elseif (className) then codebase.niceName = name or string.Trim(className); codebase.objType = "class"; - OUTPUT_TABLE["classes"][codebase.niceName] = codebase; + OUTPUT_TABLE[fileName]["classes"][codebase.niceName] = codebase; counter.classes = counter.classes + 1; bIsValidField = true; @@ -232,12 +234,17 @@ local function ProcessFile(fileName) if (countString != "") then MsgC(Color(150, 225, 150), "@codebase "..(string.gsub(fileName, "gamemodes/clockwork/framework/", "")).."\n"); MsgC(Color(150, 150, 150), "\t"..countString.."\n"); + else + OUTPUT_TABLE[fileName] = nil; + table.insert(OUTPUT_TABLE["empty_files.lua"], fileName); + MsgC(Color(255, 128, 128), "@codebase "..(string.gsub(fileName, "gamemodes/clockwork/framework/", "")).."\n"); end; end; concommand.Add("codebase", function(player, command, arguments) FILE_MANIFEST = {}; - OUTPUT_TABLE = {functions = {}, classes = {}, libraries = {}, hooks = {}}; + OUTPUT_TABLE = {}; + OUTPUT_TABLE["empty_files.lua"] = {}; AddFilesToManifest("gamemodes/clockwork/framework"); @@ -256,8 +263,28 @@ concommand.Add("codebase", function(player, command, arguments) if (delay > 0) then timer.Simple(delay, function() - file.Write("codebase.txt", Clockwork.json:Encode(OUTPUT_TABLE)); - MsgC(Color(255, 128, 128), "@codebase has saved the generated JSON to data/codebase.txt\n"); + for k, v in pairs(OUTPUT_TABLE) do + local saveName = string.gsub(k, "gamemodes/clockwork/", ""); + saveName = "codebase/"..string.gsub(saveName, ".lua", ".txt"); + local dirString = ""; + local explodeTable = string.Explode("/", saveName); + + for k, v in ipairs(explodeTable) do + if (k != #explodeTable) then + dirString = dirString..v.."/"; + + file.CreateDir(dirString); + end; + end; + + local success, err = pcall(file.Write, saveName, Clockwork.json:Encode(v)); + + if (!success) then + MsgC(Color(255, 128, 128), err.."\n"); + else + MsgC(Color(255, 200, 0), "@codebase has saved the generated JSON to data/"..saveName.."\n"); + end + end; end); end; end); \ No newline at end of file