ACF2: Fix Lua error when hog dies during cyborg choice phase
authorWuzzy <Wuzzy2@mail.ru>
Tue, 21 May 2019 14:38:10 +0200
changeset 15020 fa597f6e301d
parent 15019 51fbc0034c6f
child 15021 62e3853fa2ed
ACF2: Fix Lua error when hog dies during cyborg choice phase
ChangeLog.txt
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua
--- a/ChangeLog.txt	Tue May 21 12:58:28 2019 +0200
+++ b/ChangeLog.txt	Tue May 21 14:38:10 2019 +0200
@@ -51,6 +51,7 @@
  + Backstab: Disable utilities before traitor has been dealt with
  * Backstab: Prevent attacking the cannibals before making the choice
  * First blood: Fix Lua error when hitting Attack after failing the rope challenge
+ * The Shadow Falls: Fix Lua error when hog dies during choice phase
  * General: Clear hazards around cyborg when it appears in cut scenes
  * General: Disable Sudden Death for all missions
  * Various minor tweaks and bugfixes
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua	Tue May 21 12:58:28 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua	Tue May 21 14:38:10 2019 +0200
@@ -790,7 +790,7 @@
 end
 
 function CheckRefuse()
-  return GetX(dense) > 1400 and StoppedGear(dense)
+  return GetHealth(dense) and GetX(dense) > 1400 and StoppedGear(dense)
 end
 
 function DoRefuse()
@@ -801,6 +801,9 @@
 end
 
 function CheckAccept()
+  if not GetHealth(dense) then
+    return false
+  end
   if GetX(dense) < 1300 then
     -- When close to cyborg, wait for a short time before accepting,
     -- to allow player to attack with melee weapons.
@@ -822,7 +825,7 @@
 end
 
 function CheckConfront()
-  return cyborgAttacked and StoppedGear(dense)
+  return cyborgAttacked and GetHealth(dense) and StoppedGear(dense)
 end
 
 function DoConfront()