Code |
function GM:CalcMainActivity( ply, velocity )
ply.CalcIdeal = ACT_MP_STAND_IDLE
ply.CalcSeqOverride = -1
if self:HandlePlayerDriving( ply ) ||
self:HandlePlayerJumping( ply, velocity ) ||
self:HandlePlayerDucking( ply, velocity ) ||
self:HandlePlayerSwimming( ply ) then
else
local len2d = velocity:Length2D()
if len2d > 210 then
ply.CalcIdeal = ACT_MP_RUN
elseif len2d > 0.5 then
ply.CalcIdeal = ACT_MP_WALK
end
end
// a bit of a hack because we're missing ACTs for a couple holdtypes
local weapon = ply:GetActiveWeapon()
if ply.CalcIdeal == ACT_MP_CROUCH_IDLE &&
IsValid(weapon) &&
( weapon:GetHoldType() == "knife" || weapon:GetHoldType() == "melee2" ) then
ply.CalcSeqOverride = ply:LookupSequence("cidle_" .. weapon:GetHoldType())
end
return ply.CalcIdeal, ply.CalcSeqOverride
end
|