mirror of
https://github.com/iTracerFacer/DCS_MissionDev.git
synced 2025-12-03 04:14:46 +00:00
Moved helper function out of config section.
This commit is contained in:
parent
2bce81c559
commit
11c3ad6dd1
@ -39,36 +39,6 @@ local ZONE_COLORS = {
|
|||||||
EMPTY = {0, 1, 0} -- Green (no owner)
|
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
|
-- ZONE CONFIGURATION
|
||||||
-- ==========================================
|
-- ==========================================
|
||||||
@ -303,6 +273,36 @@ local totalZones = InitializeZones()
|
|||||||
-- Global cached unit set - created once and maintained automatically by MOOSE
|
-- Global cached unit set - created once and maintained automatically by MOOSE
|
||||||
local CachedUnitSet = nil
|
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
|
-- Utility guard to safely test whether a unit is inside a zone without throwing
|
||||||
local function IsUnitInZone(unit, zone)
|
local function IsUnitInZone(unit, zone)
|
||||||
if not unit or not zone then
|
if not unit or not zone then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user