ACF6: Fix error message spam when falling into water when took last rope crate w/o touching ground
authorWuzzy <almikes@aol.com>
Wed, 27 Sep 2017 03:54:35 +0200
changeset 12553 933aee9786c3
parent 12552 9337c55f34ef
child 12554 d8af6f9b51c6
ACF6: Fix error message spam when falling into water when took last rope crate w/o touching ground
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua	Wed Sep 27 02:57:44 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/dragon.lua	Wed Sep 27 03:54:35 2017 +0200
@@ -414,6 +414,14 @@
   AddFunction({func = AfterKillAnim, args = {}})
 end
 
+function CheckPutCrates(gear)
+  if gear and GetHealth(gear) then
+    return StoppedGear(gear)
+  else
+    return false
+  end
+end
+
 function PutCrates(index)
   if index <= 7 then
     cratesNum = cratesNum + 1
@@ -421,7 +429,7 @@
     AddNewEvent(CheckGearDead, {crates[cratesNum]}, PutCrates, {index + 1}, 0)
     FollowGear(native)
   else
-    AddEvent(StoppedGear, {native}, DoCratesTaken, {}, 0)
+    AddEvent(CheckPutCrates, {native}, DoCratesTaken, {}, 0)
   end
   if index == 4 then
     AnimSay(native, loc("I'm a ninja."), SAY_THINK, 0)