2nd try... just shortcircuit most of onGameTick20 when we are between turns.
authornemo
Tue, 24 Oct 2017 14:36:24 -0400
changeset 12754 c7224d202e8b
parent 12753 327f71313e04
child 12755 528f9752c3fe
2nd try... just shortcircuit most of onGameTick20 when we are between turns.
share/hedgewars/Data/Maps/ClimbHome/map.lua
--- a/share/hedgewars/Data/Maps/ClimbHome/map.lua	Tue Oct 24 14:14:00 2017 -0400
+++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua	Tue Oct 24 14:36:24 2017 -0400
@@ -49,6 +49,7 @@
 local multiplayerVictoryDelay = -1
 local multiplayerWinningHogs = {}
 local multiplayerWins = 0
+local racing = false
 
 -- Placement positions of winning hogs
 local victoryPosses = { }
@@ -117,6 +118,7 @@
     elseif GetGearType(gear) == gtHedgehog then
 	onGameTick20()
 	onGearDamage(gear, 0)
+        ready = false
         HH[gear] = nil
     end
 end
@@ -251,10 +253,6 @@
 function onGameTick20()
     local x,y
 
-    if gameTime - startTime < 40 then 
-        return
-    end
-
     if math.random(20) == 1 then AddVisualGear(2012,56,vgtSmoke,0,false) end
     if CurrentHedgehog == dummyHog and dummySkip ~= 0 and dummySkip < GameTime then
         ParseCommand("/skip")
@@ -281,6 +279,10 @@
         --end
     end
 
+    if not ready then 
+        return
+    end
+
     -- This will be executed if a player reached home in multiplayer
     if multiplayerVictoryDelay > 0 then
         multiplayerVictoryDelay = multiplayerVictoryDelay - 20
@@ -417,6 +419,7 @@
                 if distanceFromWater < 0 and not YouLost and not YouWon then
                     makeSinglePlayerLoserStats()
                     YouLost = true
+                    ready = false
                 end
                 -- FIXME: Hog is also in winning box if it just walks into the chair from the left, touching it. Intentional?
                 if not YouWon and not YouLost and gearIsInBox(CurrentHedgehog, 1920, 252, 50, 50) then
@@ -437,12 +440,14 @@
                     EndGame()
                     onAchievementsDeclaration()
                     YouWon = true
+                    ready = false
                 end
             else
                 if distanceFromWater < 0 and not YouLost and not YouWon then
                     makeMultiPlayerLoserStat(CurrentHedgehog)
                     deadHedgehogs = deadHedgehogs + 1
                     YouLost = true
+                    ready = false
                     if deadHedgehogs >= totalHedgehogs then
                         makeFinalMultiPlayerStats()
                         EndGame()
@@ -466,6 +471,7 @@
                     -- TODO: Add stupid winner grin.
                     multiplayerVictoryDelay = 4000
                     YouWon = true
+                    ready = false
                 end
             end
 
@@ -627,6 +633,7 @@
             end
         end
         YouLost = true
+        ready = false
     end
 end