mirror of
https://github.com/iTracerFacer/Moose_DualCoalitionZoneCapture.git
synced 2025-12-03 04:12:31 +00:00
Added nil checks where needed.
This commit is contained in:
parent
505a9663ac
commit
afdd777680
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user