Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove networking of velocity for animations, this is done by GMod now #324

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions gamemode/sh_animations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,7 @@ local CurTime = CurTime
local Vector = Vector
local math = math
local IsValid = IsValid
local engine = engine
--local DbgPrint = GetLogging("Animation")
local engineTick = engine.TickInterval()

local function GetPlayerVelocity(ply, velocity)
if CLIENT and ply ~= LocalPlayer() then
velocity = ply:GetNWVector("LambdaVelocity", velocity)
ply.InterpolatedVelocity = ply.InterpolatedVelocity or Vector(0, 0, 0)

if velocity:Distance(ply.InterpolatedVelocity) > 10 then
ply.InterpolatedVelocity = velocity
else
ply.InterpolatedVelocity = LerpVector(engineTick * 2.0, ply.InterpolatedVelocity, velocity)
end

return ply.InterpolatedVelocity
end

return velocity
end

function GM:HandlePlayerJumping(ply, velocity)
if (ply:GetMoveType() == MOVETYPE_NOCLIP) then
Expand Down Expand Up @@ -203,7 +184,6 @@ Name: gamemode:UpdateAnimation()
Desc: Animation updates (pose params etc) should be done here
-----------------------------------------------------------]]
function GM:UpdateAnimation(ply, velocity, maxseqgroundspeed)
velocity = GetPlayerVelocity(ply, velocity)
local len = velocity:Length()
local movement = len / maxseqgroundspeed
local rate = math.min(movement, 2)
Expand Down Expand Up @@ -285,7 +265,6 @@ end
function GM:CalcMainActivity(ply, velocity)
ply.CalcIdeal = ACT_MP_STAND_IDLE
ply.CalcSeqOverride = -1
velocity = GetPlayerVelocity(ply, velocity)
self:HandlePlayerLanding(ply, velocity, ply.m_bWasOnGround)
local isHandled = self:HandlePlayerNoClipping(ply, velocity) or self:HandlePlayerDriving(ply) or self:HandlePlayerVaulting(ply, velocity) or self:HandlePlayerJumping(ply, velocity) or self:HandlePlayerSwimming(ply, velocity) or self:HandlePlayerDucking(ply, velocity)

Expand Down
1 change: 0 additions & 1 deletion gamemode/sh_lambda_player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,6 @@ function GM:PlayerTick(ply, mv)
self:LimitPlayerAmmo(ply)
self:PlayerCheckDrowning(ply)
if ply:GetNWBool("LambdaHEVSuit", false) ~= ply:IsSuitEquipped() then ply:SetNWBool("LambdaHEVSuit", ply:IsSuitEquipped()) end
ply:SetNWVector("LambdaVelocity", ply:GetVelocity())
end
end

Expand Down