Construction Mode: Fix construction/support station
authorWuzzy <almikes@aol.com>
Wed, 13 Apr 2016 02:20:04 +0200
changeset 11724 cf4d61123440
parent 11723 456f4e9f9dce
child 11725 3444792e8ebe
Construction Mode: Fix construction/support station
share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Wed Apr 13 01:53:25 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Wed Apr 13 02:20:04 2016 +0200
@@ -805,13 +805,15 @@
 
 function HandleStructures()
 
-	for i = 1, #sProx do
-		sProx[i][2] = false
+	if GameTime % 100 == 0 then
+		for i = 1, #sProx do
+			sProx[i][2] = false
 
-		if sProx[i][1] == loc("Structure Placement Mode") then
-			sProx[i][2] = true
+			if sProx[i][1] == loc("Structure Placement Mode") then
+				sProx[i][2] = true
+			end
+
 		end
-
 	end
 
 	for i = 1, #strucID do
@@ -858,38 +860,40 @@
 	-- this is kinda messy and gross (even more than usual), fix it up at some point
 	-- it just assumes that if you have access to girders, it works for rubbers
 	-- as that is what the struc implemenation means due to construction station
-	anyUIProx = false
-	for i = 1, #sProx do
+	if GameTime % 100 == 0 then
+		anyUIProx = false
+		for i = 1, #sProx do
 
-		if sProx[i][1] == loc("Girder Placement Mode") then
-			if sProx[i][2] == true then
-				AddAmmo(CurrentHedgehog, amGirder, 100)
-				AddAmmo(CurrentHedgehog, amRubber, 100)
-				AddAmmo(CurrentHedgehog, amDrillStrike, 100)
-			else
-				AddAmmo(CurrentHedgehog, amGirder, 0)
-				AddAmmo(CurrentHedgehog, amRubber, 0)
-				AddAmmo(CurrentHedgehog, amDrillStrike, 0) -- new
+			if sProx[i][1] == loc("Girder Placement Mode") then
+				if sProx[i][2] == true then
+					AddAmmo(CurrentHedgehog, amGirder, 100)
+					AddAmmo(CurrentHedgehog, amRubber, 100)
+					AddAmmo(CurrentHedgehog, amDrillStrike, 100)
+				else
+					AddAmmo(CurrentHedgehog, amGirder, 0)
+					AddAmmo(CurrentHedgehog, amRubber, 0)
+					AddAmmo(CurrentHedgehog, amDrillStrike, 0) -- new
+				end
+			elseif sProx[i][1] == loc("Teleportation Mode") then
+				if sProx[i][2] == true then
+					AddAmmo(CurrentHedgehog, amTeleport, 100)
+				else
+					AddAmmo(CurrentHedgehog, amTeleport, 0)
+				end
+			elseif sProx[i][1] == loc("Weapon Crate Placement Mode") then
+				-- this is new stuff
+				if sProx[i][2] == true then
+					AddAmmo(CurrentHedgehog, amNapalm, 100)
+				else
+					AddAmmo(CurrentHedgehog, amNapalm, 0)
+				end
 			end
-		elseif sProx[i][1] == loc("Teleportation Mode") then
-			if sProx[i][2] == true then
-				AddAmmo(CurrentHedgehog, amTeleport, 100)
-			else
-				AddAmmo(CurrentHedgehog, amTeleport, 0)
+
+			if (sProx[i][2] == true) then
+				anyUIProx = true
 			end
-		elseif sProx[i][1] == loc("Weapon Crate Placement Mode") then
-			-- this is new stuff
-			if sProx[i][2] == true then
-				AddAmmo(CurrentHedgehog, amNapalm, 100)
-			else
-				AddAmmo(CurrentHedgehog, amNapalm, 0)
-			end
+
 		end
-
-		if (sProx[i][2] == true) then
-			anyUIProx = true
-		end
-
 	end
 
 end