Construction Mode: Hide power tag when it's nobody's turn
authorWuzzy <Wuzzy2@mail.ru>
Sat, 10 Feb 2018 12:59:13 +0100
changeset 12957 08f91e9e3d2c
parent 12956 89930daecaab
child 12958 c0746aa9944d
Construction Mode: Hide power tag when it's nobody's turn
share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Sat Feb 10 12:44:40 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Sat Feb 10 12:59:13 2018 +0100
@@ -300,6 +300,11 @@
 
 end
 
+function DeleteClanPowerTag()
+	DeleteVisualGear(clanPowerTag)
+	clanPowerTag = nil
+end
+
 function XYisInRect(px, py, psx, psy, pex, pey)
 
 	if (px > psx) and (px < pex) and (py > psy) and (py < pey) then
@@ -1013,7 +1018,9 @@
 		end
 
 		if placed then
+			-- Pay the price
 			clanPower[GetHogClan(CurrentHedgehog)] = clanPower[GetHogClan(CurrentHedgehog)] - placedExpense
+			DrawClanPowerTag()
 		else
 			AddCaption(loc("Invalid Placement"), colorMessageError, capgrpVolume)
 			PlaySound(sndDenied)
@@ -1176,15 +1183,15 @@
 
 		if GameTime % 100 == 0 then
 
-			DrawClanPowerTag()
-
 			-- Force-update the construction mode tools every 100ms.
 			-- This makes sure the announcer messages don't disappear
 			-- while the tool is selected.
 			if (band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then
+				DrawClanPowerTag()
 				curWep = GetCurAmmoType()
 				HandleConstructionModeTools()
 			else
+				DeleteClanPowerTag()
 				curWep = amNothing
 			end
 
@@ -1629,11 +1636,14 @@
 	end
 	clanUsedExtraTime[clan] = false
 	clanCratesSpawned[clan] = 0
+
+	DrawClanPowerTag()
 end
 
 function onEndTurn()
 	curWep = amNothing
 	HandleConstructionModeTools()
+	DeleteClanPowerTag()
 end
 
 function onGameTick()