The Specialits: Use gfSwitchHog for hog switching and delete the terrible Lua hacks
authorWuzzy <Wuzzy2@mail.ru>
Fri, 23 Mar 2018 03:37:07 +0100
changeset 13273 8f579173b161
parent 13272 5984e8c6cbeb
child 13274 e381f5260b45
The Specialits: Use gfSwitchHog for hog switching and delete the terrible Lua hacks
ChangeLog.txt
share/hedgewars/Data/Locale/de.lua
share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
--- a/ChangeLog.txt	Fri Mar 23 03:17:01 2018 +0100
+++ b/ChangeLog.txt	Fri Mar 23 03:37:07 2018 +0100
@@ -64,6 +64,7 @@
  + HedgeEditor: Show cursor coordinates in top left corner
  + Control: Always remove TimeBox and Resurrector
  + Climb Home: Show messages when a fire cake is nearby and when you're inside home
+ * The Specialists: Less buggy hog switching at turn start
  * Mutant: When game ends due to all land being gone, declare the highest-scoring team the winner
  * Battalion: Some texts in the mission panel were wrong and misleading
  * Construction Mode: Remove drill strike if added by weapon scheme (it's broken)
--- a/share/hedgewars/Data/Locale/de.lua	Fri Mar 23 03:17:01 2018 +0100
+++ b/share/hedgewars/Data/Locale/de.lua	Fri Mar 23 03:37:07 2018 +0100
@@ -710,7 +710,7 @@
 ["“g=150”, where 150 is 150% of normal gravity."] = "»g=150«, wobei die »150« für 150% der Normalschwerkraft steht.", -- Gravity
 ["“g=50, g2=150, period=4000” for gravity changing|from 50 to 150 and back with period of 4000 ms."] = "»g=50, g2=150, period=4000«, für Schwerkraft,|die von 50% bis 150% wechselt mit einer Periode von 4000ms.", -- Gravity
 ["Galaxy Guardians"] = "Galaxiewächter", -- Big_Armory
-["Game Modifiers: "]="Spiel-Modifikatoren",
+["Game Modifiers: "]="Spiel-Modifikatoren: ",
 ["Game over!"] = "Spiel vorbei!", -- Space_Invasion
 ["GAME OVER!"]="SPIEL ZU ENDE!",
 ["Game Started!"]="Spiel gestartet!",
--- a/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Fri Mar 23 03:17:01 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Fri Mar 23 03:37:07 2018 +0100
@@ -58,16 +58,7 @@
 local numhhs = 0
 local hhs = {}
 
-local currName
-local lastName
 local started = false
-local switchStage = 0
-
-local hogCounter
-
-function CountHog(gear)
-	hogCounter = hogCounter +1
-end
 
 function onNewAmmoStore(groupIndex, hogIndex)
 
@@ -183,7 +174,7 @@
 
 function onGameInit()
 	ClearGameFlags()
-	EnableGameFlags(gfRandomOrder, gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo)
+	EnableGameFlags(gfRandomOrder, gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo, gfSwitchHog)
 	Delay = 10
 	HealthCaseProb = 100
 end
@@ -213,55 +204,9 @@
 
 
 function onNewTurn()
-	currName = GetHogName(CurrentHedgehog)
-	lastName = GetHogName(CurrentHedgehog)
+
 	started = true
-	switchStage = 0
-end
-
-function onGameTick20()
-
-	if (CurrentHedgehog ~= nil) then
-
-		currName = GetHogName(CurrentHedgehog)
-
-		if (currName ~= lastName) and (switchStage > 5) then
-			AddCaption(loc("Switched to ") .. currName .. "!")
-		end
-
-		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 5) then
-
-			AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!")
-
-			hogCounter = 0
-			runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) )
-
-			if hogCounter > 1 then
-
-				switchStage = switchStage + 1
-
-				if switchStage == 1 then
-					AddAmmo(CurrentHedgehog, amSwitch, 1)
-
-				elseif switchStage == 2 then
-					SetWeapon(amSwitch)
-				elseif switchStage == 3 then
-					SetGearMessage(CurrentHedgehog,gmAttack)
-				elseif switchStage == 4 then
-					switchStage = 6
-					AddAmmo(CurrentHedgehog, amSwitch, 0)
-				end
-
-			else
-				switchStage = 6
-			end
-
-
-		end
-
-		lastName = currName
-
-	end
+	AddCaption(loc("Prepare yourself") .. ", " .. GetHogName(CurrentHedgehog).. "!")
 
 end
 
@@ -278,7 +223,6 @@
 		trackGear(gear)
 	end
 
-
 end
 
 function onGearDelete(gear)
@@ -287,7 +231,3 @@
 	end
 end
 
-function onAmmoStoreInit()
---
-end
-