From f838453a151070f4d0784153d3da00130b0207da Mon Sep 17 00:00:00 2001 From: Fesiug Date: Sun, 12 Nov 2023 19:20:08 -0500 Subject: [PATCH] More vault changes and fixes --- .../benny/gamemode/modules/player/cl_hud.lua | 20 ---------- .../gamemode/modules/player/sh_basic.lua | 2 +- .../modules/player/sh_movement_advanced.lua | 39 ++++++++++++++----- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua index 552657a..0a3b588 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_hud.lua @@ -223,8 +223,6 @@ local spacer_long = 2 -- screenscaled local gap = 24 local trash_vec, trash_ang = Vector(), Angle() -local vaultsave = false -local nextvaultrecheck = 0 bucket_selected = bucket_selected or 1 item_selected = item_selected or 1 @@ -273,24 +271,6 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() end do -- Vaulting - if nextvaultrecheck <= CurTime() then - local forback, leright = 0, 0 - forback = forback + (p:KeyDown( IN_FORWARD ) and 1 or 0) - forback = forback - (p:KeyDown( IN_BACK ) and 1 or 0) - leright = leright + (p:KeyDown( IN_MOVELEFT ) and 1 or 0) - leright = leright - (p:KeyDown( IN_MOVERIGHT ) and 1 or 0) - trash_vec.x = forback - trash_vec.y = leright - trash_vec.z = 0 - trash_ang.p = 0 - trash_ang.y = TPSOverride.y - trash_ang.z = 0 - trash_vec:Rotate( trash_ang ) - - vaultsave = VaultReady( p, p:GetPos(), p:EyeAngles(), trash_vec.x, trash_vec.y ) - nextvaultrecheck = CurTime() + (0.1) - end - if vaultsave then local tex = "[SPACE] VAULT OVER" diff --git a/gamemodes/benny/gamemode/modules/player/sh_basic.lua b/gamemodes/benny/gamemode/modules/player/sh_basic.lua index 7c0c98b..2f82aa9 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_basic.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_basic.lua @@ -13,7 +13,7 @@ function GM:PlayerSpawn( ply ) ply:SetSlowWalkSpeed( 100 ) ply:SetWalkSpeed( 160 ) ply:SetRunSpeed( 220 ) - ply:SetStepSize( 8 ) + ply:SetStepSize( 16 ) end if SERVER then diff --git a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua b/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua index 2229dd4..1a9e96c 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua @@ -2,7 +2,7 @@ local small = Vector( 1, 1, 1 ) local smale = -small -local moe = Vector( 0, 0, 8 ) +local moe = Vector( 0, 0, 1/16 ) local dmaxs = Vector( 16, 16, 48 ) local dmins = Vector( -16, -16, 0 ) @@ -19,15 +19,17 @@ end) function VaultReady( ply, pos, ang, forw, side ) local wantdir = Vector( forw, -side, 0 ):GetNormalized() wantdir:Rotate( Angle( 0, ang.y, 0 ) ) - local cum = pos + wantdir*8 + local cum = pos + wantdir*16 - local ts, te = cum + Vector( 0, 0, 24 ), cum + Vector( 0, 0, 65 ) + local ts, te = cum + Vector( 0, 0, 22 ), cum + Vector( 0, 0, 65 ) + local bottom, top = ply:GetHull() + if ply:Crouching() then bottom, top = ply:GetHullDuck() end local tr = util.TraceHull( { start = ts, endpos = te, - mins = dmins, - maxs = dmaxs, - filter = ply + mins = bottom, + maxs = top, + filter = ply, } ) return (ply:GetVaultDebuff() == 0 and tr.Hit and tr.StartSolid and !tr.AllSolid and tr.FractionLeftSolid>0) and tr, ts, te or false @@ -50,10 +52,27 @@ hook.Add( "Move", "Benny_Move", function( ply, mv ) mv:SetMaxClientSpeed( speed ) local vault, v2, v3 = VaultReady( ply, pos, ang, mv:GetForwardSpeed(), mv:GetSideSpeed() ) - if mv:KeyDown( IN_JUMP ) and vault then + if CLIENT then vaultsave = false end + if vault then local epic = LerpVector( vault.FractionLeftSolid, v2, v3 ) - mv:SetOrigin( epic + Vector(0, 0, 1/16) ) - mv:SetVelocity( Vector( 0, 0, -100 ) ) - ply:SetVaultDebuff( 1 ) + epic:Add( moe ) + + local bottom, top = ply:GetHull() + if ply:Crouching() then bottom, top = ply:GetHullDuck() end + local tr = util.TraceHull( { + start = epic, + endpos = epic, + mins = bottom, + maxs = top, + filter = ply, + } ) + if !tr.AllSolid then + if CLIENT then vaultsave = true end + if mv:KeyDown( IN_JUMP ) then + mv:SetOrigin( epic ) + mv:SetVelocity( Vector( 0, 0, -100 ) ) + ply:SetVaultDebuff( 1 ) + end + end end end) \ No newline at end of file