share/hedgewars/Data/Maps/TrophyRace/map.lua
author jose1711
Tue, 16 Nov 2010 20:55:39 +0100
changeset 4350 cdb3d7a39fa2
parent 4188 e1bf1b5a301e
child 4503 a8ab151bcae3
permissions -rw-r--r--
updated/added slovak translations of lua files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     1
-- Hedgewars - Roperace for 2+ Players
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     2
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     3
local caption = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     4
	["en"] = "TrophyRace",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     5
	["sv"] = "TrophyRace",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     6
	["pt_PT"] = "TrophyRace",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     7
	["pl"] = "TrophyRace",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     8
	["es"] = "TrophyRace",
4350
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
     9
	["pt_BR"] = "TrophyRace",
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    10
	["sk"] = "Preteky o trofej"
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    11
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    12
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    13
local goal = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    14
	["en"] = "Use your rope to get from start to finish as fast as you can!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    15
	["sv"] = "Använd ditt rep för att ta dig från start till mål så fort som möjligt!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    16
	["pt_PT"] = "Utilizando a corda, percorre o percurso do inicio ao fim o mais rápido que conseguires!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    17
	["pl"] = "Użyj liny by jak najszybciej dotrzec od startu do mety",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    18
	["es"] = "¡Usa tu cuerda para llegar a la salida lo más rápido que puedas!",
4350
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    19
	["pt_BR"] = "Use sua corda para ir do início ao fim o mais rápido que você puder!",
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    20
	["sk"] = "Použite lano na presun zo štartovnej pozície do cieľa tak rýchlo, ako to len viete!"
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    21
	}
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
local done = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    24
	["en"] = "You've reached the goal!| |Time: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    25
	["sv"] = "Du har nått målet!| |Tid: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    26
	["pt_PT"] = "Chegaste ao fim!| |Tempo: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    27
	["pl"] = "Dotarłeś do celu!| |Czas: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    28
	["es"] = "¡Has llegado a la meta!| |Tiempo: ",
4350
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    29
	["pt_BR"] = "Você alcançou o objetivo!| |Tempo: ",
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    30
	["sk"] = "Dosiahli ste cieľ!| |Čas: "
4188
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
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    33
local eliminated = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    34
	["en"] = "Eliminating worst hedgehog this round...| |%s is OUT!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    35
	["sv"] = "Eliminerar sämsta igelkott den här rundan...| |%s är UTE!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    36
	["pt_PT"] = "A eliminar o pior ouriço da ronda...| |% está FORA!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    37
	["pl"] = "Eliminujemy najgorszego jeża tej rundy...| |%s ODPADŁ!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    38
	["es"] = "Eliminando al peor erizo de esta ronda...| |¡%s está FUERA!",
4350
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    39
	["pt_BR"] = "Eliminando o ouriço mais lento...| |%s vai para o chuveiro!",
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    40
	["sk"] = "Eliminujem najhoršieho ježka tohto kola...| |%s je mimo hru!"
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    41
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    42
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    43
local newbesttime = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    44
	["en"] = "NEW fastest lap: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    45
	["sv"] = "NYTT snabbast varv: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    46
	["pt_PT"] = "NOVA volta recorde: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    47
	["pl"] = "NOWE najszybsze okrążenie: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    48
	["es"] = "NUEVA vuelta rápida: ",
4350
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    49
	["pt_BR"] = "NOVA volta mais rápida: ",
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    50
	["sk"] = "NOVÉ najrýchlejšie kolo: "
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    51
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    52
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    53
local oldbesttime = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    54
	["en"] = "Fastest lap: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    55
	["sv"] = "Snabbast varv: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    56
	["pt_PT"] = "Volta mais rápida: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    57
	["pl"] = "Najszybsze okrążenie: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    58
	["es"] = "Vuelta rápida: ",
4350
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    59
	["pt_BR"] = "Volta mais rápida: ",
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    60
	["sk"] = "Najrýchlejšie kolo: "
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    61
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    62
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    63
local bestclantimes = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    64
	["en"] = "Best laps per team: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    65
	["sv"] = "Bästa varv per lag: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    66
	["pt_PT"] = "Melhores voltas por equipa: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    67
	["pl"] = "Najszybsze okrążenie drużyny: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    68
	["es"] = "Mejores tiempos por equipo: ",
4350
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    69
	["pt_BR"] = "Melhor volta por equipe: ",
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    70
	["sk"] = "Najrýchlejšie kolá podľa tímov: "
4188
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
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    73
local clantime = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    74
	["en"] = "Team %d: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    75
	["sv"] = "Lag %d: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    76
	["pt_PT"] = "Equipa %d: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    77
	["pl"] = "Drużyna %d: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    78
	["es"] = "Equipo %d",
4350
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    79
	["pt_BR"] = "Equipe %d: ",
