ASA fruit03: Fix skipping not adding to turn time in next turn
authorWuzzy <almikes@aol.com>
Thu, 28 Sep 2017 19:26:22 +0200
changeset 12578 5b23c42ef150
parent 12577 e2b5c6e805e8
child 12579 0411e04cf12a
ASA fruit03: Fix skipping not adding to turn time in next turn
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua	Thu Sep 28 18:39:59 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua	Thu Sep 28 19:26:22 2017 +0200
@@ -122,7 +122,6 @@
 	AddAmmo(hero.gear, amSniperRifle, 2)
 	AddAmmo(hero.gear, amWatermelon, 2)
 
-	-- these 2 are needed in order hero has 10 sec more in the first turn
 	AddAmmo(hero.gear, amSkip, 100)
 	timeLeft = 0
 
@@ -142,7 +141,7 @@
 function onNewTurn()
 	if CurrentHedgehog == hero.gear then
 		if firstTurn then
-			-- Unique game rule in this mission
+			-- Unique game rule in this mission: First turn has more time
 			TurnTimeLeft = 25000
 			-- Generous ready time on first turn to give more time to read
 			ReadyTimeLeft = 35000
@@ -192,10 +191,15 @@
 	end
 end
 
-onHogAttack = hideMissionOnAction
-onAttack = hideMissionOnAction
 onSlot = hideMissionOnAction
 onSetWeapon = hideMissionOnAction
+onAttack = hideMissionOnAction
+function onHogAttack(ammoType)
+	hideMissionOnAction()
+	if CurrentHedgehog == hero.gear then
+		lastWeaponUsed = ammoType
+	end
+end
 
 -------------- EVENTS ------------------
 
@@ -277,11 +281,6 @@
 	end
 end
 
-function onSwitch()
-	ReadyTimeLeft = ReadyTimeLeft + 2000
-	PlaySound(sndExtraTime)
-end
-
 function isHog(gear)
 	local hog = false
 	for i=1,table.getn(enemiesOdd) do