More vault changes and fixes
This commit is contained in:
parent
a8bd4a2b49
commit
f838453a15
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
Loading…
Reference in New Issue