Fix ACF2 mission sometimes being unwinnable after returning to Leaks A Lot
authorWuzzy <almikes@aol.com>
Wed, 27 Sep 2017 06:17:41 +0200
changeset 12553 a401aec4df64
parent 12552 ed59dd8ff29d
child 12554 194b00c4ba07
Fix ACF2 mission sometimes being unwinnable after returning to Leaks A Lot After accepting cyborgs offer, combat should normally start after walking past the tree. This sometimes didn't work, the mission did not advance and you could never win, even after defeating the Stronglings.
ChangeLog.txt
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua
--- a/ChangeLog.txt	Wed Sep 27 06:04:02 2017 +0200
+++ b/ChangeLog.txt	Wed Sep 27 06:17:41 2017 +0200
@@ -182,6 +182,7 @@
  * Mission 1: Leaf of faith: Hog was able to walk to the right and get stuck
  * Mission 1: Leap of faith: Teleport player back to mole when failing
  * Mission 2: Fix crash when trying to open ammo menu in opening sequence
+ * Mission 2: Fix game sometimes getting stuck after walking back to Leaks A Lot
  * Mission 2: Remove restart option when cooperating with cyborg; it messed things up too much
  * Mission 3: Fix various Lua errors when playing with 2 hogs and one of them dies
  * Mission 3: Fix broken end sequence after killing cyborg or princess
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua	Wed Sep 27 06:04:02 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/shadow.lua	Wed Sep 27 06:17:41 2017 +0200
@@ -204,7 +204,7 @@
   SpawnUtilityCrate(1370, 810, amGirder)
   SpawnUtilityCrate(1300, 810, amParachute)
   ShowMission(loc("The Shadow Falls"), loc("The walk of Fame"), loc("Return to Leaks A Lot!"), 1, 6000)
-  AddEvent(CheckTookWeapons, {}, DoTookWeapons, {}, 0)
+  AddEvent(CheckReadyForStronglings, {}, DoReadyForStronglings, {}, 0)
   AddEvent(CheckNeedGirder, {}, DoNeedGirder, {}, 0)
   AddEvent(CheckNeedWeapons, {}, DoNeedWeapons, {}, 0)
   RemoveEventFunc(CheckDenseDead)
@@ -705,11 +705,11 @@
   AddCaption(loc("A little gift from the cyborgs"))
 end
 
-function CheckTookWeapons()
-  return shotgunTaken and grenadeTaken
+function CheckReadyForStronglings()
+  return (shotgunTaken and grenadeTaken) or GetX(dense) > 2700
 end
 
-function DoTookWeapons()
+function DoReadyForStronglings()
   ShowMission(loc("The Shadow Falls"), loc("The guardian"), loc("Protect yourselves!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power"), 1, 8000)
   AddAmmo(dense, amSkip, 100)
   AddAmmo(dense, amSwitch, 100)