share/hedgewars/Data/Maps/ClimbHome/map.lua
branch0.9.22
changeset 12370 d974b32ab58b
parent 12369 d75c666e2d21
equal deleted inserted replaced
12369:d75c666e2d21 12370:d974b32ab58b
    17 local deadHedgehogs = 0
    17 local deadHedgehogs = 0
    18 local currTeam = ''
    18 local currTeam = ''
    19 local teams = {}
    19 local teams = {}
    20 local teamScoreStats = {}
    20 local teamScoreStats = {}
    21 local teamBests = {}
    21 local teamBests = {}
       
    22 local teamTimes = {}
    22 local MrMine -- in honour of sparkle's first arrival in the cabin
    23 local MrMine -- in honour of sparkle's first arrival in the cabin
    23 local YouWon = false
    24 local YouWon = false
    24 local YouLost = false
    25 local YouLost = false
    25 local HogsAreInvulnerable = false
    26 local HogsAreInvulnerable = false
    26 local WaterRise = nil
    27 local WaterRise = nil
   445                 SetHealth(Cake,999999)
   446                 SetHealth(Cake,999999)
   446                 CakeTries = CakeTries + 1 
   447                 CakeTries = CakeTries + 1 
   447             end
   448             end
   448 
   449 
   449             if (y > 286) or (y < 286 and MaxHeight > 286) then
   450             if (y > 286) or (y < 286 and MaxHeight > 286) then
       
   451                 if MaxHeight > 286 and y <= 286 then
       
   452                     -- wow, reached top
       
   453                     local teamName = GetHogTeamName(CurrentHedgehog)
       
   454                     if teamTimes[teamName] == nil or teamTimes[teamName] > GameTime - startTime then 
       
   455                         teamTimes[teamName] = GameTime - startTime 
       
   456                     end
       
   457                     MaxHeight = 286
       
   458                 end
   450                 if y < MaxHeight and y > 286 then MaxHeight = y end
   459                 if y < MaxHeight and y > 286 then MaxHeight = y end
   451                 if y < 286 then MaxHeight = 286 end
       
   452                 if MaxHeight < hTagHeight then
   460                 if MaxHeight < hTagHeight then
   453                     hTagHeight = MaxHeight
   461                     hTagHeight = MaxHeight
   454                     if hTag ~= nil then DeleteVisualGear(hTag) end
   462                     if hTag ~= nil then DeleteVisualGear(hTag) end
   455                     hTag = AddVisualGear(0, 0, vgtHealthTag, 0, true)
   463                     hTag = AddVisualGear(0, 0, vgtHealthTag, 0, true)
   456                     local g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(hTag)
   464                     local g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(hTag)
   685 
   693 
   686 function onAchievementsDeclaration()
   694 function onAchievementsDeclaration()
   687     for teamname, score in pairs(teamBests) do
   695     for teamname, score in pairs(teamBests) do
   688         DeclareAchievement("height reached", teamname, "ClimbHome", score)
   696         DeclareAchievement("height reached", teamname, "ClimbHome", score)
   689     end
   697     end
   690 end
   698     for teamname, score in pairs(teamTimes) do
       
   699         DeclareAchievement("rope race", teamname, "ClimbHome", score)
       
   700     end
       
   701 end