cdb3d7a39fa2 updated/added slovak translations of lua files
jose1711
parents: 4188
diff changeset
    80
	["sk"] = "Tím %d: "
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    81
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    82
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    83
local function loc(text)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    84
	if text == nil then return "**missing**"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    85
	elseif text[L] == nil then return text["en"]
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    86
	else return text[L]
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    87
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    88
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    89
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    90
---------------------------------------------------------------
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    91
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    92
-- store number of hedgehogs
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    93
local numhhs = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    94
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    95
-- store hedgehog gears
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    96
local hhs = {}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    97
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    98
-- store best time per team
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    99
local clantimes = {}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   100
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   101
-- store best times
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   102
local times = {}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   103
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   104
-- in milisseconds
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   105
local maxtime = 99000
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   106
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   107
-- define start area (left, top, width, height)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   108
local start_area = {1606, 498, 356, 80}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   109
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   110
-- define goal area (left, top, width, height)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   111
local goal_area = {2030, 300, 56, 280}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   112
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   113
-- last active hog
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   114
local lasthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   115
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   116
-- active hog reached the goal?
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   117
local reached = false
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   118
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   119
-- hog with best time
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   120
local besthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   121
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   122
-- hog with worst time (per round)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   123
local worsthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   124
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   125
-- best time
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   126
local besttime = maxtime + 1
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   127
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   128
-- worst time (per round)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   129
local worsttime = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   130
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   131
function onGameInit()
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   132
	GameFlags = gfSolidLand + gfInvulnerable
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   133
	TurnTime = maxtime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   134
	CaseFreq = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   135
	MinesNum = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   136
	Explosives = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   137
	Delay = 500
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   138
	SuddenDeathTurns = 99999 -- "disable" sudden death
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   139
	Theme = 'Olympics'
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   140
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   141
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   142
function onGameStart()
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   143
	ShowMission(loc(caption), "", loc(goal), -amRope, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   144
	started = true
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   145
	p=1820
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   146
	for i = 0, numhhs - 1 do
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   147
	p = p + 50	
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   148
	SetGearPosition(hhs[i], p, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   149
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   150
	
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   151
	for i=0, ClansCount-1 do
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   152
		clantimes[i] = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   153
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   154
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   155
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   156
function onAmmoStoreInit()
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   157
	SetAmmo(amRope, 9, 2, 0)
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 onGameTick()
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   161
	if TurnTimeLeft == 1 and CurrentHedgehog ~= nil then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   162
		SetHealth(CurrentHedgehog, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   163
		x, y = GetGearPosition(CurrentHedgehog)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   164
		AddGear(x, y, gtAmmo_Grenade, 0, 0, 0, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   165
		worsttime = 99999
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   166
		worsthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   167
	elseif TurnTimeLeft == maxtime - 1 and CurrentHedgehog ~= nil then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   168
		if lasthog ~= nil then 
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   169
		SetGearPosition(lasthog, p , 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   170
		end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   171
		reached = false
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   172
		SetGearPosition(CurrentHedgehog, start_area[1] + start_area[3] / 2, start_area[2] + start_area[4] / 2)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   173
	elseif CurrentHedgehog ~= nil then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   174
		x, y = GetGearPosition(CurrentHedgehog)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   175
		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
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   176
			reached = true
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   177
			local ttime = maxtime - TurnTimeLeft
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   178
			--give it a sound;)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   179
			if ttime < besttime then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   180
				PlaySound (sndHomerun)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   181
			else
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   182
				PlaySound (sndHellish)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   183
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   184
			for i = 0, numhhs - 1 do
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   185
				if hhs[i] == CurrentHedgehog then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   186
					times[numhhs] = ttime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   187
				end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   188
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   189
				
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   190
			local hscore = "| |"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   191
			local clan = GetHogClan(CurrentHedgehog)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   192
			if ttime < clantimes[clan] or clantimes[clan] == 0 then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   193
				clantimes[clan] = ttime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   194
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   195
			
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   196
			if ttime < besttime then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   197
				besttime = ttime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   198
				besthog = CurrentHedgehog
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   199
				hscore = hscore .. loc(newbesttime)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   200
			else
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   201
				hscore = hscore .. loc(oldbesttime)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   202
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   203
			if ttime > worsttime then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   204
				worsttime = ttime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   205
				worsthog = CurrentHedgehog
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   206
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   207
			hscore = hscore .. GetHogName(besthog) .. " - " .. (besttime / 1000) .. " s | |" .. loc(bestclantimes)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   208
			
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   209
			if clan == ClansCount -1 then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   210
				-- Time for elimination - worst hog is out and the worst hog vars are reset.
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   211
				SetHealth(worsthog, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   212
				--Place a grenade to make inactive slowest hog active
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   213
				x, y = GetGearPosition(worsthog)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   214
				AddGear(x, y, gtShell, 0, 0, 0, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   215
				worsttime = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   216
				worsthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   217
				end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   218
			
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   219
			for i=0, ClansCount -1 do
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   220
				local tt = "" .. (clantimes[i] / 1000) .. " s"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   221
				if clantimes[i] == 0 then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   222
					tt = "--"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   223
				end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   224
				hscore = hscore .. "|" .. string.format(loc(clantime), i+1) .. tt
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   225
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   226
			
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   227
			ShowMission(loc(caption), "", loc(done) .. (ttime / 1000) .. " s" .. hscore, 0, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   228
			TurnTimeLeft = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   229
		end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   230
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   231
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   232
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   233
function onGearAdd(gear)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   234
	if GetGearType(gear) == gtHedgehog then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   235
		hhs[numhhs] = gear
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   236
		times[numhhs] = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   237
		numhhs = numhhs + 1
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   238
	elseif GetGearType(gear) == gtRope then -- rope is shot
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   239
		
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   240
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   241
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   242
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   243
function onGearDelete(gear)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   244
	if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   245
		--TurnTimeLeft = 0 -- end turn or not? hm...
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   246
		lasthog = CurrentHedgehog
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   247
		
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   248
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   249
end