diff --git a/Moose Development/Moose/AI/AI_Designate.lua b/Moose Development/Moose/AI/AI_Designate.lua
index 663fe47fb..08824f330 100644
--- a/Moose Development/Moose/AI/AI_Designate.lua
+++ b/Moose Development/Moose/AI/AI_Designate.lua
@@ -67,33 +67,33 @@ do -- AI_DESIGNATE
-- * A **Player** is an active CLIENT object containing a human player.
-- * A **Designate Menu** is the menu that is dynamically created during the designation process for each _AttackGroup_.
--
- -- The _RecceSet_ is continuously detecting for potential _Targets_, executing its task as part of the _DetectionObject_.
- -- Once _Targets_ have been detected, the _DesignateObject_ will trigger the **Detect Event**.
+ -- The RecceSet is continuously detecting for potential Targets, executing its task as part of the DetectionObject.
+ -- Once Targets have been detected, the DesignateObject will trigger the **Detect Event**.
--
- -- As part of the Detect Event, the _DetectionItems_ list is used by the _DesignateObject_ to provide the _Players_ with:
+ -- As part of the Detect Event, the DetectionItems list is used by the DesignateObject to provide the Players with:
--
- -- * The _RecceGroups_ are reporting to each _AttackGroup_, sending **Messages** containing the _Threat Level_ and the _TargetSet_ composition.
- -- * **Menu options** are created and updated for each _AttackGroup_, containing the _Threat Level_ and the _TargetSet_ composition.
+ -- * The RecceGroups are reporting to each AttackGroup, sending **Messages** containing the Threat Level and the TargetSet composition.
+ -- * **Menu options** are created and updated for each AttackGroup, containing the Threat Level and the TargetSet composition.
--
- -- A _Player_ can then select an action from the _Designate Menu_.
+ -- A Player can then select an action from the Designate Menu.
--
- -- **Note that each selected action will be executed for a _TargetSet_, thus the _Target_ grouping done by the _DetectionObject_.**
+ -- **Note that each selected action will be executed for a TargetSet, thus the Target grouping done by the DetectionObject.**
--
- -- Each **Menu Option** in the _Designate Menu_ has two modes:
+ -- Each **Menu Option** in the Designate Menu has two modes:
--
- -- 1. If the _TargetSet_ **is not being designated**, then the **Designate Menu** option for the target Set will provide options to **Lase** or **Smoke** the targets.
+ -- 1. If the TargetSet **is not being designated**, then the **Designate Menu** option for the target Set will provide options to **Lase** or **Smoke** the targets.
-- 2. If the Target Set **is being designated**, then the **Designate Menu** option will provide an option to stop or cancel the designation.
--
- -- While designating, the _RecceGroups_ will report any change in _TargetSet_ composition or _Target_ presence.
+ -- While designating, the RecceGroups will report any change in TargetSet composition or Target presence.
--
- -- The following logic is executed when a _TargetSet_ is selected to be *lased* from the _Designation Menu_:
+ -- The following logic is executed when a TargetSet is selected to be *lased* from the Designation Menu:
--
- -- * The _RecceSet_ is searched for any _Recce_ that is within *designation distance* from a _Target_ in the _TargetSet_ that is currently not being designated.
- -- * If there is a _Recce_ found that is currently no designating a target, and is within designation distance from the _Target_, then that _Target_ will be designated.
- -- * During designation, any _Recce_ that does not have Line of Sight (LOS) and is not within disignation distance from the _Target_, will stop designating the _Target_, and a report is given.
- -- * When a _Recce_ is designating a _Target_, and that _Target_ is destroyed, then the _Recce_ will stop designating the _Target_, and will report the event.
- -- * When a _Recce_ is designating a _Target_, and that _Recce_ is destroyed, then the _Recce_ will be removed from the _RecceSet_ and designation will stop without reporting.
- -- * When all _RecceGroups_ are destroyed from the _RecceSet_, then the DesignationObject will stop functioning, and nothing will be reported.
+ -- * The RecceSet is searched for any Recce that is within *designation distance* from a Target in the TargetSet that is currently not being designated.
+ -- * If there is a Recce found that is currently no designating a target, and is within designation distance from the Target, then that Target will be designated.
+ -- * During designation, any Recce that does not have Line of Sight (LOS) and is not within disignation distance from the Target, will stop designating the Target, and a report is given.
+ -- * When a Recce is designating a Target, and that Target is destroyed, then the Recce will stop designating the Target, and will report the event.
+ -- * When a Recce is designating a Target, and that Recce is destroyed, then the Recce will be removed from the RecceSet and designation will stop without reporting.
+ -- * When all RecceGroups are destroyed from the RecceSet, then the DesignationObject will stop functioning, and nothing will be reported.
--
-- In this way, the DesignationObject assists players to designate ground targets for a coordinated attack!
--
@@ -145,15 +145,42 @@ do -- AI_DESIGNATE
--
-- ## 4. Autolase to automatically lase detected targets.
--
- -- _DetectionItems_ can be auto lased once detected by _Recces_. As such, there is almost no action required from the _Players_ using the _Designate Menu_.
+ -- DetectionItems can be auto lased once detected by Recces. As such, there is almost no action required from the Players using the Designate Menu.
-- The **auto lase** function can be activated through the Designation Menu.
-- Use the method @{#AI_DESIGNATE.SetAutoLase}() to activate or deactivate the auto lase function programmatically.
- -- Note that autolase will automatically activate lasing for ALL _DetectedItems_. Individual items can be switched-off if required using the _Designation Menu_.
+ -- Note that autolase will automatically activate lasing for ALL DetectedItems. Individual items can be switched-off if required using the Designation Menu.
--
-- AIDesignate:SetAutoLase( true )
--
-- Activate the auto lasing.
--
+ -- ## 5. Target prioritization on threat level
+ --
+ -- Targets can be detected of different types in one DetectionItem. Depending on the type of the Target, a different threat level applies in an Air to Ground combat context.
+ -- SAMs are of a higher threat than normal tanks. So, if the Target type was recognized, the Recces will select those targets that form the biggest threat first,
+ -- and will continue this until the remaining vehicles with the lowest threat have been reached.
+ --
+ -- This threat level prioritization can be activated using the method @{#AI_DESIGNATE.SetThreatLevelPrioritization}().
+ -- If not activated, Targets will be selected in a random order, but most like those first which are the closest to the Recce marking the Target.
+ --
+ -- AIDesignate:SetThreatLevelPrioritization( true )
+ --
+ -- The example will activate the threat level prioritization for this the AIDesignate object. Threats will be marked based on the threat level of the Target.
+ --
+ -- ## 6. Status Report
+ --
+ -- A status report is available that displays the current Targets detected, grouped per DetectionItem, and a list of which Targets are currently being marked.
+ --
+ -- * The status report can be shown by selecting "Status" -> "Report Status" from the Designation menu .
+ -- * The status report can be automatically flashed by selecting "Status" -> "Flash Status On".
+ -- * The automatic flashing of the status report can be deactivated by selecting "Status" -> "Flash Status Off".
+ -- * The flashing of the status menu is disabled by default.
+ -- * The method @{#AI_DESIGNATE.FlashStatusMenu}() can be used to enable or disable to flashing of the status menu.
+ --
+ -- AIDesignate:FlashStatusMenu( true )
+ --
+ -- The example will activate the flashing of the status menu for this AIDesignate object.
+ --
-- @field #AI_DESIGNATE
--
AI_DESIGNATE = {
@@ -171,6 +198,7 @@ do -- AI_DESIGNATE
self:F( { Detection } )
self:SetStartState( "Designating" )
+
self:AddTransition( "*", "Detect", "*" )
--- Detect Handler OnBefore for AI_DESIGNATE
@@ -197,7 +225,6 @@ do -- AI_DESIGNATE
-- @param #AI_DESIGNATE self
-- @param #number Delay
-
self:AddTransition( "*", "LaseOn", "Lasing" )
@@ -343,19 +370,41 @@ do -- AI_DESIGNATE
self.LaseDuration = 60
+ self:SetFlashStatusMenu( false )
+ self:SetDesignateMenu()
+
self:SetLaserCodes( 1688 ) -- set self.LaserCodes
self:SetAutoLase( false ) -- set self.Autolase
+ self:SetThreatLevelPrioritization( false ) -- self.ThreatLevelPrioritization, default is threat level priorization off
+
self.LaserCodesUsed = {}
self.Detection:__Start( 2 )
- self:SetDesignateMenu()
-
return self
end
-
+
+ --- Set the flashing of the status menu.
+ -- @param #AI_DESIGNATE self
+ -- @param #boolean FlashMenu true: the status menu will be flashed every detection run; false: no flashing of the menu.
+ -- @return #AI_DESIGNATE
+ function AI_DESIGNATE:SetFlashStatusMenu( FlashMenu ) --R2.1
+
+ self.FlashStatusMenu = {}
+
+ self.AttackSet:ForEachGroup(
+
+ --- @param Wrapper.Group#GROUP GroupReport
+ function( AttackGroup )
+ self.FlashStatusMenu[AttackGroup] = FlashMenu
+ end
+ )
+
+ return self
+ end
+
--- Set an array of possible laser codes.
-- Each new lase will select a code from this table.
@@ -447,6 +496,18 @@ do -- AI_DESIGNATE
return self
end
+
+ --- Set priorization of Targets based on the **Threat Level of the Target** in an Air to Ground context.
+ -- @param #AI_DESIGNATE self
+ -- @param #boolean Prioritize
+ -- @return #AI_DESIGNATE
+ function AI_DESIGNATE:SetThreatLevelPrioritization( Prioritize ) --R2.1
+
+ self.ThreatLevelPrioritization = Prioritize
+
+ return self
+ end
+
---
@@ -457,10 +518,7 @@ do -- AI_DESIGNATE
self:__Detect( -60 )
self:ActivateAutoLase()
-
self:SendStatus()
-
-
self:SetDesignateMenu()
return self
@@ -468,21 +526,49 @@ do -- AI_DESIGNATE
--- Sends the status to the Attack Groups.
-- @param #AI_DESIGNATE self
+ -- @param Wrapper.Group#GROUP AttackGroup
-- @return #AI_DESIGNATE
- function AI_DESIGNATE:SendStatus()
+ function AI_DESIGNATE:SendStatus( MenuAttackGroup )
- local DetectedReport = REPORT:New( "Targets ready to be designated:" )
- local DetectedItems = self.Detection:GetDetectedItems()
- for Index, DetectedItemData in pairs( DetectedItems ) do
+ self.AttackSet:ForEachGroup(
+
+ --- @param Wrapper.Group#GROUP GroupReport
+ function( AttackGroup )
- local Report = self.Detection:DetectedItemReportSummary( Index )
- DetectedReport:Add(" - " .. Report)
- end
-
- local RecceLeader = self.RecceSet:GetFirst() -- Wrapper.Group#GROUP
+ if self.FlashStatusMenu[AttackGroup] or AttackGroup:GetName() == MenuAttackGroup:GetName() then
- RecceLeader:MessageToSetGroup( DetectedReport:Text( "\n" ), 15, self.AttackSet )
+ local DetectedReport = REPORT:New( "Targets ready to be designated:" )
+ local DetectedItems = self.Detection:GetDetectedItems()
+
+ for Index, DetectedItemData in pairs( DetectedItems ) do
+
+ local Report = self.Detection:DetectedItemReportSummary( Index )
+ DetectedReport:Add(" - " .. Report)
+ end
+
+ local RecceLeader = self.RecceSet:GetFirst() -- Wrapper.Group#GROUP
+
+ RecceLeader:MessageToGroup( DetectedReport:Text( "\n" ), 15, AttackGroup )
+
+ local DesignationReport = REPORT:New( "Targets currently marked:" )
+
+ self.RecceSet:ForEachGroup(
+ function( RecceGroup )
+ local RecceUnits = RecceGroup:GetUnits()
+ for UnitID, RecceData in pairs( RecceUnits ) do
+ local Recce = RecceData -- Wrapper.Unit#UNIT
+ if Recce:IsLasing() then
+ DesignationReport:Add( " - " .. Recce:GetMessageText( "Marking " .. Recce:GetSpot().Target:GetTypeName() .. " with laser " .. Recce:GetSpot().LaserCode .. "." ) )
+ end
+ end
+ end
+ )
+
+ RecceLeader:MessageToGroup( DesignationReport:Text(), 15, AttackGroup )
+ end
+ end
+ )
return self
end
@@ -543,7 +629,13 @@ do -- AI_DESIGNATE
MENU_GROUP_COMMAND:New( AttackGroup, "Auto Lase On", DesignateMenu, self.MenuAutoLase, self, true )
end
- MENU_GROUP_COMMAND:New( AttackGroup, "Report Designation Status", DesignateMenu, self.MenuStatus, self, AttackGroup )
+ local StatusMenu = MENU_GROUP:New( AttackGroup, "Status", DesignateMenu )
+ MENU_GROUP_COMMAND:New( AttackGroup, "Report Status", StatusMenu, self.MenuStatus, self, AttackGroup )
+ if self.FlashStatusMenu[AttackGroup] then
+ MENU_GROUP_COMMAND:New( AttackGroup, "Flash Status Off", StatusMenu, self.MenuFlashStatus, self, AttackGroup, false )
+ else
+ MENU_GROUP_COMMAND:New( AttackGroup, "Flash Status On", StatusMenu, self.MenuFlashStatus, self, AttackGroup, true )
+ end
local DetectedItems = self.Detection:GetDetectedItems()
@@ -588,18 +680,17 @@ do -- AI_DESIGNATE
self:E("Status")
- self.RecceSet:ForEachGroup(
- function( RecceGroup )
- local RecceUnits = RecceGroup:GetUnits()
- for UnitID, RecceData in pairs( RecceUnits ) do
- local Recce = RecceData -- Wrapper.Unit#UNIT
- if Recce:IsLasing() then
- Recce:MessageToGroup( "Marking " .. Recce:GetSpot().Target:GetTypeName() .. " with laser " .. Recce:GetSpot().LaserCode .. ".", 5, AttackGroup )
- end
- end
- end
- )
+ self:SendStatus( AttackGroup )
+ end
+
+ ---
+ -- @param #AI_DESIGNATE self
+ function AI_DESIGNATE:MenuFlashStatus( AttackGroup, Flash )
+ self:E("Flash Status")
+
+ self.FlashStatusMenu[AttackGroup] = Flash
+ self:SetDesignateMenu()
end
@@ -679,7 +770,7 @@ do -- AI_DESIGNATE
end
end
- TargetSetUnit:ForEachUnit(
+ TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
--- @param Wrapper.Unit#UNIT SmokeUnit
function( TargetUnit )
self:E("In procedure")
@@ -699,14 +790,14 @@ do -- AI_DESIGNATE
local AttackSet = self.AttackSet
function Spot:OnAfterDestroyed( From, Event, To )
self:E( "Destroyed Message" )
- self.Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() .. " destroyed." .. TargetSetUnit:Count() .. " targets left.", 15, AttackSet )
+ self.Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() .. " destroyed. " .. TargetSetUnit:Count() .. " targets left.", 5, AttackSet )
end
self.Recces[TargetUnit] = RecceUnit
RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.", 5, self.AttackSet )
break
end
else
- RecceUnit:MessageToSetGroup( "Can't lase " .. TargetUnit:GetTypeName(), 5, self.AttackSet )
+ RecceUnit:MessageToSetGroup( "Can't mark " .. TargetUnit:GetTypeName(), 5, self.AttackSet )
end
else
-- The Recce is lasing, but the Target is not detected or within LOS. So stop lasing and send a report.
@@ -741,7 +832,7 @@ do -- AI_DESIGNATE
local Recce = self.RecceSet:GetFirst()
if Recce then
- Recce:MessageToSetGroup( "Stopped lasing.", 15, self.AttackSet )
+ Recce:MessageToSetGroup( "Stopped lasing.", 5, self.AttackSet )
end
local TargetSetUnit = self.Detection:GetDetectedSet( Index )
@@ -750,7 +841,7 @@ do -- AI_DESIGNATE
for TargetID, RecceData in pairs( Recces ) do
local Recce = RecceData -- Wrapper.Unit#UNIT
- Recce:MessageToSetGroup( "Stopped lasing " .. Recce:GetSpot().Target:GetTypeName() .. ".", 15, self.AttackSet )
+ Recce:MessageToSetGroup( "Stopped lasing " .. Recce:GetSpot().Target:GetTypeName() .. ".", 5, self.AttackSet )
Recce:LaseOff()
end
diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua
index 9891aa5fd..8bbaeade6 100644
--- a/Moose Development/Moose/Core/Event.lua
+++ b/Moose Development/Moose/Core/Event.lua
@@ -1,4 +1,4 @@
---- **Core** - EVENT models DCS **event dispatching** using a **publish-subscribe** model.
+--- **Core R2.1** - EVENT models DCS **event dispatching** using a **publish-subscribe** model.
--
-- 
--
@@ -491,7 +491,7 @@ end
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
-- @param Dcs.DCSWorld#world.event EventID
-- @return #EVENT.Events
-function EVENT:Reset( EventObject )
+function EVENT:Reset( EventObject ) --R2.1
self:E( { "Resetting subscriptions for class: ", EventObject:GetClassNameAndID() } )
diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua
index 8eb488490..196982ffb 100644
--- a/Moose Development/Moose/Core/Set.lua
+++ b/Moose Development/Moose/Core/Set.lua
@@ -140,7 +140,7 @@ function SET_BASE:Add( ObjectName, Object )
self.List.Count = self.List.Count + 1
- self.Set[ObjectName] = t._
+ self.Set[ObjectName] = Object
table.insert( self.Index, ObjectName )
@@ -345,7 +345,7 @@ end
--- Starts the filtering of the Dead events for the collection.
-- @param #SET_BASE self
-- @return #SET_BASE self
-function SET_BASE:FilterDeads()
+function SET_BASE:FilterDeads() --R2.1 allow deads to be filtered to automatically handle deads in the collection.
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
@@ -355,7 +355,7 @@ end
--- Starts the filtering of the Crash events for the collection.
-- @param #SET_BASE self
-- @return #SET_BASE self
-function SET_BASE:FilterCrashes()
+function SET_BASE:FilterCrashes() --R2.1 allow crashes to be filtered to automatically handle crashes in the collection.
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
@@ -1346,7 +1346,7 @@ SET_UNIT = {
function SET_UNIT:New()
-- Inherits from BASE
- local self = BASE:Inherit( self, SET_BASE:New( _DATABASE.UNITS ) )
+ local self = BASE:Inherit( self, SET_BASE:New( _DATABASE.UNITS ) ) -- Core.Set#SET_UNIT
return self
end
@@ -1586,6 +1586,50 @@ function SET_UNIT:ForEachUnit( IteratorFunction, ... )
return self
end
+--- Iterate the SET_UNIT **sorted *per Threat Level** and call an interator function for each **alive** UNIT, providing the UNIT and optional parameters.
+--
+-- @param #SET_UNIT self
+-- @param #number FromThreatLevel The TreatLevel to start the evaluation **From** (this must be a value between 0 and 10).
+-- @param #number ToThreatLevel The TreatLevel to stop the evaluation **To** (this must be a value between 0 and 10).
+-- @param #function IteratorFunction The function that will be called when there is an alive UNIT in the SET_UNIT. The function needs to accept a UNIT parameter.
+-- @return #SET_UNIT self
+-- @usage
+--
+-- UnitSet:ForEachUnitPerThreatLevel( 10, 0,
+-- -- @param Wrapper.Unit#UNIT UnitObject The UNIT object in the UnitSet, that will be passed to the local function for evaluation.
+-- function( UnitObject )
+-- .. logic ..
+-- end
+-- )
+--
+function SET_UNIT:ForEachUnitPerThreatLevel( FromThreatLevel, ToThreatLevel, IteratorFunction, ... ) --R2.1 Threat Level implementation
+ self:F2( arg )
+
+ local ThreatLevelSet = {}
+
+ for UnitName, UnitObject in pairs( self.Set ) do
+ local Unit = UnitObject -- Wrapper.Unit#UNIT
+
+ local ThreatLevel = Unit:GetThreatLevel()
+ ThreatLevelSet[ThreatLevel] = ThreatLevelSet[ThreatLevel] or {}
+ ThreatLevelSet[ThreatLevel].Set = ThreatLevelSet[ThreatLevel].Set or {}
+ ThreatLevelSet[ThreatLevel].Set[UnitName] = UnitObject
+ self:E( { ThreatLevel = ThreatLevel, ThreatLevelSet = ThreatLevelSet[ThreatLevel].Set } )
+ end
+
+ local ThreatLevelIncrement = FromThreatLevel <= ToThreatLevel and 1 or -1
+
+ for ThreatLevel = FromThreatLevel, ToThreatLevel, ThreatLevelIncrement do
+ self:E( { ThreatLevel = ThreatLevel } )
+ local ThreatLevelItem = ThreatLevelSet[ThreatLevel]
+ if ThreatLevelItem then
+ self:ForEach( IteratorFunction, arg, ThreatLevelItem.Set )
+ end
+ end
+
+ return self
+end
+
--- Iterate the SET_UNIT and call an iterator function for each **alive** UNIT presence completely in a @{Zone}, providing the UNIT and optional parameters to the called function.
-- @param #SET_UNIT self
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index f876970b7..d3a8b54a4 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -678,14 +678,53 @@ do -- DETECTION_BASE
if self.DetectionCount > 0 and self.DetectionRun == self.DetectionCount then
self:T( "--> Create Detection Sets" )
- self:CreateDetectionSets()
+ self:CreateDetectionItems() -- Polymorphic call to Create/Update the DetectionItems list for the DETECTION_ class grouping method.
+ self:CleanDetectionItems() -- Any DetectionItem that has a Set with zero elements in it, must be removed from the DetectionItems list.
+
self:__Detect( self.DetectionInterval )
end
end
+ end
+
+ do -- DetectionItems Creation
+
+ --- Make a DetectionSet table. This function will be overridden in the derived clsses.
+ -- @param #DETECTION_BASE self
+ -- @return #DETECTION_BASE
+ function DETECTION_BASE:CleanDetectionItems() --R2.1 Clean the DetectionItems list
+ self:F2()
+
+ -- We clean all DetectedItems.
+ -- if there are any remaining DetectedItems with no Set Objects then the Item in the DetectedItems must be deleted.
+
+ for DetectedItemID, DetectedItemData in pairs( self.DetectedItems ) do
+
+ local DetectedItem = DetectedItemData -- #DETECTION_BASE.DetectedItem
+ local DetectedSet = DetectedItem.Set
+
+ if DetectedSet:Count() == 0 then
+ self.DetectedItems[DetectedItemID] = nil
+ end
+ end
+
+ return self
+ end
+
+ --- Make a DetectionSet table. This function will be overridden in the derived clsses.
+ -- @param #DETECTION_BASE self
+ -- @return #DETECTION_BASE
+ function DETECTION_BASE:CreateDetectionItems()
+ self:F2()
+
+ self:E( "Error, in DETECTION_BASE class..." )
+ return self
+ end
+
+
end
do -- Initialization methods
@@ -1255,16 +1294,6 @@ do -- DETECTION_BASE
return DetectionSetGroup
end
- --- Make a DetectionSet table. This function will be overridden in the derived clsses.
- -- @param #DETECTION_BASE self
- -- @return #DETECTION_BASE self
- function DETECTION_BASE:CreateDetectionSets()
- self:F2()
-
- self:E( "Error, in DETECTION_BASE class..." )
-
- end
-
--- Schedule the DETECTION construction.
-- @param #DETECTION_BASE self
@@ -1359,7 +1388,7 @@ do -- DETECTION_UNITS
-- For each DetectedItem, a one field array is created containing the Unit detected.
-- @param #DETECTION_UNITS self
-- @return #DETECTION_UNITS self
- function DETECTION_UNITS:CreateDetectionSets()
+ function DETECTION_UNITS:CreateDetectionItems()
self:F2( #self.DetectedObjects )
-- Loop the current detected items, and check if each object still exists and is detected.
@@ -1582,7 +1611,7 @@ do -- DETECTION_TYPES
-- For each DetectedItem, a one field array is created containing the Unit detected.
-- @param #DETECTION_TYPES self
-- @return #DETECTION_TYPES self
- function DETECTION_TYPES:CreateDetectionSets()
+ function DETECTION_TYPES:CreateDetectionItems()
self:F2( #self.DetectedObjects )
-- Loop the current detected items, and check if each object still exists and is detected.
@@ -1636,6 +1665,9 @@ do -- DETECTION_TYPES
end
end
+
+
+ -- Check if there are any friendlies nearby.
for DetectedItemID, DetectedItemData in pairs( self.DetectedItems ) do
local DetectedItem = DetectedItemData -- #DETECTION_BASE.DetectedItem
@@ -1974,7 +2006,7 @@ do -- DETECTION_AREAS
--- Make a DetectionSet table. This function will be overridden in the derived clsses.
-- @param #DETECTION_AREAS self
-- @return #DETECTION_AREAS self
- function DETECTION_AREAS:CreateDetectionSets()
+ function DETECTION_AREAS:CreateDetectionItems()
self:F2()
@@ -2121,7 +2153,7 @@ do -- DETECTION_AREAS
-- New detection area
local DetectedItem = self:AddDetectedItemZone( nil,
- SET_UNIT:New(),
+ SET_UNIT:New():FilterDeads():FilterCrashes(),
ZONE_UNIT:New( DetectedUnitName, DetectedUnit, self.DetectionZoneRange )
)
--self:E( DetectedItem.Zone.ZoneUNIT.UnitName )
diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua
index 695e2ed44..213312a3e 100644
--- a/Moose Development/Moose/Wrapper/Positionable.lua
+++ b/Moose Development/Moose/Wrapper/Positionable.lua
@@ -302,19 +302,38 @@ function POSITIONABLE:GetVelocityKMH()
return nil
end
+
+--- Returns the message text with the callsign embedded (if there is one).
+-- @param #POSITIONABLE self
+-- @param #string Message The message text
+-- @param #string Name (optional) The Name of the sender. If not provided, the Name is the type of the Positionable.
+-- @return #string The message text
+function POSITIONABLE:GetMessageText( Message, Name ) --R2.1 added
+
+ local DCSObject = self:GetDCSObject()
+ if DCSObject then
+ Name = Name and ( " (" .. Name .. ")" ) or ""
+ local Callsign = self:GetCallsign() ~= "" and self:GetCallsign() or self:GetName()
+ local MessageText = Callsign .. Name .. ": " .. Message
+ return MessageText
+ end
+
+ return nil
+end
+
+
--- Returns a message with the callsign embedded (if there is one).
-- @param #POSITIONABLE self
-- @param #string Message The message text
-- @param Dcs.DCSTypes#Duration Duration The duration of the message.
-- @param #string Name (optional) The Name of the sender. If not provided, the Name is the type of the Positionable.
-- @return Core.Message#MESSAGE
-function POSITIONABLE:GetMessage( Message, Duration, Name )
+function POSITIONABLE:GetMessage( Message, Duration, Name ) --R2.1 changed callsign and name and using GetMessageText
local DCSObject = self:GetDCSObject()
if DCSObject then
- Name = Name or self:GetTypeName()
- local Callsign = self:GetCallsign() ~= "" and self:GetCallsign() or self:GetName()
- return MESSAGE:New( Message, Duration, Callsign .. " (" .. Name .. ")" )
+ local MessageText = self:GetMessageText( Message, Name )
+ return MESSAGE:New( MessageText, Duration )
end
return nil
diff --git a/docs/Documentation/AI_Designate.html b/docs/Documentation/AI_Designate.html
index 590d48988..a557d4ee9 100644
--- a/docs/Documentation/AI_Designate.html
+++ b/docs/Documentation/AI_Designate.html
@@ -186,6 +186,12 @@ each detected set of potential targets can be lased or smoked...
AI_DESIGNATE.Detection |
+ |
+
+
+ | AI_DESIGNATE.FlashStatusMenu |
+
+
|
@@ -234,6 +240,12 @@ each detected set of potential targets can be lased or smoked...
| AI_DESIGNATE:MenuAutoLase(AutoLase) |
+ |
+
+
+ | AI_DESIGNATE:MenuFlashStatus(AttackGroup, Flash) |
+
+
|
@@ -372,12 +384,24 @@ each detected set of potential targets can be lased or smoked...
| AI_DESIGNATE:SetDesignateMenu() |
Sets the Designate Menu.
+ |
+
+
+ | AI_DESIGNATE:SetFlashStatusMenu(FlashMenu) |
+
+ Set the flashing of the status menu.
|
| AI_DESIGNATE:SetLaserCodes(<, LaserCodes) |
Set an array of possible laser codes.
+ |
+
+
+ | AI_DESIGNATE:SetThreatLevelPrioritization(Prioritize) |
+
+ Set priorization of Targets based on the Threat Level of the Target in an Air to Ground context.
|
@@ -390,6 +414,12 @@ each detected set of potential targets can be lased or smoked...
| AI_DESIGNATE:Status() |
Status Trigger for AI_DESIGNATE
+ |
+
+
+ | AI_DESIGNATE.ThreatLevelPrioritization |
+
+
|
@@ -518,38 +548,38 @@ each detected set of potential targets can be lased or smoked...
A Designate Menu is the menu that is dynamically created during the designation process for each AttackGroup.
-The RecceSet is continuously detecting for potential Targets, executing its task as part of the DetectionObject.
-Once Targets have been detected, the DesignateObject will trigger the Detect Event.
+The RecceSet is continuously detecting for potential Targets, executing its task as part of the DetectionObject.
+Once Targets have been detected, the DesignateObject will trigger the Detect Event.
-As part of the Detect Event, the DetectionItems list is used by the DesignateObject to provide the Players with:
+As part of the Detect Event, the DetectionItems list is used by the DesignateObject to provide the Players with:
- - The RecceGroups are reporting to each AttackGroup, sending Messages containing the Threat Level and the TargetSet composition.
- - Menu options are created and updated for each AttackGroup, containing the Threat Level and the TargetSet composition.
+ - The RecceGroups are reporting to each AttackGroup, sending Messages containing the Threat Level and the TargetSet composition.
+ - Menu options are created and updated for each AttackGroup, containing the Threat Level and the TargetSet composition.
-A Player can then select an action from the Designate Menu.
+A Player can then select an action from the Designate Menu.
-Note that each selected action will be executed for a TargetSet, thus the Target grouping done by the DetectionObject.
+Note that each selected action will be executed for a TargetSet, thus the Target grouping done by the DetectionObject.
-Each Menu Option in the Designate Menu has two modes:
+Each Menu Option in the Designate Menu has two modes:
- - If the TargetSet is not being designated, then the Designate Menu option for the target Set will provide options to Lase or Smoke the targets.
+ - If the TargetSet is not being designated, then the Designate Menu option for the target Set will provide options to Lase or Smoke the targets.
- If the Target Set is being designated, then the Designate Menu option will provide an option to stop or cancel the designation.
-While designating, the RecceGroups will report any change in TargetSet composition or Target presence.
+While designating, the RecceGroups will report any change in TargetSet composition or Target presence.
-The following logic is executed when a TargetSet is selected to be lased from the Designation Menu:
+The following logic is executed when a TargetSet is selected to be lased from the Designation Menu:
- - The RecceSet is searched for any Recce that is within designation distance from a Target in the TargetSet that is currently not being designated.
- - If there is a Recce found that is currently no designating a target, and is within designation distance from the Target, then that Target will be designated.
- - During designation, any Recce that does not have Line of Sight (LOS) and is not within disignation distance from the Target, will stop designating the Target, and a report is given.
- - When a Recce is designating a Target, and that Target is destroyed, then the Recce will stop designating the Target, and will report the event.
- - When a Recce is designating a Target, and that Recce is destroyed, then the Recce will be removed from the RecceSet and designation will stop without reporting.
- - When all RecceGroups are destroyed from the RecceSet, then the DesignationObject will stop functioning, and nothing will be reported.
+ - The RecceSet is searched for any Recce that is within designation distance from a Target in the TargetSet that is currently not being designated.
+ - If there is a Recce found that is currently no designating a target, and is within designation distance from the Target, then that Target will be designated.
+ - During designation, any Recce that does not have Line of Sight (LOS) and is not within disignation distance from the Target, will stop designating the Target, and a report is given.
+ - When a Recce is designating a Target, and that Target is destroyed, then the Recce will stop designating the Target, and will report the event.
+ - When a Recce is designating a Target, and that Recce is destroyed, then the Recce will be removed from the RecceSet and designation will stop without reporting.
+ - When all RecceGroups are destroyed from the RecceSet, then the DesignationObject will stop functioning, and nothing will be reported.
In this way, the DesignationObject assists players to designate ground targets for a coordinated attack!
@@ -610,16 +640,37 @@ One laser code can be given or an sequence of laser codes through an table...4. Autolase to automatically lase detected targets.
-DetectionItems can be auto lased once detected by Recces. As such, there is almost no action required from the Players using the Designate Menu.
+
DetectionItems can be auto lased once detected by Recces. As such, there is almost no action required from the Players using the Designate Menu.
The auto lase function can be activated through the Designation Menu.
Use the method AI_DESIGNATE.SetAutoLase() to activate or deactivate the auto lase function programmatically.
-Note that autolase will automatically activate lasing for ALL DetectedItems. Individual items can be switched-off if required using the Designation Menu.
+Note that autolase will automatically activate lasing for ALL DetectedItems. Individual items can be switched-off if required using the Designation Menu.
AIDesignate:SetAutoLase( true )
Activate the auto lasing.
+5. Target prioritization on threat level
+
+Targets can be detected of different types in one DetectionItem. Depending on the type of the Target, a different threat level applies in an Air to Ground combat context.
+SAMs are of a higher threat than normal tanks. So, if the Target type was recognized, the Recces will select those targets that form the biggest threat first,
+and will continue this until the remaining vehicles with the lowest threat have been reached.
+
+This threat level prioritization can be activated using the method AI_DESIGNATE.SetThreatLevelPrioritization().
+If not activated, Targets will be selected in a random order, but most like those first which are the closest to the Recce marking the Target.
+
+6. Status Report
+
+A status report is available that displays the current Targets detected, grouped per DetectionItem, and a list of which Targets are currently being marked.
+
+
+ - The status report can be shown by selecting "Status" -> "Report Status" from the Designation menu .
+ - The status report can be automatically flashed by selecting "Status" -> "Flash Status On".
+ - The automatic flashing of the status report can be deactivated by selecting "Status" -> "Flash Status Off".
+ - The flashing of the status menu is disabled by default.
+ - The method AI_DESIGNATE.FlashStatusMenu() can be used to enable or disable to flashing of the status menu.
+
+
@@ -712,6 +763,20 @@ Note that autolase will automatically activate lasing for ALL DetectedItems<
+
+
+
+-
+
+
+
+
+-
+
+
+
@@ -796,6 +861,7 @@ function below will use the range 1-7 just in case
-
+
AI_DESIGNATE.LaserCodes
@@ -844,6 +910,32 @@ function below will use the range 1-7 just in case
-
+
+
+-
+
+
+
+
Parameters
+
+ -
+
+
AttackGroup :
+
+
+ -
+
+
Flash :
+
+
+
+
+
+
+-
+
@@ -1489,6 +1581,33 @@ The Attack collection of GROUP objects to designate and report for.
#AI_DESIGNATE:
+
+
+
+-
+
+
+
+-
+
+
Set the flashing of the status menu.
+
+ Parameter
+
+ Return value
+
+#AI_DESIGNATE:
+
+
@@ -1524,6 +1643,32 @@ number> LaserCodes
#AI_DESIGNATE:
+
+
+
+-
+
+
+AI_DESIGNATE:SetThreatLevelPrioritization(Prioritize)
+
+
+-
+
+
Set priorization of Targets based on the Threat Level of the Target in an Air to Ground context.
+
+ Parameter
+
+ -
+
+
#boolean Prioritize :
+
+
+
+ Return value
+
+#AI_DESIGNATE:
+
+
@@ -1550,6 +1695,20 @@ number> LaserCodes
Status Trigger for AI_DESIGNATE
+
+
+
+-
+
+
+
+AI_DESIGNATE.ThreatLevelPrioritization
+
+
+-
+
+
+
diff --git a/docs/Documentation/AI_Patrol.html b/docs/Documentation/AI_Patrol.html
index d80d5e9ce..3f3376551 100644
--- a/docs/Documentation/AI_Patrol.html
+++ b/docs/Documentation/AI_Patrol.html
@@ -951,9 +951,6 @@ Use the method AIPATROLZONE.M
-
- This table contains the targets detected during patrol.
-
diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html
index 227aa5e92..9d751074b 100644
--- a/docs/Documentation/Detection.html
+++ b/docs/Documentation/Detection.html
@@ -189,7 +189,7 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu
- | DETECTION_AREAS:CreateDetectionSets() |
+ DETECTION_AREAS:CreateDetectionItems() |
Make a DetectionSet table.
|
@@ -346,6 +346,12 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu
DETECTION_BASE.AlphaAngleProbability |
+ |
+
+
+ | DETECTION_BASE:CleanDetectionItems() |
+
+ Make a DetectionSet table.
|
@@ -355,7 +361,7 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu
- | DETECTION_BASE:CreateDetectionSets() |
+ DETECTION_BASE:CreateDetectionItems() |
Make a DetectionSet table.
|
@@ -930,7 +936,7 @@ The different values of Unit.Category can be:
- | DETECTION_TYPES:CreateDetectionSets() |
+ DETECTION_TYPES:CreateDetectionItems() |
Create the DetectedItems list from the DetectedObjects table.
|
@@ -1006,7 +1012,7 @@ The different values of Unit.Category can be:
- | DETECTION_UNITS:CreateDetectionSets() |
+ DETECTION_UNITS:CreateDetectionItems() |
Create the DetectedItems list from the DetectedObjects table.
|
@@ -1454,8 +1460,8 @@ self
-
-
-DETECTION_AREAS:CreateDetectionSets()
+
+DETECTION_AREAS:CreateDetectionItems()
-
@@ -2024,6 +2030,27 @@ The index of the DetectedItem.
+
+
+
+-
+
+
+DETECTION_BASE:CleanDetectionItems()
+
+
+-
+
+
Make a DetectionSet table.
+
+
+This function will be overridden in the derived clsses.
+
+ Return value
+
+#DETECTION_BASE:
+
+
@@ -2043,8 +2070,8 @@ The index of the DetectedItem.
-
-
-DETECTION_BASE:CreateDetectionSets()
+
+DETECTION_BASE:CreateDetectionItems()
-
@@ -2056,8 +2083,8 @@ The index of the DetectedItem.
Return value
-#DETECTION_BASE:
-self
+#DETECTION_BASE:
+
@@ -2174,6 +2201,7 @@ self
-
+ #number
DETECTION_BASE.DetectedItemCount
@@ -2187,6 +2215,7 @@ self
-
+ #number
DETECTION_BASE.DetectedItemMax
@@ -2300,7 +2329,7 @@ self
-
-
+ #number
DETECTION_BASE.DetectionInterval
@@ -4110,8 +4139,8 @@ Beware that when the amount of different types detected is large, the DetectedIt
-
-
-DETECTION_TYPES:CreateDetectionSets()
+
+DETECTION_TYPES:CreateDetectionItems()
-
@@ -4345,8 +4374,8 @@ Beware that when the amount of units detected is large, the DetectedItems list w
-
-
-DETECTION_UNITS:CreateDetectionSets()
+
+DETECTION_UNITS:CreateDetectionItems()
-
diff --git a/docs/Documentation/Event.html b/docs/Documentation/Event.html
index 5c5843e5a..b9966478d 100644
--- a/docs/Documentation/Event.html
+++ b/docs/Documentation/Event.html
@@ -95,7 +95,7 @@
Module Event
-
Core - EVENT models DCS event dispatching using a publish-subscribe model.
+
Core R2.1 - EVENT models DCS event dispatching using a publish-subscribe model.
diff --git a/docs/Documentation/Movement.html b/docs/Documentation/Movement.html
index 6199b647b..6c410e890 100644
--- a/docs/Documentation/Movement.html
+++ b/docs/Documentation/Movement.html
@@ -213,7 +213,6 @@ on defined intervals (currently every minute).
-
- #number
MOVEMENT.AliveUnits
@@ -222,9 +221,6 @@ on defined intervals (currently every minute).
-
-
Contains the counter how many units are currently alive
-
diff --git a/docs/Documentation/Positionable.html b/docs/Documentation/Positionable.html
index f6c4a9726..0504df3bd 100644
--- a/docs/Documentation/Positionable.html
+++ b/docs/Documentation/Positionable.html
@@ -181,6 +181,12 @@
| POSITIONABLE:GetMessage(Message, Duration, Name) |
Returns a message with the callsign embedded (if there is one).
+ |
+
+
+ | POSITIONABLE:GetMessageText(Message, Name) |
+
+ Returns the message text with the callsign embedded (if there is one).
|
@@ -531,6 +537,39 @@ The duration of the message.
Core.Message#MESSAGE:
+
+
+
+-
+
+
+POSITIONABLE:GetMessageText(Message, Name)
+
+
+-
+
+
Returns the message text with the callsign embedded (if there is one).
+
+ Parameters
+
+ -
+
+
#string Message :
+The message text
+
+
+ -
+
+
#string Name :
+(optional) The Name of the sender. If not provided, the Name is the type of the Positionable.
+
+
+
+ Return value
+
+#string:
+The message text
+
diff --git a/docs/Documentation/Set.html b/docs/Documentation/Set.html
index ed98dd773..adc1e69e8 100644
--- a/docs/Documentation/Set.html
+++ b/docs/Documentation/Set.html
@@ -969,6 +969,13 @@ mission designer to add a dedicated method
| SET_UNIT:ForEachUnitNotInZone(ZoneObject, IteratorFunction, ...) |
Iterate the SET_UNIT and call an iterator function for each alive UNIT presence not in a Zone, providing the UNIT and optional parameters to the called function.
+ |
+
+
+ | SET_UNIT:ForEachUnitPerThreatLevel(FromThreatLevel, ToThreatLevel, IteratorFunction, ...) |
+
+ Iterate the SET_UNIT sorted *per Threat Level and call an interator function for each alive UNIT, providing the UNIT and optional parameters.
+
|
@@ -4755,6 +4762,61 @@ self
-
+
+SET_UNIT:ForEachUnitPerThreatLevel(FromThreatLevel, ToThreatLevel, IteratorFunction, ...)
+
+
+-
+
+
Iterate the SET_UNIT sorted *per Threat Level and call an interator function for each alive UNIT, providing the UNIT and optional parameters.
+
+
+ Parameters
+
+ -
+
+
#number FromThreatLevel :
+The TreatLevel to start the evaluation From (this must be a value between 0 and 10).
+
+
+ -
+
+
#number ToThreatLevel :
+The TreatLevel to stop the evaluation To (this must be a value between 0 and 10).
+
+
+ -
+
+
#function IteratorFunction :
+The function that will be called when there is an alive UNIT in the SET_UNIT. The function needs to accept a UNIT parameter.
+
+
+ -
+
+
... :
+
+
+
+ Return value
+
+#SET_UNIT:
+self
+
+ Usage:
+
+ UnitSet:ForEachUnitPerThreatLevel( 10, 0,
+ -- @param Wrapper.Unit#UNIT UnitObject The UNIT object in the UnitSet, that will be passed to the local function for evaluation.
+ function( UnitObject )
+ .. logic ..
+ end
+ )
+
+
+
+
+
+-
+
SET_UNIT:GetTypeNames(Delimiter)
diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html
index 6b3dd2a7a..02284a8f1 100644
--- a/docs/Documentation/Spawn.html
+++ b/docs/Documentation/Spawn.html
@@ -2077,6 +2077,9 @@ The group that was spawned. You can use this group for further actions.
+
+
Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
+
diff --git a/docs/Documentation/SpawnStatic.html b/docs/Documentation/SpawnStatic.html
index 07c50b18e..d1eef677c 100644
--- a/docs/Documentation/SpawnStatic.html
+++ b/docs/Documentation/SpawnStatic.html
@@ -444,6 +444,7 @@ ptional) The name of the new static.
-
+ #number
SPAWNSTATIC.SpawnIndex
diff --git a/docs/Documentation/index.html b/docs/Documentation/index.html
index 9b29ab0bc..f5ed4837b 100644
--- a/docs/Documentation/index.html
+++ b/docs/Documentation/index.html
@@ -346,7 +346,7 @@ even when there are hardly any players in the mission.
| Event |
- Core - EVENT models DCS event dispatching using a publish-subscribe model.
+Core R2.1 - EVENT models DCS event dispatching using a publish-subscribe model.
|