share/hedgewars/Data/Scripts/Animate.lua
changeset 13037 91f23558c936
parent 12783 cb29ec085767
child 13689 739fd039daaa
equal deleted inserted replaced
13036:bef97cc310b0 13037:91f23558c936
   423 end
   423 end
   424 
   424 
   425 -------------------------------------Misc---------------------------------
   425 -------------------------------------Misc---------------------------------
   426 
   426 
   427 function StoppedGear(gear)
   427 function StoppedGear(gear)
       
   428   -- GetHealth returns nil if gear does not exist
       
   429   if not GetHealth(gear) then
       
   430      -- We consider the gear to be “stopped” if it has been destroyed
       
   431      return true
       
   432   end
   428   dx,dy = GetGearVelocity(gear)
   433   dx,dy = GetGearVelocity(gear)
   429   return math.abs(dx) <= 1 and math.abs(dy) <= 1
   434   return math.abs(dx) <= 1 and math.abs(dy) <= 1
   430 end
   435 end