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