Make turn timer gray when finishing target practice
authorWuzzy <Wuzzy2@mail.ru>
Sun, 06 Jan 2019 02:16:45 +0100
changeset 14547 797e3f441c14
parent 14546 029f40c609b4
child 14548 0fc9560be9cc
Make turn timer gray when finishing target practice
share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua
share/hedgewars/Data/Scripts/TargetPractice.lua
--- a/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua	Sun Jan 06 01:21:16 2019 +0100
+++ b/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua	Sun Jan 06 02:16:45 2019 +0100
@@ -193,12 +193,8 @@
 			-- ... end the game ...
 			generateStats()
 			EndGame()
-		else
-			-- ... or just lower the timer by 1.
-			-- Reset the time left to stop the timer
-			SetTurnTimeLeft(time_goal)
 		end
-        end_timer = end_timer - 20
+        	end_timer = end_timer - 20
 	end
 end
 
@@ -385,8 +381,7 @@
 				AddCaption(loc("Last Target!"));
 				spawnTarget(3480,1200)
 			end
-		else
-			if not game_lost then
+		elseif not game_lost then
 			-- Victory!
 			SaveMissionVar("Won", "true")
 			AddCaption(loc("Victory!"), capcolDefault, capgrpGameState)
@@ -402,7 +397,9 @@
 
 			-- Save the time left so we may keep it.
 			time_goal = TurnTimeLeft
-			end
+
+			-- Freeze the clock because the challenge has been completed
+			SetTurnTimePaused(true)
 		end
 		SetTeamLabel(playerTeamName, getTargetScore())
 	end
--- a/share/hedgewars/Data/Scripts/TargetPractice.lua	Sun Jan 06 01:21:16 2019 +0100
+++ b/share/hedgewars/Data/Scripts/TargetPractice.lua	Sun Jan 06 02:16:45 2019 +0100
@@ -195,10 +195,8 @@
 			if end_timer == 0 then
 				generateStats()
 				EndGame()
-			else
-				SetTurnTimeLeft(time_goal)
 			end
-	   	     end_timer = end_timer - 20
+			end_timer = end_timer - 20
 		end
 
 		for gear, _ in pairs(gearsInGame) do
@@ -242,6 +240,7 @@
 					-- Disable control
 					SetInputMask(0)
 					AddAmmo(player, params.ammoType, 0)
+					SetTurnTimePaused(true)
 				end
 			end
 		end