Important changes

-- Renamed AI_DESIGNATE to DESIGNATE
-- Added a parameter to the New() method: CC.
The declaration prototype is now:
`function DESIGNATE:New( CC, Detection, AttackSet )`

I've added a lot of good stuff in the clas now. Almost ready.
This commit is contained in:
FlightControl 2017-04-24 13:04:25 +02:00
parent f6b64a8170
commit 6b3fe625e5
3 changed files with 183 additions and 181 deletions

View File

@ -1,10 +1,10 @@
--- **AI R2.1** -- Management of target **Designation**. --- **Funtional R2.1** -- Management of target **Designation**.
-- --
-- --![Banner Image](..\Presentations\DESIGNATE\Dia1.JPG) -- --![Banner Image](..\Presentations\DESIGNATE\Dia1.JPG)
-- --
-- === -- ===
-- --
-- AI_DESIGNATE is orchestrating the designation of potential targets executed by a Recce group, -- DESIGNATE is orchestrating the designation of potential targets executed by a Recce group,
-- and communicates these to a dedicated attacking group of players, -- and communicates these to a dedicated attacking group of players,
-- so that following a dynamically generated menu system, -- so that following a dynamically generated menu system,
-- each detected set of potential targets can be lased or smoked... -- each detected set of potential targets can be lased or smoked...
@ -30,17 +30,17 @@
-- --
-- * **FlightControl**: Design & Programming -- * **FlightControl**: Design & Programming
-- --
-- @module AI_Designate -- @module Designate
do -- AI_DESIGNATE do -- DESIGNATE
--- @type AI_DESIGNATE --- @type DESIGNATE
-- @extends Core.Fsm#FSM_PROCESS -- @extends Core.Fsm#FSM_PROCESS
--- # AI_DESIGNATE class, extends @{Fsm#FSM} --- # DESIGNATE class, extends @{Fsm#FSM}
-- --
-- AI_DESIGNATE is orchestrating the designation of potential targets executed by a Recce group, -- DESIGNATE is orchestrating the designation of potential targets executed by a Recce group,
-- and communicates these to a dedicated attacking group of players, -- and communicates these to a dedicated attacking group of players,
-- so that following a dynamically generated menu system, -- so that following a dynamically generated menu system,
-- each detected set of potential targets can be lased or smoked... -- each detected set of potential targets can be lased or smoked...
@ -53,7 +53,7 @@ do -- AI_DESIGNATE
-- --
-- The following terminology is being used throughout this document: -- The following terminology is being used throughout this document:
-- --
-- * The **DesignateObject** is the object of the AI_DESIGNATE class, which is this class explained in the document. -- * The **DesignateObject** is the object of the DESIGNATE class, which is this class explained in the document.
-- * The **DetectionObject** is the object of a DETECTION_ class (DETECTION_TYPES, DETECTION_AREAS, DETECTION_UNITS), which is executing the detection and grouping of Targets into _DetectionItems_. -- * The **DetectionObject** is the object of a DETECTION_ class (DETECTION_TYPES, DETECTION_AREAS, DETECTION_UNITS), which is executing the detection and grouping of Targets into _DetectionItems_.
-- * **DetectionItems** is the list of detected target groupings by the _DetectionObject_. Each _DetectionItem_ contains a _TargetSet_. -- * **DetectionItems** is the list of detected target groupings by the _DetectionObject_. Each _DetectionItem_ contains a _TargetSet_.
-- * **DetectionItem** is one element of the _DetectionItems_ list, and contains a _TargetSet_. -- * **DetectionItem** is one element of the _DetectionItems_ list, and contains a _TargetSet_.
@ -99,58 +99,58 @@ do -- AI_DESIGNATE
-- --
-- Have FUN! -- Have FUN!
-- --
-- ## 1. AI_DESIGNATE constructor -- ## 1. DESIGNATE constructor
-- --
-- * @{#AI_DESIGNATE.New}(): Creates a new AI_DESIGNATE object. -- * @{#DESIGNATE.New}(): Creates a new DESIGNATE object.
-- --
-- ## 2. AI_DESIGNATE is a FSM -- ## 2. DESIGNATE is a FSM
-- --
-- ![Process](..\Presentations\DESIGNATE\Dia2.JPG) -- ![Process](..\Presentations\DESIGNATE\Dia2.JPG)
-- --
-- ### 2.1 AI_DESIGNATE States -- ### 2.1 DESIGNATE States
-- --
-- * **Designating** ( Group ): The process is not started yet. -- * **Designating** ( Group ): The process is not started yet.
-- --
-- ### 2.2 AI_DESIGNATE Events -- ### 2.2 DESIGNATE Events
-- --
-- * **@{#AI_DESIGNATE.Detect}**: Detect targets. -- * **@{#DESIGNATE.Detect}**: Detect targets.
-- * **@{#AI_DESIGNATE.LaseOn}**: Lase the targets with the specified Index. -- * **@{#DESIGNATE.LaseOn}**: Lase the targets with the specified Index.
-- * **@{#AI_DESIGNATE.LaseOff}**: Stop lasing the targets with the specified Index. -- * **@{#DESIGNATE.LaseOff}**: Stop lasing the targets with the specified Index.
-- * **@{#AI_DESIGNATE.Smoke}**: Smoke the targets with the specified Index. -- * **@{#DESIGNATE.Smoke}**: Smoke the targets with the specified Index.
-- * **@{#AI_DESIGNATE.Status}**: Report designation status. -- * **@{#DESIGNATE.Status}**: Report designation status.
-- --
-- ## 3. Laser codes -- ## 3. Laser codes
-- --
-- ### 3.1 Set possible laser codes -- ### 3.1 Set possible laser codes
-- --
-- An array of laser codes can be provided, that will be used by the AI_DESIGNATE when lasing. -- An array of laser codes can be provided, that will be used by the DESIGNATE when lasing.
-- The laser code is communicated by the Recce when it is lasing a larget. -- The laser code is communicated by the Recce when it is lasing a larget.
-- Note that the default laser code is 1113. -- Note that the default laser code is 1113.
-- Working known laser codes are: 1113,1462,1483,1537,1362,1214,1131,1182,1644,1614,1515,1411,1621,1138,1542,1678,1573,1314,1643,1257,1467,1375,1341,1275,1237 -- Working known laser codes are: 1113,1462,1483,1537,1362,1214,1131,1182,1644,1614,1515,1411,1621,1138,1542,1678,1573,1314,1643,1257,1467,1375,1341,1275,1237
-- --
-- Use the method @{#AI_DESIGNATE.SetLaserCodes}() to set the possible laser codes to be selected from. -- Use the method @{#DESIGNATE.SetLaserCodes}() to set the possible laser codes to be selected from.
-- One laser code can be given or an sequence of laser codes through an table... -- One laser code can be given or an sequence of laser codes through an table...
-- --
-- AIDesignate:SetLaserCodes( 1214 ) -- Designate:SetLaserCodes( 1214 )
-- --
-- The above sets one laser code with the value 1214. -- The above sets one laser code with the value 1214.
-- --
-- AIDesignate:SetLaserCodes( { 1214, 1131, 1614, 1138 } ) -- Designate:SetLaserCodes( { 1214, 1131, 1614, 1138 } )
-- --
-- The above sets a collection of possible laser codes that can be assigned. **Note the { } notation!** -- The above sets a collection of possible laser codes that can be assigned. **Note the { } notation!**
-- --
-- ### 3.2 Auto generate laser codes -- ### 3.2 Auto generate laser codes
-- --
-- Use the method @{#AI_DESIGNATE.GenerateLaserCodes}() to generate all possible laser codes. Logic implemented and advised by Ciribob! -- Use the method @{#DESIGNATE.GenerateLaserCodes}() to generate all possible laser codes. Logic implemented and advised by Ciribob!
-- --
-- ## 4. Autolase to automatically lase detected targets. -- ## 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. -- 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. -- Use the method @{#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 ) -- Designate:SetAutoLase( true )
-- --
-- Activate the auto lasing. -- Activate the auto lasing.
-- --
@ -160,12 +160,12 @@ do -- AI_DESIGNATE
-- 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, -- 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. -- 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}(). -- This threat level prioritization can be activated using the method @{#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. -- 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 ) -- Designate: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. -- The example will activate the threat level prioritization for this the Designate object. Threats will be marked based on the threat level of the Target.
-- --
-- ## 6. Status Report -- ## 6. Status Report
-- --
@ -175,193 +175,195 @@ do -- AI_DESIGNATE
-- * The status report can be automatically flashed by selecting "Status" -> "Flash Status On". -- * 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 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 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. -- * The method @{#DESIGNATE.FlashStatusMenu}() can be used to enable or disable to flashing of the status menu.
-- --
-- AIDesignate:FlashStatusMenu( true ) -- Designate:FlashStatusMenu( true )
-- --
-- The example will activate the flashing of the status menu for this AIDesignate object. -- The example will activate the flashing of the status menu for this Designate object.
-- --
-- @field #AI_DESIGNATE -- @field #DESIGNATE
-- --
AI_DESIGNATE = { DESIGNATE = {
ClassName = "AI_DESIGNATE", ClassName = "DESIGNATE",
} }
--- AI_DESIGNATE Constructor. This class is an abstract class and should not be instantiated. --- DESIGNATE Constructor. This class is an abstract class and should not be instantiated.
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param Tasking.CommandCenter#COMMANDCENTER CC
-- @param Functional.Detection#DETECTION_BASE Detection -- @param Functional.Detection#DETECTION_BASE Detection
-- @param Core.Set#SET_GROUP AttackSet The Attack collection of GROUP objects to designate and report for. -- @param Core.Set#SET_GROUP AttackSet The Attack collection of GROUP objects to designate and report for.
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:New( Detection, AttackSet ) function DESIGNATE:New( CC, Detection, AttackSet )
local self = BASE:Inherit( self, FSM:New() ) -- #AI_DESIGNATE local self = BASE:Inherit( self, FSM:New() ) -- #DESIGNATE
self:F( { Detection } ) self:F( { Detection } )
self:SetStartState( "Designating" ) self:SetStartState( "Designating" )
self:AddTransition( "*", "Detect", "*" ) self:AddTransition( "*", "Detect", "*" )
--- Detect Handler OnBefore for AI_DESIGNATE --- Detect Handler OnBefore for DESIGNATE
-- @function [parent=#AI_DESIGNATE] OnBeforeDetect -- @function [parent=#DESIGNATE] OnBeforeDetect
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Detect Handler OnAfter for AI_DESIGNATE --- Detect Handler OnAfter for DESIGNATE
-- @function [parent=#AI_DESIGNATE] OnAfterDetect -- @function [parent=#DESIGNATE] OnAfterDetect
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- Detect Trigger for AI_DESIGNATE --- Detect Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE] Detect -- @function [parent=#DESIGNATE] Detect
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
--- Detect Asynchronous Trigger for AI_DESIGNATE --- Detect Asynchronous Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE] __Detect -- @function [parent=#DESIGNATE] __Detect
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #number Delay -- @param #number Delay
self:AddTransition( "*", "LaseOn", "Lasing" ) self:AddTransition( "*", "LaseOn", "Lasing" )
--- LaseOn Handler OnBefore for AI_DESIGNATE --- LaseOn Handler OnBefore for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] OnBeforeLaseOn -- @function [parent=#DESIGNATE ] OnBeforeLaseOn
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- LaseOn Handler OnAfter for AI_DESIGNATE --- LaseOn Handler OnAfter for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] OnAfterLaseOn -- @function [parent=#DESIGNATE ] OnAfterLaseOn
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- LaseOn Trigger for AI_DESIGNATE --- LaseOn Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] LaseOn -- @function [parent=#DESIGNATE ] LaseOn
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
--- LaseOn Asynchronous Trigger for AI_DESIGNATE --- LaseOn Asynchronous Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] __LaseOn -- @function [parent=#DESIGNATE ] __LaseOn
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #number Delay -- @param #number Delay
self:AddTransition( "Lasing", "Lasing", "Lasing" ) self:AddTransition( "Lasing", "Lasing", "Lasing" )
self:AddTransition( "*", "LaseOff", "Designate" ) self:AddTransition( "*", "LaseOff", "Designate" )
--- LaseOff Handler OnBefore for AI_DESIGNATE --- LaseOff Handler OnBefore for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] OnBeforeLaseOff -- @function [parent=#DESIGNATE ] OnBeforeLaseOff
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- LaseOff Handler OnAfter for AI_DESIGNATE --- LaseOff Handler OnAfter for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] OnAfterLaseOff -- @function [parent=#DESIGNATE ] OnAfterLaseOff
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- LaseOff Trigger for AI_DESIGNATE --- LaseOff Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] LaseOff -- @function [parent=#DESIGNATE ] LaseOff
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
--- LaseOff Asynchronous Trigger for AI_DESIGNATE --- LaseOff Asynchronous Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] __LaseOff -- @function [parent=#DESIGNATE ] __LaseOff
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #number Delay -- @param #number Delay
self:AddTransition( "*", "Smoke", "*" ) self:AddTransition( "*", "Smoke", "*" )
--- Smoke Handler OnBefore for AI_DESIGNATE --- Smoke Handler OnBefore for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] OnBeforeSmoke -- @function [parent=#DESIGNATE ] OnBeforeSmoke
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Smoke Handler OnAfter for AI_DESIGNATE --- Smoke Handler OnAfter for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] OnAfterSmoke -- @function [parent=#DESIGNATE ] OnAfterSmoke
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- Smoke Trigger for AI_DESIGNATE --- Smoke Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] Smoke -- @function [parent=#DESIGNATE ] Smoke
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
--- Smoke Asynchronous Trigger for AI_DESIGNATE --- Smoke Asynchronous Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] __Smoke -- @function [parent=#DESIGNATE ] __Smoke
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #number Delay -- @param #number Delay
self:AddTransition( "*", "Illuminate", "*" ) self:AddTransition( "*", "Illuminate", "*" )
--- Illuminate Handler OnBefore for AI_DESIGNATE --- Illuminate Handler OnBefore for DESIGNATE
-- @function [parent=#AI_DESIGNATE] OnBeforeIlluminate -- @function [parent=#DESIGNATE] OnBeforeIlluminate
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Illuminate Handler OnAfter for AI_DESIGNATE --- Illuminate Handler OnAfter for DESIGNATE
-- @function [parent=#AI_DESIGNATE] OnAfterIlluminate -- @function [parent=#DESIGNATE] OnAfterIlluminate
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- Illuminate Trigger for AI_DESIGNATE --- Illuminate Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE] Illuminate -- @function [parent=#DESIGNATE] Illuminate
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
--- Illuminate Asynchronous Trigger for AI_DESIGNATE --- Illuminate Asynchronous Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE] __Illuminate -- @function [parent=#DESIGNATE] __Illuminate
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #number Delay -- @param #number Delay
self:AddTransition( "*", "Done", "*" ) self:AddTransition( "*", "Done", "*" )
self:AddTransition( "*", "Status", "*" ) self:AddTransition( "*", "Status", "*" )
--- Status Handler OnBefore for AI_DESIGNATE --- Status Handler OnBefore for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] OnBeforeStatus -- @function [parent=#DESIGNATE ] OnBeforeStatus
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Status Handler OnAfter for AI_DESIGNATE --- Status Handler OnAfter for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] OnAfterStatus -- @function [parent=#DESIGNATE ] OnAfterStatus
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- Status Trigger for AI_DESIGNATE --- Status Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] Status -- @function [parent=#DESIGNATE ] Status
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
--- Status Asynchronous Trigger for AI_DESIGNATE --- Status Asynchronous Trigger for DESIGNATE
-- @function [parent=#AI_DESIGNATE ] __Status -- @function [parent=#DESIGNATE ] __Status
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #number Delay -- @param #number Delay
self.CC = CC
self.Detection = Detection self.Detection = Detection
self.AttackSet = AttackSet self.AttackSet = AttackSet
self.RecceSet = Detection:GetDetectionSetGroup() self.RecceSet = Detection:GetDetectionSetGroup()
@ -387,10 +389,10 @@ do -- AI_DESIGNATE
end end
--- Set the flashing of the status menu. --- Set the flashing of the status menu.
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #boolean FlashMenu true: the status menu will be flashed every detection run; false: no flashing of the menu. -- @param #boolean FlashMenu true: the status menu will be flashed every detection run; false: no flashing of the menu.
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:SetFlashStatusMenu( FlashMenu ) --R2.1 function DESIGNATE:SetFlashStatusMenu( FlashMenu ) --R2.1
self.FlashStatusMenu = {} self.FlashStatusMenu = {}
@ -408,10 +410,10 @@ do -- AI_DESIGNATE
--- Set an array of possible laser codes. --- Set an array of possible laser codes.
-- Each new lase will select a code from this table. -- Each new lase will select a code from this table.
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #list<#number> LaserCodes -- @param #list<#number> LaserCodes
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:SetLaserCodes( LaserCodes ) --R2.1 function DESIGNATE:SetLaserCodes( LaserCodes ) --R2.1
self.LaserCodes = ( type( LaserCodes ) == "table" ) and LaserCodes or { LaserCodes } self.LaserCodes = ( type( LaserCodes ) == "table" ) and LaserCodes or { LaserCodes }
self:E(self.LaserCodes) self:E(self.LaserCodes)
@ -428,9 +430,9 @@ do -- AI_DESIGNATE
-- -- and the last three digits must be between 1 and 8. -- -- and the last three digits must be between 1 and 8.
-- The range used to be bugged so its not 1 - 8 but 0 - 7. -- The range used to be bugged so its not 1 - 8 but 0 - 7.
-- function below will use the range 1-7 just in case -- function below will use the range 1-7 just in case
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:GenerateLaserCodes() --R2.1 function DESIGNATE:GenerateLaserCodes() --R2.1
self.LaserCodes = {} self.LaserCodes = {}
@ -476,19 +478,19 @@ do -- AI_DESIGNATE
--- Set auto lase. --- Set auto lase.
-- Auto lase will start lasing targets immediately when these are in range. -- Auto lase will start lasing targets immediately when these are in range.
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #boolean AutoLase -- @param #boolean AutoLase
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:SetAutoLase( AutoLase ) --R2.1 function DESIGNATE:SetAutoLase( AutoLase ) --R2.1
self.AutoLase = AutoLase self.AutoLase = AutoLase
local AutoLaseOnOff = ( AutoLase == true ) and "On" or "Off" local AutoLaseOnOff = ( AutoLase == true ) and "On" or "Off"
local Recce = self.RecceSet:GetFirst() local CC = self.CC:GetPositionable()
if Recce then if CC then
Recce:MessageToSetGroup( "Auto Lase " .. AutoLaseOnOff .. ".", 15, self.AttackSet ) CC:MessageToSetGroup( "Auto Lase " .. AutoLaseOnOff .. ".", 15, self.AttackSet )
end end
self:ActivateAutoLase() self:ActivateAutoLase()
@ -498,10 +500,10 @@ do -- AI_DESIGNATE
end end
--- Set priorization of Targets based on the **Threat Level of the Target** in an Air to Ground context. --- Set priorization of Targets based on the **Threat Level of the Target** in an Air to Ground context.
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param #boolean Prioritize -- @param #boolean Prioritize
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:SetThreatLevelPrioritization( Prioritize ) --R2.1 function DESIGNATE:SetThreatLevelPrioritization( Prioritize ) --R2.1
self.ThreatLevelPrioritization = Prioritize self.ThreatLevelPrioritization = Prioritize
@ -511,9 +513,9 @@ do -- AI_DESIGNATE
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:onafterDetect() function DESIGNATE:onafterDetect()
self:__Detect( -60 ) self:__Detect( -60 )
@ -525,10 +527,10 @@ do -- AI_DESIGNATE
end end
--- Sends the status to the Attack Groups. --- Sends the status to the Attack Groups.
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @param Wrapper.Group#GROUP AttackGroup -- @param Wrapper.Group#GROUP AttackGroup
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:SendStatus( MenuAttackGroup ) function DESIGNATE:SendStatus( MenuAttackGroup )
self.AttackSet:ForEachGroup( self.AttackSet:ForEachGroup(
@ -547,9 +549,9 @@ do -- AI_DESIGNATE
DetectedReport:Add(" - " .. Report) DetectedReport:Add(" - " .. Report)
end end
local RecceLeader = self.RecceSet:GetFirst() -- Wrapper.Group#GROUP local CC = self.CC:GetPositionable()
RecceLeader:MessageToGroup( DetectedReport:Text( "\n" ), 15, AttackGroup ) CC:MessageToGroup( DetectedReport:Text( "\n" ), 15, AttackGroup )
local DesignationReport = REPORT:New( "Targets currently marked:" ) local DesignationReport = REPORT:New( "Targets currently marked:" )
@ -565,7 +567,7 @@ do -- AI_DESIGNATE
end end
) )
RecceLeader:MessageToGroup( DesignationReport:Text(), 15, AttackGroup ) CC:MessageToGroup( DesignationReport:Text(), 15, AttackGroup )
end end
end end
) )
@ -574,9 +576,9 @@ do -- AI_DESIGNATE
end end
--- Coordinates the Auto Lase. --- Coordinates the Auto Lase.
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:ActivateAutoLase() function DESIGNATE:ActivateAutoLase()
self.AttackSet:Flush() self.AttackSet:Flush()
@ -601,9 +603,9 @@ do -- AI_DESIGNATE
end end
--- Sets the Designate Menu. --- Sets the Designate Menu.
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:SetDesignateMenu() function DESIGNATE:SetDesignateMenu()
self.AttackSet:Flush() self.AttackSet:Flush()
@ -675,8 +677,8 @@ do -- AI_DESIGNATE
end end
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
function AI_DESIGNATE:MenuStatus( AttackGroup ) function DESIGNATE:MenuStatus( AttackGroup )
self:E("Status") self:E("Status")
@ -684,8 +686,8 @@ do -- AI_DESIGNATE
end end
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
function AI_DESIGNATE:MenuFlashStatus( AttackGroup, Flash ) function DESIGNATE:MenuFlashStatus( AttackGroup, Flash )
self:E("Flash Status") self:E("Flash Status")
@ -695,8 +697,8 @@ do -- AI_DESIGNATE
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
function AI_DESIGNATE:MenuAutoLase( AutoLase ) function DESIGNATE:MenuAutoLase( AutoLase )
self:E("AutoLase") self:E("AutoLase")
@ -704,8 +706,8 @@ do -- AI_DESIGNATE
end end
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
function AI_DESIGNATE:MenuSmoke( Index, Color ) function DESIGNATE:MenuSmoke( Index, Color )
self:E("Designate through Smoke") self:E("Designate through Smoke")
@ -714,8 +716,8 @@ do -- AI_DESIGNATE
end end
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
function AI_DESIGNATE:MenuIlluminate( Index ) function DESIGNATE:MenuIlluminate( Index )
self:E("Designate through Illumination") self:E("Designate through Illumination")
@ -725,8 +727,8 @@ do -- AI_DESIGNATE
end end
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
function AI_DESIGNATE:MenuLaseOn( Index, Duration ) function DESIGNATE:MenuLaseOn( Index, Duration )
self:E("Designate through Lase") self:E("Designate through Lase")
@ -734,8 +736,8 @@ do -- AI_DESIGNATE
end end
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
function AI_DESIGNATE:MenuLaseOff( Index, Duration ) function DESIGNATE:MenuLaseOff( Index, Duration )
self:E("Lasing off") self:E("Lasing off")
@ -744,8 +746,8 @@ do -- AI_DESIGNATE
end end
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
function AI_DESIGNATE:onafterLaseOn( From, Event, To, Index, Duration ) function DESIGNATE:onafterLaseOn( From, Event, To, Index, Duration )
self.Designating[Index] = "Laser" self.Designating[Index] = "Laser"
self:Lasing( Index, Duration ) self:Lasing( Index, Duration )
@ -753,9 +755,9 @@ do -- AI_DESIGNATE
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:onafterLasing( From, Event, To, Index, Duration ) function DESIGNATE:onafterLasing( From, Event, To, Index, Duration )
local TargetSetUnit = self.Detection:GetDetectedSet( Index ) local TargetSetUnit = self.Detection:GetDetectedSet( Index )
@ -825,14 +827,14 @@ do -- AI_DESIGNATE
end end
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:onafterLaseOff( From, Event, To, Index ) function DESIGNATE:onafterLaseOff( From, Event, To, Index )
local Recce = self.RecceSet:GetFirst() local CC = self.CC:GetPositionable()
if Recce then if CC then
Recce:MessageToSetGroup( "Stopped lasing.", 5, self.AttackSet ) CC:MessageToSetGroup( "Stopped lasing.", 5, self.AttackSet )
end end
local TargetSetUnit = self.Detection:GetDetectedSet( Index ) local TargetSetUnit = self.Detection:GetDetectedSet( Index )
@ -854,9 +856,9 @@ do -- AI_DESIGNATE
--- ---
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:onafterSmoke( From, Event, To, Index, Color ) function DESIGNATE:onafterSmoke( From, Event, To, Index, Color )
local TargetSetUnit = self.Detection:GetDetectedSet( Index ) local TargetSetUnit = self.Detection:GetDetectedSet( Index )
@ -888,9 +890,9 @@ do -- AI_DESIGNATE
end end
--- Illuminating --- Illuminating
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:onafterIlluminate( From, Event, To, Index ) function DESIGNATE:onafterIlluminate( From, Event, To, Index )
local TargetSetUnit = self.Detection:GetDetectedSet( Index ) local TargetSetUnit = self.Detection:GetDetectedSet( Index )
@ -914,9 +916,9 @@ do -- AI_DESIGNATE
end end
--- Done --- Done
-- @param #AI_DESIGNATE self -- @param #DESIGNATE self
-- @return #AI_DESIGNATE -- @return #DESIGNATE
function AI_DESIGNATE:onafterDone( From, Event, To, Index ) function DESIGNATE:onafterDone( From, Event, To, Index )
self.Designating[Index] = nil self.Designating[Index] = nil
self:SetDesignateMenu() self:SetDesignateMenu()

View File

@ -37,12 +37,12 @@ Functional/Escort.lua
Functional/MissileTrainer.lua Functional/MissileTrainer.lua
Functional/AirbasePolice.lua Functional/AirbasePolice.lua
Functional/Detection.lua Functional/Detection.lua
Functional/Designate.lua
AI/AI_Balancer.lua AI/AI_Balancer.lua
AI/AI_Patrol.lua AI/AI_Patrol.lua
AI/AI_Cap.lua AI/AI_Cap.lua
AI/AI_Cas.lua AI/AI_Cas.lua
AI/AI_Designate.lua
Actions/Act_Assign.lua Actions/Act_Assign.lua
Actions/Act_Route.lua Actions/Act_Route.lua

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170423_1757' ) env.info( 'Moose Generation Timestamp: 20170424_1257' )
local base = _G local base = _G
@ -57,11 +57,11 @@ __Moose.Include( 'Functional/Escort.lua' )
__Moose.Include( 'Functional/MissileTrainer.lua' ) __Moose.Include( 'Functional/MissileTrainer.lua' )
__Moose.Include( 'Functional/AirbasePolice.lua' ) __Moose.Include( 'Functional/AirbasePolice.lua' )
__Moose.Include( 'Functional/Detection.lua' ) __Moose.Include( 'Functional/Detection.lua' )
__Moose.Include( 'Functional/Designate.lua' )
__Moose.Include( 'AI/AI_Balancer.lua' ) __Moose.Include( 'AI/AI_Balancer.lua' )
__Moose.Include( 'AI/AI_Patrol.lua' ) __Moose.Include( 'AI/AI_Patrol.lua' )
__Moose.Include( 'AI/AI_Cap.lua' ) __Moose.Include( 'AI/AI_Cap.lua' )
__Moose.Include( 'AI/AI_Cas.lua' ) __Moose.Include( 'AI/AI_Cas.lua' )
__Moose.Include( 'AI/AI_Designate.lua' )
__Moose.Include( 'Actions/Act_Assign.lua' ) __Moose.Include( 'Actions/Act_Assign.lua' )
__Moose.Include( 'Actions/Act_Route.lua' ) __Moose.Include( 'Actions/Act_Route.lua' )
__Moose.Include( 'Actions/Act_Account.lua' ) __Moose.Include( 'Actions/Act_Account.lua' )