Skip to content

Commit

Permalink
Merge pull request #324 from GMLambda/animation-hack
Browse files Browse the repository at this point in the history
Remove networking of velocity for animations, this is done by GMod now
  • Loading branch information
ZehMatt authored Oct 31, 2024
2 parents 0cbc4f1 + 2d54bb7 commit 1e8066e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
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

0 comments on commit 1e8066e

Please sign in to comment.