added death planet in cosmos without the order restriction yet spacecampaign
authorPeriklis Ntanasis <pntanasis@gmail.com>
Sat, 24 Aug 2013 04:14:33 +0300
branchspacecampaign
changeset 9572 278cff2a965f
parent 9570 d4b4ddcd85bb
child 9574 da3d39667881
added death planet in cosmos without the order restriction yet
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Fri Aug 23 23:46:10 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Sat Aug 24 04:14:33 2013 +0300
@@ -186,6 +186,9 @@
 	if GetCampaignVar("Planet") ~= "icePlanet" then
 		AddEvent(onIcePlanetLanding, {hero.gear}, icePlanetLanding, {hero.gear}, 0)
 	end
+	if GetCampaignVar("Planet") ~= "deathPlanet" then
+		AddEvent(onDeathPlanetLanding, {hero.gear}, deathPlanetLanding, {hero.gear}, 0)
+	end
 end
 
 function onGameTick()
@@ -279,6 +282,13 @@
 	return false
 end
 
+function onDeathPlanetLanding(gear)
+	if GetHealth(hero.gear) and GetX(gear) > 310 and GetX(gear) < 675  and GetY(gear) < 400 and StoppedGear(gear) then
+		return true
+	end
+	return false
+end
+
 function onNoFuelAtLand(gear)
 	if GetHealth(hero.gear) and GetY(gear) > 1400 and GetAmmoCount(gear, amJetpack) == 0 and StoppedGear(gear) then
 		return true
@@ -371,6 +381,19 @@
 	end
 end
 
+function deathPlanetLanding(gear)
+	if checkPointReached < 5 then
+		AddAnim(dialog06)
+	else
+		AnimCaption(hero.gear,loc("Welcome to the Death Planet!"))
+		SaveCampaignVar("Planet", "deathPlanet")
+		SaveCampaignVar("UnlockedMissions", "2")
+		SaveCampaignVar("Mission1", "9")
+		SaveCampaignVar("Mission2", "1")
+		EndGame()
+	end
+end
+
 function noFuelAtLand(gear)
 	AddAnim(dialog06)
 end