From ae952b9a44569895f73ece5637185dd80d2c6213 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Sun, 17 Dec 2023 23:10:20 -0500 Subject: [PATCH] Implement more movement penalties --- .../benny/entities/weapons/benny/shared.lua | 2 +- .../gamemode/modules/gui/cl_spawnmenu.lua | 90 +++++++++--- .../benny/gamemode/modules/player/cl_hud.lua | 1 + .../modules/player/sh_movement_advanced.lua | 4 +- .../gamemode/modules/weapons/sh_weapons.lua | 135 ++++++++++++++---- .../modules/weapons/sh_weapons_forlater.lua | 24 ---- 6 files changed, 183 insertions(+), 73 deletions(-) diff --git a/gamemodes/benny/entities/weapons/benny/shared.lua b/gamemodes/benny/entities/weapons/benny/shared.lua index e3b2979..98db6f8 100644 --- a/gamemodes/benny/entities/weapons/benny/shared.lua +++ b/gamemodes/benny/entities/weapons/benny/shared.lua @@ -280,7 +280,7 @@ function SWEP:Think() local hand = i==2 if self:BClass( hand ) then if self:BClass( hand ).Custom_Think then - self:BClass( hand ).Custom_Think( self, self:BTable( hand ) ) + self:BClass( hand ).Custom_Think( self, self:BTable( hand ), self:BClass( hand ), hand ) end end end diff --git a/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua b/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua index a0183d5..71725a2 100644 --- a/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua +++ b/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua @@ -98,24 +98,24 @@ local mewer = { end, -- "How managable the weapon's recoil and spread is under sustained fire.\nAffected by RPM and various Recoil stats." }, - { - Name = "Handling", - Size = 12, - Font = "Benny_10", - Stat = function( class ) - return 0 - end, - -- "How quickly this weapon readies from sprinting, aiming and deploying.\nAffected by Aim Down Sights Time, Sprint To Fire Time, and Deploy Time." - }, - { - Name = "Maneuvering", - Size = 12, - Font = "Benny_10", - Stat = function( class ) - return 0 - end, - -- "How accurate the weapon is while not aiming.\nAffected by Hipfire Spread, Mid-air Spread, Sway, and Free Aim Angle." - }, + -- { + -- Name = "Handling", + -- Size = 12, + -- Font = "Benny_10", + -- Stat = function( class ) + -- return 0 + -- end, + -- -- "How quickly this weapon readies from sprinting, aiming and deploying.\nAffected by Aim Down Sights Time, Sprint To Fire Time, and Deploy Time." + -- }, + --{ + -- Name = "Maneuvering", + -- Size = 12, + -- Font = "Benny_10", + -- Stat = function( class ) + -- return 0 + -- end, + -- -- "How accurate the weapon is while not aiming.\nAffected by Hipfire Spread, Mid-air Spread, Sway, and Free Aim Angle." + --}, { Name = "Mobility", Size = 12, @@ -127,16 +127,16 @@ local mewer = { local score_moving, score_aiming, score_reloading, score_firing = 1, 1, 1, 1 - score_moving = rmt1c( BENNY_GetStat( class, "Speed_Move" ), 0.75, 0.95 ) + score_moving = rmt1c( BENNY_GetStat( class, "Speed_Move" ), 0.8, 1 ) score_moving = score_moving * weight_moving - score_aiming = rmt1c( BENNY_GetStat( class, "Speed_Aiming" ), 0.75, 0.95 ) + score_aiming = rmt1c( BENNY_GetStat( class, "Speed_Aiming" ), 0.8, .98 ) score_aiming = score_aiming * weight_aiming - score_reloading = rmt1c( BENNY_GetStat( class, "Speed_Reloading" ), 0.75, 0.9 ) + score_reloading = rmt1c( BENNY_GetStat( class, "Speed_Reloading" ), 0.75, 0.95 ) score_reloading = score_reloading * weight_reloading - score_firing = rmt1c( BENNY_GetStat( class, "Speed_Firing" ), 0.75, 0.9 ) + score_firing = rmt1c( BENNY_GetStat( class, "Speed_Firing" ), 0.75, 0.95 ) score_firing = score_firing * weight_firing return score_moving + score_aiming + score_reloading + score_firing @@ -328,6 +328,52 @@ function OpenSMenu() end end + do + local fucker = statlist:Add( "DLabel" ) + fucker:SetTall( ss(14) ) + fucker:Dock( TOP ) + fucker:DockMargin( 0, 0, 0, ss(2) ) + function fucker:Paint( w, h ) + local hm = WeaponGet( pan_active ) + surface.SetDrawColor( schema("fg") ) + surface.DrawRect( 0, 0, w, h ) + + draw.SimpleText( BENNY_GetStat( hm, "Ammo" ) .. " rounds", "Benny_12", ss(2), ss(2), schema_c("bg") ) + return true + end + end + + do + local fucker = statlist:Add( "DLabel" ) + fucker:SetTall( ss(14) ) + fucker:Dock( TOP ) + fucker:DockMargin( 0, 0, 0, ss(2) ) + function fucker:Paint( w, h ) + local hm = WeaponGet( pan_active ) + surface.SetDrawColor( schema("fg") ) + surface.DrawRect( 0, 0, w, h ) + + local fm = BENNY_GetStat( hm, "Firemodes" ) + local fms = "" + + for i,v in ipairs( fm) do + local m =v.Mode + if m == math.huge then + fms = fms .. "AUTO" + elseif m == 1 then + fms = fms .. "SEMI" + else + fms = fms .. m .. "-BURST" + end + if i != #fm then + fms = fms .. " / " + end + end + draw.SimpleText( fms, "Benny_12", ss(2), ss(2), schema_c("bg") ) + return true + end + end + local createlist = {} for ClassName, Class in pairs( WEAPONS ) do diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua index 0c0e73f..c5c4350 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_hud.lua @@ -761,6 +761,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() local magbump = 0 for _, mag in ipairs( maginv ) do local mitem = inv[mag] + if !mitem then continue end local loaded = (item.Loaded == mag) local perc = mitem.Ammo/WeaponGet(mitem.Class).Ammo surface.SetDrawColor( scheme["bg"] ) diff --git a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua b/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua index 7ed0d95..cdfcd5c 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua @@ -158,7 +158,9 @@ hook.Add( "Move", "Benny_Move", function( ply, mv ) targetspeed = targetspeed * Lerp( w:GetAim(), 1, w:GetStat( false, "Speed_Aiming" ) ) local st = w:D_GetShotTime( false ) - targetspeed = targetspeed * Lerp( math.TimeFraction( st, st+w:GetStat( hand, "Speed_FiringTime" ), CurTime() )>1 and 1 or 0, w:GetStat( false, "Speed_Firing" ), 1 ) + targetspeed = targetspeed * (st+w:GetStat( hand, "Speed_FiringTime" ) > CurTime() and w:GetStat( false, "Speed_Firing" ) or 1) + + targetspeed = targetspeed * (w:D_GetReloading( false ) > 0 and w:GetStat( false, "Speed_Reloading" ) or 1) mv:SetMaxSpeed( targetspeed ) mv:SetMaxClientSpeed( targetspeed ) diff --git a/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua b/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua index 4863570..5b6c0d1 100644 --- a/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua +++ b/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua @@ -431,6 +431,11 @@ do -- Handguns SpreadDecay_End = 11, SpreadDecay_RampTime = 0.5, + Reload_MagOut = 0.1, + Reload_MagIn = 0.75, + Reload_MagIn_Bonus1 = 0.4, + Reload_MagIn_Bonus2 = 0.4+0.15, + Speed_Move = 1, Speed_Aiming = 0.98, Speed_Reloading = 1, @@ -469,6 +474,11 @@ do -- Handguns SpreadDecay_End = 11, SpreadDecay_RampTime = 0.5, + Reload_MagOut = 0.15, + Reload_MagIn = 0.85, + Reload_MagIn_Bonus1 = 0.5, + Reload_MagIn_Bonus2 = 0.5+0.12, + Speed_Move = 1, Speed_Aiming = 0.98, Speed_Reloading = 1, @@ -506,6 +516,11 @@ do -- Handguns SpreadDecay_End = 11, SpreadDecay_RampTime = 0.5, + Reload_MagOut = 0.25, + Reload_MagIn = 1.1, + Reload_MagIn_Bonus1 = 0.8, + Reload_MagIn_Bonus2 = 0.8+0.08, + Speed_Move = 1, Speed_Aiming = 0.95, Speed_Reloading = 0.95, @@ -543,10 +558,15 @@ do -- Handguns SpreadDecay_End = 11, SpreadDecay_RampTime = 0.5, + Reload_MagOut = 0.5, + Reload_MagIn = 0.5, + Reload_MagIn_Bonus1 = 0.2, + Reload_MagIn_Bonus2 = 0.2+0.1, + Speed_Move = 1, Speed_Aiming = 1, Speed_Reloading = 0.9, - Speed_Firing = 0.95, + Speed_Firing = 1, Features = "firearm", } @@ -580,8 +600,13 @@ do -- Handguns SpreadDecay_End = 22, SpreadDecay_RampTime = 0.65, - Speed_Move = 0.97, - Speed_Aiming = 0.9, + Reload_MagOut = 0.6, + Reload_MagIn = 0.6, + Reload_MagIn_Bonus1 = 0.18, + Reload_MagIn_Bonus2 = 0.18+0.08, + + Speed_Move = 1.0, + Speed_Aiming = 0.95, Speed_Reloading = 0.9, Speed_Firing = 0.95, @@ -877,8 +902,8 @@ do -- Shotguns SpreadDecay_End = 30, SpreadDecay_RampTime = 0.7, - Speed_Move = 0.85, - Speed_Aiming = 0.85, + Speed_Move = 0.93, + Speed_Aiming = 0.95, Speed_Reloading = 0.85, Speed_Firing = 0.75, @@ -912,10 +937,45 @@ do -- Shotguns SpreadDecay_End = 30, SpreadDecay_RampTime = 0.5, - Speed_Move = 0.9, - Speed_Aiming = 0.9, + Speed_Move = 0.95, + Speed_Aiming = 0.95, + Speed_Reloading = 0.9, + Speed_Firing = 0.9, + + Features = "firearm", + } + + WEAPONS["overunder"] = { + Name = "O/U", + Description = "Full-length double-barrelled bar fight finisher.", + Type = "shotgun", + + WModel = "models/weapons/w_shot_kozlice.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, + + Sound_Fire = "SPAS12.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "SPAS12.MagOut", + Sound_MagIn = "SPAS12.MagIn", + + Delay = (60/120), + Firemodes = FIREMODE_SEMI, + Ammo = 2, + Damage = 10, + Pellets = 8, + Spread = 130/60, + SpreadAdd = 130/60, + SpreadAddMax = 20, + + SpreadDecay_Start = 10, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 0.5, + + Speed_Move = 0.93, + Speed_Aiming = 0.95, Speed_Reloading = 0.85, - Speed_Firing = 0.75, + Speed_Firing = 0.85, Features = "firearm", } @@ -947,10 +1007,16 @@ do -- Shotguns SpreadDecay_End = 30, SpreadDecay_RampTime = 1, - Speed_Move = 0.82, - Speed_Aiming = 0.82, + Reload_MagOut = 0.5, + Reload_MagIn = 1.5, + Reload_MagIn_Bonus1 = 1.2, + Reload_MagIn_Bonus2 = 1.2+0.1, + + Speed_Move = 0.92, + Speed_Aiming = 0.92, Speed_Reloading = 0.5, Speed_Firing = 0.334, + Speed_FiringTime = 0.5, Features = "firearm", } @@ -987,10 +1053,15 @@ do -- Rifles SpreadDecay_End = 12, SpreadDecay_RampTime = 0.2, - Speed_Move = 0.9, - Speed_Aiming = 0.9, - Speed_Reloading = 0.9, - Speed_Firing = 0.9, + Reload_MagOut = 0.3, + Reload_MagIn = 1.3, + Reload_MagIn_Bonus1 = 0.8, + Reload_MagIn_Bonus2 = 0.8+0.1, + + Speed_Move = 0.95, + Speed_Aiming = 0.95, + Speed_Reloading = 0.95, + Speed_Firing = 0.95, Features = "firearm", } @@ -1023,10 +1094,15 @@ do -- Rifles SpreadDecay_End = 36, SpreadDecay_RampTime = 0.6, - Speed_Move = 0.9, - Speed_Aiming = 0.935, - Speed_Reloading = 0.935, - Speed_Firing = 0.935, + Reload_MagOut = 0.4, + Reload_MagIn = 1.5, + Reload_MagIn_Bonus1 = 0.8, + Reload_MagIn_Bonus2 = 0.8+0.1, + + Speed_Move = 0.975, + Speed_Aiming = 0.975, + Speed_Reloading = 0.975, + Speed_Firing = 0.975, Features = "firearm", } @@ -1062,10 +1138,15 @@ do -- Rifles SpreadDecay_End = 12, SpreadDecay_RampTime = 0.3, - Speed_Move = 0.9, - Speed_Aiming = 0.85, - Speed_Reloading = 0.9, - Speed_Firing = 0.85, + Reload_MagOut = 0.3, + Reload_MagIn = 1.3, + Reload_MagIn_Bonus1 = 0.6, + Reload_MagIn_Bonus2 = 0.6+0.1, + + Speed_Move = 0.95, + Speed_Aiming = 0.9, + Speed_Reloading = 0.95, + Speed_Firing = 0.9, Features = "firearm", } @@ -1194,11 +1275,14 @@ end do -- Grenades, nothing here is guaranteed. - local function GrenadeFire( self, data ) + local function GrenadeFire( self, data, class, hand ) local p = self:GetOwner() if self:GetGrenadeDown() then return true end + if self:D_GetHolstering( hand ) > 0 then + return true + end self:SetGrenadeDown( true ) self:SetGrenadeDownStart( CurTime() ) @@ -1253,7 +1337,7 @@ do -- Grenades, nothing here is guaranteed. -- end end - local function GrenadeThink( self, data ) + local function GrenadeThink( self, data, class, hand ) local p = self:GetOwner() local class = WeaponGet(data.Class) if self:GetGrenadeDown() then @@ -1439,7 +1523,8 @@ end -- Ammo generator -for class, data in pairs( WEAPONS ) do +for class, data in SortedPairs( WEAPONS ) do + print(class=="aa12") if data.Features == "firearm" then WEAPONS["mag_" .. class] = { Name = "MAG: " .. WEAPONS[class].Name, diff --git a/gamemodes/benny/gamemode/modules/weapons/sh_weapons_forlater.lua b/gamemodes/benny/gamemode/modules/weapons/sh_weapons_forlater.lua index 06d4135..edda274 100644 --- a/gamemodes/benny/gamemode/modules/weapons/sh_weapons_forlater.lua +++ b/gamemodes/benny/gamemode/modules/weapons/sh_weapons_forlater.lua @@ -53,30 +53,6 @@ Features = "firearm", } - WEAPONS["overunder"] = { - Name = "O/U", - Description = "meow", - Type = "shotgun", - - WModel = "models/weapons/w_shot_kozlice.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, - - Sound_Fire = "SPAS12.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "SPAS12.MagOut", - Sound_MagIn = "SPAS12.MagIn", - - Delay = (60/120), - Firemodes = FIREMODE_SEMI, - Ammo = 2, - Damage = 10, - Pellets = 8, - Spread = 130/60, - - Features = "firearm", - } - WEAPONS["cqb70"] = { Name = "CS-70", Description = "meow",