share/hedgewars/Data/Maps/TrophyRace/map.lua
author unc0rr
Sun, 07 Nov 2010 19:27:22 +0300
changeset 4171 7bbd7ab84454
parent 4168 49ad7bea4a33
parent 4170 7fb7386423d8
child 4174 acaa5e7fd286
permissions -rw-r--r--
merge
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",
4170
7fb7386423d8 portuguese update for map lua
inu
parents: 4162
diff changeset
     6
	["pt_PT"] = "TrophyRace"
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     7
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     8
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     9
local goal = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    10
	["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
    11
	["sv"] = "Använd ditt rep för att ta dig från start till mål så fort som möjligt!",
4170
7fb7386423d8 portuguese update for map lua
inu
parents: 4162
diff changeset
    12
	["pt_PT"] = "Utilizando a corda, percorre o percurso do inicio ao fim o mais rápido que conseguires!"
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    13
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    14
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    15
local done = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    16
	["en"] = "You've reached the goal!| |Time: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    17
	["sv"] = "Du har nått målet!| |Tid: ",
4170
7fb7386423d8 portuguese update for map lua
inu
parents: 4162
diff changeset
    18
	["pt_PT"] = "Chegaste ao fim!| |Tempo: "
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    19
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    20
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    21
local eliminated = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    22
	["en"] = "Eliminating worst hedgehog this round...| |%s is OUT!",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    23
	["sv"] = "Eliminerar sämsta igelkott den här rundan...| |%s är UTE!",
4170
7fb7386423d8 portuguese update for map lua
inu
parents: 4162
diff changeset
    24
	["pt_PT"] = "A eliminar o pior ouriço da ronda...| |% está FORA!"
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 newbesttime = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    28
	["en"] = "NEW fastest lap: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    29
	["sv"] = "NYTT snabbast varv: ",
4170
7fb7386423d8 portuguese update for map lua
inu
parents: 4162
diff changeset
    30
	["pt_PT"] = "NOVA volta recorde: "
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    31
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    32
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    33
local oldbesttime = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    34
	["en"] = "Fastest lap: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    35
	["sv"] = "Snabbast varv: ",
4170
7fb7386423d8 portuguese update for map lua
inu
parents: 4162
diff changeset
    36
	["pt_PT"] = "Volta mais rápida: "
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    37
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    38
local bestclantimes = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    39
	["en"] = "Best laps per team: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    40
	["sv"] = "Bästa varv per lag: ",
4170
7fb7386423d8 portuguese update for map lua
inu
parents: 4162
diff changeset
    41
	["pt_PT"] = "Melhores voltas por equipa: "
4106
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 clantime = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    44
	["en"] = "Team %d: ",
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
    45
	["sv"] = "Lag %d: ",
4170
7fb7386423d8 portuguese update for map lua
inu
parents: 4162
diff changeset
    46
	["pt_PT"] = "Equipa %d: "
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    47
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    48
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    49
	local function loc(text)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    50
	if text == nil then return "**missing**"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    51
	elseif text[L] == nil then return text["en"]
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    52
	else return text[L]
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    53
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    54
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    55
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    56
---------------------------------------------------------------
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    57
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    58
-- store number of hedgehogs
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    59
local numhhs = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    60
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    61
-- store hedgehog gears
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    62
local hhs = {}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    63
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    64
-- store best time per team
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    65
local clantimes = {}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    66
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    67
-- store best times
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    68
local times = {}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    69
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    70
-- in milisseconds
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    71
local maxtime = 99000
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    72
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    73
-- define start area (left, top, width, height)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    74
local start_area = {1606, 498, 356, 80}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    75
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    76
-- define goal area (left, top, width, height)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    77
local goal_area = {2030, 300, 56, 280}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    78
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    79
-- last active hog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    80
local lasthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    81
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    82
-- active hog reached the goal?
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    83
local reached = false
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    84
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    85
-- hog with best time
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    86
local besthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    87
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    88
-- hog with worst time (per round)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    89
local worsthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    90
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    91
-- best time
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    92
local besttime = maxtime + 1
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    93
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    94
-- worst time (per round)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    95
local worsttime = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    96
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    97
function onGameInit()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    98
	GameFlags = gfSolidLand + gfInvulnerable
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    99
	TurnTime = maxtime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   100
	CaseFreq = 0
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 4106
diff changeset
   101
	MinesNum = 0
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   102
	Explosives = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   103
	Delay = 500
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   104
	SuddenDeathTurns = 99999 -- "disable" sudden death
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   105
	Theme = 'Olympics'
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   106
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   107
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   108
function onGameStart()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   109
	ShowMission(loc(caption), "", loc(goal), -amRope, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   110
	started = true
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   111
	p=1820
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   112
	for i = 0, numhhs - 1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   113
	p = p + 50	
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   114
	SetGearPosition(hhs[i], p, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   115
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   116
	
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   117
	for i=0, ClansCount-1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   118
		clantimes[i] = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   119
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   120
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   121
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   122
function onAmmoStoreInit()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   123
	SetAmmo(amRope, 9, 2, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   124
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   125
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   126
function onGameTick()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   127
	if TurnTimeLeft == 1 and CurrentHedgehog ~= nil then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   128
		SetHealth(CurrentHedgehog, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   129
		x, y = GetGearPosition(CurrentHedgehog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   130
		AddGear(x, y, gtAmmo_Grenade, 0, 0, 0, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   131
		worsttime = 99999
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   132
		worsthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   133
	elseif TurnTimeLeft == maxtime - 1 and CurrentHedgehog ~= nil then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   134
		if lasthog ~= nil then 
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   135
		SetGearPosition(lasthog, p , 0)
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
		reached = false
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   138
		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
   139
	elseif CurrentHedgehog ~= nil then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   140
		x, y = GetGearPosition(CurrentHedgehog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   141
		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
   142
			reached = true
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   143
			local ttime = maxtime - TurnTimeLeft
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   144
			--give it a sound;)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   145
			if ttime < besttime then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   146
				PlaySound (sndHomerun)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   147
			else
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   148
				PlaySound (sndHellish)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   149
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   150
			for i = 0, numhhs - 1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   151
				if hhs[i] == CurrentHedgehog then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   152
					times[numhhs] = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   153
				end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   154
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   155
				
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   156
			local hscore = "| |"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   157
			local clan = GetHogClan(CurrentHedgehog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   158
			if ttime < clantimes[clan] or clantimes[clan] == 0 then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   159
				clantimes[clan] = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   160
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   161
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   162
			if ttime < besttime then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   163
				besttime = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   164
				besthog = CurrentHedgehog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   165
				hscore = hscore .. loc(newbesttime)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   166
			else
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   167
				hscore = hscore .. loc(oldbesttime)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   168
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   169
			if ttime > worsttime then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   170
				worsttime = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   171
				worsthog = CurrentHedgehog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   172
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   173
			hscore = hscore .. GetHogName(besthog) .. " - " .. (besttime / 1000) .. " s | |" .. loc(bestclantimes)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   174
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   175
			if clan == ClansCount -1 then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   176
				-- 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
   177
				SetHealth(worsthog, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   178
				--Place a grenade to make inactive slowest hog active
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   179
				x, y = GetGearPosition(worsthog)
4168
49ad7bea4a33 renaming gtAmmo_Bomb and gtAmmo_Grenade
Henek
parents: 4162
diff changeset
   180
				AddGear(x, y, gtShell, 0, 0, 0, 0)
4106
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   181
				worsttime = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   182
				worsthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   183
				end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   184
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   185
			for i=0, ClansCount -1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   186
				local tt = "" .. (clantimes[i] / 1000) .. " s"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   187
				if clantimes[i] == 0 then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   188
					tt = "--"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   189
				end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   190
				hscore = hscore .. "|" .. string.format(loc(clantime), i+1) .. tt
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   191
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   192
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   193
			ShowMission(loc(caption), "", loc(done) .. (ttime / 1000) .. " s" .. hscore, 0, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   194
			TurnTimeLeft = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   195
		end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   196
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   197
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   198
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   199
function onGearAdd(gear)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   200
	if GetGearType(gear) == gtHedgehog then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   201
		hhs[numhhs] = gear
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   202
		times[numhhs] = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   203
		numhhs = numhhs + 1
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   204
	elseif GetGearType(gear) == gtRope then -- rope is shot
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   205
		
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   206
	end
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
function onGearDelete(gear)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   210
	if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   211
		--TurnTimeLeft = 0 -- end turn or not? hm...
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   212
		lasthog = CurrentHedgehog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   213
		
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   214
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   215
end