# HG changeset patch # User unC0Rr # Date 1459510934 -10800 # Node ID 2a53e219bc1aaaa40ab3c992e7a3297574046c6c # Parent cac74d9075be01a22c074b4f46f7bed6dbf352e2 Time achievement for ClimbHome diff -r cac74d9075be -r 2a53e219bc1a share/hedgewars/Data/Maps/ClimbHome/map.lua --- a/share/hedgewars/Data/Maps/ClimbHome/map.lua Tue Mar 15 22:29:40 2016 +0300 +++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua Fri Apr 01 14:42:14 2016 +0300 @@ -19,6 +19,7 @@ local teams = {} local teamScoreStats = {} local teamBests = {} +local teamTimes = {} local MrMine -- in honour of sparkle's first arrival in the cabin local YouWon = false local YouLost = false @@ -447,8 +448,15 @@ end if (y > 286) or (y < 286 and MaxHeight > 286) then + if MaxHeight > 286 and y <= 286 then + -- wow, reached top + local teamName = GetHogTeamName(CurrentHedgehog) + if teamTimes[teamName] == nil or teamTimes[teamName] > GameTime - startTime then + teamTimes[teamName] = GameTime - startTime + end + MaxHeight = 286 + end if y < MaxHeight and y > 286 then MaxHeight = y end - if y < 286 then MaxHeight = 286 end if MaxHeight < hTagHeight then hTagHeight = MaxHeight if hTag ~= nil then DeleteVisualGear(hTag) end @@ -687,4 +695,7 @@ for teamname, score in pairs(teamBests) do DeclareAchievement("height reached", teamname, "ClimbHome", -score) end + for teamname, score in pairs(teamTimes) do + DeclareAchievement("rope race", teamname, "ClimbHome", score) + end end