diff --git a/gamemodes/benny/entities/weapons/benny/sh_inv.lua b/gamemodes/benny/entities/weapons/benny/sh_inv.lua index 86a706f..419756c 100644 --- a/gamemodes/benny/entities/weapons/benny/sh_inv.lua +++ b/gamemodes/benny/entities/weapons/benny/sh_inv.lua @@ -133,10 +133,32 @@ local fallbackstat = { ["Reload_MagIn_Bonus1"] = 0.56, ["Reload_MagIn_Bonus2"] = 0.56+0.1, ["Sound_Cock"] = "Glock.Cock", + ["Damage"] = 0, + ["Pellets"] = 1, + ["Firemodes"] = { { Mode = 1 } }, + ["Delay"] = 0, + ["Ammo"] = 0, + ["Spread"] = 0, + ["SpreadAdd"] = 0, + ["SpreadDecay_Start"] = 0, + ["SpreadDecay_End"] = 0, + ["SpreadDecay_RampTime"] = 0, + ["Speed_Move"] = 1, + ["Speed_Aiming"] = 1, + ["Speed_Reloading"] = 1, + ["Speed_Firing"] = 1, } function SWEP:GetStat( hand, stat ) - return (self:BClass( hand )[stat] or fallbackstat[stat]) + local thereturn = (self:BClass( hand )[stat] or fallbackstat[stat]) + assert( thereturn, "No stat for " .. stat ) + return thereturn +end + +function BENNY_GetStat( class, stat ) + local thereturn = (class[stat] or fallbackstat[stat]) + assert( thereturn, "No stat for " .. stat ) + return thereturn end function SWEP:C_DualCheck() diff --git a/gamemodes/benny/entities/weapons/benny/shared.lua b/gamemodes/benny/entities/weapons/benny/shared.lua index 008d993..8a1fc25 100644 --- a/gamemodes/benny/entities/weapons/benny/shared.lua +++ b/gamemodes/benny/entities/weapons/benny/shared.lua @@ -233,20 +233,20 @@ function SWEP:Think() self:SetAim( math.Approach( self:GetAim(), self:GetUserAim() and 1 or 0, FrameTime()/0.2 ) ) - if !self:C_AttackDown( false ) then - self:SetWep1_Burst( 0 ) - end - if !self:C_AttackDown( true ) then - self:SetWep2_Burst( 0 ) + for i=1, 2 do + local hand = i==2 + if !self:C_AttackDown( hand ) then + self:D_SetBurst( hand, 0 ) + end end for i=1, 2 do local hand = i==2 local wep, wepc = self:BTable( hand ), self:BClass( hand ) if wepc and wepc.Features == "firearm" and self:D_GetDelay( hand ) < CurTime()-0.01 then - local mweh = math.Remap( CurTime(), self:D_GetShotTime( hand ), self:D_GetShotTime( hand )+wepc.SpreadDecay_RampTime, 0, 1 ) + local mweh = math.Remap( CurTime(), self:D_GetShotTime( hand ), self:D_GetShotTime( hand ) + self:GetStat( hand, "SpreadDecay_RampTime" ), 0, 1 ) mweh = math.Clamp( mweh, 0, 1 ) - local decayfinal = Lerp( math.ease.InExpo( mweh ), wepc.SpreadDecay_Start, wepc.SpreadDecay_End ) + local decayfinal = Lerp( math.ease.InExpo( mweh ), self:GetStat( hand, "SpreadDecay_Start" ), self:GetStat( hand, "SpreadDecay_End" ) ) self:D_SetSpread( hand, math.Approach( self:D_GetSpread( hand ), 0, decayfinal * FrameTime() ) ) end end diff --git a/gamemodes/benny/gamemode/modules/commons/sh_convars.lua b/gamemodes/benny/gamemode/modules/commons/sh_convars.lua index 7a70dfe..ea7f052 100644 --- a/gamemodes/benny/gamemode/modules/commons/sh_convars.lua +++ b/gamemodes/benny/gamemode/modules/commons/sh_convars.lua @@ -58,6 +58,9 @@ CONVARS_CL["wep_ao_junk"] = { 0, 0, 1, true, true, "Whether offhand junk CONVARS_CL["wep_toolgun"] = { "", nil, nil, true, true, "Toolgun tool." } +CONVARS_CL["cam_override"] = { "", nil, nil, false, true, "Override camera" } +CONVARS_CL["cam_unlock"] = { 0, 0, 1, false, false, "Unlock camera" } + CONVARS_CL_GEN = {} for i, v in pairs( CONVARS_CL ) do CONVARS_CL_GEN[i] = CreateConVar( "benny_" .. i, v[1], (v[4] and FCVAR_USERINFO or 0) + (v[5] and FCVAR_ARCHIVE or 0), v[6], v[2], v[3] ) diff --git a/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua b/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua index 3ce7954..a0183d5 100644 --- a/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua +++ b/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua @@ -41,7 +41,7 @@ local mewer = { Size = 12, Font = "Benny_10", Stat = function( class ) - local bwep = math.Clamp( math.Remap( class.Damage * (class.Pellets or 1), 14, 80, 0, 1 ), 0, 1 ) + local bwep = math.Clamp( math.Remap( BENNY_GetStat( class, "Damage" ) * ( BENNY_GetStat( class, "Pellets" ) or 1 ), 14, 80, 0, 1 ), 0, 1 ) local meowzor = math.ease.OutQuart( bwep ) return meowzor end, @@ -57,14 +57,14 @@ local mewer = { weight_1, weight_2 = weight_1/totalscore, weight_2/totalscore local score_1, score_2 = 1, 1 - local truedelay = (1/class.Delay) - if class.Firemodes[1].Mode == 1 then + local truedelay = ( 1 / BENNY_GetStat( class, "Delay" ) ) + if BENNY_GetStat( class, "Firemodes" )[1].Mode == 1 then truedelay = math.min( truedelay, 60/300 ) end - score_1 = rmt1c( class.Damage * truedelay, 100, 350 ) + score_1 = rmt1c( BENNY_GetStat( class, "Damage" ) * truedelay, 100, 350 ) score_1 = score_1 * weight_1 - score_2 = rmt1c( class.Ammo, 16, 42 ) + score_2 = rmt1c( BENNY_GetStat( class, "Ammo" ), 16, 42 ) score_2 = score_2 * weight_2 return score_1 + score_2 @@ -85,7 +85,7 @@ local mewer = { Size = 12, Font = "Benny_10", Stat = function( class ) - return math.Clamp( math.Remap( class.Spread, 1/60, 2, 1, 0 ), 0, 1 ) + return math.Clamp( math.Remap( BENNY_GetStat( class, "Spread" ), 1/60, 2, 1, 0 ), 0, 1 ) end, -- "How accurate the weapon is when firing single shots or short bursts.\nAffected by Spread and various Recoil stats." }, @@ -94,28 +94,28 @@ local mewer = { Size = 12, Font = "Benny_10", Stat = function( class ) - return math.Clamp( math.Remap( class.SpreadAdd * (1/class.Delay), 1, 13, 1, 0 ), 0, 1 ) + return math.Clamp( math.Remap( BENNY_GetStat( class, "SpreadAdd" ) * ( 1 / BENNY_GetStat( class, "Delay" ) ), 1, 13, 1, 0 ), 0, 1 ) 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( class.Speed_Move or 1, 0.75, 0.95 ) + score_moving = rmt1c( BENNY_GetStat( class, "Speed_Move" ), 0.75, 0.95 ) score_moving = score_moving * weight_moving - score_aiming = rmt1c( class.Speed_Aiming or 1, 0.75, 0.95 ) + score_aiming = rmt1c( BENNY_GetStat( class, "Speed_Aiming" ), 0.75, 0.95 ) score_aiming = score_aiming * weight_aiming - score_reloading = rmt1c( class.Speed_Reloading or 1, 0.75, 0.9 ) + score_reloading = rmt1c( BENNY_GetStat( class, "Speed_Reloading" ), 0.75, 0.9 ) score_reloading = score_reloading * weight_reloading - score_firing = rmt1c( class.Speed_Firing or 1, 0.75, 0.9 ) + score_firing = rmt1c( BENNY_GetStat( class, "Speed_Firing" ), 0.75, 0.9 ) score_firing = score_firing * weight_firing return score_moving + score_aiming + score_reloading + score_firing diff --git a/gamemodes/benny/gamemode/modules/player/cl_camera.lua b/gamemodes/benny/gamemode/modules/player/cl_camera.lua index 23fa13f..c4d224a 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_camera.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_camera.lua @@ -174,9 +174,6 @@ tempmapcameras["benny_test"]["barber"] = { BENNY_ACTIVECAMERA = nil -local c_over = CreateConVar( "benny_cam_override", "" ) -local c_unlock = CreateConVar( "benny_cam_unlock", 0 ) - local si = 4 local ctrace = { start = nil, @@ -275,7 +272,7 @@ function bennyfp( origin, angles, fov ) end hook.Add( "CalcView", "Benny_CalcView", function( ply, pos, ang, fov ) - if c_unlock:GetBool() then return end + if ConVarCL_Bool("cam_unlock") then return end if ply:NoclippingAndNotVaulting() then return end decide_active() local camera = BENNY_ACTIVECAMERA @@ -305,7 +302,7 @@ hook.Add( "CalcView", "Benny_CalcView", function( ply, pos, ang, fov ) end end - local st = c_over:GetString() + local st = ConVarCL_String("cam_override") if st != "" then local st = string.Explode( " ", st ) view.origin.x = tonumber(st[1]) diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua index 650430d..ce2732d 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_hud.lua @@ -332,6 +332,14 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() surface.DrawRect( b_x + b_s + ((i-1)*ss(32+2)) + ss(1), b_y + b_bh + ss(4+2) + ss(1), ss(32*localperc) - ss(2), b_bh2 - ss(2) ) end end + + if true then + surface.SetDrawColor( schema("bg") ) + local s_h = ss(20) + surface.DrawRect( b_x, b_y - s_h - ss(4), b_w, s_h ) + + draw.SimpleText( string.format( "%f m/s", p:GetVelocity():Length2D()/39.3701 ), "Benny_24", b_x + b_w/2, b_y - s_h/2 - ss(4/2), schema_c("fg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) + end end do -- Vaulting @@ -570,7 +578,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() local touse1 = col_1 local touse1_primary = col_1a local touse2 = col_2 - if false then + if ConVarCL_String("cam_override") != "" then pl_x = tr1f:ToScreen().x pl_y = tr1f:ToScreen().y ps_x = tr1f:ToScreen().x