ASA, Spacetrip mission: Fix poor detection of crate collection
authorWuzzy <almikes@aol.com>
Mon, 25 Sep 2017 19:16:14 +0200
changeset 12522 193b5882429d
parent 12521 90569bd07627
child 12523 94bba599efd3
ASA, Spacetrip mission: Fix poor detection of crate collection
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Mon Sep 25 18:58:50 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Mon Sep 25 19:16:14 2017 +0200
@@ -275,6 +275,12 @@
 	return false
 end
 
+function onGearDelete(gear)
+	if GetGearType(gear) == gtCase and band(GetGearMessage(gear), gmDestroy) ~= 0 then
+		heroAtSaucerPosition()
+	end
+end
+
 function onHeroOutOfGuardSight(gear)
 	if GetHealth(hero.gear) and GetX(gear) < 3100 and GetY(gear) > saucerY-25 and StoppedGear(gear) and not guard1.keepTurning then
 		return true
@@ -347,15 +353,18 @@
 end
 
 function heroAtSaucerPosition(gear)
-	EndTurn(true)
-	-- save check point
-	SaveCampaignVar("CosmosCheckPoint", "2")
-	checkPointReached = 2
-	AddAnim(dialog02)
-	-- check if he was spotted by the guard
-	if guard1.turn and GetX(hero.gear) > saucerX-150 then
-		guard1.keepTurning = false
-		AddAnim(dialog03)
+	if not saucerAcquired then
+		EndTurn(true)
+		-- save check point
+		SaveCampaignVar("CosmosCheckPoint", "2")
+		checkPointReached = 2
+		AddAnim(dialog02)
+		-- check if he was spotted by the guard
+		if guard1.turn and GetX(hero.gear) > saucerX-150 then
+			guard1.keepTurning = false
+			AddAnim(dialog03)
+		end
+		saucerAcquired = true
 	end
 end