Merge pull request #462 from FlightControl-Master/386-ai-designate

386 ai designate
This commit is contained in:
Sven Van de Velde 2017-04-24 12:39:04 +02:00 committed by GitHub
commit 5cbc737727
15 changed files with 593 additions and 121 deletions

View File

@ -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
@ -198,7 +226,6 @@ do -- AI_DESIGNATE
-- @param #number Delay
self:AddTransition( "*", "LaseOn", "Lasing" )
--- LaseOn Handler OnBefore for AI_DESIGNATE
@ -343,15 +370,37 @@ 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
@ -448,6 +497,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
---
-- @param #AI_DESIGNATE self
@ -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(
local Report = self.Detection:DetectedItemReportSummary( Index )
DetectedReport:Add(" - " .. Report)
end
--- @param Wrapper.Group#GROUP GroupReport
function( AttackGroup )
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

View File

@ -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.
--
-- ![Banner Image](..\Presentations\EVENT\Dia1.JPG)
--
@ -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() } )

View File

@ -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.

View File

@ -678,7 +678,9 @@ 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
@ -686,6 +688,43 @@ do -- DETECTION_BASE
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 )

View File

@ -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

View File

@ -186,6 +186,12 @@ each detected set of potential targets can be lased or smoked...</p>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).Detection">AI_DESIGNATE.Detection</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).FlashStatusMenu">AI_DESIGNATE.FlashStatusMenu</a></td>
<td class="summary">
</td>
</tr>
<tr>
@ -234,6 +240,12 @@ each detected set of potential targets can be lased or smoked...</p>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).MenuAutoLase">AI_DESIGNATE:MenuAutoLase(AutoLase)</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).MenuFlashStatus">AI_DESIGNATE:MenuFlashStatus(AttackGroup, Flash)</a></td>
<td class="summary">
</td>
</tr>
<tr>
@ -372,12 +384,24 @@ each detected set of potential targets can be lased or smoked...</p>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).SetDesignateMenu">AI_DESIGNATE:SetDesignateMenu()</a></td>
<td class="summary">
<p>Sets the Designate Menu.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).SetFlashStatusMenu">AI_DESIGNATE:SetFlashStatusMenu(FlashMenu)</a></td>
<td class="summary">
<p>Set the flashing of the status menu.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).SetLaserCodes">AI_DESIGNATE:SetLaserCodes(<, LaserCodes)</a></td>
<td class="summary">
<p>Set an array of possible laser codes.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).SetThreatLevelPrioritization">AI_DESIGNATE:SetThreatLevelPrioritization(Prioritize)</a></td>
<td class="summary">
<p>Set priorization of Targets based on the <strong>Threat Level of the Target</strong> in an Air to Ground context.</p>
</td>
</tr>
<tr>
@ -390,6 +414,12 @@ each detected set of potential targets can be lased or smoked...</p>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).Status">AI_DESIGNATE:Status()</a></td>
<td class="summary">
<p>Status Trigger for AI_DESIGNATE </p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_DESIGNATE).ThreatLevelPrioritization">AI_DESIGNATE.ThreatLevelPrioritization</a></td>
<td class="summary">
</td>
</tr>
<tr>
@ -518,38 +548,38 @@ each detected set of potential targets can be lased or smoked...</p>
<li>A <strong>Designate Menu</strong> is the menu that is dynamically created during the designation process for each <em>AttackGroup</em>.</li>
</ul>
<p>The <em>RecceSet</em> is continuously detecting for potential <em>Targets</em>, executing its task as part of the <em>DetectionObject</em>.
Once <em>Targets</em> have been detected, the <em>DesignateObject</em> will trigger the <strong>Detect Event</strong>.</p>
<p>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 <strong>Detect Event</strong>.</p>
<p>As part of the Detect Event, the <em>DetectionItems</em> list is used by the <em>DesignateObject</em> to provide the <em>Players</em> with:</p>
<p>As part of the Detect Event, the DetectionItems list is used by the DesignateObject to provide the Players with:</p>
<ul>
<li>The <em>RecceGroups</em> are reporting to each <em>AttackGroup</em>, sending <strong>Messages</strong> containing the <em>Threat Level</em> and the <em>TargetSet</em> composition.</li>
<li><strong>Menu options</strong> are created and updated for each <em>AttackGroup</em>, containing the <em>Threat Level</em> and the <em>TargetSet</em> composition.</li>
<li>The RecceGroups are reporting to each AttackGroup, sending <strong>Messages</strong> containing the Threat Level and the TargetSet composition.</li>
<li><strong>Menu options</strong> are created and updated for each AttackGroup, containing the Threat Level and the TargetSet composition.</li>
</ul>
<p>A <em>Player</em> can then select an action from the <em>Designate Menu</em>. </p>
<p>A Player can then select an action from the Designate Menu. </p>
<p><strong>Note that each selected action will be executed for a <em>TargetSet</em>, thus the <em>Target</em> grouping done by the <em>DetectionObject</em>.</strong></p>
<p><strong>Note that each selected action will be executed for a TargetSet, thus the Target grouping done by the DetectionObject.</strong></p>
<p>Each <strong>Menu Option</strong> in the <em>Designate Menu</em> has two modes: </p>
<p>Each <strong>Menu Option</strong> in the Designate Menu has two modes: </p>
<ol>
<li>If the <em>TargetSet</em> <strong>is not being designated</strong>, then the <strong>Designate Menu</strong> option for the target Set will provide options to <strong>Lase</strong> or <strong>Smoke</strong> the targets.</li>
<li>If the TargetSet <strong>is not being designated</strong>, then the <strong>Designate Menu</strong> option for the target Set will provide options to <strong>Lase</strong> or <strong>Smoke</strong> the targets.</li>
<li>If the Target Set <strong>is being designated</strong>, then the <strong>Designate Menu</strong> option will provide an option to stop or cancel the designation.</li>
</ol>
<p>While designating, the <em>RecceGroups</em> will report any change in <em>TargetSet</em> composition or <em>Target</em> presence.</p>
<p>While designating, the RecceGroups will report any change in TargetSet composition or Target presence.</p>
<p>The following logic is executed when a <em>TargetSet</em> is selected to be <em>lased</em> from the <em>Designation Menu</em>:</p>
<p>The following logic is executed when a TargetSet is selected to be <em>lased</em> from the Designation Menu:</p>
<ul>
<li>The <em>RecceSet</em> is searched for any <em>Recce</em> that is within <em>designation distance</em> from a <em>Target</em> in the <em>TargetSet</em> that is currently not being designated.</li>
<li>If there is a <em>Recce</em> found that is currently no designating a target, and is within designation distance from the <em>Target</em>, then that <em>Target</em> will be designated.</li>
<li>During designation, any <em>Recce</em> that does not have Line of Sight (LOS) and is not within disignation distance from the <em>Target</em>, will stop designating the <em>Target</em>, and a report is given.</li>
<li>When a <em>Recce</em> is designating a <em>Target</em>, and that <em>Target</em> is destroyed, then the <em>Recce</em> will stop designating the <em>Target</em>, and will report the event.</li>
<li>When a <em>Recce</em> is designating a <em>Target</em>, and that <em>Recce</em> is destroyed, then the <em>Recce</em> will be removed from the <em>RecceSet</em> and designation will stop without reporting.</li>
<li>When all <em>RecceGroups</em> are destroyed from the <em>RecceSet</em>, then the DesignationObject will stop functioning, and nothing will be reported.</li>
<li>The RecceSet is searched for any Recce that is within <em>designation distance</em> from a Target in the TargetSet that is currently not being designated.</li>
<li>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.</li>
<li>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.</li>
<li>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.</li>
<li>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.</li>
<li>When all RecceGroups are destroyed from the RecceSet, then the DesignationObject will stop functioning, and nothing will be reported.</li>
</ul>
<p>In this way, the DesignationObject assists players to designate ground targets for a coordinated attack!</p>
@ -610,16 +640,37 @@ One laser code can be given or an sequence of laser codes through an table...</p
<h2>4. Autolase to automatically lase detected targets.</h2>
<p><em>DetectionItems</em> can be auto lased once detected by <em>Recces</em>. As such, there is almost no action required from the <em>Players</em> using the <em>Designate Menu</em>.
<p>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 <strong>auto lase</strong> function can be activated through the Designation Menu.
Use the method <a href="##(AI_DESIGNATE).SetAutoLase">AI_DESIGNATE.SetAutoLase</a>() to activate or deactivate the auto lase function programmatically.
Note that autolase will automatically activate lasing for ALL <em>DetectedItems</em>. Individual items can be switched-off if required using the <em>Designation Menu</em>.</p>
Note that autolase will automatically activate lasing for ALL DetectedItems. Individual items can be switched-off if required using the Designation Menu.</p>
<pre><code>AIDesignate:SetAutoLase( true )
</code></pre>
<p>Activate the auto lasing.</p>
<h2>5. Target prioritization on threat level</h2>
<p>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.</p>
<p>This threat level prioritization can be activated using the method <a href="##(AI_DESIGNATE).SetThreatLevelPrioritization">AI_DESIGNATE.SetThreatLevelPrioritization</a>().
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.</p>
<h2>6. Status Report</h2>
<p>A status report is available that displays the current Targets detected, grouped per DetectionItem, and a list of which Targets are currently being marked.</p>
<ul>
<li>The status report can be shown by selecting "Status" -> "Report Status" from the Designation menu .</li>
<li>The status report can be automatically flashed by selecting "Status" -> "Flash Status On".</li>
<li>The automatic flashing of the status report can be deactivated by selecting "Status" -> "Flash Status Off".</li>
<li>The flashing of the status menu is disabled by default.</li>
<li>The method <a href="##(AI_DESIGNATE).FlashStatusMenu">AI_DESIGNATE.FlashStatusMenu</a>() can be used to enable or disable to flashing of the status menu.</li>
</ul>
</dd>
</dl>
@ -712,6 +763,20 @@ Note that autolase will automatically activate lasing for ALL <em>DetectedItems<
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(AI_DESIGNATE).FlashStatusMenu" >
<strong>AI_DESIGNATE.FlashStatusMenu</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
@ -796,6 +861,7 @@ function below will use the range 1-7 just in case</p>
<dl class="function">
<dt>
<em></em>
<a id="#(AI_DESIGNATE).LaserCodes" >
<strong>AI_DESIGNATE.LaserCodes</strong>
</a>
@ -844,6 +910,32 @@ function below will use the range 1-7 just in case</p>
<dl class="function">
<dt>
<a id="#(AI_DESIGNATE).MenuFlashStatus" >
<strong>AI_DESIGNATE:MenuFlashStatus(AttackGroup, Flash)</strong>
</a>
</dt>
<dd>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em> AttackGroup </em></code>: </p>
</li>
<li>
<p><code><em> Flash </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_DESIGNATE).MenuIlluminate" >
<strong>AI_DESIGNATE:MenuIlluminate(Index)</strong>
</a>
@ -1489,6 +1581,33 @@ The Attack collection of GROUP objects to designate and report for.</p>
<p><em><a href="##(AI_DESIGNATE)">#AI_DESIGNATE</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_DESIGNATE).SetFlashStatusMenu" >
<strong>AI_DESIGNATE:SetFlashStatusMenu(FlashMenu)</strong>
</a>
</dt>
<dd>
<p>Set the flashing of the status menu.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#boolean FlashMenu </em></code>:
true: the status menu will be flashed every detection run; false: no flashing of the menu.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(AI_DESIGNATE)">#AI_DESIGNATE</a>:</em></p>
</dd>
</dl>
<dl class="function">
@ -1524,6 +1643,32 @@ number> LaserCodes</p>
<p><em><a href="##(AI_DESIGNATE)">#AI_DESIGNATE</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_DESIGNATE).SetThreatLevelPrioritization" >
<strong>AI_DESIGNATE:SetThreatLevelPrioritization(Prioritize)</strong>
</a>
</dt>
<dd>
<p>Set priorization of Targets based on the <strong>Threat Level of the Target</strong> in an Air to Ground context.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#boolean Prioritize </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(AI_DESIGNATE)">#AI_DESIGNATE</a>:</em></p>
</dd>
</dl>
<dl class="function">
@ -1550,6 +1695,20 @@ number> LaserCodes</p>
<p>Status Trigger for AI_DESIGNATE </p>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(AI_DESIGNATE).ThreatLevelPrioritization" >
<strong>AI_DESIGNATE.ThreatLevelPrioritization</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">

