merge with tip 0.9.19 0.9.19-release
authorunc0rr
Fri, 31 May 2013 00:12:11 +0400
branch0.9.19
changeset 9089 1617149e01a4
parent 9086 77f471657230 (current diff)
parent 9088 553355472675 (diff)
child 9090 9ceacd996ea0
merge with tip
Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Nobody_Laugh.png has changed
Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Nobody_Laugh@2x.png has changed
--- a/share/hedgewars/Data/Locale/missions_en.txt	Fri May 31 00:10:59 2013 +0400
+++ b/share/hedgewars/Data/Locale/missions_en.txt	Fri May 31 00:12:11 2013 +0400
@@ -43,6 +43,9 @@
 User_Mission_-_Rope_Knock_Challenge.name=Challenge: Rope Knocking
 User_Mission_-_Rope_Knock_Challenge.desc="Look behind you!"
 
+User_Mission_-_Nobody_Laugh.name=Mission: Nobody Laugh
+User_Mission_-_Nobody_Laugh.desc="This ain't no joke."
+
 User_Mission_-_RCPlane_Challenge.name=Challenge: RC Plane
 User_Mission_-_RCPlane_Challenge.desc="Feeling pretty confident, eh, flyboy?"
 
--- a/share/hedgewars/Data/Missions/Training/User_Mission_-_Dangerous_Ducklings.lua	Fri May 31 00:10:59 2013 +0400
+++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_Dangerous_Ducklings.lua	Fri May 31 00:12:11 2013 +0400
@@ -1,11 +1,9 @@
 
 HedgewarsScriptLoad("/Scripts/Locale.lua")
 
-
 local player = nil -- This variable will point to the hog's gear
 local instructor = nil
 local enemy = nil
---local givenSpeech = false
 
 local speechStage = 0
 
@@ -33,22 +31,18 @@
 
 	AddTeam(loc("Bloody Rookies"), 14483456, "Simple", "Island", "Default")
 	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
+	instructor = AddHog(loc("Instructor"), 0, 100, "sf_vega")
 
-	--AddTeam("Instructors", 14483456, "Simple", "Island", "Default")
-	instructor = AddHog(loc("Instructor"), 1, 1, "sf_vega")
-
-	AddTeam("Blue Team", 29439, "Simple", "Island", "Default")
-	enemy = AddHog("Filthy Blue", 1, 100, "Skull")
+	AddTeam(loc("Blue Team"), 29439, "Simple", "Island", "Default")
+	enemy = AddHog(loc("Filthy Blue"), 1, 100, "Skull")
 
 	SetGearPosition(player,146,902)
 	SetGearPosition(instructor,317,902)
 	SetGearPosition(enemy,1918,837)
 
-
 	HogSay(player, ".............................", SAY_THINK)
 	HogTurnLeft(instructor, true)
 
-
 end
 
 
@@ -59,15 +53,7 @@
 
 	FollowGear(player)
 
-	--spawnTarget()
-
-	-- Show some nice mission goals.
-	-- Parameters are: caption, sub caption, description,
-	-- extra text, icon and time to show.
-	-- A negative icon parameter (-n) represents the n-th weapon icon
-	-- A positive icon paramter (n) represents the (n+1)-th mission icon
-	-- A timeframe of 0 is replaced with the default time to show.
-	ShowMission(loc("Dangerous Ducklings"), "", loc("Eliminate the Blue Team"), -amRope, 1);
+	ShowMission(loc("Dangerous Ducklings"), "", loc("Eliminate the Blue Team"), -amRope, 5000);
 
 end
 
@@ -101,15 +87,14 @@
 
 	end
 
-
 	-- if player falls in water or if player ignores speech
 	if (CurrentHedgehog ~= nil) and (CurrentHedgehog == player) then
-		if (GetY(player) > 2060) and (gameLost == false) then
+		if (GetY(player) > WaterLine) and (gameLost == false) then
 			HogSay(instructor, loc("DAMMIT, ROOKIE!"), SAY_SHOUT)
 			gameLost = true
 		end
 
-		if (GetX(player) > 1324) and (GetY(player) > 1908) and (notListening == false) and (speechStage < 3) then
+		if (GetX(player) > 300) and (GetY(player) > 880) and (notListening == false) and (speechStage < 3) then
 			HogSay(instructor, loc("DAMMIT, ROOKIE! GET OFF MY HEAD!"), SAY_SHOUT)
 			notListening = true
 		end
@@ -126,10 +111,11 @@
 		endTimer = endTimer + 1
 		if (CurrentHedgehog ~= nil) and (CurrentHedgehog == instructor) then
 			if endTimer >= 3000 then
-				SetHealth(instructor,0)
-				TurnTimeLeft = 0
+				--SetHealth(instructor,0)
+				TurnTimeLeft = 1
+				ParseCommand("teamgone " .. loc("Bloody Rookies"))
 			end
-			ShowMission(loc("MISSION FAILED"), loc(":("), loc("You've failed. Try again."), -amRope, 1);
+			ShowMission(loc("MISSION FAILED"), loc(":("), loc("You've failed. Try again."), -amRope, 5000);
 		end
 	end
 
@@ -146,9 +132,12 @@
 	if GetGearType(gear) == gtHedgehog then
 		if gear == player then
 			gameLost = true
-		elseif gear == instructor then
+		elseif (gear == instructor) and (GetY(gear) > WaterLine) then
 			HogSay(player, loc("See ya!"), SAY_THINK)
 			TurnTimeLeft = 3000
+			AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Naughty Ninja"),0xffba00ff,capgrpMessage2)
+			ParseCommand("teamgone " .. loc("Blue Team"))
+			gameWon = true
 		elseif gear == enemy then
 			HogSay(player, loc("Enjoy the swim..."), SAY_THINK)
 			gameWon = true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_Nobody_Laugh.lua	Fri May 31 00:12:11 2013 +0400
@@ -0,0 +1,130 @@
+--------------------------------------
+-- NOBODY LAUGH
+-- a hilarious (not really) adventure
+--------------------------------------
+
+HedgewarsScriptLoad("/Scripts/Locale.lua")
+HedgewarsScriptLoad("/Scripts/Tracker.lua")
+
+local hhs = {}
+
+function onGameInit()
+
+	Seed = 0
+	GameFlags = gfInfAttack + gfPerHogAmmo +gfDisableWind
+	SuddenDeathTurns = 9999
+	TurnTime = 180000
+	CaseFreq = 0
+	MinesNum = 0
+	Explosives = 0
+	Map = "Bath"
+	Theme = "Nature"
+
+	AddTeam(loc("Nameless Heroes"), 14483456, "eyecross", "Wood", "HillBilly", "cm_birdy")
+	hhs[1] = AddHog(loc( "Hunter" ), 0, 1, "Skull")
+	SetGearPosition(hhs[1], 1267, 451)
+	hhs[2] = AddHog(loc("Drowner"), 0, 31, "mp3")
+	SetGearPosition(hhs[2], 1332, 451)
+
+	AddTeam(loc("Clowns"), 1175851, "Duck2", "Tank", "Mobster", "cm_spider")
+	hhs[3] = AddHog("Poison", 5, 100, "WhySoSerious")
+	SetGearPosition(hhs[3], 1133, 446)
+	hhs[4] = AddHog("Bobo", 5, 100, "clown")
+	SetGearPosition(hhs[4], 1215, 553)
+	hhs[5] = AddHog("Copper", 5, 10, "clown-copper")
+	SetGearPosition(hhs[5], 414, 376)
+	hhs[6] = AddHog("Derp", 5, 100, "clown-crossed")
+	SetGearPosition(hhs[6], 1590, 886)
+	hhs[7] = AddHog("Eckles", 5, 100, "clown-copper")
+	SetGearPosition(hhs[7], 772, 754)
+	hhs[8] = AddHog("Frank", 5, 50, "clown-copper")
+	SetGearPosition(hhs[8], 1688, 714)
+	hhs[9] = AddHog("Harry", 5, 50, "clown-copper")
+	SetGearPosition(hhs[9], 1932, 837)
+	hhs[10] = AddHog("Igmund", 5, 50, "WhySoSerious")
+	SetGearPosition(hhs[10], 1601, 733)
+
+end
+
+function onGameStart()
+
+	AddAmmo(enemy, amAirAttack, 100)
+
+	ShowMission(	loc("Nobody Laugh"),
+					loc("User Challenge"),
+					loc("Eliminate the enemy before the time runs out")
+					, 0, 0
+				)
+
+	-- GIRDERS
+	PlaceGirder(1212, 710, 7)
+	PlaceGirder(1215, 570, 4)
+	PlaceGirder(1288, 520, 2)
+	PlaceGirder(1184, 468, 4)
+	PlaceGirder(1344, 468, 4)
+	PlaceGirder(1247, 346, 4)
+
+	PlaceGirder(667, 438, 4)
+	PlaceGirder(507, 438, 4)
+	PlaceGirder(434, 487, 2)
+	PlaceGirder(505, 537, 4)
+	PlaceGirder(665, 537, 4)
+	PlaceGirder(737, 487, 2)
+
+	PlaceGirder(416, 465, 6)
+	PlaceGirder(1415, 378, 6)
+	PlaceGirder(1300, 625, 3)
+	PlaceGirder(1359, 566, 3)
+	PlaceGirder(1436, 538, 0)
+	PlaceGirder(1505, 468, 4)
+
+	------ AMMO CRATE LIST ------
+	tempG = SpawnAmmoCrate(1242, 315, amBaseballBat)
+	tempG = SpawnAmmoCrate(1309, 315, amAirAttack)
+	tempG = SpawnAmmoCrate(144, 895, amAirAttack)
+	tempG = SpawnAmmoCrate(664, 699, amIceGun)
+	tempG = SpawnAmmoCrate(1572, 444, amFirePunch)
+	tempG = SpawnAmmoCrate(1574, 382, amDynamite)
+
+	------ UTIL CRATE LIST ------
+	tempG = SpawnUtilityCrate(654, 513, amParachute)
+	tempG = SpawnUtilityCrate(1569, 413, amParachute)
+
+	-- HOG AMMO
+	AddAmmo(hhs[1],amParachute,1)
+	AddAmmo(hhs[1],amHammer,1)
+	AddAmmo(hhs[2],amWhip,1)
+
+	for i = 3, 10 do
+		AddAmmo(hhs[i], amDeagle, 100)
+		AddAmmo(hhs[i], amShotgun, 100)
+		AddAmmo(hhs[i], amGrenade, 100)
+		AddAmmo(hhs[i], amBazooka, 100)
+		AddAmmo(hhs[i], amDrill, 100)
+	end
+
+end
+
+function onNewTurn()
+	SetWind(100)
+end
+
+function onAmmoStoreInit()
+
+	SetAmmo(amBaseballBat, 0, 0, 0, 1)
+	SetAmmo(amAirAttack, 0, 0, 0, 1)
+	SetAmmo(amFirePunch, 0, 0, 0, 1)
+	SetAmmo(amDynamite, 0, 0, 0, 1)
+	SetAmmo(amHammer, 0, 0, 0, 1)
+	SetAmmo(amIceGun, 0, 0, 0, 1)
+
+	SetAmmo(amParachute, 0, 0, 0, 1)
+
+	SetAmmo(amSwitch, 9, 0, 0, 0)
+	SetAmmo(amSkip, 9, 0, 0, 0)
+
+end
+
+------------------------------
+--                  I'm in         whitesppaaaaaaaaaacceeeee           :D
+------------------------------
--- a/share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua	Fri May 31 00:10:59 2013 +0400
+++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua	Fri May 31 00:12:11 2013 +0400
@@ -20,7 +20,7 @@
 	Explosives = 0
 
 	AddTeam(loc("Wannabe Flyboys"), 14483456, "Simple", "Island", "Default", "Hedgewars")
