Construction Mode: Don't update ticker for cursor keys when hedgehog is not under control anymore
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua Tue Apr 26 17:40:29 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua Tue Apr 26 17:54:48 2016 +0200
@@ -1262,7 +1262,8 @@
end
-- update display selection criteria
- if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) or (curWep == amRubber) then
+ if ((curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) or (curWep == amRubber))
+ and (CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then
---------------hooolllllyyyy fucking shit this
-- code is a broken mess now
@@ -1346,6 +1347,8 @@
function updateCost()
+ if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then return end
+
if pMode[pIndex] == loc("Healing Station") then
placedExpense = 50
elseif pMode[pIndex] == loc("Weapon Filter") then
@@ -1410,7 +1413,7 @@
end
function showModeMessage()
- if CurrentHedgehog == nil then return end
+ if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then return end
local val = pMode[pIndex]
local str
if cat[cIndex] == "Mine Placement Mode" then
@@ -1478,7 +1481,9 @@
function onUp()
if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then
- updatePlacementDisplay(-1)
+ if CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then
+ updatePlacementDisplay(-1)
+ end
end
end
@@ -1486,7 +1491,9 @@
function onDown()
if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then
- updatePlacementDisplay(1)
+ if CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then
+ updatePlacementDisplay(1)
+ end
end
end