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