View File

@ -951,9 +951,6 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
<p> This table contains the targets detected during patrol.</p>
</dd>
</dl>
<dl class="function">

View File

@ -189,7 +189,7 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(DETECTION_AREAS).CreateDetectionSets">DETECTION_AREAS:CreateDetectionSets()</a></td>
<td class="name" nowrap="nowrap"><a href="##(DETECTION_AREAS).CreateDetectionItems">DETECTION_AREAS:CreateDetectionItems()</a></td>
<td class="summary">
<p>Make a DetectionSet table.</p>
</td>
@ -346,6 +346,12 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu
<td class="name" nowrap="nowrap"><a href="##(DETECTION_BASE).AlphaAngleProbability">DETECTION_BASE.AlphaAngleProbability</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(DETECTION_BASE).CleanDetectionItems">DETECTION_BASE:CleanDetectionItems()</a></td>
<td class="summary">
<p>Make a DetectionSet table.</p>
</td>
</tr>
<tr>
@ -355,7 +361,7 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(DETECTION_BASE).CreateDetectionSets">DETECTION_BASE:CreateDetectionSets()</a></td>
<td class="name" nowrap="nowrap"><a href="##(DETECTION_BASE).CreateDetectionItems">DETECTION_BASE:CreateDetectionItems()</a></td>
<td class="summary">
<p>Make a DetectionSet table.</p>
</td>
@ -930,7 +936,7 @@ The different values of Unit.Category can be:</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(DETECTION_TYPES).CreateDetectionSets">DETECTION_TYPES:CreateDetectionSets()</a></td>
<td class="name" nowrap="nowrap"><a href="##(DETECTION_TYPES).CreateDetectionItems">DETECTION_TYPES:CreateDetectionItems()</a></td>
<td class="summary">
<p>Create the DetectedItems list from the DetectedObjects table.</p>
</td>
@ -1006,7 +1012,7 @@ The different values of Unit.Category can be:</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(DETECTION_UNITS).CreateDetectionSets">DETECTION_UNITS:CreateDetectionSets()</a></td>
<td class="name" nowrap="nowrap"><a href="##(DETECTION_UNITS).CreateDetectionItems">DETECTION_UNITS:CreateDetectionItems()</a></td>
<td class="summary">
<p>Create the DetectedItems list from the DetectedObjects table.</p>
</td>
@ -1454,8 +1460,8 @@ self</p>
<dl class="function">
<dt>
<a id="#(DETECTION_AREAS).CreateDetectionSets" >
<strong>DETECTION_AREAS:CreateDetectionSets()</strong>
<a id="#(DETECTION_AREAS).CreateDetectionItems" >
<strong>DETECTION_AREAS:CreateDetectionItems()</strong>
</a>
</dt>
<dd>
@ -2024,6 +2030,27 @@ The index of the DetectedItem.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(DETECTION_BASE).CleanDetectionItems" >
<strong>DETECTION_BASE:CleanDetectionItems()</strong>
</a>
</dt>
<dd>
<p>Make a DetectionSet table.</p>
<p>This function will be overridden in the derived clsses.</p>
<h3>Return value</h3>
<p><em><a href="##(DETECTION_BASE)">#DETECTION_BASE</a>:</em></p>
</dd>
</dl>
<dl class="function">
@ -2043,8 +2070,8 @@ The index of the DetectedItem.</p>
<dl class="function">
<dt>
<a id="#(DETECTION_BASE).CreateDetectionSets" >
<strong>DETECTION_BASE:CreateDetectionSets()</strong>
<a id="#(DETECTION_BASE).CreateDetectionItems" >
<strong>DETECTION_BASE:CreateDetectionItems()</strong>
</a>
</dt>
<dd>
@ -2056,8 +2083,8 @@ The index of the DetectedItem.</p>
<h3>Return value</h3>
<p><em><a href="##(DETECTION_BASE)">#DETECTION_BASE</a>:</em>
self</p>
<p><em><a href="##(DETECTION_BASE)">#DETECTION_BASE</a>:</em></p>
</dd>
</dl>
@ -2174,6 +2201,7 @@ self</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(DETECTION_BASE).DetectedItemCount" >
<strong>DETECTION_BASE.DetectedItemCount</strong>
</a>
@ -2187,6 +2215,7 @@ self</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(DETECTION_BASE).DetectedItemMax" >
<strong>DETECTION_BASE.DetectedItemMax</strong>
</a>
@ -2300,7 +2329,7 @@ self</p>
<dl class="function">
<dt>
<em></em>
<em>#number</em>
<a id="#(DETECTION_BASE).DetectionInterval" >
<strong>DETECTION_BASE.DetectionInterval</strong>
</a>
@ -4110,8 +4139,8 @@ Beware that when the amount of different types detected is large, the DetectedIt
<dl class="function">
<dt>
<a id="#(DETECTION_TYPES).CreateDetectionSets" >
<strong>DETECTION_TYPES:CreateDetectionSets()</strong>
<a id="#(DETECTION_TYPES).CreateDetectionItems" >
<strong>DETECTION_TYPES:CreateDetectionItems()</strong>
</a>
</dt>
<dd>
@ -4345,8 +4374,8 @@ Beware that when the amount of units detected is large, the DetectedItems list w
<dl class="function">
<dt>
<a id="#(DETECTION_UNITS).CreateDetectionSets" >
<strong>DETECTION_UNITS:CreateDetectionSets()</strong>
<a id="#(DETECTION_UNITS).CreateDetectionItems" >
<strong>DETECTION_UNITS:CreateDetectionItems()</strong>
</a>
</dt>
<dd>

