From afdd777680db65fee5666086660ef803e0e6abf6 Mon Sep 17 00:00:00 2001 From: iTracerFacer <134304944+iTracerFacer@users.noreply.github.com> Date: Mon, 1 Dec 2025 09:46:06 -0600 Subject: [PATCH] Added nil checks where needed. --- Moose_DualCoalitionZoneCapture.lua | 4 ++++ Moose_DynamicGroundBattle_Plugin.lua | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Moose_DualCoalitionZoneCapture.lua b/Moose_DualCoalitionZoneCapture.lua index 3b3c739..044618d 100644 --- a/Moose_DualCoalitionZoneCapture.lua +++ b/Moose_DualCoalitionZoneCapture.lua @@ -1,4 +1,8 @@ -- Refactored version with configurable zone ownership +---@diagnostic disable: undefined-global, lowercase-global +-- MOOSE framework globals are defined at runtime by DCS World + + -- ========================================== -- MESSAGE AND TIMING CONFIGURATION diff --git a/Moose_DynamicGroundBattle_Plugin.lua b/Moose_DynamicGroundBattle_Plugin.lua index 1ccd479..8366541 100644 --- a/Moose_DynamicGroundBattle_Plugin.lua +++ b/Moose_DynamicGroundBattle_Plugin.lua @@ -72,6 +72,8 @@ - Spawns occur in zones controlled by the appropriate coalition - AI tasks units to patrol zones from DualCoalitionZoneCapture's ZONE_CONFIG --]] +---@diagnostic disable: undefined-global, lowercase-global +-- MOOSE framework globals are defined at runtime by DCS World ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- USER CONFIGURATION SECTION @@ -568,7 +570,7 @@ local function TryDefenderRotation(group, zone) end end - if oldestDefender and oldestDefenderGroup:GetName() ~= group:GetName() then + if oldestDefender and oldestDefenderGroup and oldestDefenderGroup:GetName() ~= group:GetName() then -- Remove old defender for i, defenderName in ipairs(garrison.defenders) do if defenderName == oldestDefender then @@ -688,7 +690,7 @@ local function AssignTasksToGroups() end -- 3. HANDLE GROUPS IN FRIENDLY ZONES - if currentZone and currentZoneCapture:GetCoalition() == groupCoalition then + if currentZone and currentZoneCapture and currentZoneCapture:GetCoalition() == groupCoalition then local zoneName = currentZone:GetName() -- PRIORITY 1: If the zone is under attack, all non-defenders should help defend it