Fix double achievements and ranks in The First Stop mission (fixes #106)
authorWuzzy <almikes@aol.com>
Tue, 22 Nov 2016 15:52:57 +0100
changeset 11975 c52d35c859e8
parent 11974 1d07f4ceb8c6
child 11976 d5dabb71d6bf
Fix double achievements and ranks in The First Stop mission (fixes #106)
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Sun Nov 20 15:20:08 2016 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Tue Nov 22 15:52:57 2016 +0100
@@ -19,6 +19,7 @@
 local battleZoneReached = false
 local checkPointReached = 1 -- 1 is start of the game
 local afterDialog02 = false
+local gameOver = false
 -- dialogs
 local dialog01 = {}
 local dialog02 = {}
@@ -353,6 +354,7 @@
 end
 
 function professorDeath(gear)
+	if gameOver then return end
 	if GetHealth(minion1.gear) then
 		AnimSay(minion1.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000)
 	elseif GetHealth(minion2.gear) then
@@ -371,10 +373,12 @@
 	SendStat(siPlayerKills,'1',teamD.name)
 	SendStat(siPlayerKills,'0',teamC.name)
 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
+	gameOver = true
 	EndGame()
 end
 
 function minionsDeath(gear)
+	if gameOver then return end
 	-- do staffs here
 	AnimSay(professor.gear, loc("I may lost this battle, but I haven't lost the war yet!"), SAY_SHOUT, 6000)
 	DismissTeam(teamC.name)
@@ -388,6 +392,7 @@
 	SendStat(siPlayerKills,'1',teamD.name)
 	SendStat(siPlayerKills,'0',teamC.name)
 	SaveCampaignVar("CosmosCheckPoint", "5") -- hero got fuels
+	gameOver = true
 	EndGame()
 end