Add TERRITORY class and various fixes

Add a new passive TERRITORY functional module (Functional/Territory.lua) and register it in Modules.lua. TERRITORY provides zone-backed territory objects and DB helpers (Find/Add/Delete).

Update AUFTRAG: bump version to 1.5.0, introduce AUFTRAG.Summary, add an "Evaluated" event/transition, populate and emit mission summary from Evaluate(), set a dTevaluate for BAI, replace Stop() with __Stop(-120) on terminal states, and clear summary on repeats/stops. Minor ARTY debug prints and make Speed param optional.

INTEL: add _UpdateAgents and SetAgentAuto to optionally auto-refresh the detection set and invoke it during status updates.

OPSGROUP: require StayInZoneTime>0 before treating task as stayed.

AIRBASE: determine DCS object category and name, handle ship/oil-rig/helipad edge cases (add static helipad to DB), keep Zell detection, and create parkingCircle with explicit parameter. Coherent small refactors and safety checks across modules.
This commit is contained in:
Frank
2026-08-01 16:29:24 +02:00
parent e8f5214e0b
commit 2a73d8d34a
6 changed files with 421 additions and 21 deletions
+62 -4
View File
@@ -191,6 +191,8 @@
-- @field #boolean optionEmission Emission is on or off.
-- @field #boolean optionInvisible Invisible is on/off.
-- @field #boolean optionImmortal Immortal is on/off.
--
-- @field #AUFTRAG.Summary summary Auftrag summary.
--
-- @extends Core.Fsm#FSM
@@ -656,6 +658,19 @@ AUFTRAG.Category={
-- @field #string DAMAGED Target was damaged.
-- @field #string DESTROYED Target was destroyed.
--- Mission summary.
-- @type AUFTRAG.Summary
-- @field #boolean success If true, mission was successful.
-- @field #number Ntargets0 Number of initial targets.
-- @field #number Ntargets Number of final targets after mission is done.
-- @field #number damage Target damage in per cent.
-- @field #number Ndestroyed Number of destroyed targets.
-- @field #number Nkills Number of kills from assigned groups.
-- @field #number Nelements Number of elements assigned to mission.
-- @field #number targetLife Target life points after mission is over.
-- @field #number category Target category.
-- @field #number Ncasualties Number of own casualties.
--- Generic mission condition.
-- @type AUFTRAG.Condition
-- @field #function func Callback function to check for a condition. Should return a #boolean.
@@ -676,7 +691,7 @@ AUFTRAG.Category={
--- AUFTRAG class version.
-- @field #string version
AUFTRAG.version="1.4.2"
AUFTRAG.version="1.5.0"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@@ -776,6 +791,7 @@ function AUFTRAG:New(Type)
self:AddTransition("*", "Cancel", AUFTRAG.Status.CANCELLED) -- Command to cancel the mission.
self:AddTransition("*", "Evaluated", "*")
self:AddTransition("*", "Success", AUFTRAG.Status.SUCCESS)
self:AddTransition("*", "Failed", AUFTRAG.Status.FAILED)
@@ -946,6 +962,24 @@ function AUFTRAG:New(Type)
-- @param #string Event Event.
-- @param #string To To state.
--- Triggers the FSM event "Evaluated".
-- @function [parent=#AUFTRAG] Evaluated
-- @param #AUFTRAG self
-- @param #AUFTRAG.Summary
--- Triggers the FSM event "Evaluated" after a delay.
-- @function [parent=#AUFTRAG] __Evaluated
-- @param #AUFTRAG self
-- @param #number delay Delay in seconds.
-- @param #AUFTRAG.Summary Summary Mission summary.
--- On after "Evaluated" event.
-- @function [parent=#AUFTRAG] OnAfterEvaluated
-- @param #AUFTRAG self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param #AUFTRAG.Summary Summary Mission summary.
--- Triggers the FSM event "Success".
-- @function [parent=#AUFTRAG] Success
@@ -1750,6 +1784,9 @@ function AUFTRAG:NewBAI(Target, Altitude)
mission.missionFraction=0.75
mission.optionROE=ENUMS.ROE.OpenFire
mission.optionROT=ENUMS.ROT.PassiveDefense
-- Evaluate result after 5 min. We might need time until the bombs have dropped and targets have been detroyed.
mission.dTevaluate=5*60
mission.categories={AUFTRAG.Category.AIRCRAFT}
@@ -2303,6 +2340,9 @@ end
function AUFTRAG:NewARTY(Target, Nshots, Radius, Altitude)
local mission=AUFTRAG:New(AUFTRAG.Type.ARTY)
printf("FF nshots=%s", tostring(Nshots))
printf("FF radius=%s", tostring(Radius))
mission:_TargetFromObject(Target)
@@ -2407,7 +2447,7 @@ end
-- @param #AUFTRAG self
-- @param Ops.OpsZone#OPSZONE OpsZone The OPS zone to capture.
-- @param #number Coalition The coalition which should capture the zone for the mission to be successful.
-- @param #number Speed Speed in knots.
-- @param #number Speed (Optional) Speed in knots.
-- @param #number Altitude (Optional) Altitude in feet. Only for airborne units. Default 2000 feet ASL.
-- @param #string Formation (Optional) Formation used by ground units during patrol. Default "Off Road".
-- @param #number StayInZoneTime Stay this many seconds in the zone when done, only then drive back.
@@ -4689,6 +4729,18 @@ function AUFTRAG:Evaluate()
elseif successCondition then
failed=false
end
self.summary={} --#AUFTRAG.Summary
self.summary.success=not failed
self.summary.damage=targetdamage
self.summary.Ntargets=Ntargets
self.summary.Ntargets0=Ntargets0
self.summary.Ncasualties=self.Ncasualties
self.summary.Ndestroyed=self.engageTarget.Ndestroyed
self.summary.Nelements=self.Nelements
self.summary.Nkills=self.Nkills
self.summary.category=self.engageTarget:GetCategory()
self.summary.targetLife=Life
-- Debug text.
if self.verbose > 0 then
@@ -4708,6 +4760,9 @@ function AUFTRAG:Evaluate()
text=text..string.format("=========================")
self:I(self.lid..text)
end
-- Trigger evaluated result and pass summary.
self:Evaluated(self.summary)
-- Trigger events.
if failed then
@@ -5429,7 +5484,7 @@ function AUFTRAG:onafterSuccess(From, Event, To)
-- Stop mission.
self:T(self.lid..string.format("Mission SUCCESS! Number of max repeats %d reached ==> Stopping mission!", self.repeated+1))
self:Stop()
self:__Stop(-120)
end
@@ -5471,7 +5526,7 @@ function AUFTRAG:onafterFailed(From, Event, To)
-- Stop mission.
self:T(self.lid..string.format("Mission FAILED! Number of max repeats %d reached ==> Stopping mission!", self.repeated+1))
self:Stop()
self:__Stop(-120)
end
@@ -5584,6 +5639,7 @@ function AUFTRAG:onafterRepeat(From, Event, To)
self.Ngroups=0
self.Nassigned=nil
self.Ndead=0
self.summary=nil
-- Update DCS mission task. Could be that the initial task (e.g. for bombing) was destroyed. Then we need to update the coordinate.
self.DCStask=self:GetDCSMissionTask()
@@ -5634,6 +5690,8 @@ function AUFTRAG:onafterStop(From, Event, To)
-- No group data.
self.groupdata={}
self.summary=nil
-- Clear pending scheduler calls.
self.CallScheduler:Clear()
@@ -350,6 +350,18 @@ INTEL.RCS_NoseOnFraction = 0.15
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Create a new INTEL object and start the FSM.
-- @param #INTEL self
-- @return #INTEL self
function INTEL:_UpdateAgents()
-- Filter coalition.
if self.coalition then
local coalitionname=UTILS.GetCoalitionName(self.coalition):lower()
self.detectionset:FilterCoalitions(coalitionname):FilterAlive():FilterOnce()
end
end
--- Create a new INTEL object and start the FSM.
-- @param #INTEL self
@@ -837,6 +849,20 @@ function INTEL:AddAgent(AgentGroup)
return self
end
--- Set whether the detection set, aka agents, are updated periodically. With this all alive groups of the INTEL coalition are included.
-- @param #INTEL self
-- @param #boolean switch If `true` or nil, all groups of the coalition will be added automatically to the Agent set.
-- @return #INTEL self
function INTEL:SetAgentAuto(switch)
if switch==nil then
switch=true
else
switch=false
end
self.update_detectionset=switch
return self
end
--- Enable or disable cluster analysis of detected targets.
-- Targets will be grouped in coupled clusters.
-- @param #INTEL self
@@ -1025,6 +1051,10 @@ function INTEL:onafterStatus(From, Event, To)
-- FSM state.
local fsmstate=self:GetState()
if self.update_detectionset then
self:_UpdateAgents()
end
-- Fresh arrays.
self.ContactsLost={}
+1 -1
View File
@@ -4691,7 +4691,7 @@ function OPSGROUP:_UpdateTask(Task, Mission)
self:T(self.lid..string.format("Zone %s captured ==> Task DONE!", zoneCurr:GetName()))
-- Task done.
if Task.StayInZoneTime then
if Task.StayInZoneTime and Task.StayInZoneTime>0 then
local stay = Task.StayInZoneTime
self:__TaskDone(stay,Task)
else