157 if not gameEnded then |
157 if not gameEnded then |
158 if cratesCollected == #crates then |
158 if cratesCollected == #crates then |
159 SaveMissionVar("Won", "true") |
159 SaveMissionVar("Won", "true") |
160 PlaySound(sndVictory, playerHog) |
160 PlaySound(sndVictory, playerHog) |
161 SetEffect(playerHog, heInvulnerable, 1) |
161 SetEffect(playerHog, heInvulnerable, 1) |
162 SetState(playerHog, bor(GetState(playerHog), gstWinner)) |
162 local dx, dy = GetGearVelocity(playerHog) |
163 SetState(playerHog, band(GetState(playerHog), bnot(gstHHDriven))) |
163 SetGearVelocity(playerHog, 0, dy) |
164 AddCaption(loc("Challenge completed!")) |
164 AddCaption(loc("Challenge completed!")) |
165 SendStat(siGameResult, loc("Challenge completed!")) |
165 SendStat(siGameResult, loc("Challenge completed!")) |
166 SendStat(siPointType, "!TIME") |
166 SendStat(siPointType, "!TIME") |
167 local time = startTime - endTime |
167 local time = startTime - endTime |
168 SendStat(siPlayerKills, tostring(time), GetHogTeamName(playerHog)) |
168 SendStat(siPlayerKills, tostring(time), GetHogTeamName(playerHog)) |