ACF3: Fix weapons being disabled in first turn
authorWuzzy <Wuzzy2@mail.ru>
Fri, 14 Dec 2018 01:40:13 +0100
changeset 14449 d084fc76c566
parent 14448 6b1fe6d0a26b
child 14450 12940929cb66
ACF3: Fix weapons being disabled in first turn
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua	Fri Dec 14 01:19:12 2018 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/journey.lua	Fri Dec 14 01:40:13 2018 +0100
@@ -135,6 +135,7 @@
 TurnsLeft = 0
 stage = 0
 
+startAnimStarted = false
 blowTaken = false
 fireTaken = false
 gravityTaken = false
@@ -782,8 +783,6 @@
     end
     SetupPlaceAlone()
     SetupEventsAlone()
-    AddAnim(startAnim)
-    AddFunction({func = AfterStartAnim, args = {}})
   else
     if m2Choice == choiceAccepted then
       SetupAnimAcceptedLived()
@@ -792,8 +791,6 @@
     end
     SetupPlaceDuo()
     SetupEventsDuo()
-    AddAnim(startAnim)
-    AddFunction({func = AfterStartAnim, args = {}})
   end
   HideHedge(cyborg)
   HideHedge(princess)
@@ -1087,6 +1084,8 @@
     HealthDecrease = 0
     WaterRise = 0
 
+  AnimInit(true)
+
   AddTeam(loc("Natives"), -2, "Bone", "Island", "HillBilly", "cm_birdy")
   leaks = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
   dense = AddHog(loc("Dense Cloud"), 0, 100, "RobinHood")
@@ -1115,8 +1114,6 @@
   AnimSetGearPosition(leaks, 0, 0)
   AnimSetGearPosition(cyborg, 0, 0)
   AnimSetGearPosition(princess, 0, 0)
-  
-  AnimInit()
 end
 
 function onGameStart()
@@ -1186,6 +1183,11 @@
 end
 
 function onNewTurn()
+  if not startAnimStarted then
+      AddAnim(startAnim)
+      AddFunction({func = AfterStartAnim, args = {}})
+      startAnimStarted = true
+  end
   if AnimInProgress() then
     SetTurnTimeLeft(MAX_TURN_TIME)
   elseif victory then