share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua
changeset 11890 712e20a3d895
parent 11692 68eddcdc9f26
child 11952 63988f36debf
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua	Wed Nov 16 16:32:44 2016 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua	Wed Nov 16 16:34:33 2016 +0100
@@ -155,7 +155,17 @@
 	SendStat(siGameResult, loc("Congratulations, you won!"))
 	SendStat(siCustomAchievement, loc("You have escaped successfully."))
 	SendStat(siCustomAchievement, string.format(loc("Your escape took you %d turns."), TotalRounds))
-	SendStat(siPlayerKills,'1',teamA.name)
+	local record = tonumber(GetCampaignVar("FastestMineEscape"))
+	if record ~= nil and TotalRounds >= record then
+		SendStat(siCustomAchievement, string.format(loc("Your fastest escape so far: %d turns"), record))
+	end
+	if record == nil or TotalRounds < record then
+		SaveCampaignVar("FastestMineEscape", tostring(TotalRounds))
+		if record ~= nil then
+			SendStat(siCustomAchievement, loc("This is a new personal best, congratulations!"))
+		end
+	end
+	SendStat(siPlayerKills,'0',teamA.name)
 	EndGame()
 end