Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function HookedCalcMainActivity(pl, vel)
- if pl:Team() == TEAM_UNDEAD then
- local cls = pl:GetDTInt(1) or 1
- local ctbl = GAMEMODE.ZombieClasses[cls]
- local seq,over = SpecialAnims[cls](pl, vel)
- if seq==nil then seq=ACT_IDLE end
- if over==nil then over=ACT_IDLE end
- if (string.lower(pl:GetModel())==string.lower(ctbl.Model)) and (pl:Alive()) and (pl:Health()>0) then
- if pl:GetDTBool(0) then -- DT 0 = special animation
- seq = pl:GetDTInt(0)
- end
- return seq,over
- end
- end
- end
- hook.Add( "CalcMainActivity" , "CCGM CalcMainActivity" , HookedCalcMainActivity )
- function HookedUpdateAnimation( pl, vel, maxspeed ) -- Should control zombie turning
- if pl:Team()==TEAM_UNDEAD then
- local cls = pl:GetDTInt(1) or 1
- local ctbl = GAMEMODE.ZombieClasses[cls]
- local ang, eyaw, myaw
- ang = pl:EyeAngles( )
- pl:SetLocalAngles( ang )
- if CLIENT then
- pl:SetRenderAngles( ang )
- end
- eyaw = math.Clamp( math.deg( math.atan2( vel.y, vel.x ) ), -180, 180 )
- myaw = math.NormalizeAngle( math.NormalizeAngle( ang.y ) - eyaw )
- pl:SetPoseParameter( "move_yaw", myaw )
- if vel:Length()>0 then -- moving
- pl:SetPlaybackRate( ctbl.WalkPlayback )
- elseif pl:GetDTBool(0) then -- special
- pl:SetPlaybackRate( pl:GetDTFloat(0) )
- else -- idle
- pl:SetPlaybackRate( 1 )
- end
- return true
- end
- end
- hook.Add( "UpdateAnimation" , "CCGM UpdateAnimation" , HookedUpdateAnimation )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement