Use onSkipTurn in scripts to detect turn skips
authorWuzzy <Wuzzy2@mail.ru>
Mon, 12 Mar 2018 12:54:33 +0100
changeset 13172 159004144897
parent 13171 9f80c08cdae9
child 13173 4d1cf0d76eb7
Use onSkipTurn in scripts to detect turn skips
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua
share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Mon Mar 12 12:37:35 2018 +0100
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Mon Mar 12 12:54:33 2018 +0100
@@ -1168,8 +1168,8 @@
   end
 end
 
-function onHogAttack(ammoType)
-  if stage == spyKillStage and ammoType == amSkip then
+function onSkipTurn()
+  if stage == spyKillStage then
     highJumped = true
   end
 end
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua	Mon Mar 12 12:37:35 2018 +0100
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua	Mon Mar 12 12:54:33 2018 +0100
@@ -555,9 +555,7 @@
 	end
 end
 
-function onHogAttack(ammoType)
-	if ammoType == amSkip then
-		AddCaption(loc("Try again!"), 0xFFFFFFFF, capgrpMessage2)
-		ResetCurrentTarget()
-	end
+function onSkipTurn()
+	AddCaption(loc("Try again!"), 0xFFFFFFFF, capgrpMessage2)
+	ResetCurrentTarget()
 end
--- a/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Mon Mar 12 12:37:35 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Mon Mar 12 12:54:33 2018 +0100
@@ -694,16 +694,14 @@
 	end
 end
 
-function onHogAttack(ammoType)
+function onSkipTurn()
 	-- Record skips for achievement
-	if ammoType == amSkip then
-		local team = GetHogTeamName(CurrentHedgehog)
-		increaseTeamValue(team, "Skips")
-		if(getTeamValue(team, "Skips") > recordSkips) then
-			recordSkips = getTeamValue(team, "Skips")
-			recordSkipsHogName = getGearValue(CurrentHedgehog, "Name")
-			recordSkipsTeamName = team
-		end
+	local team = GetHogTeamName(CurrentHedgehog)
+	increaseTeamValue(team, "Skips")
+	if(getTeamValue(team, "Skips") > recordSkips) then
+		recordSkips = getTeamValue(team, "Skips")
+		recordSkipsHogName = getGearValue(CurrentHedgehog, "Name")
+		recordSkipsTeamName = team
 	end
 end