share/hedgewars/Data/Scripts/SpeedShoppa.lua
changeset 14496 2113296b7a29
parent 14485 ead8928a59f8
child 14501 208359558642
--- a/share/hedgewars/Data/Scripts/SpeedShoppa.lua	Wed Dec 19 01:47:41 2018 +0100
+++ b/share/hedgewars/Data/Scripts/SpeedShoppa.lua	Wed Dec 19 05:50:02 2018 +0100
@@ -21,6 +21,7 @@
 
 ]=]
 
+HedgewarsScriptLoad("/Scripts/Utils.lua")
 HedgewarsScriptLoad("/Scripts/Locale.lua")
 
 --[[
@@ -115,7 +116,8 @@
 
 	_G.onGameStart = function()
 		SendHealthStatsOff()
-		ShowMission(params.missionTitle, loc("Challenge"), params.goalText, -amRope, 5000) 
+		local append = getReadableChallengeRecord("TimeRecord")
+		ShowMission(params.missionTitle, loc("Challenge"), params.goalText .. "|" .. append, -amRope, 5000)
 		-- <crates collected>/<total number of crates>
 		SetTeamLabel(params.teamName, string.format(loc("%d/%d"), cratesCollected, #crates))
 		for i=1,#crates do
@@ -176,6 +178,7 @@
 				SendStat(siPlayerKills, tostring(time), params.teamName)
 				SendStat(siCustomAchievement, string.format(loc("You have finished the challenge in %.3f s."), (time/1000)))
 				SetTurnTimeLeft(0)
+				updateChallengeRecord("TimeRecord", time)
 			else
 				SendStat(siGameResult, loc("Challenge failed!"))
 				SendStat(siPointType, loc("crate(s)"))