diff --git a/Moose_CTLD_Pure/Moose_CTLD.lua b/Moose_CTLD_Pure/Moose_CTLD.lua index 8480204..e06a9f6 100644 --- a/Moose_CTLD_Pure/Moose_CTLD.lua +++ b/Moose_CTLD_Pure/Moose_CTLD.lua @@ -1421,6 +1421,17 @@ function CTLD:New(cfg) local o = setmetatable({}, self) o.Config = DeepCopy(CTLD.Config) if cfg then o.Config = DeepMerge(o.Config, cfg) end + + -- Debug: check if MASH zones survived the merge + env.info('[Moose_CTLD][DEBUG] After config merge:') + env.info('[Moose_CTLD][DEBUG] o.Config.Zones exists: '..tostring(o.Config.Zones ~= nil)) + if o.Config.Zones then + env.info('[Moose_CTLD][DEBUG] o.Config.Zones.MASHZones exists: '..tostring(o.Config.Zones.MASHZones ~= nil)) + if o.Config.Zones.MASHZones then + env.info('[Moose_CTLD][DEBUG] o.Config.Zones.MASHZones count: '..tostring(#o.Config.Zones.MASHZones)) + end + end + o.Side = o.Config.CoalitionSide o.MenuRoots = {} o.MenusByGroup = {} @@ -5076,9 +5087,15 @@ function CTLD:_InitMASHZones() local cfg = CTLD.MEDEVAC if not cfg or not cfg.Enabled then return end + env.info('[Moose_CTLD][DEBUG] _InitMASHZones called for coalition '..tostring(self.Side)) + env.info('[Moose_CTLD][DEBUG] self.MASHZones count: '..tostring(#(self.MASHZones or {}))) + env.info('[Moose_CTLD][DEBUG] self.Config.Zones.MASHZones count: '..tostring(#(self.Config.Zones and self.Config.Zones.MASHZones or {}))) + -- Fixed MASH zones are now initialized via InitZones() in the standard Zones structure -- This function now focuses on setting up mobile MASH tracking and announcements + if not CTLD._mashZones then CTLD._mashZones = {} end + -- Register fixed MASH zones in the global _mashZones table for delivery detection -- (mobile MASH zones will be added dynamically when built) for _, mz in ipairs(self.MASHZones or {}) do diff --git a/Moose_CTLD_Pure/Moose_CTLD_Init_DualCoalitions.lua b/Moose_CTLD_Pure/Moose_CTLD_Init_DualCoalitions.lua index 1eb5afa..50aeb6c 100644 --- a/Moose_CTLD_Pure/Moose_CTLD_Init_DualCoalitions.lua +++ b/Moose_CTLD_Pure/Moose_CTLD_Init_DualCoalitions.lua @@ -18,7 +18,7 @@ -- Create CTLD instances only if Moose and CTLD are available if _MOOSE_CTLD and _G.BASE then -ctldBlue = _MOOSE_CTLD:New({ +local blueCfg = { CoalitionSide = coalition.side.BLUE, PickupZoneSmokeColor = trigger.smokeColor.Blue, AllowedAircraft = { -- transport-capable unit type names (case-sensitive as in DCS DB) @@ -26,16 +26,26 @@ ctldBlue = _MOOSE_CTLD:New({ }, -- Optional: drive zone activation from mission flags (preferred: set per-zone below via flag/activeWhen) + MapDraw = { + Enabled = true, + DrawMASHZones = true, -- Enable MASH zone drawing + }, + Zones = { PickupZones = { { name = 'ALPHA', smoke = trigger.smokeColor.Blue, flag = 9001, activeWhen = 0 } }, DropZones = { { name = 'BRAVO', flag = 9002, activeWhen = 0 } }, FOBZones = { { name = 'CHARLIE', flag = 9003, activeWhen = 0 } }, - --MASHZones = { { name = 'MASH Alpha', freq = '251.0 AM', radius = 500, flag = 9010, activeWhen = 0 } }, + MASHZones = { { name = 'MASH Alpha', freq = '251.0 AM', radius = 500, flag = 9010, activeWhen = 0 } }, }, - BuildRequiresGroundCrates = true, -}) + BuildRequiresGroundCrates = true, +} +env.info('[DEBUG] blueCfg.Zones.MASHZones count: ' .. tostring(blueCfg.Zones and blueCfg.Zones.MASHZones and #blueCfg.Zones.MASHZones or 'NIL')) +if blueCfg.Zones and blueCfg.Zones.MASHZones and blueCfg.Zones.MASHZones[1] then + env.info('[DEBUG] blueCfg.Zones.MASHZones[1].name: ' .. tostring(blueCfg.Zones.MASHZones[1].name)) +end +ctldBlue = _MOOSE_CTLD:New(blueCfg) -ctldRed = _MOOSE_CTLD:New({ +local redCfg = { CoalitionSide = coalition.side.RED, PickupZoneSmokeColor = trigger.smokeColor.Red, AllowedAircraft = { -- transport-capable unit type names (case-sensitive as in DCS DB) @@ -44,14 +54,24 @@ ctldRed = _MOOSE_CTLD:New({ }, -- Optional: drive zone activation for RED via per-zone flag/activeWhen + MapDraw = { + Enabled = true, + DrawMASHZones = true, -- Enable MASH zone drawing + }, + Zones = { PickupZones = { { name = 'DELTA', smoke = trigger.smokeColor.Red, flag = 9101, activeWhen = 0 } }, DropZones = { { name = 'ECHO', flag = 9102, activeWhen = 0 } }, FOBZones = { { name = 'FOXTROT', flag = 9103, activeWhen = 0 } }, - --MASHZones = { { name = 'MASH Bravo', freq = '252.0 AM', radius = 500, flag = 9111, activeWhen = 0 } }, + MASHZones = { { name = 'MASH Bravo', freq = '252.0 AM', radius = 500, flag = 9111, activeWhen = 0 } }, }, - BuildRequiresGroundCrates = true, -}) + BuildRequiresGroundCrates = true, +} +env.info('[DEBUG] redCfg.Zones.MASHZones count: ' .. tostring(redCfg.Zones and redCfg.Zones.MASHZones and #redCfg.Zones.MASHZones or 'NIL')) +if redCfg.Zones and redCfg.Zones.MASHZones and redCfg.Zones.MASHZones[1] then + env.info('[DEBUG] redCfg.Zones.MASHZones[1].name: ' .. tostring(redCfg.Zones.MASHZones[1].name)) +end +ctldRed = _MOOSE_CTLD:New(redCfg) else env.info('[init_mission_dual_coalition] Moose or CTLD missing; skipping CTLD init') end diff --git a/Moose_CTLD_Pure/Moose_CTLD_Pure.miz b/Moose_CTLD_Pure/Moose_CTLD_Pure.miz index 86c60a5..cffc6ab 100644 Binary files a/Moose_CTLD_Pure/Moose_CTLD_Pure.miz and b/Moose_CTLD_Pure/Moose_CTLD_Pure.miz differ