Lots of improvements, min height check, fuckery
This commit is contained in:
parent
565d9ef170
commit
2fefc88b86
|
@ -15,7 +15,7 @@ local dC = Color( 0, 0, 255, 0 )
|
|||
|
||||
hook.Add( "PlayerTick", "Benny_PlayerTick", function( ply, mv )
|
||||
if ply:GetVaultTransition() == 0 then
|
||||
ply:SetVaultDebuff( math.Approach( ply:GetVaultDebuff(), 0, FrameTime()/0.4 ) )
|
||||
ply:SetVaultDebuff( math.Approach( ply:GetVaultDebuff(), 0, FrameTime()/0.25 ) )
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -30,20 +30,28 @@ local function Vault_GetAngle( ply, pos, ang, vel )
|
|||
return true
|
||||
end
|
||||
|
||||
local VAULTCHECKDIST = 16
|
||||
local VAULTMOVEDIST = 16
|
||||
local MAXVAULTHEIGHT = 66
|
||||
local MAXVAULTHEIGHT_V = Vector( 0, 0, MAXVAULTHEIGHT )
|
||||
local VAULTCHECKDIST = 8
|
||||
local VAULTMOVEDIST = 32
|
||||
|
||||
local MAXVAULTHEIGHT = 64
|
||||
|
||||
local MAXVAULTHEIGHT_FUCKERY = MAXVAULTHEIGHT+1
|
||||
local MAXVAULTHEIGHT_V = Vector( 0, 0, MAXVAULTHEIGHT_FUCKERY )
|
||||
|
||||
hook.Add( "Move", "Benny_Move", function( ply, mv )
|
||||
local ang = mv:GetMoveAngles()
|
||||
local pos = mv:GetOrigin()
|
||||
local vel = mv:GetVelocity()
|
||||
|
||||
local speed = mv:GetMaxSpeed() * (1-ply:GetVaultDebuff())
|
||||
mv:SetMaxSpeed( speed )
|
||||
mv:SetMaxClientSpeed( speed )
|
||||
|
||||
local forw, side = mv:GetForwardSpeed(), mv:GetSideSpeed()
|
||||
local ba, bb = ply:GetHull()
|
||||
if ply:Crouching() then ba, bb = ply:GetHullDuck() end
|
||||
|
||||
|
||||
local WishDir = Vector( forw, -side, 0 ):GetNormalized()
|
||||
WishDir:Rotate( Angle( 0, ang.y, 0 ) )
|
||||
|
||||
|
@ -77,7 +85,7 @@ hook.Add( "Move", "Benny_Move", function( ply, mv )
|
|||
filter = ply,
|
||||
} )
|
||||
if CLIENT then vaultsave = false end
|
||||
if T1.Hit then -- A challenger approaches
|
||||
if ply:GetVaultDebuff() == 0 and !ply:NoclippingAndNotVaulting() and T1.Hit then -- A challenger approaches
|
||||
|
||||
-- How tall is it, basically? We still need to do a ledge check
|
||||
local T2 = util.TraceHull( {
|
||||
|
@ -102,7 +110,7 @@ hook.Add( "Move", "Benny_Move", function( ply, mv )
|
|||
local VertClearance = T3.HitPos.z - T3.StartPos.z
|
||||
|
||||
-- If we try to go so high and it's TOO high then give up
|
||||
if VertClearance > ply:GetStepSize() and VertClearance != MAXVAULTHEIGHT then
|
||||
if VertClearance > ply:GetStepSize() and VertClearance <= MAXVAULTHEIGHT then
|
||||
-- Trace from clearance to final
|
||||
local T4 = util.TraceHull( {
|
||||
start = T3.HitPos,
|
||||
|
@ -118,11 +126,27 @@ hook.Add( "Move", "Benny_Move", function( ply, mv )
|
|||
if CLIENT then vaultsave = true end
|
||||
|
||||
if mv:KeyDown( IN_JUMP ) then
|
||||
mv:SetOrigin( T4.HitPos )
|
||||
ply:SetVaultPos1( ply:GetPos() )
|
||||
ply:SetVaultPos2( T4.HitPos )
|
||||
ply:SetVaultTransition( 1 )
|
||||
ply:SetVaultDebuff( 1 )
|
||||
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:SelectWeightedSequence( ACT_GMOD_GESTURE_BOW ), 0.75, true )
|
||||
--mv:SetOrigin( T4.HitPos )
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ply:GetVaultTransition() != 0 then
|
||||
ply:SetVaultTransition( math.Approach( ply:GetVaultTransition(), 0, FrameTime()/0.25 ) )
|
||||
local t, vp1, vp2 = ply:GetVaultTransition(), ply:GetVaultPos1(), ply:GetVaultPos2()
|
||||
local Meow = Vector( Lerp( (1-t), vp1.x, vp2.x ), Lerp( (1-t), vp1.y, vp2.y ), Lerp( math.ease.OutQuint(1-t), vp1.z, vp2.z ) )
|
||||
mv:SetOrigin( Meow )
|
||||
mv:SetVelocity( Vector( 0, 0, 0 ) )
|
||||
ply:SetVaultDebuff( 1 )
|
||||
ply:SetMoveType( (ply:GetVaultTransition() == 0) and MOVETYPE_WALK or MOVETYPE_NOCLIP )
|
||||
return true
|
||||
end
|
||||
--debugoverlay.Box( Target+(TargetNor*16), ba, bb, 0, CR )
|
||||
end)
|
Loading…
Reference in New Issue