-	player = AddHog(loc("Ace"), 0, 80, "Gasmask") --NoHat
+	player = AddHog(loc("Ace"), 0, 80, "Gasmask")
 	SetGearPosition(player, 1380, 1500)
 
 end
@@ -314,6 +314,10 @@
 
 		if cratesLeft == 0 then
 
+			if planesUsed == 1 then
+				AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Prestigious Pilot"),0xffba00ff,capgrpMessage2)
+			end
+
 			ShowMission     (
                                 loc("CHALLENGE COMPLETE"),
                                 loc("Congratulations!"),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Frenzy.cfg	Fri May 31 00:12:11 2013 +0400
@@ -0,0 +1,2 @@
+Default
+locked
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Frenzy.lua	Fri May 31 00:12:11 2013 +0400
@@ -0,0 +1,142 @@
+-------------------------------------------
+-- FRENZY
+-- a hedgewars mode inspired by Hysteria
+-------------------------------------------
+
+HedgewarsScriptLoad("/Scripts/Locale.lua")
+HedgewarsScriptLoad("/Scripts/Tracker.lua")
+
+local cTimer = 0
+local cn = 0
+
+function initialSetup(gear)
+	SetHealth(gear, 75) -- official is 80, but that assumes bazookas/grenades that do 50 damage
+end
+
+function showStartingInfo()
+
+	ruleSet = "" ..
+	loc("RULES") .. ": " .. "|" ..
+	loc("Each turn is only ONE SECOND!") .. "|" ..
+	loc("Use your ready time to think.") .. "|" ..
+	loc("Slot keys save time! (F1-F10 by default)") .. "|" ..
+	" |" ..
+	loc("SLOTS") .. ": " .. "|" ..
+	loc("Slot") .. " 1 - " .. loc("Bazooka") .. "|" ..
+	loc("Slot") .. " 2 - " .. loc("Grenade") .. "|" ..
+	loc("Slot") .. " 3 - " .. loc("Shotgun") .. "|" ..
+	loc("Slot") .. " 4 - " .. loc("Shoryuken") .. "|" ..
+	loc("Slot") .. " 5 - " .. loc("Mine") .. "|" ..
+	loc("Slot") .. " 6 - " .. loc("Teleport") .. "|" ..
+	loc("Slot") .. " 7 - " .. loc("Blowtorch") .. "|" ..
+	loc("Slot") .. " 8 - " .. loc("Flying Saucer") .. "|" ..
+	loc("Slot") .. " 9 - " .. loc("Molotov") .. "|" ..
+	loc("Slot") .. " 10 - " .. loc("Low Gravity")
+
+	ShowMission(loc("FRENZY"),
+                loc("a frenetic Hedgewars mini-game"),
+                ruleSet, 0, 4000)
+
+end
+
+function onGameInit()
+
+	if TurnTime > 10001 then
+		Ready = 8000
+	else
+		Ready = TurnTime
+	end
+
+	TurnTime = 1000
+
+	--These are the official settings, but I think I prefer allowing customization in this regard
+	--MinesNum = 8
+	--MinesTime = 3000
+	--MinesDudPercent = 30
+	--Explosives = 0
+
+	--Supposedly official settings
+	HealthCaseProb = 0
+	CrateFreq = 0
+
+	--Approximation of Official Settings
+	--SuddenDeathTurns = 10
+	--WaterRise = 47
+	--HealthDecrease = 0
+
+end
+
+function onGameStart()
+	showStartingInfo()
+	runOnHogs(initialSetup)
+end
+
+function onSlot(sln)
+	cTimer = 8
+	cn = sln
+end
+
+function onGameTick()
+	if cTimer ~= 0 then
+		cTimer = cTimer -1
+		if cTimer == 1 then
+			ChangeWep(cn)
+			cn = 0
+			cTimer = 0
+		end
+	end
+end
+
+function ChangeWep(s)
+
+	if s == 0 then
+		ParseCommand("setweap " .. string.char(amBazooka))
+	elseif s == 1 then
+		ParseCommand("setweap " .. string.char(amGrenade))
+	elseif s == 2 then
+		ParseCommand("setweap " .. string.char(amShotgun))
+	elseif s == 3 then
+		ParseCommand("setweap " .. string.char(amFirePunch))
+	elseif s == 4 then
+		ParseCommand("setweap " .. string.char(amMine))
+	elseif s == 5 then
+		ParseCommand("setweap " .. string.char(amTeleport))
+	elseif s == 6 then
+		ParseCommand("setweap " .. string.char(amBlowTorch))
+	elseif s == 7 then
+		ParseCommand("setweap " .. string.char(amJetpack))
+	elseif s == 8 then
+		ParseCommand("setweap " .. string.char(amMolotov))
+	elseif s == 9 then
+		ParseCommand("setweap " .. string.char(amLowGravity))
+	end
+
+end
+
+function onGearAdd(gear)
+	if GetGearType(gear) == gtHedgehog then
+		trackGear(gear)
+	end
+end
+
+function onGearDelete(gear)
+	if GetGearType(gear) == gtHedgehog then
+		trackDeletion(gear)
+	end
+end
+
+function onAmmoStoreInit()
+	SetAmmo(amBazooka, 9, 0, 0, 0)
+	SetAmmo(amGrenade, 9, 0, 0, 0)
+	SetAmmo(amMolotov, 9, 0, 0, 0)
+	SetAmmo(amShotgun, 9, 0, 0, 0)
+	--SetAmmo(amFlamethrower, 9, 0, 0, 0) -- this was suggested on hw.org but it's not present on base
+	SetAmmo(amFirePunch, 9, 0, 0, 0)
+	SetAmmo(amMine, 9, 0, 0, 0)
+	--SetAmmo(amCake, 1, 0, 2, 0) -- maybe it's beefcake?
+	SetAmmo(amJetpack, 9, 0, 0, 0)
+	SetAmmo(amBlowTorch, 9, 0, 0, 0)
+	SetAmmo(amTeleport, 9, 0, 0, 0)
+	SetAmmo(amLowGravity, 9, 0, 0, 0)
+	--SetAmmo(amSkipGo, 9, 0, 0, 0) -- not needed with 1s turn time
+end
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Fri May 31 00:10:59 2013 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Fri May 31 00:12:11 2013 +0400
@@ -1,6 +1,6 @@
 --------------------------------
 -- HIGHLANDER / HOGS OF WAR
--- version 0.4
+-- version 0.4b
 -- by mikade
 --------------------------------
 
@@ -63,10 +63,15 @@
 -- add more whitespace
 -- break everything
 
+-----------
+--0.4b
+-----------
+-- as per request, add ice-gun
+
 -------------------------
 -- ideas for the future
 -------------------------
--- add ice gun, structure
+-- add structure
 -- allow switcher, resurrector
 -- add abuse
 -- nerf teleport
@@ -90,7 +95,7 @@
 local atkArray = 	{
 					amBazooka, amBee, amMortar, amDrill, --[[amSnowball,]]
 					amGrenade, amClusterBomb, amMolotov, amWatermelon, amHellishBomb, amGasBomb,
-					amShotgun, amDEagle, amFlamethrower, amSniperRifle, amSineGun,
+					amShotgun, amDEagle, amFlamethrower, amSniperRifle, amSineGun, amIceGun,
 					amFirePunch, amWhip, amBaseballBat, --[[amKamikaze,]] amSeduction, --[[amHammer,]]
 					amMine, amDynamite, amCake, amBallgun, amRCPlane, amSMine,
 					amRCPlane, amSMine,
--- a/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Fri May 31 00:10:59 2013 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Fri May 31 00:12:11 2013 +0400
@@ -1,625 +1,615 @@
-local MUTANT_VERSION = "v0.9.4"
-
---[[                  ___                   ___
-                    (   )                 (   )
-___ .-. .-. ___  ___ | |_    .---. ___ .-. | |_
-(   )   '   (   )(   (   __) / .-, (   )   (   __)
-|  .-.  .-. | |  | | | |   (__) ; ||  .-. .| |
-| |  | |  | | |  | | | | ___ .'`  || |  | || | ___
-| |  | |  | | |  | | | |(   / .'| || |  | || |(   )
-| |  | |  | | |  | | | | | | /  | || |  | || | | |
-| |  | |  | | |  ; ' | ' | ; |  ; || |  | || ' | |
-| |  | |  | ' `-'  / ' `-' ' `-'  || |  | |' `-' ;
-(___)(___)(___'.__.'   `.__.`.__.'_(___)(___)`.__.
-
-
-----  IMPORTANT!
-----
-----  You should save (press Ctrl+S) this script to:
-----  Program Files\Hedgewars\share\hedgewars\Data\Scripts\Multiplayer\Mutant.lua
-----     or (on Linux):
-----  ~/.hedgewars/Data/Scripts/Multiplayer/Mutant.lua
-----
-----  (or wherever scripts like Highlander.lua, Racer.lua are on your system)
-----
-----  Also, if you didn't have Mutant script yet, you need to restart Hedgewars for it to find the script file.
-----
-
-
-----  GAME RULES
-----
-----  Recommended settings:
-----    * one hedgehog per team
-----    * 'Small' one-island map
-----
-----  First one to kill anyone becomes Mutant. Mutant has super-weapons
-----  and a lot of health, which however depletes if he doesn't frag fast.
-----  Goal of Mutant is to use his weapons to hold his status for as long
-----  as he can.
-----  Goal of others is to hunt the Mutant down. The one who kills Mutant,
-----  becomes Mutant himself.
-----  The player with least points (or most deaths) is Bottom Feeder. He
-----  can gain points by killing anyone. Other normal players only get points
-----  for killing Mutant.
-----
-----  Points:
-----    +2 for becoming a Mutant
-----    +1 to a Mutant for killing anyone
-----    +1 to a Bottom Feeder for killing anyone
-----    -1 to anyone for a suicide
-----   other kills don't give you points.
-----
-
---]]
-
-HedgewarsScriptLoad("/Scripts/Locale.lua")
-HedgewarsScriptLoad("/Scripts/Tracker.lua")
-
---[[
-    MUTANT SCRIPT
-
-    To Do:  -Clean-up this fucking piece of code
-            -Debug
-            -Find a girlfriend
-            -Fix Sheepluva's hat  +[p]
-            -Cookies
-
------------------------]]
-
-local hhs = {}
-local numhhs = 0
-
-local gameOver=false
-
-local mutant = nil
-local mutant_base_health = 200
-local mutant_base_disease = 25
-local disease_timer = 2000
-
-local kill_reward = nil
-local mt_hurt=false
-
-local killsCounter = 0
-
-local team_fire_punishment = 3
-local mutant_kill_reward = 2
-
-local hh_weapons = { amBazooka, amGrenade, amShotgun, amMine}
-
-local mt_weapons = {amWatermelon, amHellishBomb, amBallgun, amRCPlane, amTeleport}
-
-local disease=0
-local timer=0
-
-local winScore = 15
-local hogsLimit = 1
-
-local teams = {}
-
-local circles = {}
-local circleFrame = -1
-
-function onGameInit()
-    TurnTime = 20000
-    WaterRise = 0
-    GameFlags = GameFlags + gfResetWeps + gfPerHogAmmo
-    HealthCaseProb=0
-    HealthCaseAmount=0
-    MinesTime=1000
-    CaseFreq = 2
-
-end
-
-
-function limitHogs(gear)
-    cnthhs = cnthhs + 1
-        if cnthhs > 1 then
-            hogLimitHit = true
-            SetEffect(gear, heResurrectable, false)
-            --SetHealth(gear, 0)
-            SetGearPosition(gear, -100,LAND_HEIGHT)
-        end
-end
-
-function onGameStart()
-    trackTeams()
-    teamScan()
-    runOnHogs(saveStuff)
-    --local str = "/say " .. MUTANT_VERSION
-    --ParseCommand(str)
-
-    hogLimitHit = false
-    for i=0 , TeamsCount - 1 do
-        cnthhs = 0
-        runOnHogsInTeam(limitHogs, teams[i])
-    end
-    if hogLimitHit then
-        AddCaption(loc("ONE HOG PER TEAM! KILLING EXCESS HEDGES"))
-    end
-end
-
-
-
-function giveWeapons(gear)
-
-    if gear == mutant then
-        AddAmmo(gear, amRope)
-        for i=1, #mt_weapons do
-            AddAmmo(gear, mt_weapons[i])
-        end
-
-    else
-        for i=1, #hh_weapons do
-            AddAmmo(gear,hh_weapons[i])
-        end
-    end
-end
-
-function onAmmoStoreInit()
-
-    SetAmmo(amSkip, 9, 0, 0, 0)
-    SetAmmo(amRope,0,1,0,5)
-    SetAmmo(amSnowball,0,1,0,1)
-
-    for i=1, #hh_weapons do
-        SetAmmo(hh_weapons[i], 0, 0, 0, 1)
-    end
-
-    for i=1, #mt_weapons do
-        SetAmmo(mt_weapons[i], 0, 3, 0, 1)
-    end
-
-end
-
-function drawCircles()
-    for i = 0, #hhs do
-        if circles[hhs[i]] ~= nil then
-            DeleteVisualGear(circles[hhs[i]])
-            circles[hhs[i]] = nil
-        end
-
-        if hhs[i] ~= CurrentHedgehog then
-            if mutant == nil then
-                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
-                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080)
-            elseif CurrentHedgehog == mutant then
-                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
-                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070)
-            elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then
-                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
-                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070)
-            elseif hhs[i] == mutant then
-                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
-                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080)
-            end
-        end
-    end
-    circleFrame = 0
-end
-
-function onNewTurn()
-
-    trackTeams()
-    killsCounter = 0
-
-    if mutant == nil then
-        AddCaption( loc("FIRST BLOOD MUTATES") )
-    end
-
-    checkScore()
-    giveWeapons(CurrentHedgehog)
-    drawCircles()
-    setAIHints()
-    kill_reward= numhhs*10
-
-    if CurrentHedgehog == mutant then
-        mt_hurt=true
-        disease= mutant_base_disease - numhhs
-    else
-        mt_hurt=false
-    end
-
-    setGearValue(CurrentHedgehog, "Alive", true)
-
-end
-
-function countBodies()
-        if killsCounter == 2 then
-            AddCaption(loc("DOUBLE KILL"))
-        elseif killsCounter == 3 then
-            AddCaption(loc("MEGA KILL"))
-            PlaySound(sndRegret)
-        elseif killsCounter == 4 then
-            AddCaption(loc("ULTRA KILL"))
-        elseif killsCounter == 5 then
-            AddCaption(loc("MONSTER KILL"))
-            PlaySound(sndIllGetYou)
-        elseif killsCounter == 6 then
-            AddCaption(loc("LUDICROUS KILL"))
-            PlaySound(sndNutter)
-        elseif killsCounter == 7 then
-            AddCaption(loc("HOLY SHYTE!"))
-            PlaySound(sndLaugh)
-        elseif killsCounter > 8 then
-            AddCaption(loc("INSANITY"))
-        end
-
-end
-
-function onGameTick()
-
-    if circleFrame > -1 then
-        for i = 0, #hhs do
-            if circles[hhs[i]] ~= nil and hhs[i]~= nil then
-                hhx, hhy = GetGearPosition(hhs[i])
-                X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint = GetVisualGearValues(circles[hhs[i]])
-                SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25), Timer, Tint)
-            end
-        end
-
-        circleFrame = circleFrame + 0.06
-
-        if circleFrame >= 25 then
-            for i = 0, #hhs do
-                if circles[hhs[i]] ~= nil then
-                    DeleteVisualGear(circles[hhs[i]])
-                    circles[hhs[i]] = nil
-                end
-            end
-        end
-    end
-
-    if TurnTimeLeft==0 and mt_hurt then
-        mt_hurt = false
-    end
-
-    if mt_hurt and mutant~=nil then
-        timer = timer + 1
-            if timer > disease_timer then
-                timer = 0
-                SetHealth(mutant, GetHealth(mutant)-disease )
-                AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true)
-                    if GetHealth(mutant)<=0 then
-                        SetHealth(mutant,0)
-                        mt_hurt= false
-                        setGearValue(mutant,"SelfDestruct",true)
-                        TurnTimeLeft = 0
-                    end
-            end
-    end
-end
-
-function saveStuff(gear)
-    setGearValue(gear,"Name",GetHogName(gear))
-    setGearValue(gear,"Hat",GetHogHat(gear))
-end
-
-function armageddon(gear)
-    SetState(gear, gstLoser)
-    SetEffect(gear, heResurrectable, false)
-    SetHealth(gear, 0)
-end
-
-function updateScore()
-local showScore = ""
-
-    for i=0, TeamsCount-1 do
-        if teams[i]~= nil then
-
-            local curr_score = getTeamValue(teams[i], "Score")
-            showScore = showScore .. teams[i] .. ": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|"
-
-        end
-    end
-
-    ShowMission(loc("Score"),
-                "-------",
-                showScore, 0, 200)
-
-    HideMission()
-
-end
-
-function checkScore()
-local showScore = ""
-local lowest_score_team = nil
-local min_score=nil
-local winTeam = nil
-
-local only_low_score = true
-
-    for i=0, TeamsCount-1 do
-        if teams[i]~=nil then
-            local curr_score = getTeamValue(teams[i], "Score")
-
-            runOnHogsInTeam(removeFeeder, teams[i])
-
-            showScore = showScore .. teams[i] ..": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|"
-
-            if curr_score >= winScore then
-                gameOver = true
-                winTeam = teams[i]
-            end
-
-            if min_score==nil then
-                min_score= curr_score
-                lowest_score_team = teams[i]
-            else
-                if curr_score <= min_score then
-                    if curr_score == min_score then
-                        if getTeamValue(teams[i], "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then
-                            only_low_score = false
-                        else
-                            if getTeamValue(teams[i], "DeadHogs") > getTeamValue(lowest_score_team, "DeadHogs") then
-                                lowest_score_team = teams[i]
-                            end
-                            only_low_score = true
-                        end
-
-                    else
-                        min_score= curr_score
-                        lowest_score_team = teams[i]
-                        only_low_score = true
-                    end
-                end
-            end
-        end
-    end
-
-    if gameOver then
-        TurnTimeLeft = 0
-        for i=0, #teams do
-            if teams[i]~=winTeam then
-                runOnHogsInTeam(armageddon, teams[i])
-            end
-        end
-
-    ShowMission(    loc("WINNER IS ") .. winTeam,
-                    "~~~~~~~~~~~~~~~~~~~~~~~~~",
-                    showScore, 0, 200)
-    else
-
-    if only_low_score then
-        runOnHogsInTeam(setFeeder, lowest_score_team)
-    end
-
-    ShowMission(    loc("Score"),
-                    loc("-------"),
-                    showScore, 0, 200)
-
-    end
-end
-
-function backToNormal(gear)
-
-    SetHogName(gear, getGearValue(gear,"Name"))
-    SetHogHat(gear, 'NoHat')
-    SetHogHat(gear, getGearValue(gear,"Hat"))
-    setGearValue(mutant,"SelfDestruct",false)
-    mt_hurt=false
-    mutant=nil
-end
-
-function setAIHints()
-    for i = 0, #hhs do
-        if mutant == nil or hhs[i] == mutant or CurrentHedgehog == mutant then
-            SetGearAIHints(hhs[i], aihUsual)
-        else
-            SetGearAIHints(hhs[i], aihDoesntMatter)
-        end
-    end
-end
-
-function removeFeeder(gear)
-
-    if gear~=nil then
-        setGearValue(gear,"Feeder",false)
-        if gear~= mutant then
-            SetHogName(gear, getGearValue(gear,"Name") )
-            SetHogHat(gear, 'NoHat')
-            SetHogHat(gear, getGearValue(gear,"Hat"))
-        end
-    end
-end
-
-function setFeeder(gear)
-
-    if gear~= mutant and gear~= nil then
-        SetHogName(gear,"BOTTOM FEEDER")
-        SetHogHat(gear, 'poke_slowpoke')
-        setGearValue(gear,"Feeder", true)
-    end
-end
-
-function setMutantStuff(gear)
-    mutant = gear
-
-    SetHogName(gear,"MUTANT")
-    SetHogHat(gear,'WhySoSerious')
-    SetHealth(gear, ( mutant_base_health + numhhs*25) )
-    SetEffect(gear, hePoisoned, 1)
-    setGearValue(mutant,"SelfDestruct",false)
-    setGearValue(gear, "Feeder", false)
-
-    AddCaption(getGearValue(gear, "Name") .. loc(" HAS MUTATED"))
-
-    TurnTimeLeft=0
-
-    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
-    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
-    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
-    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
-    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
-    PlaySound(sndSuddenDeath)
-end
-
-function teamScan()
-
-        for i=0, TeamsCount-1 do --nil filling
-        teams[i]=nil
-        end
-
-        for i=0, #hhs do
-            for j=0, TeamsCount-1 do
-                if teams[j] ==nil and hhs[i]~=nil then
-                teams[j] = GetHogTeamName(hhs[i])
-                setTeamValue(teams[j],"Score",0)
-                setTeamValue(teams[j], "DeadHogs",0)
-                break
-                end
-
-                if teams[j] == GetHogTeamName(hhs[i]) then
-                    break
-                end
-            end
-        end
-
-        ---***---
-end
-
-
-function onGearDamage(gear, dmg)
-
-end
-
-function set_Mutant_and_Score(gear)
-
-local curr_team = GetHogTeamName(CurrentHedgehog)
-
-    if gear == CurrentHedgehog then
-        if CurrentHedgehog == mutant then
-            PlaySound(sndHomerun)
-            if getGearValue(gear, "SelfDestruct")==false then
-                decreaseTeamValue(curr_team,"Score")
-            end
-            backToNormal(gear)
-        else
-            decreaseTeamValue(curr_team,"Score")
-        end
-
-    else
-            if gear == mutant then
-                    backToNormal(mutant)
-                    if curr_team ~=GetHogTeamName(gear) then
-                            if  getGearValue(CurrentHedgehog, "Alive") then
-                            setMutantStuff(CurrentHedgehog)
-                            setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
-                            end
-                    else
-                        setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
-                    end
-            else
-                if mutant==nil then
-                        if curr_team ~=GetHogTeamName(gear) then
-                            if getGearValue(CurrentHedgehog, "Alive") then
-                                    setMutantStuff(CurrentHedgehog)
-                                    setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
-                            else
-                                increaseTeamValue(curr_team,"Score")
-                            end
-                        else
-                            setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
-                        end
-                else
-                    if curr_team ~=GetHogTeamName(gear) then
-                        if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then
-                            SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+kill_reward)
-                            AddCaption("+" .. kill_reward .. loc(" HP") )
-                            increaseTeamValue(curr_team,"Score")
-                        end
-                        if getGearValue(CurrentHedgehog,"Feeder") then
-                            increaseTeamValue(curr_team,"Score")
-                        end
-                    else
-                        setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
-                    end
-                end
-            end
-    end
-end
-
-function onGearResurrect(gear)
-if not gameOver then
-    if GetGearType(gear) == gtHedgehog then
-
-        increaseTeamValue(GetHogTeamName(gear), "DeadHogs")
-
-        if gear==CurrentHedgehog then
-            setGearValue(CurrentHedgehog, "Alive", false)
-        end
-        set_Mutant_and_Score(gear)
-        if gear~=CurrentHedgehog then
-            killsCounter = killsCounter + 1
-            countBodies()
-        end
-        AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
-        PlaySound(sndWhack)
-        updateScore()
-    end
-end
-end
-
-function onGearAdd(gear)
-
-    -- Catch hedgehogs for the tracker
-    if GetGearType(gear) == gtHedgehog then
-        trackGear(gear)
-        hhs[numhhs] = gear
-        numhhs = numhhs + 1
-        SetEffect(gear, heResurrectable, 1)
-    end
-end
-
-function checkEmptyTeam (teamName)
-    for i=0 , #hhs do
-        if hhs[i]~=nil then
-            if teamName == GetHogTeamName(hhs[i]) then
-                return false
-            end
-        end
-    end
-    return true
-end
-
-function onGearDelete(gear)
-    -- Remove hogs that are gone
-    if GetGearType(gear) == gtHedgehog then
-        numhhs = numhhs - 1
-
-        local found
-        for i=0, #hhs do
-            if hhs[i] == gear then
-                found = i
-                break
-            end
-        end
-        for i = found, #hhs - 1 do
-            hhs[i] = hhs[i + 1]
-        end
-        hhs[#hhs] = nil
-
-        local t_name = GetHogTeamName(gear)
-        if checkEmptyTeam(t_name) then
-            for i = 0, TeamsCount - 1 do
-                if teams[i] == t_name then
-                    found = i
-                    break
-                end
-            end
-            for i = found, TeamsCount - 2 do
-                teams[i] = teams[i + 1]
-            end
-            teams[TeamsCount - 1] = nil
-            TeamsCount = TeamsCount - 1
-        end
-        AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
-        trackDeletion(gear)
-    end
-end
-
---[[
-S T A R R I N G
-
-    prof - Coding, implementing and evangelism
-    vos  - Initial idea and script improvements
---]]
+local MUTANT_VERSION = "v0.9.5"
+
+--[[                  ___                   ___
+                    (   )                 (   )
+___ .-. .-. ___  ___ | |_    .---. ___ .-. | |_
+(   )   '   (   )(   (   __) / .-, (   )   (   __)
+|  .-.  .-. | |  | | | |   (__) ; ||  .-. .| |
+| |  | |  | | |  | | | | ___ .'`  || |  | || | ___
+| |  | |  | | |  | | | |(   / .'| || |  | || |(   )
+| |  | |  | | |  | | | | | | /  | || |  | || | | |
+| |  | |  | | |  ; ' | ' | ; |  ; || |  | || ' | |
+| |  | |  | ' `-'  / ' `-' ' `-'  || |  | |' `-' ;
+(___)(___)(___'.__.'   `.__.`.__.'_(___)(___)`.__.
+
+
+----  Recommended settings:
+----    * one hedgehog per team
+----    * 'Small' one-island map
+
+--]]
+
+HedgewarsScriptLoad("/Scripts/Locale.lua")
+HedgewarsScriptLoad("/Scripts/Tracker.lua")
+
+--[[
+    MUTANT SCRIPT
+
+    To Do:  -Clean-up this fucking piece of code
+            -Debug
+            -Find a girlfriend
+            -Fix Sheepluva's hat  +[p]
+            -Cookies
+-----------------------]]
+
+local hhs = {}
+local numhhs = 0
+local meh = false
+
+local gameOver=false
+
+local mutant = nil
+local mutant_base_health = 200
+local mutant_base_disease = 25
+local disease_timer = 2000
+
+local kill_reward = nil
+local mt_hurt=false
+
+local killsCounter = 0
+
+local team_fire_punishment = 3
+local mutant_kill_reward = 2
+
+local hh_weapons = { amBazooka, amGrenade, amShotgun, amMine}
+
+local mt_weapons = {amWatermelon, amHellishBomb, amBallgun, amRCPlane, amTeleport}
+
+local disease=0
+local timer=0
+
+local winScore = 15
+local hogsLimit = 1
+
+local teams = {}
+
+local circles = {}
+local circleFrame = -1
+
+function showStartingInfo()
+
+	ruleSet = loc("RULES") .. ": " ..
+	" |" .. --" |" ..
+	loc("The first player to kill someone becomes the Mutant.") .. "|" ..
+	loc("The Mutant has super-weapons and a lot of health.") .. "|" ..
+	loc("The Mutant loses health quickly if he doesn't keep scoring kills.") .. "|" ..
+	" |" ..
+	loc("Normal players can only score points by killing the mutant.") .. "|" ..
+	" |" .. "" ..
+	loc("The player with least points (or most deaths) becomes the Bottom Feeder.") .. "|" ..
+	loc("The Bottom Feeder can score points by killing anyone.") .. "|" ..
+	" |" ..
+	loc("POINTS") .. ": " ..
+	" |" ..
+	loc("+2 for becoming a Mutant") .. "|" ..
+	loc("+1 to a Mutant for killing anyone") .. "|" ..
+	loc("+1 to a Bottom Feeder for killing anyone") .. "|" ..
+	loc("-1 to anyone for a suicide") .. "|" ..
+	loc("Other kills don't give you points.")
+
+	ShowMission(loc("Mutant"),
+                loc("a Hedgewars tag game"),
+                ruleSet, 0, 5000)
+
+end
+
+function onGameInit()
+    TurnTime = 20000
+    WaterRise = 0
+    GameFlags = GameFlags + gfResetWeps + gfPerHogAmmo
+    HealthCaseProb=0
+    HealthCaseAmount=0
+    MinesTime=1000
+    CaseFreq = 2
+end
+
+
+function limitHogs(gear)
+    cnthhs = cnthhs + 1
+        if cnthhs > 1 then
+            hogLimitHit = true
+            SetEffect(gear, heResurrectable, false)
+            --SetHealth(gear, 0)
+            SetGearPosition(gear, -100,LAND_HEIGHT)
+        end
+end
+
+function onGameStart()
+    trackTeams()
+    teamScan()
+    runOnHogs(saveStuff)
+    --local str = "/say " .. MUTANT_VERSION
+    --ParseCommand(str)
+
+    hogLimitHit = false
+    for i=0 , TeamsCount - 1 do
+        cnthhs = 0
+        runOnHogsInTeam(limitHogs, teams[i])
+    end
+    if hogLimitHit then
+        AddCaption(loc("ONE HOG PER TEAM! KILLING EXCESS HEDGES"))
+    end
+    showStartingInfo()
+end
+
+
+
+function giveWeapons(gear)
+    if gear == mutant then
+        AddAmmo(gear, amRope)
+        for i=1, #mt_weapons do
+            AddAmmo(gear, mt_weapons[i])
+        end
+
+    else
+        for i=1, #hh_weapons do
+            AddAmmo(gear,hh_weapons[i])
+        end
+    end
+end
+
+function onAmmoStoreInit()
+
+    SetAmmo(amSkip, 9, 0, 0, 0)
+    SetAmmo(amRope,0,1,0,5)
+    SetAmmo(amSnowball,0,1,0,1)
+
+    for i=1, #hh_weapons do
+        SetAmmo(hh_weapons[i], 0, 0, 0, 1)
+    end
+
+    for i=1, #mt_weapons do
+        SetAmmo(mt_weapons[i], 0, 3, 0, 1)
+    end
+
+end
+
+function drawCircles()
+    for i = 0, #hhs do
+        if circles[hhs[i]] ~= nil then
+            DeleteVisualGear(circles[hhs[i]])
+            circles[hhs[i]] = nil
+        end
+
+        if hhs[i] ~= CurrentHedgehog then
+            if mutant == nil then
+                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
+                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080)
+            elseif CurrentHedgehog == mutant then
+                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
+                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070)
+            elseif getGearValue(CurrentHedgehog, "Feeder") and hhs[i] ~= mutant then
+                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
+                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 3, 0xaa000070)
+            elseif hhs[i] == mutant then
+                circles[hhs[i]] = AddVisualGear(0, 0, vgtCircle, 0, false)
+                SetVisualGearValues(circles[hhs[i]], 0, 0, 0, 0, 0, 0, 0, 22, 5, 0xff000080)
+            end
+        end
+    end
+    circleFrame = 0
+end
+
+function onNewTurn()
+
+    trackTeams()
+    killsCounter = 0
+
+    if mutant == nil then
+        AddCaption( loc("FIRST BLOOD MUTATES") )
+    end
+
+    checkScore()
+    giveWeapons(CurrentHedgehog)
+    drawCircles()
+    setAIHints()
+    kill_reward= numhhs*10
+
+    if CurrentHedgehog == mutant then
+        mt_hurt=true
+        disease= mutant_base_disease - numhhs
+    else
+        mt_hurt=false
+    end
+
+    setGearValue(CurrentHedgehog, "Alive", true)
+
+end
+
+function countBodies()
+        if killsCounter == 2 then
+            AddCaption(loc("DOUBLE KILL"))
+        elseif killsCounter == 3 then
+            AddCaption(loc("MEGA KILL"))
+            PlaySound(sndRegret)
+        elseif killsCounter == 4 then
+            AddCaption(loc("ULTRA KILL"))
+        elseif killsCounter == 5 then
+            AddCaption(loc("MONSTER KILL"))
+            PlaySound(sndIllGetYou)
+        elseif killsCounter == 6 then
+            AddCaption(loc("LUDICROUS KILL"))
+            PlaySound(sndNutter)
+        elseif killsCounter == 7 then
+            AddCaption(loc("HOLY SHYTE!"))
+            PlaySound(sndLaugh)
+        elseif killsCounter > 8 then
+            AddCaption(loc("INSANITY"))
+        end
+end
+
+function onGameTick()
+
+    if circleFrame > -1 then
+        for i = 0, #hhs do
+            if circles[hhs[i]] ~= nil and hhs[i]~= nil then
+                hhx, hhy = GetGearPosition(hhs[i])
+                X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint = GetVisualGearValues(circles[hhs[i]])
+                SetVisualGearValues(circles[hhs[i]], hhx + 1, hhy - 3, 0, 0, 0, 0, 0, 40 - (circleFrame % 25), Timer, Tint)
+            end
+        end
+
+        circleFrame = circleFrame + 0.06
+
+        if circleFrame >= 25 then
+            for i = 0, #hhs do
+                if circles[hhs[i]] ~= nil then
+                    DeleteVisualGear(circles[hhs[i]])
+                    circles[hhs[i]] = nil
+                end
+            end
+        end
+    end
+
+    if TurnTimeLeft==0 and mt_hurt then
+        mt_hurt = false
+    end
+
+    if mt_hurt and mutant~=nil then
+        timer = timer + 1
+            if timer > disease_timer then
+                timer = 0
+                SetHealth(mutant, GetHealth(mutant)-disease )
+                AddVisualGear(GetX(mutant), GetY(mutant)-5, vgtHealthTag, disease, true)
+                    if GetHealth(mutant)<=0 then
+                        SetHealth(mutant,0)
+                        mt_hurt= false
+                        setGearValue(mutant,"SelfDestruct",true)
+                        TurnTimeLeft = 0
+                    end
+            end
+    end
+
+end
+
+function saveStuff(gear)
+    setGearValue(gear,"Name",GetHogName(gear))
+    setGearValue(gear,"Hat",GetHogHat(gear))
+end
+
+function armageddon(gear)
+    SetState(gear, gstLoser)
+    SetEffect(gear, heResurrectable, false)
+    SetHealth(gear, 0)
+end
+
+function updateScore()
+
+    local showScore = ""
+
+    for i=0, TeamsCount-1 do
+        if teams[i]~= nil then
+
+            local curr_score = getTeamValue(teams[i], "Score")
+            showScore = showScore .. teams[i] .. ": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|"
+
+        end
+    end
+
+    ShowMission(loc("Score"),
+                "-------",
+                showScore, 0, 200)
+
+    HideMission()
+
+end
+
+function checkScore()
+local showScore = ""
+local lowest_score_team = nil
+local min_score=nil
+local winTeam = nil
+
+local only_low_score = true
+
+    for i=0, TeamsCount-1 do
+        if teams[i]~=nil then
+            local curr_score = getTeamValue(teams[i], "Score")
+
+            runOnHogsInTeam(removeFeeder, teams[i])
+
+            showScore = showScore .. teams[i] ..": " .. curr_score .. " (deaths: " .. getTeamValue(teams[i], "DeadHogs") .. ") " .. "|"
+
+            if curr_score >= winScore then
+                gameOver = true
+                winTeam = teams[i]
+            end
+
+            if min_score==nil then
+                min_score= curr_score
+                lowest_score_team = teams[i]
+            else
+                if curr_score <= min_score then
+                    if curr_score == min_score then
+                        if getTeamValue(teams[i], "DeadHogs") == getTeamValue(lowest_score_team, "DeadHogs") then
+                            only_low_score = false
+                        else
+                            if getTeamValue(teams[i], "DeadHogs") > getTeamValue(lowest_score_team, "DeadHogs") then
+                                lowest_score_team = teams[i]
+                            end
+                            only_low_score = true
+                        end
+
+                    else
+                        min_score= curr_score
+                        lowest_score_team = teams[i]
+                        only_low_score = true
+                    end
+                end
+            end
+        end
+    end
+
+    if gameOver then
+        TurnTimeLeft = 0
+        for i=0, #teams do
+            if teams[i]~=winTeam then
+                runOnHogsInTeam(armageddon, teams[i])
+            end
+        end
+
+    ShowMission(    loc("WINNER IS ") .. winTeam,
+                    "~~~~~~~~~~~~~~~~~~~~~~~~~",
+                    showScore, 0, 200)
+    else
+
+    if only_low_score then
+        runOnHogsInTeam(setFeeder, lowest_score_team)
+    end
+
+    if meh == false then
+		meh = true
+	else
+		ShowMission(    loc("Score"),
+                    loc("-------"),
+                    showScore, 0, 200)
+	end
+
+    end
+end
+
+function backToNormal(gear)
+    SetHogName(gear, getGearValue(gear,"Name"))
+    SetHogHat(gear, 'NoHat')
+    SetHogHat(gear, getGearValue(gear,"Hat"))
+    setGearValue(mutant,"SelfDestruct",false)
+    mt_hurt=false
+    mutant=nil
+end
+
+function setAIHints()
+    for i = 0, #hhs do
+        if mutant == nil or hhs[i] == mutant or CurrentHedgehog == mutant then
+            SetGearAIHints(hhs[i], aihUsual)
+        else
+            SetGearAIHints(hhs[i], aihDoesntMatter)
+        end
+    end
+end
+
+function removeFeeder(gear)
+    if gear~=nil then
+        setGearValue(gear,"Feeder",false)
+        if gear~= mutant then
+            SetHogName(gear, getGearValue(gear,"Name") )
+            SetHogHat(gear, 'NoHat')
+            SetHogHat(gear, getGearValue(gear,"Hat"))
+        end
+    end
+end
+
+function setFeeder(gear)
+    if gear~= mutant and gear~= nil then
+        SetHogName(gear,"BOTTOM FEEDER")
+        SetHogHat(gear, 'poke_slowpoke')
+        setGearValue(gear,"Feeder", true)
+    end
+end
+
+function setMutantStuff(gear)
+    mutant = gear
+
+    SetHogName(gear,"MUTANT")
+    SetHogHat(gear,'WhySoSerious')
+    SetHealth(gear, ( mutant_base_health + numhhs*25) )
+    SetEffect(gear, hePoisoned, 1)
+    setGearValue(mutant,"SelfDestruct",false)
+    setGearValue(gear, "Feeder", false)
+
+    AddCaption(getGearValue(gear, "Name") .. loc(" HAS MUTATED"))
+
+    TurnTimeLeft=0
+
+    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
+    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
+    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
+    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
+    AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
+    PlaySound(sndSuddenDeath)
+end
+
+function teamScan()
+
+        for i=0, TeamsCount-1 do --nil filling
+        teams[i]=nil
+        end
+
+        for i=0, #hhs do
+            for j=0, TeamsCount-1 do
+                if teams[j] ==nil and hhs[i]~=nil then
+                teams[j] = GetHogTeamName(hhs[i])
+                setTeamValue(teams[j],"Score",0)
+                setTeamValue(teams[j], "DeadHogs",0)
+                break
+                end
+
+                if teams[j] == GetHogTeamName(hhs[i]) then
+                    break
+                end
+            end
+        end
+
+        ---***---
+end
+
+function set_Mutant_and_Score(gear)
+
+local curr_team = GetHogTeamName(CurrentHedgehog)
+
+    if gear == CurrentHedgehog then
+        if CurrentHedgehog == mutant then
+            PlaySound(sndHomerun)
+            if getGearValue(gear, "SelfDestruct")==false then
+                decreaseTeamValue(curr_team,"Score")
+            end
+            backToNormal(gear)
+        else
+            decreaseTeamValue(curr_team,"Score")
+        end
+
+    else
+            if gear == mutant then
+                    backToNormal(mutant)
+                    if curr_team ~=GetHogTeamName(gear) then
+                            if  getGearValue(CurrentHedgehog, "Alive") then
+                            setMutantStuff(CurrentHedgehog)
+                            setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
+                            end
+                    else
+                        setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
+                    end
+            else
+                if mutant==nil then
+                        if curr_team ~=GetHogTeamName(gear) then
+                            if getGearValue(CurrentHedgehog, "Alive") then
+                                    setMutantStuff(CurrentHedgehog)
+                                    setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") + mutant_kill_reward))
+                            else
+                                increaseTeamValue(curr_team,"Score")
+                            end
+                        else
+                            setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
+                        end
+                else
+                    if curr_team ~=GetHogTeamName(gear) then
+                        if CurrentHedgehog==mutant and getGearValue(mutant,"SelfDestruct")==false then
+                            SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+kill_reward)
+                            AddCaption("+" .. kill_reward .. loc(" HP") )
+                            increaseTeamValue(curr_team,"Score")
+                        end
+                        if getGearValue(CurrentHedgehog,"Feeder") then
+                            increaseTeamValue(curr_team,"Score")
+                        end
+                    else
+                        setTeamValue(curr_team,"Score",(getTeamValue(curr_team,"Score") - team_fire_punishment))
+                    end
+                end
+            end
+    end
+end
+
+function onGearResurrect(gear)
+if not gameOver then
+    if GetGearType(gear) == gtHedgehog then
+
+        increaseTeamValue(GetHogTeamName(gear), "DeadHogs")
+
+        if gear==CurrentHedgehog then
+            setGearValue(CurrentHedgehog, "Alive", false)
+        end
+        set_Mutant_and_Score(gear)
+        if gear~=CurrentHedgehog then
+            killsCounter = killsCounter + 1
+            countBodies()
+        end
+        AddVisualGear(GetX(gear), GetY(gear), vgtSmokeRing, 0, false)
+        PlaySound(sndWhack)
+        updateScore()
+    end
+end
+end
+
+function onGearAdd(gear)
+
+    -- Catch hedgehogs for the tracker
+    if GetGearType(gear) == gtHedgehog then
+        trackGear(gear)
+        hhs[numhhs] = gear
+        numhhs = numhhs + 1
+        SetEffect(gear, heResurrectable, 1)
+    end
+end
+
+function checkEmptyTeam (teamName)
+    for i=0 , #hhs do
+        if hhs[i]~=nil then
+            if teamName == GetHogTeamName(hhs[i]) then
+                return false
+            end
+        end
+    end
+    return true
+end
+
+function onGearDelete(gear)
+    -- Remove hogs that are gone
+    if GetGearType(gear) == gtHedgehog then
+        numhhs = numhhs - 1
+
+        local found
+        for i=0, #hhs do
+            if hhs[i] == gear then
+                found = i
+                break
+            end
+        end
+        for i = found, #hhs - 1 do
+            hhs[i] = hhs[i + 1]
+        end
+        hhs[#hhs] = nil
+
+        local t_name = GetHogTeamName(gear)
+        if checkEmptyTeam(t_name) then
+            for i = 0, TeamsCount - 1 do
+                if teams[i] == t_name then
+                    found = i
+                    break
+                end
+            end
+            for i = found, TeamsCount - 2 do
+                teams[i] = teams[i + 1]
+            end
+            teams[TeamsCount - 1] = nil
+            TeamsCount = TeamsCount - 1
+        end
+        AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
+        trackDeletion(gear)
+    end
+end
+
+--[[
+S T A R R I N G
+    prof - Coding, implementing and evangelism
+    vos  - Initial idea and script improvements
+    mikade - Moving the `how to play` into the game so that people know `how to play`, and whitespace :D
+--]]
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Fri May 31 00:10:59 2013 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Fri May 31 00:12:11 2013 +0400
@@ -1,700 +1,706 @@
-
-------------------------------------------
--- RACER 0.5
--- map-independant racing script
--- by mikade
------------------------------------------
-
------------------------------------
---0.1: took all the code from crazy racer and scrapped most of it
------------------------------------
-
--- Removed tumbler system
--- Removed extra adds like boosters etc
--- Added experimental waypoint placement system
--- More user feedback
--- Reduced race complexity limit to 5 waypoints
--- stop placement at complexity limit reached and end turn
--- guys dont keep racing after dying
--- invulnerable feasibility
--- reverted time keeping method
--- reduced feedback display time
--- colour-coded addcaptions
--- cleaned up code
--- support for more players properly added
--- tardis fix
--- remove airstrikes
-
--- i think the remainder 0 .456 sec of the tracktime isnt getting reset on newturn
-
--- update feedback
-
--------
--- 0.2
--------
-
--- allow gameflags
--- extend time to 90s
--- remove other air-attack based weps
--- turn off water rise for sd
-
--------
--- 0.3
--------
-
--- prevent WP being placed in land
--- prevent waypoints being placed outside border
-
--------
--- 0.4
--------
-
--- update user feedback
--- add more sounds
-
--------
--- 0.5
--------
-
--- fix ghost disappearing if hog falls in water or somehow dies
--- lengthen ghost tracking interval to improve performance on slower machines
--- increase waypoint limit to 8
--- allow for persistent showmission information
-
------------------------------
--- SCRIPT BEGINS
------------------------------
-
-HedgewarsScriptLoad("/Scripts/Locale.lua")
-
-------------------
--- Got Variables?
-------------------
-
-local fMod = 1000000 -- 1
-local roundLimit = 3
-local roundNumber = 0
-local firstClan = 10
-
-local fastX = {}
-local fastY = {}
-local fastCount = 0
-local fastIndex = 0
-local fastColour
-
-local currX = {}
-local currY = {}
-local currCount = 0
-
---------------------------
--- hog and team tracking variales
---------------------------
-
-local numhhs = 0 -- store number of hedgehogs
-local hhs = {} -- store hedgehog gears
-
-local numTeams --  store the number of teams in the game
-local teamNameArr = {}	-- store the list of teams
-local teamClan = {}
-local teamSize = {}	-- store how many hogs per team
-local teamIndex = {} -- at what point in the hhs{} does each team begin
-
-local teamComment = {}
-local teamScore = {}
-
--------
--- racer vars
---------
-
-local cGear = nil
-
-local bestClan = nil
-local bestTime = nil
-
-local gameBegun = false
-local gameOver = false
-local racerActive = false
-local trackTime = 0
-
-local wpCirc = {}
-local wpX = {}
-local wpY = {}
-local wpCol = {}
-local wpActive = {}
-local wpRad = 450 --75
-local wpCount = 0
-local wpLimit = 8
-
-local roundN
-local lastRound
-local RoundHasChanged
-
--------------------
--- general methods
--------------------
-
-function RebuildTeamInfo()
-
-
-	-- make a list of individual team names
-	for i = 0, (TeamsCount-1) do
-		teamNameArr[i] = " " -- = i
-		teamSize[i] = 0
-		teamIndex[i] = 0
-		teamScore[i] = 100000
-	end
-	numTeams = 0
-
-	for i = 0, (numhhs-1) do
-
-		z = 0
-		unfinished = true
-		while(unfinished == true) do
-
-			newTeam = true
-			tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
-
-			if tempHogTeamName == teamNameArr[z] then
-				newTeam = false
-				unfinished = false
-			end
-
-			z = z + 1
-
-			if z == TeamsCount then
-				unfinished = false
-				if newTeam == true then
-					teamNameArr[numTeams] = tempHogTeamName
-					numTeams = numTeams + 1
-				end
-			end
-
-		end
-
-	end
-
-	-- find out how many hogs per team, and the index of the first hog in hhs
-	for i = 0, (numTeams-1) do
-		for z = 0, (numhhs-1) do
-			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
-				teamClan[i] = GetHogClan(hhs[z])
-				if teamSize[i] == 0 then
-					teamIndex[i] = z -- should give starting index
-				end
-				teamSize[i] = teamSize[i] + 1
-				--add a pointer so this hog appears at i in hhs
-			end
-		end
-
-	end
-
-end
-
-
------------------
--- RACER METHODS
------------------
-
-function CheckWaypoints()
-
-	trackFinished = true
-
-	for i = 0, (wpCount-1) do
-
-		g1X, g1Y = GetGearPosition(CurrentHedgehog)
-		g2X, g2Y = wpX[i], wpY[i]
-
-		g1X = g1X - g2X
-		g1Y = g1Y - g2Y
-		dist = (g1X*g1X) + (g1Y*g1Y)
-
-		--if i == 0 then
-		--	AddCaption(dist .. "/" .. (wpRad*wpRad) )
-		--end
-
-		NR = (48/100*wpRad)/2
-
-		if dist < (NR*NR) then
-		--if dist < (wpRad*wpRad) then
-			--AddCaption("howdy")
-			wpActive[i] = true
-			wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog)) -- new				--GetClanColor(1)
-			SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
-
-			wpRem = 0
-			for k = 0, (wpCount-1) do
-				if wpActive[k] == false then
-					wpRem = wpRem + 1
-				end
-			end
-
-			AddCaption(loc("Way-Points Remaining") .. ": " .. wpRem,0xffba00ff,capgrpAmmoinfo)
-
-		end
-
-		if wpActive[i] == false then
-			trackFinished = false
-		end
-
-	end
-
-	return(trackFinished)
-
-end
-
-function AdjustScores()
-
-	if bestTime == nil then
-		bestTime = 100000
-		bestClan = 10
-		bestTimeComment = "N/A"
-	end
-
-	newScore = false
-
-	-- update this clan's time if the new track is better
-	for i = 0, (numTeams-1) do
-		if teamClan[i] == GetHogClan(CurrentHedgehog) then
-			if trackTime < teamScore[i] then
-				teamScore[i] = trackTime
-				newScore = true
-			else
-				newScore = false
-			end
-		end
-	end
-
-	--bestTime = 100000
-	--bestClan = 10
-
-	-- find the best time out of those so far
-	for i = 0, (numTeams-1) do
-		if teamScore[i] < bestTime then
-			bestTime = teamScore[i]
-			bestClan = teamClan[i]
-		end
-	end
-
-	if bestTime ~= 100000 then
-		bestTimeComment = (bestTime/1000) ..loc("s")
-	end
-
-	if newScore == true then
-		if trackTime == bestTime then -- best time of the race
-			ShowMission(loc("RACER"),
-			loc("TRACK COMPLETED"),
-			loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
-			loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
-			PlaySound(sndHomerun)
-		else	-- best time for the clan
-			ShowMission(loc("RACER"),
-			loc("TRACK COMPLETED"),
-			loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
-			loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
-		end
-	else -- not any kind of new score
-		ShowMission(loc("RACER"),
-		loc("TRACK COMPLETED"),
-		loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" ..
-		loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
-		PlaySound(sndHellish)
-	end
-
-
-	--------
-	--new
-	--------
-
-	if bestTime == trackTime then
-		--AddCaption("wooooooooooooooooooooooooooooo")
-
-		fastColour = GetClanColor(GetHogClan(CurrentHedgehog))
-
-		for i = 0, (currCount-1) do
-			fastX[i] = currX[i]
-			fastY[i] = currY[i]
-		end
-
-		fastCount = currCount
-		fastIndex = 0
-
-		--currCount = 0 -- is this needed?
-
-	else
-		currCount = 0
-		fastIndex = 0
-	end
-
-
-end
-
-function onNewRound()
-
-	roundNumber = roundNumber + 1
-
-	totalComment = ""
-	for i = 0, (TeamsCount-1) do
-			if teamNameArr[i] ~= " " then				-- teamScore[teamClan[i]]
-				teamComment[i] = teamNameArr[i] .. ": " .. (teamScore[i]/1000) .. loc("s|")
-				totalComment = totalComment .. teamComment[i]
-			elseif teamNameArr[i] == " " then
-				teamComment[i] = "|"
-			end
-	end
-
-	ShowMission(	loc("RACER"),
-					loc("STATUS UPDATE"),
-					loc("Rounds Complete: ") .. roundNumber .. "/" .. roundLimit .. "|" .. " " .. "|" ..
-					loc("Best Team Times: ") .. "|" .. totalComment, 0, 4000)
-
-	-- end game if its at round limit
-	if roundNumber == roundLimit then
-		for i = 0, (numhhs-1) do
-			if GetHogClan(hhs[i]) ~= bestClan then
-				SetEffect(hhs[i], heResurrectable, 0)
-				SetHealth(hhs[i],0)
-			end
-		end
-		gameOver = true
-		TurnTimeLeft = 1
-	end
-
-end
-
-function CheckForNewRound()
-
-	-------------
-	------ new
-	-------------
-
-	--[[turnN = turnN + 1
-	if gameBegun == false then
-		if turnN == 2 then
-			for i = 0, (numhhs-1) do
-				if hhs[i] ~= nil then
-					SetEffect(hhs[i], heResurrectable, 0)
-					SetHealth(hhs[i],0)
-				end
-			end
-			gameOver = true
-			TurnTimeLeft = 1
-		end
-	else
-
-
-	end]]
-
-	--[[if roundBegun == true then
-
-		if RoundHasChanged == true then
-			roundN = roundN + 1
-			RoundHasChanged = false
-			onNewRound()
-		end
-
-		if lastRound ~= TotalRounds then -- new round, but not really
-
-			if RoundHasChanged == false then
-				RoundHasChanged = true
-			end
-
-		end
-
-		AddCaption("RoundN:" .. roundN .. "; " .. "TR: " .. TotalRounds)
-
-		lastRound = TotalRounds
-
-	end]]
-
-	------------
-	----- old
-	------------
-
-	if GetHogClan(CurrentHedgehog) == firstClan then
-		onNewRound()
-	end
-
-end
-
-function DisableTumbler()
-	currCount = 0
-	fastIndex = 0
-	TurnTimeLeft = 0
-	racerActive = false -- newadd
-end
-
-function HandleGhost()
-
-	-- get the current xy of the racer at this point
-	currX[currCount] = GetX(CurrentHedgehog)
-	currY[currCount] = GetY(CurrentHedgehog)
-	currCount = currCount + 1
-
-	-- draw a ping of smoke where the fastest player was at this point
-	if (fastCount ~= 0) and (fastIndex < fastCount) then
-
-		fastIndex = fastIndex + 1
-
-		tempE = AddVisualGear(fastX[fastIndex], fastY[fastIndex], vgtSmoke, 0, false)
-		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
-		SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, fastColour )
-
-		--AddCaption("fC: " .. fastIndex .. " / " .. fastCount)
-
-	else
-
-		--AddCaption("excep fC: " .. fastIndex .. " / " .. fastCount)
-
-	end
-
-
-
-end
-
-----------------------------------
--- GAME METHODS / EVENT HANDLERS
-----------------------------------
-
-function onGameInit()
-	GameFlags = GameFlags + gfInfAttack + gfInvulnerable
-	CaseFreq = 0
-	TurnTime = 90000
-	WaterRise = 0
-end
-
-
-function onGameStart()
-
-	roundN = 0
-	lastRound = TotalRounds
-	RoundHasChanged = false -- true
-
-	RebuildTeamInfo()
-
-	ShowMission	(
-				loc("RACER"),
-				loc("a Hedgewars mini-game"),
-
-				loc("Build a track and race.") .. "|" ..
-				loc("Round Limit:") .. " " .. roundLimit .. "|" ..
-
-				"", 4, 4000
-				)
-end
-
-function PlaceWayPoint(x,y)
-
-	if (wpCount < wpLimit) then -- seems to not work with a hedgehog nil chek
-
-		wpX[wpCount] = x
-		wpY[wpCount] = y
-		wpCol[wpCount] = 0xffffffff
-		wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
-																		--100
-		SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
-
-		wpCount = wpCount + 1
-
-		AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
-
-	end
-
-end
-
-function onNewTurn()
-
-	CheckForNewRound()
-
-	racerActive = false
-
-	trackTime = 0
-
-	currCount = 0 -- hopefully this solves problem
-	AddAmmo(CurrentHedgehog, amAirAttack, 0)
-	gTimer = 0
-
-	-- Set the waypoints to unactive on new round
-	for i = 0,(wpCount-1) do
-		wpActive[i] = false
-		wpCol[i] = 0xffffffff
-		SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
-	end
-
-	-- Handle Starting Stage of Game
-	if (gameOver == false) and (gameBegun == false) then
-		if wpCount >= 3 then
-			gameBegun = true
-			roundNumber = 0
-			firstClan = GetHogClan(CurrentHedgehog)
-			ShowMission(loc("RACER"),
-			loc("GAME BEGUN!!!"),
-			loc("Complete the track as fast as you can!"), 2, 4000)
-		else
-			ShowMission(loc("RACER"),
-			loc("NOT ENOUGH WAYPOINTS"),
-			loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
-			AddAmmo(CurrentHedgehog, amAirAttack, 4000)
-            ParseCommand("setweap " .. string.char(amAirAttack))
-		end
-	end
-
-	if gameOver == true then
-		gameBegun = false
-		racerActive = false -- newadd
-	end
-
-	AddAmmo(CurrentHedgehog, amTardis, 0)
-	AddAmmo(CurrentHedgehog, amDrillStrike, 0)
-	AddAmmo(CurrentHedgehog, amMineStrike, 0)
-	AddAmmo(CurrentHedgehog, amNapalm, 0)
-	AddAmmo(CurrentHedgehog, amPiano, 0)
-
-end
-
-function onGameTick20()
-
-	-- airstrike detected, convert this into a potential waypoint spot
-	if cGear ~= nil then
-		x,y = GetGearPosition(cGear)
-        if x > -9000 then
-            x,y = GetGearTarget(cGear)
-
-
-            if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
-                AddCaption(loc("Please place the way-point in the open, within the map boundaries."))
-                PlaySound(sndDenied)
-            elseif (y > WaterLine-50) then
-                AddCaption(loc("Please place the way-point further from the waterline."))
-                PlaySound(sndDenied)
-            else
-                PlaceWayPoint(x, y)
-                if wpCount == wpLimit then
-                    AddCaption(loc("Race complexity limit reached."))
-                    DisableTumbler()
-                end
-            end
-        else
-            DeleteGear(cGear)
-        end
-        SetGearPosition(cGear, -10000, 0)
-	end
-
-
-	-- start the player tumbling with a boom once their turn has actually begun
-	if racerActive == false then
-
-		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
-
-			-- if the gamehas started put the player in the middle of the first
-			--waypoint that was placed
-			if gameBegun == true then
-				AddCaption(loc("Good to go!"))
-				racerActive = true
-				trackTime = 0
-
-				SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
-				AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
-				FollowGear(CurrentHedgehog)
-
-				HideMission()
-
-			else
-				-- still in placement mode
-			end
-
-		end
-	end
-
-
-
-	-- has the player started his tumbling spree?
-	if (CurrentHedgehog ~= nil) then
-
-		--airstrike conversion used to be here
-
-		-- if the RACE has started, show tracktimes and keep tabs on waypoints
-		if (racerActive == true) and (gameBegun == true) then
-
-			--ghost
-			if GameTime%40 == 0 then
-				HandleGhost()
-			end
-
-			trackTime = trackTime + 20
-
-			if GameTime%100 == 0 then
-                
-                if trackTime%1000 == 0 then
-                    AddCaption((trackTime/1000)..'.0',GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
-                else
-                    AddCaption(trackTime/1000,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
-                end
-
-				if (CheckWaypoints() == true) then
-					AdjustScores()
-					racerActive = false
-					DisableTumbler()
-				end
-
-			end
-
-		end
-
-
-
-		-- if the player has expended his tunbling time, stop him tumbling
-		if TurnTimeLeft <= 20 then
-			DisableTumbler()
-		end
-
-	end
-
-end
-
-function onGearResurrect(gear)
-
-	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
-
-	if gear == CurrentHedgehog then
-		DisableTumbler()
-	end
-
-	-- if the player stops and "dies" or flies into water, stop him racing
-	--[[if gear == CurrentHedgehog then
-		DisableTumbler()
-		ShowMission(loc("RACER"),
-		loc("TRACK FAILED!"),
-		loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
-	end]]
-
-end
-
-function onGearAdd(gear)
-
-	if GetGearType(gear) == gtHedgehog then
-		hhs[numhhs] = gear
-		numhhs = numhhs + 1
-		SetEffect(gear, heResurrectable, 1)
-	end
-
-	if GetGearType(gear) == gtAirAttack then
-		cGear = gear
-	end
-
-end
-
-function onGearDelete(gear)
-
-	if GetGearType(gear) == gtAirAttack then
-		cGear = nil
-	end
-
-end
-
---[[function onAmmoStoreInit()
-	SetAmmo(amRope, 9, 0, 0, 0)
-	SetAmmo(amJetpack, 9, 0, 0, 0)
-	SetAmmo(amSkip, 9, 0, 0, 0)
-end]]
-
-
+
+------------------------------------------
+-- RACER 0.6
+-- map-independant racing script
+-- by mikade
+-----------------------------------------
+
+-----------------------------------
+--0.1: took all the code from crazy racer and scrapped most of it
+-----------------------------------
+
+-- Removed tumbler system
+-- Removed extra adds like boosters etc
+-- Added experimental waypoint placement system
+-- More user feedback
+-- Reduced race complexity limit to 5 waypoints
+-- stop placement at complexity limit reached and end turn
+-- guys dont keep racing after dying
+-- invulnerable feasibility
+-- reverted time keeping method
+-- reduced feedback display time
+-- colour-coded addcaptions
+-- cleaned up code
+-- support for more players properly added
+-- tardis fix
+-- remove airstrikes
+
+-- i think the remainder 0 .456 sec of the tracktime isnt getting reset on newturn
+
+-- update feedback
+
+-------
+-- 0.2
+-------
+
+-- allow gameflags
+-- extend time to 90s
+-- remove other air-attack based weps
+-- turn off water rise for sd
+
+-------
+-- 0.3
+-------
+
+-- prevent WP being placed in land
+-- prevent waypoints being placed outside border
+
+-------
+-- 0.4
+-------
+
+-- update user feedback
+-- add more sounds
+
+-------
+-- 0.5
+-------
+
+-- fix ghost disappearing if hog falls in water or somehow dies
+-- lengthen ghost tracking interval to improve performance on slower machines
+-- increase waypoint limit to 8
+-- allow for persistent showmission information
+
+-------
+-- 0.6
+-------
+
+-- remove hogs from racing area as per request
+
+-----------------------------
+-- SCRIPT BEGINS
+-----------------------------
+
+HedgewarsScriptLoad("/Scripts/Locale.lua")
+
+------------------
+-- Got Variables?
+------------------
+
+local fMod = 1000000 -- 1
+local roundLimit = 3
+local roundNumber = 0
+local firstClan = 10
+
+local fastX = {}
+local fastY = {}
+local fastCount = 0
+local fastIndex = 0
+local fastColour
+
+local currX = {}
+local currY = {}
+local currCount = 0
+
+--------------------------
+-- hog and team tracking variales
+--------------------------
+
+local numhhs = 0 -- store number of hedgehogs
+local hhs = {} -- store hedgehog gears
+
+local numTeams --  store the number of teams in the game
+local teamNameArr = {}  -- store the list of teams
+local teamClan = {}
+local teamSize = {}     -- store how many hogs per team
+local teamIndex = {} -- at what point in the hhs{} does each team begin
+
+local teamComment = {}
+local teamScore = {}
+
+-------
+-- racer vars
+--------
+
+local cGear = nil
+
+local bestClan = nil
+local bestTime = nil
+
+local gameBegun = false
+local gameOver = false
+local racerActive = false
+local trackTime = 0
+
+local wpCirc = {}
+local wpX = {}
+local wpY = {}
+local wpCol = {}
+local wpActive = {}
+local wpRad = 450 --75
+local wpCount = 0
+local wpLimit = 8
+
+local roundN
+local lastRound
+local RoundHasChanged
+
+-------------------
+-- general methods
+-------------------
+
+function RebuildTeamInfo()
+
+
+        -- make a list of individual team names
+        for i = 0, (TeamsCount-1) do
+                teamNameArr[i] = " " -- = i
+                teamSize[i] = 0
+                teamIndex[i] = 0
+                teamScore[i] = 100000
+        end
+        numTeams = 0
+
+        for i = 0, (numhhs-1) do
+
+                z = 0
+                unfinished = true
+                while(unfinished == true) do
+
+                        newTeam = true
+                        tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
+
+                        if tempHogTeamName == teamNameArr[z] then
+                                newTeam = false
+                                unfinished = false
+                        end
+
+                        z = z + 1
+
+                        if z == TeamsCount then
+                                unfinished = false
+                                if newTeam == true then
+                                        teamNameArr[numTeams] = tempHogTeamName
+                                        numTeams = numTeams + 1
+                                end
+                        end
+
+                end
+
+        end
+
+        -- find out how many hogs per team, and the index of the first hog in hhs
+        for i = 0, (numTeams-1) do
+                for z = 0, (numhhs-1) do
+                        if GetHogTeamName(hhs[z]) == teamNameArr[i] then
+                                teamClan[i] = GetHogClan(hhs[z])
+                                if teamSize[i] == 0 then
+                                        teamIndex[i] = z -- should give starting index
+                                end
+                                teamSize[i] = teamSize[i] + 1
+                                --add a pointer so this hog appears at i in hhs
+                        end
+                end
+
+        end
+
+end
+
+
+-----------------
+-- RACER METHODS
+-----------------
+
+function CheckWaypoints()
+
+        trackFinished = true
+
+        for i = 0, (wpCount-1) do
+
+                g1X, g1Y = GetGearPosition(CurrentHedgehog)
+                g2X, g2Y = wpX[i], wpY[i]
+
+                g1X = g1X - g2X
+                g1Y = g1Y - g2Y
+                dist = (g1X*g1X) + (g1Y*g1Y)
+
+                --if i == 0 then
+                --      AddCaption(dist .. "/" .. (wpRad*wpRad) )
+                --end
+
+                NR = (48/100*wpRad)/2
+
+                if dist < (NR*NR) then
+                --if dist < (wpRad*wpRad) then
+                        --AddCaption("howdy")
+                        wpActive[i] = true
+                        wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog)) -- new                             --GetClanColor(1)
+                        SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
+
+                        wpRem = 0
+                        for k = 0, (wpCount-1) do
+                                if wpActive[k] == false then
+                                        wpRem = wpRem + 1
+                                end
+                        end
+
+                        AddCaption(loc("Way-Points Remaining") .. ": " .. wpRem,0xffba00ff,capgrpAmmoinfo)
+
+                end
+
+                if wpActive[i] == false then
+                        trackFinished = false
+                end
+
+        end
+
+        return(trackFinished)
+
+end
+
+function AdjustScores()
+
+        if bestTime == nil then
+                bestTime = 100000
+                bestClan = 10
+                bestTimeComment = "N/A"
+        end
+
+        newScore = false
+
+        -- update this clan's time if the new track is better
+        for i = 0, (numTeams-1) do
+                if teamClan[i] == GetHogClan(CurrentHedgehog) then
+                        if trackTime < teamScore[i] then
+                                teamScore[i] = trackTime
+                                newScore = true
+                        else
+                                newScore = false
+                        end
+                end
+        end
+
+        --bestTime = 100000
+        --bestClan = 10
+
+        -- find the best time out of those so far
+        for i = 0, (numTeams-1) do
+                if teamScore[i] < bestTime then
+                        bestTime = teamScore[i]
+                        bestClan = teamClan[i]
+                end
+        end
+
+        if bestTime ~= 100000 then
+                bestTimeComment = (bestTime/1000) ..loc("s")
+        end
+
+        if newScore == true then
+                if trackTime == bestTime then -- best time of the race
+                        ShowMission(loc("RACER"),
+                        loc("TRACK COMPLETED"),
+                        loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
+                        loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
+                        PlaySound(sndHomerun)
+                else    -- best time for the clan
+                        ShowMission(loc("RACER"),
+                        loc("TRACK COMPLETED"),
+                        loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
+                        loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
+                end
+        else -- not any kind of new score
+                ShowMission(loc("RACER"),
+                loc("TRACK COMPLETED"),
+                loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" ..
+                loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
+                PlaySound(sndHellish)
+        end
+
+
+        --------
+        --new
+        --------
+
+        if bestTime == trackTime then
+                --AddCaption("wooooooooooooooooooooooooooooo")
+
+                fastColour = GetClanColor(GetHogClan(CurrentHedgehog))
+
+                for i = 0, (currCount-1) do
+                        fastX[i] = currX[i]
+                        fastY[i] = currY[i]
+                end
+
+                fastCount = currCount
+                fastIndex = 0
+
+                --currCount = 0 -- is this needed?
+
+        else
+                currCount = 0
+                fastIndex = 0
+        end
+
+
+end
+
+function onNewRound()
+
+        roundNumber = roundNumber + 1
+
+        totalComment = ""
+        for i = 0, (TeamsCount-1) do
+                        if teamNameArr[i] ~= " " then                           -- teamScore[teamClan[i]]
+                                teamComment[i] = teamNameArr[i] .. ": " .. (teamScore[i]/1000) .. loc("s|")
+                                totalComment = totalComment .. teamComment[i]
+                        elseif teamNameArr[i] == " " then
+                                teamComment[i] = "|"
+                        end
+        end
+
+        ShowMission(    loc("RACER"),
+                                        loc("STATUS UPDATE"),
+                                        loc("Rounds Complete: ") .. roundNumber .. "/" .. roundLimit .. "|" .. " " .. "|" ..
+                                        loc("Best Team Times: ") .. "|" .. totalComment, 0, 4000)
+
+        -- end game if its at round limit
+        if roundNumber == roundLimit then
+                for i = 0, (numhhs-1) do
+                        if GetHogClan(hhs[i]) ~= bestClan then
+                                SetEffect(hhs[i], heResurrectable, 0)
+                                SetHealth(hhs[i],0)
+                        end
+                end
+                gameOver = true
+                TurnTimeLeft = 1
+        end
+
+end
+
+function CheckForNewRound()
+
+        -------------
+        ------ new
+        -------------
+
+        --[[turnN = turnN + 1
+        if gameBegun == false then
+                if turnN == 2 then
+                        for i = 0, (numhhs-1) do
+                                if hhs[i] ~= nil then
+                                        SetEffect(hhs[i], heResurrectable, 0)
+                                        SetHealth(hhs[i],0)
+                                end
+                        end
+                        gameOver = true
+                        TurnTimeLeft = 1
+                end
+        else
+
+
+        end]]
+
+        --[[if roundBegun == true then
+
+                if RoundHasChanged == true then
+                        roundN = roundN + 1
+                        RoundHasChanged = false
+                        onNewRound()
+                end
+
+                if lastRound ~= TotalRounds then -- new round, but not really
+
+                        if RoundHasChanged == false then
+                                RoundHasChanged = true
+                        end
+
+                end
+
+                AddCaption("RoundN:" .. roundN .. "; " .. "TR: " .. TotalRounds)
+
+                lastRound = TotalRounds
+
+        end]]
+
+        ------------
+        ----- old
+        ------------
+
+        if GetHogClan(CurrentHedgehog) == firstClan then
+                onNewRound()
+        end
+
+end
+
+function DisableTumbler()
+        currCount = 0
+        fastIndex = 0
+        TurnTimeLeft = 0
+        racerActive = false -- newadd
+end
+
+function HandleGhost()
+
+        -- get the current xy of the racer at this point
+        currX[currCount] = GetX(CurrentHedgehog)
+        currY[currCount] = GetY(CurrentHedgehog)
+        currCount = currCount + 1
+
+        -- draw a ping of smoke where the fastest player was at this point
+        if (fastCount ~= 0) and (fastIndex < fastCount) then
+
+                fastIndex = fastIndex + 1
+
+                tempE = AddVisualGear(fastX[fastIndex], fastY[fastIndex], vgtSmoke, 0, false)
+                g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
+                SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, fastColour )
+
+                --AddCaption("fC: " .. fastIndex .. " / " .. fastCount)
+
+        else
+
+                --AddCaption("excep fC: " .. fastIndex .. " / " .. fastCount)
+
+        end
+
+
+
+end
+
+function TryRepositionHogs()
+
+	if MapHasBorder() == true then
+
+		for i = 0, (numhhs-1) do
+			if hhs[i] ~= nil then
+				SetGearPosition(hhs[i],GetX(hhs[i]), TopY-10)
+			end
+		end
+
+	end
+
+end
+
+----------------------------------
+-- GAME METHODS / EVENT HANDLERS
+----------------------------------
+
+function onGameInit()
+        GameFlags = bor(GameFlags,gfInfAttack + gfInvulnerable)
+        CaseFreq = 0
+        TurnTime = 90000
+        WaterRise = 0
+end
+
+
+function onGameStart()
+
+        roundN = 0
+        lastRound = TotalRounds
+        RoundHasChanged = false -- true
+
+        RebuildTeamInfo()
+
+        ShowMission     (
+                                loc("RACER"),
+                                loc("a Hedgewars mini-game"),
+
+                                loc("Build a track and race.") .. "|" ..
+                                loc("Round Limit:") .. " " .. roundLimit .. "|" ..
+
+                                "", 4, 4000
+                                )
+
+	TryRepositionHogs()
+
+end
+
+function PlaceWayPoint(x,y)
+
+        if (wpCount < wpLimit) then -- seems to not work with a hedgehog nil chek
+
+                wpX[wpCount] = x
+                wpY[wpCount] = y
+                wpCol[wpCount] = 0xffffffff
+                wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
+                                                                                                                                                --100
+                SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
+
+                wpCount = wpCount + 1
+
+                AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
+
+        end
+
+end
+
+function onNewTurn()
+
+        CheckForNewRound()
+	TryRepositionHogs()
+
+        racerActive = false
+
+        trackTime = 0
+
+        currCount = 0 -- hopefully this solves problem
+        AddAmmo(CurrentHedgehog, amAirAttack, 0)
+        gTimer = 0
+
+        -- Set the waypoints to unactive on new round
+        for i = 0,(wpCount-1) do
+                wpActive[i] = false
+                wpCol[i] = 0xffffffff
+                SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
+        end
+
+        -- Handle Starting Stage of Game
+        if (gameOver == false) and (gameBegun == false) then
+                if wpCount >= 3 then
+                        gameBegun = true
+                        roundNumber = 0
+                        firstClan = GetHogClan(CurrentHedgehog)
+                        ShowMission(loc("RACER"),
+                        loc("GAME BEGUN!!!"),
+                        loc("Complete the track as fast as you can!"), 2, 4000)
+                else
+                        ShowMission(loc("RACER"),
+                        loc("NOT ENOUGH WAYPOINTS"),
+                        loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
+                        AddAmmo(CurrentHedgehog, amAirAttack, 4000)
+            ParseCommand("setweap " .. string.char(amAirAttack))
+                end
+        end
+
+        if gameOver == true then
+                gameBegun = false
+                racerActive = false -- newadd
+        end
+
+        AddAmmo(CurrentHedgehog, amTardis, 0)
+        AddAmmo(CurrentHedgehog, amDrillStrike, 0)
+        AddAmmo(CurrentHedgehog, amMineStrike, 0)
+        AddAmmo(CurrentHedgehog, amNapalm, 0)
+        AddAmmo(CurrentHedgehog, amPiano, 0)
+
+end
+
+function onGameTick20()
+
+        -- airstrike detected, convert this into a potential waypoint spot
+        if cGear ~= nil then
+                x,y = GetGearPosition(cGear)
+        if x > -9000 then
+            x,y = GetGearTarget(cGear)
+
+
+            if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
+                AddCaption(loc("Please place the way-point in the open, within the map boundaries."))
+                PlaySound(sndDenied)
+            elseif (y > WaterLine-50) then
+                AddCaption(loc("Please place the way-point further from the waterline."))
+                PlaySound(sndDenied)
+            else
+                PlaceWayPoint(x, y)
+                if wpCount == wpLimit then
+                    AddCaption(loc("Race complexity limit reached."))
+                    DisableTumbler()
+                end
+            end
+        else
+            DeleteGear(cGear)
+        end
+        SetGearPosition(cGear, -10000, 0)
+        end
+
+
+        -- start the player tumbling with a boom once their turn has actually begun
+        if racerActive == false then
+
+                if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
+
+                        -- if the gamehas started put the player in the middle of the first
+                        --waypoint that was placed
+                        if gameBegun == true then
+                                AddCaption(loc("Good to go!"))
+                                racerActive = true
+                                trackTime = 0
+
+                                SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
+                                AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
+                                FollowGear(CurrentHedgehog)
+
+                                HideMission()
+
+                        else
+                                -- still in placement mode
+                        end
+
+                end
+        end
+
+
+
+        -- has the player started his tumbling spree?
+        if (CurrentHedgehog ~= nil) then
+
+                --airstrike conversion used to be here
+
+                -- if the RACE has started, show tracktimes and keep tabs on waypoints
+                if (racerActive == true) and (gameBegun == true) then
+
+                        --ghost
+                        if GameTime%40 == 0 then
+                                HandleGhost()
+                        end
+
+                        trackTime = trackTime + 20
+
+                        if GameTime%100 == 0 then
+
+                if trackTime%1000 == 0 then
+                    AddCaption((trackTime/1000)..'.0',GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
+                else
+                    AddCaption(trackTime/1000,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
+                end
+
+                                if (CheckWaypoints() == true) then
+                                        AdjustScores()
+                                        racerActive = false
+                                        DisableTumbler()
+                                end
+
+                        end
+
+                end
+
+                -- if the player has expended his tunbling time, stop him tumbling
+                if TurnTimeLeft <= 20 then
+                        DisableTumbler()
+                end
+
+        end
+
+end
+
+function onGearResurrect(gear)
+
+        AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
+
+        if gear == CurrentHedgehog then
+                DisableTumbler()
+        end
+
+end
+
+function onGearAdd(gear)
+
+        if GetGearType(gear) == gtHedgehog then
+                hhs[numhhs] = gear
+                numhhs = numhhs + 1
+                SetEffect(gear, heResurrectable, 1)
+        end
+
+        if GetGearType(gear) == gtAirAttack then
+                cGear = gear
+        end
+
+end
+
+function onGearDelete(gear)
+
+        if GetGearType(gear) == gtAirAttack then
+                cGear = nil
+        end
+
+end