Lua library Animate: StoppedGear now returns true if gear does not exist
Fixes Lua error spam in ACF1 when Leaks a Lot drows
--- a/ChangeLog.txt Sat Feb 17 20:59:56 2018 +0100
+++ b/ChangeLog.txt Mon Feb 19 09:45:36 2018 +0100
@@ -53,6 +53,7 @@
A Classic Fairytale:
+ Mission 3: Display number of turns left at timed parcours
* Fix incorrect storytelling in mission descriptions
+ * Mission 1: Fix error message spam when Leaks a Lot drowns
Theme customization:
+ Add fallback music with fallback-music and fallback-sd-music
--- a/share/hedgewars/Data/Scripts/Animate.lua Sat Feb 17 20:59:56 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Animate.lua Mon Feb 19 09:45:36 2018 +0100
@@ -425,6 +425,11 @@
-------------------------------------Misc---------------------------------
function StoppedGear(gear)
+ -- GetHealth returns nil if gear does not exist
+ if not GetHealth(gear) then
+ -- We consider the gear to be “stopped” if it has been destroyed
+ return true
+ end
dx,dy = GetGearVelocity(gear)
return math.abs(dx) <= 1 and math.abs(dy) <= 1
end