Vaulting is smoothed
This commit is contained in:
parent
787d9aacbd
commit
8e5eef9f52
|
@ -276,7 +276,7 @@ end
|
|||
|
||||
hook.Add( "CalcView", "Benny_CalcView", function( ply, pos, ang, fov )
|
||||
if c_unlock:GetBool() then return end
|
||||
if ply:GetMoveType() == MOVETYPE_NOCLIP then return end
|
||||
if ply:NoclippingAndNotVaulting() then return end
|
||||
decide_active()
|
||||
local camera = BENNY_ACTIVECAMERA
|
||||
local view = {}
|
||||
|
|
|
@ -11,7 +11,7 @@ TPSOverride = TPSOverride or Angle()
|
|||
hook.Add( "PlayerNoClip", "Benny_PlayerNoClip", function( ply, desiredNoClipState )
|
||||
if CLIENT then
|
||||
if desiredNoClipState then
|
||||
LocalPlayer():SetEyeAngles( TPSOverride )
|
||||
ply:SetEyeAngles( TPSOverride )
|
||||
else
|
||||
TPSOverride:Set( LocalPlayer():EyeAngles() )
|
||||
lastmoveangle = LocalPlayer():EyeAngles().y
|
||||
|
@ -21,14 +21,14 @@ hook.Add( "PlayerNoClip", "Benny_PlayerNoClip", function( ply, desiredNoClipStat
|
|||
end)
|
||||
|
||||
hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang )
|
||||
if LocalPlayer():BennyCheck() and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then
|
||||
if LocalPlayer():BennyCheck() and !LocalPlayer():NoclippingAndNotVaulting() then
|
||||
TPSOverride:Add( Angle( y*0.022, -x*0.022, 0 ) )
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add( "CreateMove", "Benny_CreateMove", function( cmd )
|
||||
if false and BENNY_ACTIVECAMERA and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then
|
||||
if false and BENNY_ACTIVECAMERA and !LocalPlayer():NoclippingAndNotVaulting() then
|
||||
local x, y = cmd:GetForwardMove(), cmd:GetSideMove()
|
||||
|
||||
local lx=input.GetAnalogValue(ANALOG_JOY_X) // Left X Axis: left -, right +
|
||||
|
@ -76,7 +76,7 @@ hook.Add( "CreateMove", "Benny_CreateMove", function( cmd )
|
|||
|
||||
local p = LocalPlayer()
|
||||
local w = p:GetActiveWeapon()
|
||||
if p:BennyCheck() and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then -- FPS cam
|
||||
if p:BennyCheck() and !LocalPlayer():NoclippingAndNotVaulting() then -- FPS cam
|
||||
local aimed = w:GetUserAim()
|
||||
local opos, ang = p:CamSpot( TPSOverride )
|
||||
|
||||
|
|
|
@ -13,10 +13,13 @@ local dS = Color( 255, 0, 0, 0 )
|
|||
local dC = Color( 0, 0, 255, 0 )
|
||||
|
||||
hook.Add( "PlayerTick", "Benny_PlayerTick", function( ply, mv )
|
||||
ply:SetVaultDebuff( math.Clamp( ply:GetVaultDebuff() - FrameTime()/0.4 , 0, 1 ) )
|
||||
if ply:GetVaultTransition() == 0 then
|
||||
ply:SetVaultDebuff( math.Approach( ply:GetVaultDebuff(), 0, FrameTime()/0.4 ) )
|
||||
end
|
||||
end)
|
||||
|
||||
function VaultReady( ply, pos, ang, forw, side )
|
||||
if ply:NoclippingAndNotVaulting() then return false end
|
||||
local wantdir = Vector( forw, -side, 0 ):GetNormalized()
|
||||
wantdir:Rotate( Angle( 0, ang.y, 0 ) )
|
||||
local cum = pos + wantdir*16
|
||||
|
@ -69,10 +72,21 @@ hook.Add( "Move", "Benny_Move", function( ply, mv )
|
|||
if !tr.AllSolid then
|
||||
if CLIENT then vaultsave = true end
|
||||
if mv:KeyDown( IN_JUMP ) then
|
||||
mv:SetOrigin( epic )
|
||||
mv:SetVelocity( Vector( 0, 0, 0 ) )
|
||||
ply:SetVaultPos1( pos )
|
||||
ply:SetVaultPos2( epic )
|
||||
ply:SetVaultTransition( 1 )
|
||||
-- mv:SetOrigin( epic )
|
||||
-- mv:SetVelocity( Vector( 0, 0, 0 ) )
|
||||
ply:SetVaultDebuff( 1 )
|
||||
end
|
||||
end
|
||||
end
|
||||
if ply:GetVaultTransition() != 0 then
|
||||
ply:SetVaultTransition( math.Approach( ply:GetVaultTransition(), 0, FrameTime()/0.3 ) )
|
||||
mv:SetOrigin( LerpVector( math.ease.OutCirc( 1-ply:GetVaultTransition() ), ply:GetVaultPos1(), ply:GetVaultPos2() ) )
|
||||
mv:SetVelocity( Vector( 0, 0, 0 ) )
|
||||
ply:SetVaultDebuff( 1 )
|
||||
ply:SetMoveType( (ply:GetVaultTransition() == 0) and MOVETYPE_WALK or MOVETYPE_NOCLIP )
|
||||
return true
|
||||
end
|
||||
end)
|
|
@ -34,6 +34,10 @@ function PT:CamSpot( ang )
|
|||
return tr.HitPos, ang, 90
|
||||
end
|
||||
|
||||
function PT:NoclippingAndNotVaulting()
|
||||
return (self:GetMoveType() == MOVETYPE_NOCLIP and self:GetVaultTransition() == 0)
|
||||
end
|
||||
|
||||
function PT:INV_Get()
|
||||
if !self.INV then
|
||||
print( "Inventory created")
|
||||
|
|
|
@ -25,6 +25,10 @@ PLAYER.UseVMHands = true
|
|||
function PLAYER:SetupDataTables()
|
||||
self.Player:NetworkVar( "Bool", 0, "Shoulder" )
|
||||
self.Player:NetworkVar( "Float", 0, "VaultDebuff" )
|
||||
|
||||
self.Player:NetworkVar( "Float", 1, "VaultTransition" )
|
||||
self.Player:NetworkVar( "Vector", 0, "VaultPos1")
|
||||
self.Player:NetworkVar( "Vector", 1, "VaultPos2")
|
||||
end
|
||||
|
||||
player_manager.RegisterClass( "player_benny", PLAYER, "player_default" )
|
||||
|
|
Loading…
Reference in New Issue