Refactor Teamwork 2: No more hacky skipping, set proper ammos for enemy instead
authorWuzzy <almikes@aol.com>
Thu, 27 Apr 2017 03:21:16 +0200
changeset 12358 ebff18a44c1e
parent 12357 7f09d01ecb45
child 12359 5e4ac10a03ce
Refactor Teamwork 2: No more hacky skipping, set proper ammos for enemy instead
share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork_2.lua
--- a/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork_2.lua	Thu Apr 27 03:11:50 2017 +0200
+++ b/share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork_2.lua	Thu Apr 27 03:21:16 2017 +0200
@@ -9,7 +9,6 @@
 local Pack = nil
 local help = false
 local GameOver = false
-local skipTime = 0
 
 function onGameInit()
 	Seed = 0
@@ -70,6 +69,13 @@
 	AddGear(1668, 842, gtExplosives, 0, 0, 0, 0)
 	AddGear(1713, 969, gtExplosives, 0, 0, 0, 0)
 	SetWind(90)
+
+	-- The enemy has no weapons and can only skip
+	for i=0, AmmoTypeMax do
+		if i ~= amNothing and i ~= amSkip then
+			AddAmmo(enemy, i, 0)
+		end
+	end
 end
 
 function onGearAdd(gear)
@@ -89,20 +95,6 @@
 	SetAmmo(amDynamite, 0, 0, 0, 1)
 end
 
---[[ This is some hackery to make the enemy hedgehog skip ]]
-function onNewTurn()
-	if CurrentHedgehog == enemy then
-		skipTime = GameTime + 1
-	end
-end
-
-function onGameTick20()
-	if CurrentHedgehog == enemy and skipTime ~= 0 and skipTime < GameTime then
-        	ParseCommand("/skip")
-		skipTime = 0
-	end
-end
-
 function onGearDelete(gear)
 	if gear == Pack then
 		HogSay(CurrentHedgehog, loc("This will certianly come in handy."), SAY_THINK)