share/hedgewars/Data/Maps/TrophyRace/map.lua
author Palewolf
Sat, 06 Nov 2010 14:05:17 +0100
changeset 4145 84008f2ca18d
parent 4106 6a52c80a20ba
child 4162 923db448ad16
permissions -rw-r--r--
Fix watermelon fragments stray pixels. Clean Nature/Landtex.svg a little
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",
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     5
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     6
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     7
local goal = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
     8
	["en"] = "Use your rope to get from start to finish as fast as you can!",
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 done = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    12
	["en"] = "You've reached the goal!| |Time: ",
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 eliminated = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    16
	["en"] = "Eliminating worst hedgehog this round...| |%s is OUT!",
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 newbesttime = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    20
	["en"] = "NEW fastest lap: ",
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    21
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    22
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    23
local oldbesttime = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    24
	["en"] = "Fastest lap: ",
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    25
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    26
local bestclantimes = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    27
	["en"] = "Best laps per team: ",
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    28
	}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    29
local clantime = {
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    30
	["en"] = "Team %d: ",
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 function loc(text)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    34
	if text == nil then return "**missing**"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    35
	elseif text[L] == nil then return text["en"]
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    36
	else return text[L]
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    37
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    38
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    39
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    40
---------------------------------------------------------------
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    41
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    42
-- store number of hedgehogs
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    43
local numhhs = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    44
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    45
-- store hedgehog gears
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    46
local hhs = {}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    47
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    48
-- store best time per team
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    49
local clantimes = {}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    50
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    51
-- store best times
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    52
local times = {}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    53
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    54
-- in milisseconds
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    55
local maxtime = 99000
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    56
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    57
-- define start area (left, top, width, height)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    58
local start_area = {1606, 498, 356, 80}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    59
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    60
-- define goal area (left, top, width, height)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    61
local goal_area = {2030, 300, 56, 280}
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    62
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    63
-- last active hog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    64
local lasthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    65
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    66
-- active hog reached the goal?
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    67
local reached = false
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    68
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    69
-- hog with best time
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    70
local besthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    71
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    72
-- hog with worst time (per round)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    73
local worsthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    74
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    75
-- best time
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    76
local besttime = maxtime + 1
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    77
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    78
-- worst time (per round)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    79
local worsttime = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    80
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    81
function onGameInit()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    82
	GameFlags = gfSolidLand + gfInvulnerable
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    83
	TurnTime = maxtime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    84
	CaseFreq = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    85
	LandAdds = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    86
	Explosives = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    87
	Delay = 500
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    88
	SuddenDeathTurns = 99999 -- "disable" sudden death
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    89
	Theme = 'Olympics'
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    90
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    91
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    92
function onGameStart()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    93
	ShowMission(loc(caption), "", loc(goal), -amRope, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    94
	started = true
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    95
	p=1820
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    96
	for i = 0, numhhs - 1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    97
	p = p + 50	
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    98
	SetGearPosition(hhs[i], p, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
    99
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   100
	
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   101
	for i=0, ClansCount-1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   102
		clantimes[i] = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   103
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   104
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   105
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   106
function onAmmoStoreInit()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   107
	SetAmmo(amRope, 9, 2, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   108
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   109
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   110
function onGameTick()
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   111
	if TurnTimeLeft == 1 and CurrentHedgehog ~= nil then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   112
		SetHealth(CurrentHedgehog, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   113
		x, y = GetGearPosition(CurrentHedgehog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   114
		AddGear(x, y, gtAmmo_Grenade, 0, 0, 0, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   115
		worsttime = 99999
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   116
		worsthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   117
	elseif TurnTimeLeft == maxtime - 1 and CurrentHedgehog ~= nil then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   118
		if lasthog ~= nil then 
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   119
		SetGearPosition(lasthog, p , 0)
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
		reached = false
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   122
		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
   123
	elseif CurrentHedgehog ~= nil then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   124
		x, y = GetGearPosition(CurrentHedgehog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   125
		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
   126
			reached = true
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   127
			local ttime = maxtime - TurnTimeLeft
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   128
			--give it a sound;)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   129
			if ttime < besttime then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   130
				PlaySound (sndHomerun)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   131
			else
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   132
				PlaySound (sndHellish)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   133
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   134
			for i = 0, numhhs - 1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   135
				if hhs[i] == CurrentHedgehog then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   136
					times[numhhs] = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   137
				end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   138
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   139
				
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   140
			local hscore = "| |"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   141
			local clan = GetHogClan(CurrentHedgehog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   142
			if ttime < clantimes[clan] or clantimes[clan] == 0 then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   143
				clantimes[clan] = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   144
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   145
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   146
			if ttime < besttime then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   147
				besttime = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   148
				besthog = CurrentHedgehog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   149
				hscore = hscore .. loc(newbesttime)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   150
			else
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   151
				hscore = hscore .. loc(oldbesttime)
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
			if ttime > worsttime then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   154
				worsttime = ttime
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   155
				worsthog = CurrentHedgehog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   156
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   157
			hscore = hscore .. GetHogName(besthog) .. " - " .. (besttime / 1000) .. " s | |" .. loc(bestclantimes)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   158
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   159
			if clan == ClansCount -1 then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   160
				-- 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
   161
				SetHealth(worsthog, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   162
				--Place a grenade to make inactive slowest hog active
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   163
				x, y = GetGearPosition(worsthog)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   164
				AddGear(x, y, gtAmmo_Grenade, 0, 0, 0, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   165
				worsttime = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   166
				worsthog = nil
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   167
				end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   168
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   169
			for i=0, ClansCount -1 do
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   170
				local tt = "" .. (clantimes[i] / 1000) .. " s"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   171
				if clantimes[i] == 0 then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   172
					tt = "--"
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   173
				end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   174
				hscore = hscore .. "|" .. string.format(loc(clantime), i+1) .. tt
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   175
			end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   176
			
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   177
			ShowMission(loc(caption), "", loc(done) .. (ttime / 1000) .. " s" .. hscore, 0, 0)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   178
			TurnTimeLeft = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   179
		end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   180
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   181
end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   182
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   183
function onGearAdd(gear)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   184
	if GetGearType(gear) == gtHedgehog then
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   185
		hhs[numhhs] = gear
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   186
		times[numhhs] = 0
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   187
		numhhs = numhhs + 1
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   188
	elseif GetGearType(gear) == gtRope then -- rope is shot
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   189
		
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   190
	end
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
function onGearDelete(gear)
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   194
	if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   195
		--TurnTimeLeft = 0 -- end turn or not? hm...
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   196
		lasthog = CurrentHedgehog
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   197
		
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   198
	end
6a52c80a20ba new maps: ShoppaKing and TrophyRace
Dragonfly
parents: 4080
diff changeset
   199
end