View File

@ -95,7 +95,7 @@
<div id="content">
<h1>Module <code>Event</code></h1>
<p><strong>Core</strong> - EVENT models DCS <strong>event dispatching</strong> using a <strong>publish-subscribe</strong> model.</p>
<p><strong>Core R2.1</strong> - EVENT models DCS <strong>event dispatching</strong> using a <strong>publish-subscribe</strong> model.</p>

View File

@ -213,7 +213,6 @@ on defined intervals (currently every minute).</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(MOVEMENT).AliveUnits" >
<strong>MOVEMENT.AliveUnits</strong>
</a>
@ -222,9 +221,6 @@ on defined intervals (currently every minute).</p>
<p> Contains the counter how many units are currently alive</p>
</dd>
</dl>
<dl class="function">

View File

@ -181,6 +181,12 @@
<td class="name" nowrap="nowrap"><a href="##(POSITIONABLE).GetMessage">POSITIONABLE:GetMessage(Message, Duration, Name)</a></td>
<td class="summary">
<p>Returns a message with the callsign embedded (if there is one).</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(POSITIONABLE).GetMessageText">POSITIONABLE:GetMessageText(Message, Name)</a></td>
<td class="summary">
<p>Returns the message text with the callsign embedded (if there is one).</p>
</td>
</tr>
<tr>
@ -531,6 +537,39 @@ The duration of the message.</p>
<p><em><a href="Core.Message.html##(MESSAGE)">Core.Message#MESSAGE</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(POSITIONABLE).GetMessageText" >
<strong>POSITIONABLE:GetMessageText(Message, Name)</strong>
</a>
</dt>
<dd>
<p>Returns the message text with the callsign embedded (if there is one).</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string Message </em></code>:
The message text</p>
</li>
<li>
<p><code><em>#string Name </em></code>:
(optional) The Name of the sender. If not provided, the Name is the type of the Positionable.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em>#string:</em>
The message text</p>
</dd>
</dl>
<dl class="function">

