share/hedgewars/Data/Maps/TrophyRace/map.lua
author koda
Sun, 03 Nov 2013 22:53:16 +0100
changeset 9673 5be4de0eb4b0
parent 9664 1e528c58e41d
child 9685 7d925e82e572
permissions -rw-r--r--
enable -fPIC on UNIX only
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4506
37744d5c877e Finnished up the lua translations by adding training maps, campaign is ignored for now
Henek
parents: 4503
diff changeset
     1
-- Hedgewars - Roperace for 2+ Players
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     2
9093
4114ce5d885d fix locale load
nemo
parents: 8349
diff changeset
     3
HedgewarsScriptLoad("/Scripts/Locale.lua")
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     4
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     5
-- store number of hedgehogs
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     6
local numhhs = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     7
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     8
-- store hedgehog gears
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     9
local hhs = {}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    10
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    11
-- store best time per team
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    12
local clantimes = {}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    13
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    14
-- store best times
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    15
local times = {}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    16
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    17
-- in milisseconds
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    18
local maxtime = 99000
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    19
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    20
-- define start area (left, top, width, height)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    21
local start_area = {1606, 498, 356, 80}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    22
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    23
-- define goal area (left, top, width, height)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    24
local goal_area = {2030, 300, 56, 280}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    25
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    26
-- last active hog
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    27
local lasthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    28
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    29
-- active hog reached the goal?
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    30
local reached = false
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    31
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    32
-- hog with worst time (per round)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    33
local worsthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    34
9664
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
    35
local besthog = nil
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
    36
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    37
-- best time
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    38
local besttime = maxtime + 1
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    39
9664
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
    40
-- best time per team
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
    41
local bestTimes = {}
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
    42
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    43
-- worst time (per round)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    44
local worsttime = 0
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    45
local startTime = 0;
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    46
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    47
function onGameInit()
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    48
    GameFlags = gfSolidLand + gfInvulnerable
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    49
    TurnTime = maxtime
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    50
    CaseFreq = 0
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    51
    MinesNum = 0
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    52
    Explosives = 0
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    53
    Delay = 500
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    54
    SuddenDeathTurns = 99999 -- "disable" sudden death
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    55
    Theme = 'Olympics'
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    56
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    57
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    58
function onGameStart()
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    59
    ShowMission(loc("TrophyRace"), "", loc("Use your rope to get from start to finish as fast as you can!"), -amRope, 0)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    60
    started = true
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    61
    p=1820
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    62
    for i = 0, numhhs - 1 do
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    63
    p = p + 50    
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    64
    SetGearPosition(hhs[i], p, 0)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    65
    end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    66
    
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    67
    for i=0, ClansCount-1 do
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    68
        clantimes[i] = 0
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    69
    end
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    70
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    71
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    72
function onAmmoStoreInit()
9664
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
    73
    SetAmmo(amRope, 9, 1, 0)
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
    74
    SetAmmo(amSkip, 9, 1, 0)
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    75
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    76
9659
e9c00dd31b07 drop onGameTick20 - it has some savings on cpu, but racers demand millisecond precision not 20 millisecond, apparently
nemo
parents: 9658
diff changeset
    77
function onGameTick()
9658
c97e8ecc7457 this isn't pascal
nemo
parents: 9657
diff changeset
    78
    if startTime == 0 and TurnTimeLeft < maxtime then
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    79
        startTime = GameTime
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    80
    end
9664
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
    81
    if CurrentHedgehog ~= nil and TurnTimeLeft == 1 then
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    82
        SetHealth(CurrentHedgehog, 0)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    83
        x, y = GetGearPosition(CurrentHedgehog)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    84
        AddGear(x, y, gtShell, 0, 0, 0, 0)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    85
        worsttime = 99999
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    86
        worsthog = nil
9659
e9c00dd31b07 drop onGameTick20 - it has some savings on cpu, but racers demand millisecond precision not 20 millisecond, apparently
nemo
parents: 9658
diff changeset
    87
    elseif TurnTimeLeft == maxtime-1 and CurrentHedgehog ~= nil then
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    88
        if lasthog ~= nil then 
9664
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
    89
            SetGearPosition(lasthog, p , 0)
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    90
        end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    91
        reached = false
7771
ce6d4dd0c780 fix trophyrace. also tweak it a little
nemo
parents: 4506
diff changeset
    92
        SetGearVelocity(CurrentHedgehog, 1, 0)
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    93
        SetGearPosition(CurrentHedgehog, start_area[1] + start_area[3] / 2, start_area[2] + start_area[4] / 2)
