Implement more movement penalties

This commit is contained in:
Fesiug 2023-12-17 23:10:20 -05:00
parent 76e8f3b37b
commit ae952b9a44
6 changed files with 183 additions and 73 deletions

View File

@ -280,7 +280,7 @@ function SWEP:Think()
local hand = i==2 local hand = i==2
if self:BClass( hand ) then if self:BClass( hand ) then
if self:BClass( hand ).Custom_Think 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 end
end end

View File

@ -98,24 +98,24 @@ local mewer = {
end, end,
-- "How managable the weapon's recoil and spread is under sustained fire.\nAffected by RPM and various Recoil stats." -- "How managable the weapon's recoil and spread is under sustained fire.\nAffected by RPM and various Recoil stats."
}, },
{ -- {
Name = "Handling", -- Name = "Handling",
Size = 12, -- Size = 12,
Font = "Benny_10", -- Font = "Benny_10",
Stat = function( class ) -- Stat = function( class )
return 0 -- return 0
end, -- end,
-- "How quickly this weapon readies from sprinting, aiming and deploying.\nAffected by Aim Down Sights Time, Sprint To Fire Time, and Deploy Time." -- -- "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", -- Name = "Maneuvering",
Size = 12, -- Size = 12,
Font = "Benny_10", -- Font = "Benny_10",
Stat = function( class ) -- Stat = function( class )
return 0 -- return 0
end, -- end,
-- "How accurate the weapon is while not aiming.\nAffected by Hipfire Spread, Mid-air Spread, Sway, and Free Aim Angle." -- -- "How accurate the weapon is while not aiming.\nAffected by Hipfire Spread, Mid-air Spread, Sway, and Free Aim Angle."
}, --},
{ {
Name = "Mobility", Name = "Mobility",
Size = 12, Size = 12,
@ -127,16 +127,16 @@ local mewer = {
local score_moving, score_aiming, score_reloading, score_firing = 1, 1, 1, 1 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_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_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_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 score_firing = score_firing * weight_firing
return score_moving + score_aiming + score_reloading + score_firing return score_moving + score_aiming + score_reloading + score_firing
@ -328,6 +328,52 @@ function OpenSMenu()
end end
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 = {} local createlist = {}
for ClassName, Class in pairs( WEAPONS ) do for ClassName, Class in pairs( WEAPONS ) do

View File

@ -761,6 +761,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
local magbump = 0 local magbump = 0
for _, mag in ipairs( maginv ) do for _, mag in ipairs( maginv ) do
local mitem = inv[mag] local mitem = inv[mag]
if !mitem then continue end
local loaded = (item.Loaded == mag) local loaded = (item.Loaded == mag)
local perc = mitem.Ammo/WeaponGet(mitem.Class).Ammo local perc = mitem.Ammo/WeaponGet(mitem.Class).Ammo
surface.SetDrawColor( scheme["bg"] ) surface.SetDrawColor( scheme["bg"] )

View File

@ -158,7 +158,9 @@ hook.Add( "Move", "Benny_Move", function( ply, mv )
targetspeed = targetspeed * Lerp( w:GetAim(), 1, w:GetStat( false, "Speed_Aiming" ) ) targetspeed = targetspeed * Lerp( w:GetAim(), 1, w:GetStat( false, "Speed_Aiming" ) )
local st = w:D_GetShotTime( false ) 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:SetMaxSpeed( targetspeed )
mv:SetMaxClientSpeed( targetspeed ) mv:SetMaxClientSpeed( targetspeed )

View File

@ -431,6 +431,11 @@ do -- Handguns
SpreadDecay_End = 11, SpreadDecay_End = 11,
SpreadDecay_RampTime = 0.5, 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_Move = 1,
Speed_Aiming = 0.98, Speed_Aiming = 0.98,
Speed_Reloading = 1, Speed_Reloading = 1,
@ -469,6 +474,11 @@ do -- Handguns
SpreadDecay_End = 11, SpreadDecay_End = 11,
SpreadDecay_RampTime = 0.5, 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_Move = 1,
Speed_Aiming = 0.98, Speed_Aiming = 0.98,
Speed_Reloading = 1, Speed_Reloading = 1,
@ -506,6 +516,11 @@ do -- Handguns
SpreadDecay_End = 11, SpreadDecay_End = 11,
SpreadDecay_RampTime = 0.5, 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_Move = 1,
Speed_Aiming = 0.95, Speed_Aiming = 0.95,
Speed_Reloading = 0.95, Speed_Reloading = 0.95,
@ -543,10 +558,15 @@ do -- Handguns
SpreadDecay_End = 11, SpreadDecay_End = 11,
SpreadDecay_RampTime = 0.5, 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_Move = 1,
Speed_Aiming = 1, Speed_Aiming = 1,
Speed_Reloading = 0.9, Speed_Reloading = 0.9,
Speed_Firing = 0.95, Speed_Firing = 1,
Features = "firearm", Features = "firearm",
} }
@ -580,8 +600,13 @@ do -- Handguns
SpreadDecay_End = 22, SpreadDecay_End = 22,
SpreadDecay_RampTime = 0.65, SpreadDecay_RampTime = 0.65,
Speed_Move = 0.97, Reload_MagOut = 0.6,
Speed_Aiming = 0.9, 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_Reloading = 0.9,
Speed_Firing = 0.95, Speed_Firing = 0.95,
@ -877,8 +902,8 @@ do -- Shotguns
SpreadDecay_End = 30, SpreadDecay_End = 30,
SpreadDecay_RampTime = 0.7, SpreadDecay_RampTime = 0.7,
Speed_Move = 0.85, Speed_Move = 0.93,
Speed_Aiming = 0.85, Speed_Aiming = 0.95,
Speed_Reloading = 0.85, Speed_Reloading = 0.85,
Speed_Firing = 0.75, Speed_Firing = 0.75,
@ -912,10 +937,45 @@ do -- Shotguns
SpreadDecay_End = 30, SpreadDecay_End = 30,
SpreadDecay_RampTime = 0.5, SpreadDecay_RampTime = 0.5,
Speed_Move = 0.9, Speed_Move = 0.95,
Speed_Aiming = 0.9, 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_Reloading = 0.85,
Speed_Firing = 0.75, Speed_Firing = 0.85,
Features = "firearm", Features = "firearm",
} }
@ -947,10 +1007,16 @@ do -- Shotguns
SpreadDecay_End = 30, SpreadDecay_End = 30,
SpreadDecay_RampTime = 1, SpreadDecay_RampTime = 1,
Speed_Move = 0.82, Reload_MagOut = 0.5,
Speed_Aiming = 0.82, 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_Reloading = 0.5,
Speed_Firing = 0.334, Speed_Firing = 0.334,
Speed_FiringTime = 0.5,
Features = "firearm", Features = "firearm",
} }
@ -987,10 +1053,15 @@ do -- Rifles
SpreadDecay_End = 12, SpreadDecay_End = 12,
SpreadDecay_RampTime = 0.2, SpreadDecay_RampTime = 0.2,
Speed_Move = 0.9, Reload_MagOut = 0.3,
Speed_Aiming = 0.9, Reload_MagIn = 1.3,
Speed_Reloading = 0.9, Reload_MagIn_Bonus1 = 0.8,
Speed_Firing = 0.9, 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", Features = "firearm",
} }
@ -1023,10 +1094,15 @@ do -- Rifles
SpreadDecay_End = 36, SpreadDecay_End = 36,
SpreadDecay_RampTime = 0.6, SpreadDecay_RampTime = 0.6,
Speed_Move = 0.9, Reload_MagOut = 0.4,
Speed_Aiming = 0.935, Reload_MagIn = 1.5,
Speed_Reloading = 0.935, Reload_MagIn_Bonus1 = 0.8,
Speed_Firing = 0.935, 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", Features = "firearm",
} }
@ -1062,10 +1138,15 @@ do -- Rifles
SpreadDecay_End = 12, SpreadDecay_End = 12,
SpreadDecay_RampTime = 0.3, SpreadDecay_RampTime = 0.3,
Speed_Move = 0.9, Reload_MagOut = 0.3,
Speed_Aiming = 0.85, Reload_MagIn = 1.3,
Speed_Reloading = 0.9, Reload_MagIn_Bonus1 = 0.6,
Speed_Firing = 0.85, 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", Features = "firearm",
} }
@ -1194,11 +1275,14 @@ end
do -- Grenades, nothing here is guaranteed. do -- Grenades, nothing here is guaranteed.
local function GrenadeFire( self, data ) local function GrenadeFire( self, data, class, hand )
local p = self:GetOwner() local p = self:GetOwner()
if self:GetGrenadeDown() then if self:GetGrenadeDown() then
return true return true
end end
if self:D_GetHolstering( hand ) > 0 then
return true
end
self:SetGrenadeDown( true ) self:SetGrenadeDown( true )
self:SetGrenadeDownStart( CurTime() ) self:SetGrenadeDownStart( CurTime() )
@ -1253,7 +1337,7 @@ do -- Grenades, nothing here is guaranteed.
-- end -- end
end end
local function GrenadeThink( self, data ) local function GrenadeThink( self, data, class, hand )
local p = self:GetOwner() local p = self:GetOwner()
local class = WeaponGet(data.Class) local class = WeaponGet(data.Class)
if self:GetGrenadeDown() then if self:GetGrenadeDown() then
@ -1439,7 +1523,8 @@ end
-- Ammo generator -- Ammo generator
for class, data in pairs( WEAPONS ) do for class, data in SortedPairs( WEAPONS ) do
print(class=="aa12")
if data.Features == "firearm" then if data.Features == "firearm" then
WEAPONS["mag_" .. class] = { WEAPONS["mag_" .. class] = {
Name = "MAG: " .. WEAPONS[class].Name, Name = "MAG: " .. WEAPONS[class].Name,

View File

@ -53,30 +53,6 @@
Features = "firearm", 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"] = { WEAPONS["cqb70"] = {
Name = "CS-70", Name = "CS-70",
Description = "meow", Description = "meow",