From 11c3ad6dd16d96472ae748be5b99ac3512f202b5 Mon Sep 17 00:00:00 2001 From: iTracerFacer <134304944+iTracerFacer@users.noreply.github.com> Date: Tue, 2 Dec 2025 20:34:38 -0600 Subject: [PATCH] Moved helper function out of config section. --- .../Moose_DualCoalitionZoneCapture.lua | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/DCS_Normandy/Operation Thunderbolt/Moose_DualCoalitionZoneCapture.lua b/DCS_Normandy/Operation Thunderbolt/Moose_DualCoalitionZoneCapture.lua index 3a95835..00f97a1 100644 --- a/DCS_Normandy/Operation Thunderbolt/Moose_DualCoalitionZoneCapture.lua +++ b/DCS_Normandy/Operation Thunderbolt/Moose_DualCoalitionZoneCapture.lua @@ -39,36 +39,6 @@ local ZONE_COLORS = { EMPTY = {0, 1, 0} -- Green (no owner) } --- Helper to get the appropriate color for a zone based on state/ownership -local function GetZoneColor(zoneCapture) - local zoneCoalition = zoneCapture:GetCoalition() - local state = zoneCapture:GetCurrentState() - - -- Priority 1: Attacked overrides ownership color - if state == "Attacked" then - if zoneCoalition == coalition.side.BLUE then - return ZONE_COLORS.BLUE_ATTACKED - elseif zoneCoalition == coalition.side.RED then - return ZONE_COLORS.RED_ATTACKED - end - end - - -- Priority 2: Empty/neutral - if state == "Empty" then - return ZONE_COLORS.EMPTY - end - - -- Priority 3: Ownership color - if zoneCoalition == coalition.side.BLUE then - return ZONE_COLORS.BLUE_CAPTURED - elseif zoneCoalition == coalition.side.RED then - return ZONE_COLORS.RED_CAPTURED - end - - -- Fallback - return ZONE_COLORS.EMPTY -end - -- ========================================== -- ZONE CONFIGURATION -- ========================================== @@ -303,6 +273,36 @@ local totalZones = InitializeZones() -- Global cached unit set - created once and maintained automatically by MOOSE local CachedUnitSet = nil +-- Helper to get the appropriate color for a zone based on state/ownership +local function GetZoneColor(zoneCapture) + local zoneCoalition = zoneCapture:GetCoalition() + local state = zoneCapture:GetCurrentState() + + -- Priority 1: Attacked overrides ownership color + if state == "Attacked" then + if zoneCoalition == coalition.side.BLUE then + return ZONE_COLORS.BLUE_ATTACKED + elseif zoneCoalition == coalition.side.RED then + return ZONE_COLORS.RED_ATTACKED + end + end + + -- Priority 2: Empty/neutral + if state == "Empty" then + return ZONE_COLORS.EMPTY + end + + -- Priority 3: Ownership color + if zoneCoalition == coalition.side.BLUE then + return ZONE_COLORS.BLUE_CAPTURED + elseif zoneCoalition == coalition.side.RED then + return ZONE_COLORS.RED_CAPTURED + end + + -- Fallback + return ZONE_COLORS.EMPTY +end + -- Utility guard to safely test whether a unit is inside a zone without throwing local function IsUnitInZone(unit, zone) if not unit or not zone then