WxW: Hide crate radar when no active hog
authorWuzzy <Wuzzy2@mail.ru>
Mon, 08 Apr 2019 17:59:38 +0200
changeset 14792 97a36fb44123
parent 14791 0ee6b01c7f30
child 14793 f5dcf47dff2c
WxW: Hide crate radar when no active hog
share/hedgewars/Data/Scripts/Multiplayer/WxW.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Mon Apr 08 17:44:33 2019 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Mon Apr 08 17:59:38 2019 +0200
@@ -696,7 +696,11 @@
 	end
 
 	local baseColor, radius, alpha
-	if getGearValue(gear, "frozen") then
+	if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then
+		radius = 40
+		baseColor = 0xFFFFFFFF
+		alpha = 255
+	elseif getGearValue(gear, "frozen") then
 		radius = 25
 		baseColor = 0xFFFFFFFF
 		alpha = math.min(255, rAlpha+127)
@@ -942,7 +946,7 @@
 
 function HandleBorderEffects()
 
-	if band(GetState(CurrentHedgehog), gstHHDriven) == 0 then
+	if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then
 		return
 	end
 	effectTimer = effectTimer + 1
@@ -1317,6 +1321,9 @@
 
 		-- Restore team's radar mode
 		radarMode = getTeamValue(teamName, "radarMode")
+		if radarMode == nil then
+			radarMode = 0
+		end
 
 		if not AreCratesUnlocked() then
 			FreezeCrates()
@@ -1628,11 +1635,12 @@
 
 		end
 
-		HandleBorderEffects()
-		HandleCircles()
 
 	end
 
+	HandleBorderEffects()
+	HandleCircles()
+
 end
 
 local menuRepeatTimer = 0
@@ -1662,7 +1670,7 @@
 		if vg then
 			table.insert(rCirc, vg)
 			setGearValue(gear,"CIRC",vg)
-			SetVisualGearValues(vg, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff00ffff)
+			SetVisualGearValues(vg, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x0)
 		end
 		setGearValue(gear,"RX",0)
 		setGearValue(gear,"RY",0)