share/hedgewars/Data/Scripts/Multiplayer/WxW.lua
changeset 14791 0ee6b01c7f30
parent 14003 681a53c8b18c
child 14792 97a36fb44123
--- a/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Mon Apr 08 16:00:15 2019 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Mon Apr 08 17:44:33 2019 +0200
@@ -848,6 +848,13 @@
 
 end
 
+function onCaseDrop()
+	if roundN == 100 then
+		allowCrate = crateGearsInGame < maxCrates
+		CheckCrateConditions()
+	end
+end
+
 function CheckCrateConditions()
 
 	local crateSpawn = AreCratesUnlocked()
@@ -935,6 +942,9 @@
 
 function HandleBorderEffects()
 
+	if band(GetState(CurrentHedgehog), gstHHDriven) == 0 then
+		return
+	end
 	effectTimer = effectTimer + 1
 	if effectTimer > 15 then --25
 
@@ -1269,6 +1279,17 @@
 	end
 end
 
+function onEndTurn()
+	crateSpawned = false
+	crateCollected = false
+	wallsLeft = #wTouched
+	for i = 1, #wTouched do
+		wTouched[i] = false
+	end
+	hasSurfed = false
+	allWallsHit = false
+end
+
 function onNewTurn()
 	turnsCount = turnsCount + 1
 
@@ -1290,20 +1311,7 @@
 		end
 	end
 
-	wallsLeft = #wTouched
-
-	for i = 1, #wTouched do
-		wTouched[i] = false
-	end
-
-	hasSurfed = false
-	allWallsHit = false
-	crateCollected = false
-
-	crateSpawned = false
-
 	if roundN == 100 then
-		allowCrate = crateGearsInGame < maxCrates
 
 		local teamName = GetHogTeamName(CurrentHedgehog)
 
@@ -1332,8 +1340,6 @@
 			setTeamValue(teamName, "skipPenalty", false)
 		end
 
-	else
-		allowCrate = false
 	end
 
 	if roundN == 1 then
@@ -1574,7 +1580,9 @@
 
 			if roundN == 100 then
 				CheckForWallCollision()
-				CheckCrateConditions()
+				if band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then
+					CheckCrateConditions()
+				end
 
 				if (GetGearType(GetFollowGear()) == gtCase) then
 					FollowGear(CurrentHedgehog)