Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. function HookedCalcMainActivity(pl, vel)
  2. if pl:Team() == TEAM_UNDEAD then
  3. local cls = pl:GetDTInt(1) or 1
  4. local ctbl = GAMEMODE.ZombieClasses[cls]
  5.  
  6. local seq,over = SpecialAnims[cls](pl, vel)
  7. if seq==nil then seq=ACT_IDLE end
  8. if over==nil then over=ACT_IDLE end
  9.  
  10. if (string.lower(pl:GetModel())==string.lower(ctbl.Model)) and (pl:Alive()) and (pl:Health()>0) then
  11.  
  12. if pl:GetDTBool(0) then -- DT 0 = special animation
  13. seq = pl:GetDTInt(0)
  14. end
  15.  
  16. return seq,over
  17. end
  18. end
  19. end
  20. hook.Add( "CalcMainActivity" , "CCGM CalcMainActivity" , HookedCalcMainActivity )
  21.  
  22. function HookedUpdateAnimation( pl, vel, maxspeed ) -- Should control zombie turning
  23. if pl:Team()==TEAM_UNDEAD then
  24. local cls = pl:GetDTInt(1) or 1
  25. local ctbl = GAMEMODE.ZombieClasses[cls]
  26.  
  27. local ang, eyaw, myaw
  28.  
  29. ang = pl:EyeAngles( )
  30.  
  31. pl:SetLocalAngles( ang )
  32.  
  33. if CLIENT then
  34. pl:SetRenderAngles( ang )
  35. end
  36.  
  37. eyaw = math.Clamp( math.deg( math.atan2( vel.y, vel.x ) ), -180, 180 )
  38. myaw = math.NormalizeAngle( math.NormalizeAngle( ang.y ) - eyaw )
  39.  
  40. pl:SetPoseParameter( "move_yaw", myaw )
  41.  
  42. if vel:Length()>0 then -- moving
  43. pl:SetPlaybackRate( ctbl.WalkPlayback )
  44. elseif pl:GetDTBool(0) then -- special
  45. pl:SetPlaybackRate( pl:GetDTFloat(0) )
  46. else -- idle
  47. pl:SetPlaybackRate( 1 )
  48. end
  49.  
  50. return true
  51. end
  52. end
  53. hook.Add( "UpdateAnimation" , "CCGM UpdateAnimation" , HookedUpdateAnimation )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement