Racer: Disable other ammos in waypoint placement phase
authorWuzzy <Wuzzy2@mail.ru>
Sun, 15 Sep 2019 14:59:46 +0200
changeset 15419 09b63f9032f4
parent 15418 b186e1f4c5ed
child 15420 4b792051c159
Racer: Disable other ammos in waypoint placement phase
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Sun Sep 15 14:46:19 2019 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Sun Sep 15 14:59:46 2019 +0200
@@ -62,6 +62,8 @@
 
 local officialChallenge
 
+local ammoDelays = {}
+
 --------------------------
 -- hog and team tracking variales
 --------------------------
@@ -611,6 +613,11 @@
         WaterRise = 0
         HealthDecrease = 0
 
+	-- Remember ammo delays for later
+        for a=0, AmmoTypeMax do
+                local _, _, delay = GetAmmo(a)
+                ammoDelays[a] = delay
+        end
 end
 
 function InstructionsBuild()
@@ -779,6 +786,13 @@
                                 InstructionsRace()
                         end
 
+                        -- Restore old ammo delays
+                        for a=0, AmmoTypeMax do
+                                if a ~= amAirAttack and a ~= amSkip then
+                                        SetAmmoDelay(a, ammoDelays[a])
+                                end
+                        end
+
                         SetAmmoTexts(amSkip, nil, nil, nil)
                 else
                         local infoString
@@ -790,6 +804,11 @@
                         ShowMission(loc("Racer"),
                         loc("Waypoint placement phase"), infoString, -amAirAttack, 4000)
                         AddAmmo(CurrentHedgehog, amAirAttack, AMMO_INFINITE)
+                        for a=0, AmmoTypeMax do
+                                if a ~= amAirAttack and a ~= amSkip then
+                                        SetAmmoDelay(a, 9999)
+                                end
+                        end
                         SetWeapon(amAirAttack)
                         -- Bots skip waypoint placement
                         if GetHogLevel(CurrentHedgehog) ~= 0 then