Fix skipping in Racer causing the next team to be skipped, too 0.9.23-alpha
authorWuzzy <almikes@aol.com>
Thu, 04 May 2017 16:49:34 +0200
changeset 12412 8cc070640fd1
parent 12411 cd53f1bf52ff
child 12413 3122735b4cb6
Fix skipping in Racer causing the next team to be skipped, too
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Thu May 04 16:36:39 2017 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Thu May 04 16:49:34 2017 +0200
@@ -160,6 +160,7 @@
 local roundN
 local lastRound
 local RoundHasChanged
+local turnSkipped = false
 
 local boostX = 0
 local boostY = 0
@@ -570,11 +571,11 @@
                 4, 4000)
 end
 
-function InstructionsRace(time)
+function InstructionsRace()
         ShowMission(loc("Racer"),
         	loc("A Hedgewars mini-game"),
         	loc("Touch all waypoints as fast as you can!"),
-		2, time)
+		2, 4000)
 end
 
 function onGameStart()
@@ -680,6 +681,7 @@
         TryRepositionHogs()
 
         racerActive = false
+        turnSkipped = false
 
         trackTime = 0
 
@@ -820,7 +822,7 @@
                 end
 
                 -- if the player has expended his tunbling time, stop him tumbling
-                if TurnTimeLeft <= 20 then
+                if TurnTimeLeft <= 20 and not turnSkipped then
                         DisableTumbler()
                 end
 
@@ -868,6 +870,12 @@
     usedWeapons[at] = 0
 end
 
+function onHogAttack(ammoType)
+    if ammoType == amSkip then
+        turnSkipped = true
+    end
+end
+
 function onAchievementsDeclaration()
     usedWeapons[amSkip] = nil
     usedWeapons[amExtraTime] = nil