7771
ce6d4dd0c780 fix trophyrace. also tweak it a little
nemo
parents: 4506
diff changeset
    94
        ParseCommand("setweap " .. string.char(amRope))
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    95
        lasthog = CurrentHedgehog
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    96
    elseif CurrentHedgehog ~= nil then
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    97
        x, y = GetGearPosition(CurrentHedgehog)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    98
        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
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
    99
            reached = true
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   100
            local ttime = GameTime-startTime
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   101
            startTime = 0
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   102
            --give it a sound;)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   103
            if ttime < besttime then
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   104
                PlaySound (sndHomerun)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   105
            else
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   106
                PlaySound (sndHellish)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   107
            end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   108
            for i = 0, numhhs - 1 do
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   109
                if hhs[i] == CurrentHedgehog then
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   110
                    times[numhhs] = ttime
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   111
                end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   112
            end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   113
                
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   114
            local hscore = "| |"
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   115
            local clan = GetHogClan(CurrentHedgehog)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   116
            if ttime < clantimes[clan] or clantimes[clan] == 0 then
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   117
                clantimes[clan] = ttime
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   118
            end
9664
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
   119
            local teamname = GetHogTeamName(CurrentHedgehog)
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
   120
            if bestTimes[teamname] == nil or bestTimes[teamname] > ttime then
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
   121
                bestTimes[teamname] = ttime
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
   122
            end
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   123
            if ttime < besttime then
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   124
                besttime = ttime
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   125
                besthog = CurrentHedgehog
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   126
                hscore = hscore .. loc("NEW fastest lap: ")
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   127
            else
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   128
                hscore = hscore .. loc("Fastest lap: ")
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   129
            end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   130
            if ttime > worsttime then
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   131
                worsttime = ttime
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   132
                worsthog = CurrentHedgehog
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   133
            end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   134
            hscore = hscore .. GetHogName(besthog) .. " - " .. (besttime / 1000) .. " s | |" .. loc("Best laps per team: ")
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   135
            
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   136
            if clan == ClansCount -1 then
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   137
                -- Time for elimination - worst hog is out and the worst hog vars are reset.
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   138
                SetHealth(worsthog, 0)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   139
                --Place a grenade to make inactive slowest hog active
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   140
                x, y = GetGearPosition(worsthog)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   141
                AddGear(x, y, gtShell, 0, 0, 0, 0)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   142
                worsttime = 0
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   143
                worsthog = nil
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   144
                end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   145
            
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   146
            for i=0, ClansCount -1 do
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   147
                local tt = "" .. (clantimes[i] / 1000) .. " s"
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   148
                if clantimes[i] == 0 then
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   149
                    tt = "--"
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   150
                end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   151
                hscore = hscore .. "|" .. string.format(loc("Team %d: "), i+1) .. tt
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   152
            end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   153
            
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   154
            ShowMission(loc("TrophyRace"), "", loc("You've reached the goal!| |Time: ") .. (ttime / 1000) .. " s" .. hscore, 0, 0)
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   155
            TurnTimeLeft = 0
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   156
        end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   157
    end
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   158
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   159
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   160
function onGearAdd(gear)
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   161
    if GetGearType(gear) == gtHedgehog then
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   162
        hhs[numhhs] = gear
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   163
        times[numhhs] = 0
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   164
        numhhs = numhhs + 1
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   165
    end
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   166
--    elseif GetGearType(gear) == gtRope then -- rope is shot
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   167
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   168
7771
ce6d4dd0c780 fix trophyrace. also tweak it a little
nemo
parents: 4506
diff changeset
   169
--function onGearDelete(gear)
9657
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   170
--    if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   171
--        --TurnTimeLeft = 0 -- end turn or not? hm...
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   172
--        lasthog = CurrentHedgehog
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   173
--        
2d8cae3c0855 use gameticks instead of turn timer. untested. also replaced tabs with spaces
nemo
parents: 9411
diff changeset
   174
--    end
7771
ce6d4dd0c780 fix trophyrace. also tweak it a little
nemo
parents: 4506
diff changeset
   175
--end
9397
7b7ee65f82ad Declare achievements in console statistics output
unc0rr
parents: 9093
diff changeset
   176
7b7ee65f82ad Declare achievements in console statistics output
unc0rr
parents: 9093
diff changeset
   177
function onAchievementsDeclaration()
9664
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
   178
    for team,time in pairs(realBestTimes) do
1e528c58e41d ok. this should avoid calling switch inappropriately. also, add skip to trophyrace and add the per-team achievement reporting.
nemo
parents: 9659
diff changeset
   179
      DeclareAchievement("rope race", team, "TrophyRace", time)
9397
7b7ee65f82ad Declare achievements in console statistics output
unc0rr
parents: 9093
diff changeset
   180
    end
7b7ee65f82ad Declare achievements in console statistics output
unc0rr
parents: 9093
diff changeset
   181
end