150 end |
150 end |
151 local teamname = GetHogTeamName(CurrentHedgehog) |
151 local teamname = GetHogTeamName(CurrentHedgehog) |
152 if bestTimes[teamname] == nil or bestTimes[teamname] > ttime then |
152 if bestTimes[teamname] == nil or bestTimes[teamname] > ttime then |
153 bestTimes[teamname] = ttime |
153 bestTimes[teamname] = ttime |
154 end |
154 end |
|
155 local fastestStr |
155 if ttime < besttime then |
156 if ttime < besttime then |
156 besttime = ttime |
157 besttime = ttime |
157 besthog = CurrentHedgehog |
158 besthog = CurrentHedgehog |
158 besthogname = GetHogName(besthog) |
159 besthogname = GetHogName(besthog) |
159 hscore = hscore .. loc("NEW fastest lap: ") |
160 fastestStr = loc("NEW fastest lap: %.3fs by %s") |
160 else |
161 else |
161 hscore = hscore .. loc("Fastest lap: ") |
162 fastestStr = loc("Fastest lap: %.3fs by %s") |
162 end |
163 end |
163 if ttime > worsttime then |
164 if ttime > worsttime then |
164 worsttime = ttime |
165 worsttime = ttime |
165 worsthog = CurrentHedgehog |
166 worsthog = CurrentHedgehog |
166 end |
167 end |
167 hscore = hscore .. besthogname .. " - " .. (besttime / 1000) .. " s | |" .. loc("Best laps per team: ") |
168 hscore = hscore .. string.format(fastestStr, (besttime / 1000), besthogname) |
168 |
169 |
169 if clan == ClansCount -1 then |
170 if clan == ClansCount -1 then |
170 -- Time for elimination - worst hog is out and the worst hog vars are reset. |
171 -- Time for elimination - worst hog is out and the worst hog vars are reset. |
171 if worsthog ~= nil then |
172 if worsthog ~= nil then |
172 SetHealth(worsthog, 0) |
173 SetHealth(worsthog, 0) |
173 --Place a grenade to make inactive slowest hog active |
174 -- Drop a bazooka to make inactive slowest hog active. |
174 x, y = GetGearPosition(worsthog) |
175 x, y = GetGearPosition(worsthog) |
175 AddGear(x, y, gtShell, 0, 0, 0, 0) |
176 AddGear(x, y, gtShell, 0, 0, 0, 0) |
176 end |
177 end |
177 worsttime = 0 |
178 worsttime = 0 |
178 worsthog = nil |
179 worsthog = nil |
179 end |
180 end |
180 |
181 |
181 for i=0, ClansCount -1 do |
182 -- print list of best team times |
182 local tt = "" .. (clantimes[i] / 1000) .. " s" |
183 hscore = hscore .. "| |" .. loc("Best laps per team: ") .. "|" |
183 if clantimes[i] == 0 then |
184 for teamName, teamTime in pairs(bestTimes) do |
184 tt = "--" |
185 if teamTime ~= 0 and teamTime ~= nil then |
|
186 -- <Team name>: <best team time in seconds> |
|
187 hscore = hscore .. "|" .. string.format(loc("%s: %.3fs"), teamName, (teamTime / 1000)) |
185 end |
188 end |
186 hscore = hscore .. "|" .. string.format(loc("Team %d: "), i+1) .. tt |
189 end |
187 end |
190 |
188 |
|
189 local strtime = string.format(loc("Time: %.3fs"), (ttime/1000)) |
191 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) |
192 ShowMission(loc("TrophyRace"), loc("Status update"), strtime .. hscore, 0, 0) |
191 AddCaption(strtime, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2) |
193 AddCaption(strtime, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2) |
|
194 AddCaption(loc("Track completed!"), 0xFFFFFFFF, capgrpGameState) |
192 EndTurn(true) |
195 EndTurn(true) |
193 else |
196 else |
194 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and CurrentHedgehog ~= nil and GetHealth(CurrentHedgehog) > 0 and (not reached) and GameTime%100 == 0 then |
197 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 |
198 local ttime = GameTime-startTime |
196 AddCaption(string.format(loc("Time: %.1fs"), (ttime/1000)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2) |
199 AddCaption(string.format(loc("Time: %.1fs"), (ttime/1000)), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpMessage2) |