Clean up portal mission code
authorWuzzy <almikes@aol.com>
Mon, 18 Apr 2016 17:25:52 +0200
changeset 11668 991c790da01e
parent 11667 7652eeb0fc7f
child 11669 66ddc8c5ecd7
Clean up portal mission code It's a mess!
share/hedgewars/Data/Missions/Training/portal.lua
--- a/share/hedgewars/Data/Missions/Training/portal.lua	Mon Apr 18 17:18:36 2016 +0200
+++ b/share/hedgewars/Data/Missions/Training/portal.lua	Mon Apr 18 17:25:52 2016 +0200
@@ -17,7 +17,6 @@
 	Map = "portal" -- The map to be played
 	Theme = "Hell" -- The theme to be used
 	
-----AddTeam(teamname, color, grave, fort, voicepack, flag)--
 	AddTeam(loc("Subjects"), 0xFFFF01, "Simple", "Island", "Default", "cm_test")
 	player = AddHog(loc("Subject 1"), 0, 10, "Terminator_Glasses")
 
@@ -39,7 +38,7 @@
 	enemy13 = AddHog(loc("Lestat"), 1, 30, "vampirichog")
 
 	SetGearPosition(player, 350, 1820)
-    SetGearPosition(enemy1, 2037, 1313)
+	SetGearPosition(enemy1, 2037, 1313)
 	SetGearPosition(enemy2, 1369, 1605)
 	SetGearPosition(enemy3, 1750, 1937)
 	SetGearPosition(enemy4, 3125, 89)
@@ -53,8 +52,6 @@
 	SetGearPosition(enemy12, 2666, 950)
 	SetGearPosition(enemy13, 3306, 1205)
 
-
-
 end
 
 function onAmmoStoreInit()
@@ -78,12 +75,6 @@
 
 function onGameStart()
 
-	SetWind(100)-- SetWind(windSpeed) Sets the current wind in the range of -100 to 100. Use together with gfDisableWind for full control.
-                -- -100to0 is to the left, and 0to100 is to the right  (of course more its far from 0, more the speed is high
-				--  -100.............................0..................................+100
-				-- <<<<<<<<--<<--<<<<<<<<<<<<<--<<<<<|||-->>>>>>>>-->>>>>>>>>>>>>>>-->>>>>>          =  wind direction
-
-
 	MineArray[0] = AddGear(840, 1847, gtMine, 0, 0, 0, 0)
 	MineArray[1] = AddGear(900, 1847, gtMine, 0, 0, 0, 0)
 	MineArray[2] = AddGear(1000, 1847, gtMine, 0, 0, 0, 0)
@@ -122,16 +113,14 @@
 	MineArray[34] = AddGear(1311, 1785, gtMine, 0, 0, 0, 0)
 
 	MineArray[35] = AddGear(4029, 89, gtMine, 0, 0, 0, 120)
-	--MineArray[36] = AddGear(3376, 1947, gtMine, 0, 0, 0, 10)
 
-		for i = 0,#MineArray do
-			SetTimer(MineArray[i],050)
-			SetState(MineArray[i],544)
-		end
-				--needed this MineArray cause timer didn't work, its was always 3sec, i wanna instant mines
+	for i = 0,#MineArray do
+		SetTimer(MineArray[i],050)
+		SetState(MineArray[i],544)
+	end
+	--needed this MineArray cause timer didn't work, its was always 3sec, i wanna instant mines
 
-
-				--UTILITY CRATE--
+	--UTILITY CRATE--
 	parachute = SpawnUtilityCrate(1670, 1165, amParachute)
 	girder = SpawnUtilityCrate(2101, 1297, amGirder)
 	SpawnUtilityCrate(3965, 625, amBlowTorch)
@@ -144,7 +133,7 @@
 	SpawnUtilityCrate(4070,1840, amLaserSight)
 	
 	
-				--AMMO CRATE--
+	--AMMO CRATE--
 	portalgun = SpawnAmmoCrate(505, 1943, amPortalGun, 1000)
 	extratime = SpawnAmmoCrate(4020, 785, amExtraTime, 2)
 	SpawnAmmoCrate(425, 613, amSnowball)
@@ -157,53 +146,36 @@
 	SpawnAmmoCrate(2900, 1400, amRope)
 	SpawnAmmoCrate(4025, 1117, amFirePunch)
 
-	
-				--HEALTH CRATE--
+	--HEALTH CRATE--
 	SpawnHealthCrate(2000, 780)
 	
-				--GIRDER--
+	--GIRDER--
 	PlaceGirder(3363, 1323, 4)
 
-
 	ShowMission (loc("Portal Mind Challenge"), loc("Mission"), 
 		loc("Defeat all enemies!") .. "|" .. loc("In this mission you have infinite time."),
 		-amPortalGun, 5000)
 	HogSay(player, loc("I should get myself a portal device, maybe this crate has one."), SAY_THINK)
 	
-
-
-
 end
 
 function onGameTick()
 
-    if (player ~= nil)  then
+	if (player ~= nil)  then
 		if (gearIsInBox(player, 1650, 1907, 200, 60) and (adviceGiven == false)) then
 			adviceGiven = true
-				HogSay(player, loc("Hmmm, I’ll have to find some way of moving him off this anti-portal surface."), SAY_THINK)
+			HogSay(player, loc("Hmmm, I’ll have to find some way of moving him off this anti-portal surface."), SAY_THINK)
 		elseif (gearIsInBox(player, 2960, 790, 200, 60) and (adviceGiven2 == false)) then
 			adviceGiven2 = true
-				HogSay(player, loc("The anti-portal surface is all over the floor, and I have nothing to kill him. Dropping something could hurt him enough to kill him."), SAY_THINK)
- end
- end
-	
+			HogSay(player, loc("The anti-portal surface is all over the floor, and I have nothing to kill him. Dropping something could hurt him enough to kill him."), SAY_THINK)
+		end
 	end
 	
-
-
-
-
-function onNewturn()
 end
-
-
-function onGearAdd(gear)
-end
-
+	
 function onGearDelete(gear)
 
 	if gear == portalgun then
-		--AddAmmo(player, amPortalGun, 10000)
 		HogSay(player, loc("Great! Let’s kill all these enemies, using portals."), SAY_THINK)
 	end
 
@@ -214,21 +186,13 @@
 	if gear == parachute then
 		HogSay(player, loc("You can’t open a portal on the blue surface."), SAY_THINK)
 	end
---if you wanted to check for collection only
---you could probably say
---if (gear == myParachuteGear) and (band(GetGearMessage(gear), gmDestroy) ~= 0) then
 
 	if gear == extratime then
 		HogSay(player, loc("What?! For all this struggle I just win some ... time? Oh dear!"), SAY_SHOUT)
 	end
 	
 	if gear == player then
-        player = nil
-    end
+		player = nil
+	end
 end
 
-
-
-
-
-