share/hedgewars/Data/Maps/TrophyRace/map.lua
changeset 15069 e16f906224fd
parent 13769 e874bfe563c7
equal deleted inserted replaced
15068:6f51c75994a4 15069:e16f906224fd
   137     elseif CurrentHedgehog ~= nil then
   137     elseif CurrentHedgehog ~= nil then
   138         x, y = GetGearPosition(CurrentHedgehog)
   138         x, y = GetGearPosition(CurrentHedgehog)
   139         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
   139         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
   140             reached = true
   140             reached = true
   141             local ttime = GameTime-startTime
   141             local ttime = GameTime-startTime
       
   142             local icon
   142             -- give it a sound ;)
   143             -- give it a sound ;)
   143             if ttime < besttime then
   144             if ttime < besttime then
   144                 PlaySound (sndHomerun)
   145                 PlaySound (sndHomerun)
       
   146                 icon = 0
   145             elseif ttime > worsttime then
   147             elseif ttime > worsttime then
   146                 PlaySound (sndHellish)
   148                 PlaySound (sndHellish)
       
   149                 icon = -amSkip
       
   150             else
       
   151                 icon = 2
   147             end
   152             end
   148             for i = 0, numhhs - 1 do
   153             for i = 0, numhhs - 1 do
   149                 if hhs[i] == CurrentHedgehog then
   154                 if hhs[i] == CurrentHedgehog then
   150                     times[numhhs] = ttime
   155                     times[numhhs] = ttime
   151                 end
   156                 end
   192             end
   197             end
   193 
   198 
   194             ShowMission(loc("TrophyRace"), loc("Status update"),
   199             ShowMission(loc("TrophyRace"), loc("Status update"),
   195                 string.format(loc("Time: %.3fs by %s"), (ttime/1000), GetHogName(CurrentHedgehog))
   200                 string.format(loc("Time: %.3fs by %s"), (ttime/1000), GetHogName(CurrentHedgehog))
   196                 .. hscore,
   201                 .. hscore,
   197                 0, 0)
   202                 icon, 0)
   198             AddCaption(string.format(loc("Time: %.3fs"), (ttime/1000)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2)
   203             AddCaption(string.format(loc("Time: %.3fs"), (ttime/1000)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2)
   199             AddCaption(loc("Track completed!"), capcolDefault, capgrpGameState)
   204             AddCaption(loc("Track completed!"), capcolDefault, capgrpGameState)
   200             EndTurn(true)
   205             EndTurn(true)
   201         else
   206         else
   202             if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and CurrentHedgehog ~= nil and GetHealth(CurrentHedgehog) > 0 and (not reached) and GameTime%100 == 0 then
   207             if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and CurrentHedgehog ~= nil and GetHealth(CurrentHedgehog) > 0 and (not reached) and GameTime%100 == 0 then