share/hedgewars/Data/Maps/TrophyRace/map.lua
changeset 13008 99ff8f4810f4
parent 12699 608db0fb90f0
child 13009 67cc3cac4c8e
equal deleted inserted replaced
13007:8a8aaaf97a95 13008:99ff8f4810f4
   123     if startTime == 0 and TurnTimeLeft < maxtime then
   123     if startTime == 0 and TurnTimeLeft < maxtime then
   124         startTime = GameTime
   124         startTime = GameTime
   125     end
   125     end
   126     if CurrentHedgehog ~= nil and TurnTimeLeft == 1 then
   126     if CurrentHedgehog ~= nil and TurnTimeLeft == 1 then
   127         killHog()
   127         killHog()
       
   128         AddCaption(loc("Time's up!"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2)
   128     elseif CurrentHedgehog ~= nil then
   129     elseif CurrentHedgehog ~= nil then
   129         x, y = GetGearPosition(CurrentHedgehog)
   130         x, y = GetGearPosition(CurrentHedgehog)
   130         if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle
   131         if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle
   131             reached = true
   132             reached = true
   132             local ttime = GameTime-startTime
   133             local ttime = GameTime-startTime
   183                     tt = "--"
   184                     tt = "--"
   184                 end
   185                 end
   185                 hscore = hscore .. "|" .. string.format(loc("Team %d: "), i+1) .. tt
   186                 hscore = hscore .. "|" .. string.format(loc("Team %d: "), i+1) .. tt
   186             end
   187             end
   187             
   188             
   188             ShowMission(loc("TrophyRace"), loc("Race"), loc("You've reached the goal!| |Time: ") .. (ttime / 1000) .. " s" .. hscore, 0, 0)
   189             local strtime = string.format(loc("Time: %.3fs"), (ttime/1000))
       
   190             ShowMission(loc("TrophyRace"), loc("Race"), loc("You've reached the goal!") .. "| |" .. strtime .. hscore, 0, 0)
       
   191             AddCaption(strtime, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2)
   189             EndTurn(true)
   192             EndTurn(true)
       
   193         else
       
   194             if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and CurrentHedgehog ~= nil and GetHealth(CurrentHedgehog) > 0 and (not reached) and GameTime%100 == 0 then
       
   195                 local ttime = GameTime-startTime
       
   196                 AddCaption(string.format(loc("Time: %.1fs"), (ttime/1000)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2)
       
   197             end
   190         end
   198         end
   191     end
   199     end
   192 end
   200 end
   193 
   201 
   194 function onGearAdd(gear)
   202 function onGearAdd(gear)