share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua
changeset 12594 fa837afff629
parent 12593 2b9f658cba90
child 12624 2b529ddf1b01
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua	Fri Sep 29 18:27:44 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua	Fri Sep 29 19:12:00 2017 +0200
@@ -202,21 +202,31 @@
 end
 
 function onNewTurn()
+	local function getReady(hog)
+		-- This clears the "Get ready, Hog!" caption from the engine, because it will name the
+		-- false hog because we immediately switch the hog after the turn start.
+		-- TODO: Find a better method for this and show the real hog name (preferably using an engine string)
+		AddCaption("")
+	end
+
 	if CurrentHedgehog ~= hero.gear and not heroIsInBattle then
-		EndTurn(true)
+		AnimSwitchHog(hero.gear)
+		getReady(hero.gear)
+		TurnTimeLeft = -1
 	elseif CurrentHedgehog == hero.gear and not heroIsInBattle then
 		TurnTimeLeft = -1
 	elseif (CurrentHedgehog == smuggler2.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 1 then
-		AnimSwitchHog(hero.gear)
-		EndTurn(true)
+		AnimSwitchHog(smuggler1.gear)
+		getReady(smuggler1.gear)
 	elseif (CurrentHedgehog == smuggler1.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 2 then
+		AnimSwitchHog(smuggler2.gear)
+		getReady(smuggler2.gear)
+	elseif (CurrentHedgehog == smuggler1.gear or CurrentHedgehog == smuggler2.gear) and ongoingBattle == 3 then
+		AnimSwitchHog(smuggler3.gear)
+		getReady(smuggler3.gear)
+	elseif CurrentHedgehog == ally.gear then
 		AnimSwitchHog(hero.gear)
-		EndTurn(true)
-	elseif (CurrentHedgehog == smuggler1.gear or CurrentHedgehog == smuggler2.gear) and ongoingBattle == 3 then
-		AnimSwitchHog(hero.gear)
-		EndTurn(true)
-	elseif CurrentHedgehog == ally.gear then
-		EndTurn(true)
+		getReady(hero.gear)
 	end
 end