# HG changeset patch # User Wuzzy # Date 1547438344 -3600 # Node ID 28d00ceb8b54b7dcb6f4519124c7ef5fd0cdfe7a # Parent 6e5cda26f6769be3f30952d242e6af173cd9a180 ASA desert02: Show escape record in-game diff -r 6e5cda26f676 -r 28d00ceb8b54 share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua Mon Jan 14 04:30:31 2019 +0100 +++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua Mon Jan 14 04:59:04 2019 +0100 @@ -22,6 +22,7 @@ local cratesCollected = 0 local totalCrates = 0 local damageTaken = false +local record -- health crates healthX = 565 health1Y = 1400 @@ -82,6 +83,7 @@ AnimSetGearPosition(hero.gear, hero.x, hero.y) HogTurnLeft(hero.gear, true) + record = tonumber(GetCampaignVar("FastestMineEscape")) initCheckpoint("desert02") AnimInit(true) @@ -97,6 +99,9 @@ AnimWait(hero.gear, 3000) FollowGear(hero.gear) + if record ~= nil then + goals[dialog01][3] = goals[dialog01][3] .. "|" .. string.format(loc("Fastest escape: %d turns"), record) + end ShowMission(unpack(goals[dialog01])) HideMission() @@ -112,6 +117,9 @@ function onNewTurn() SetWeapon(amRope) + if TotalRounds >= 0 and record ~= nil then + SetTeamLabel(teamA.name, tostring(TotalRounds)) + end end function onGameTick() @@ -185,7 +193,6 @@ 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)) - 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 @@ -231,4 +238,7 @@ function challengeStart() startChallenge = true EndTurn(true) + if record ~= nil then + SetTeamLabel(teamA.name, "0") + end end