View File

@ -969,6 +969,13 @@ mission designer to add a dedicated method</p>
<td class="name" nowrap="nowrap"><a href="##(SET_UNIT).ForEachUnitNotInZone">SET_UNIT:ForEachUnitNotInZone(ZoneObject, IteratorFunction, ...)</a></td>
<td class="summary">
<p>Iterate the SET_UNIT and call an iterator function for each <strong>alive</strong> UNIT presence not in a <a href="Zone.html">Zone</a>, providing the UNIT and optional parameters to the called function.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SET_UNIT).ForEachUnitPerThreatLevel">SET_UNIT:ForEachUnitPerThreatLevel(FromThreatLevel, ToThreatLevel, IteratorFunction, ...)</a></td>
<td class="summary">
<p>Iterate the SET_UNIT <strong>sorted *per Threat Level</strong> and call an interator function for each <strong>alive</strong> UNIT, providing the UNIT and optional parameters.</p>
</td>
</tr>
<tr>
@ -4755,6 +4762,61 @@ self</p>
<dl class="function">
<dt>
<a id="#(SET_UNIT).ForEachUnitPerThreatLevel" >
<strong>SET_UNIT:ForEachUnitPerThreatLevel(FromThreatLevel, ToThreatLevel, IteratorFunction, ...)</strong>
</a>
</dt>
<dd>
<p>Iterate the SET_UNIT <strong>sorted *per Threat Level</strong> and call an interator function for each <strong>alive</strong> UNIT, providing the UNIT and optional parameters.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#number FromThreatLevel </em></code>:
The TreatLevel to start the evaluation <strong>From</strong> (this must be a value between 0 and 10).</p>
</li>
<li>
<p><code><em>#number ToThreatLevel </em></code>:
The TreatLevel to stop the evaluation <strong>To</strong> (this must be a value between 0 and 10).</p>
</li>
<li>
<p><code><em>#function IteratorFunction </em></code>:
The function that will be called when there is an alive UNIT in the SET_UNIT. The function needs to accept a UNIT parameter.</p>
</li>
<li>
<p><code><em> ... </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(SET_UNIT)">#SET_UNIT</a>:</em>
self</p>
<h3>Usage:</h3>
<pre class="example"><code>
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
)
</code></pre>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(SET_UNIT).GetTypeNames" >
<strong>SET_UNIT:GetTypeNames(Delimiter)</strong>
</a>

View File

@ -2077,6 +2077,9 @@ The group that was spawned. You can use this group for further actions.</p>
<p> Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.</p>
</dd>
</dl>
<dl class="function">

View File

@ -444,6 +444,7 @@ ptional) The name of the new static.</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(SPAWNSTATIC).SpawnIndex" >
<strong>SPAWNSTATIC.SpawnIndex</strong>
</a>

View File

@ -346,7 +346,7 @@ even when there are hardly any players in the mission.</strong></p>
<tr>
<td class="name" nowrap="nowrap"><a href="Event.html">Event</a></td>
<td class="summary">
<p><strong>Core</strong> - EVENT models DCS <strong>event dispatching</strong> using a <strong>publish-subscribe</strong> model.</p>
<p><strong>Core R2.1</strong> - EVENT models DCS <strong>event dispatching</strong> using a <strong>publish-subscribe</strong> model.</p>
</td>
</tr>
<tr>