share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua
changeset 14475 2113296b7a29
parent 14464 ead8928a59f8
child 14482 d4aa64f51c9f
--- a/share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua	Wed Dec 19 01:47:41 2018 +0100
+++ b/share/hedgewars/Data/Missions/Challenge/User_Mission_-_Rope_Knock_Challenge.lua	Wed Dec 19 05:50:02 2018 +0100
@@ -1,3 +1,4 @@
+HedgewarsScriptLoad("/Scripts/Utils.lua")
 HedgewarsScriptLoad("/Scripts/Locale.lua")
 
 local hhs = {}
@@ -98,6 +99,10 @@
 	SendStat(siPointType, loc("points"))
 	SendStat(siPlayerKills, tostring(score), playerTeamName)
 	PlaySound(sndHellish)
+
+	-- Update highscore
+	updateChallengeRecord("Highscore", score)
+
 	EndGame()
 end
 
@@ -117,6 +122,9 @@
 	SendStat(siPlayerKills, tostring(score), playerTeamName)
 	SetTeamLabel(playerTeamName, tostring(score))
 
+	-- Update highscore
+	updateChallengeRecord("Highscore", score)
+
 	if hhs[0] and GetHealth(hhs[0]) then
 		SetEffect(hhs[0], heInvulnerable, 1)
 	end
@@ -188,11 +196,17 @@
 function onGameStart()
 	SendHealthStatsOff()
 
+	local recordInfo = getReadableChallengeRecord("Highscore")
+	if recordInfo == nil then
+		recordInfo = ""
+	else
+		recordInfo = "|" .. recordInfo
+	end
 	ShowMission     (
                         loc("Rope-knocking Challenge"),
                         loc("Challenge"),
                         loc("Use the rope to knock your enemies to their doom.") .. "|" ..
-                        loc("Finish this challenge as fast as possible to earn bonus points."),
+                        loc("Finish this challenge as fast as possible to earn bonus points.").. recordInfo,
                         -amRope, 4000)
 	SetTeamLabel(playerTeamName, "0")