mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Account for destroy events.
This commit is contained in:
parent
4dde14eba6
commit
ae4052ba2d
@ -1,8 +1,15 @@
|
|||||||
--- (SP) (MP) (FSM) Account for (Detect, count and report) DCS events occuring on DCS objects (units).
|
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occuring on @{Unit}s.
|
||||||
|
--
|
||||||
|
-- 
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # @{#ACT_ACCOUNT} FSM class, extends @{Fsm#FSM_PROCESS}
|
-- @module Account
|
||||||
|
|
||||||
|
|
||||||
|
do -- ACT_ACCOUNT
|
||||||
|
|
||||||
|
--- # @{#ACT_ACCOUNT} FSM class, extends @{Fsm#FSM_PROCESS}
|
||||||
--
|
--
|
||||||
-- ## ACT_ACCOUNT state machine:
|
-- ## ACT_ACCOUNT state machine:
|
||||||
--
|
--
|
||||||
@ -11,32 +18,24 @@
|
|||||||
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
||||||
-- but will have **different implementation behaviour** upon each event or state transition.
|
-- but will have **different implementation behaviour** upon each event or state transition.
|
||||||
--
|
--
|
||||||
-- ### ACT_ACCOUNT **Events**:
|
-- ### ACT_ACCOUNT States
|
||||||
--
|
--
|
||||||
-- These are the events defined in this class:
|
-- * **Asigned**: The player is assigned.
|
||||||
|
-- * **Waiting**: Waiting for an event.
|
||||||
|
-- * **Report**: Reporting.
|
||||||
|
-- * **Account**: Account for an event.
|
||||||
|
-- * **Accounted**: All events have been accounted for, end of the process.
|
||||||
|
-- * **Failed**: Failed the process.
|
||||||
--
|
--
|
||||||
-- * **Start**: The process is started. The process will go into the Report state.
|
-- ### ACT_ACCOUNT Events
|
||||||
-- * **Event**: A relevant event has occured that needs to be accounted for. The process will go into the Account state.
|
|
||||||
-- * **Report**: The process is reporting to the player the accounting status of the DCS events.
|
|
||||||
-- * **More**: There are more DCS events that need to be accounted for. The process will go back into the Report state.
|
|
||||||
-- * **NoMore**: There are no more DCS events that need to be accounted for. The process will go into the Success state.
|
|
||||||
--
|
--
|
||||||
-- ### ACT_ACCOUNT **Event methods**:
|
-- * **Start**: Start the process.
|
||||||
--
|
-- * **Wait**: Wait for an event.
|
||||||
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
-- * **Report**: Report the status of the accounting.
|
||||||
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
-- * **Event**: An event happened, process the event.
|
||||||
--
|
-- * **More**: More targets.
|
||||||
-- * **Immediate**: The event method has exactly the name of the event.
|
-- * **NoMore (*)**: No more targets.
|
||||||
-- * **Delayed**: The event method starts with a __ + the name of the event. The first parameter of the event method is a number value, expressing the delay in seconds when the event will be executed.
|
-- * **Fail (*)**: The action process has failed.
|
||||||
--
|
|
||||||
-- ### ACT_ACCOUNT **States**:
|
|
||||||
--
|
|
||||||
-- * **Assigned**: The player is assigned to the task. This is the initialization state for the process.
|
|
||||||
-- * **Waiting**: the process is waiting for a DCS event to occur within the simulator. This state is set automatically.
|
|
||||||
-- * **Report**: The process is Reporting to the players in the group of the unit. This state is set automatically every 30 seconds.
|
|
||||||
-- * **Account**: The relevant DCS event has occurred, and is accounted for.
|
|
||||||
-- * **Success (*)**: All DCS events were accounted for.
|
|
||||||
-- * **Failed (*)**: The process has failed.
|
|
||||||
--
|
--
|
||||||
-- (*) End states of the process.
|
-- (*) End states of the process.
|
||||||
--
|
--
|
||||||
@ -55,26 +54,6 @@
|
|||||||
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
||||||
-- These state transition methods need to provide a return value, which is specified at the function description.
|
-- These state transition methods need to provide a return value, which is specified at the function description.
|
||||||
--
|
--
|
||||||
-- # 1) @{#ACT_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#ACT_ACCOUNT}
|
|
||||||
--
|
|
||||||
-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
|
||||||
-- The process is given a @{Set} of units that will be tracked upon successful destruction.
|
|
||||||
-- The process will end after each target has been successfully destroyed.
|
|
||||||
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- ## ACT_ACCOUNT_DEADS constructor:
|
|
||||||
--
|
|
||||||
-- * @{#ACT_ACCOUNT_DEADS.New}(): Creates a new ACT_ACCOUNT_DEADS object.
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- @module Account
|
|
||||||
|
|
||||||
|
|
||||||
do -- ACT_ACCOUNT
|
|
||||||
|
|
||||||
--- ACT_ACCOUNT class
|
|
||||||
-- @type ACT_ACCOUNT
|
-- @type ACT_ACCOUNT
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends Core.Fsm#FSM_PROCESS
|
-- @extends Core.Fsm#FSM_PROCESS
|
||||||
@ -156,7 +135,18 @@ end -- ACT_ACCOUNT
|
|||||||
|
|
||||||
do -- ACT_ACCOUNT_DEADS
|
do -- ACT_ACCOUNT_DEADS
|
||||||
|
|
||||||
--- ACT_ACCOUNT_DEADS class
|
--- # @{#ACT_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#ACT_ACCOUNT}
|
||||||
|
--
|
||||||
|
-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
||||||
|
-- The process is given a @{Set} of units that will be tracked upon successful destruction.
|
||||||
|
-- The process will end after each target has been successfully destroyed.
|
||||||
|
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- ## ACT_ACCOUNT_DEADS constructor:
|
||||||
|
--
|
||||||
|
-- * @{#ACT_ACCOUNT_DEADS.New}(): Creates a new ACT_ACCOUNT_DEADS object.
|
||||||
|
--
|
||||||
-- @type ACT_ACCOUNT_DEADS
|
-- @type ACT_ACCOUNT_DEADS
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends #ACT_ACCOUNT
|
-- @extends #ACT_ACCOUNT
|
||||||
@ -200,7 +190,7 @@ do -- ACT_ACCOUNT_DEADS
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, From, Event, To )
|
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, Task, From, Event, To )
|
||||||
self:E( { ProcessUnit, From, Event, To } )
|
self:E( { ProcessUnit, From, Event, To } )
|
||||||
|
|
||||||
self:Message( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed." )
|
self:Message( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed." )
|
||||||
@ -213,17 +203,21 @@ do -- ACT_ACCOUNT_DEADS
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, From, Event, To, EventData )
|
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Task, From, Event, To, EventData )
|
||||||
self:T( { ProcessUnit, EventData, From, Event, To } )
|
self:T( { ProcessUnit, EventData, From, Event, To } )
|
||||||
|
|
||||||
self:T({self.Controllable})
|
self:T({self.Controllable})
|
||||||
|
|
||||||
self.TargetSetUnit:Flush()
|
self.TargetSetUnit:Flush()
|
||||||
|
|
||||||
|
self:T( { "Before sending Message", EventData.IniUnitName, self.TargetSetUnit:FindUnit( EventData.IniUnitName ) } )
|
||||||
if self.TargetSetUnit:FindUnit( EventData.IniUnitName ) then
|
if self.TargetSetUnit:FindUnit( EventData.IniUnitName ) then
|
||||||
|
self:T( "Sending Message" )
|
||||||
local TaskGroup = ProcessUnit:GetGroup()
|
local TaskGroup = ProcessUnit:GetGroup()
|
||||||
|
self.TargetSetUnit:Remove( EventData.IniUnitName )
|
||||||
self:Message( "You hit a target. Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:Count() .. " targets ( " .. self.TargetSetUnit:GetUnitTypesText() .. " ) left to be destroyed." )
|
self:Message( "You hit a target. Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:Count() .. " targets ( " .. self.TargetSetUnit:GetUnitTypesText() .. " ) left to be destroyed." )
|
||||||
end
|
end
|
||||||
|
self:T( { "After sending Message" } )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
@ -232,9 +226,9 @@ do -- ACT_ACCOUNT_DEADS
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, From, Event, To, EventData )
|
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Task, From, Event, To )
|
||||||
|
|
||||||
if self.TargetSetUnit:Count() > 1 then
|
if self.TargetSetUnit:Count() > 0 then
|
||||||
self:__More( 1 )
|
self:__More( 1 )
|
||||||
else
|
else
|
||||||
self:__NoMore( 1 )
|
self:__NoMore( 1 )
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20170319_0757' )
|
env.info( 'Moose Generation Timestamp: 20170319_1459' )
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
@ -25499,14 +25499,29 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- This module contains the DETECTION classes.
|
--- **Functional** - DETECTION_ classes model the detection of enemy units by FACs or RECCEs and group them according various methods.
|
||||||
|
--
|
||||||
|
-- 
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#DETECTION_BASE} class, extends @{Fsm#FSM}
|
-- ### Contributions:
|
||||||
--
|
--
|
||||||
-- The @{#DETECTION_BASE} class defines the core functions to administer detected objects.
|
-- * Mechanist : Early concept of DETECTION_AREAS.
|
||||||
-- The @{#DETECTION_BASE} class will detect objects within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s).
|
--
|
||||||
|
-- ### Authors:
|
||||||
|
--
|
||||||
|
-- * FlightControl : Analysis, Design, Programming, Testing
|
||||||
|
--
|
||||||
|
-- @module Detection
|
||||||
|
|
||||||
|
|
||||||
|
do -- DETECTION_BASE
|
||||||
|
|
||||||
|
--- # 1) DETECTION_BASE class, extends @{Fsm#FSM}
|
||||||
|
--
|
||||||
|
-- The DETECTION_BASE class defines the core functions to administer detected objects.
|
||||||
|
-- The DETECTION_BASE class will detect objects within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s).
|
||||||
--
|
--
|
||||||
-- ## 1.1) DETECTION_BASE constructor
|
-- ## 1.1) DETECTION_BASE constructor
|
||||||
--
|
--
|
||||||
@ -25688,69 +25703,6 @@ end
|
|||||||
-- * **Detected**: New units have been detected.
|
-- * **Detected**: New units have been detected.
|
||||||
-- * **Stop**: Stop the detection process.
|
-- * **Stop**: Stop the detection process.
|
||||||
--
|
--
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- # 2) @{Detection#DETECTION_UNITS} class, extends @{Detection#DETECTION_BASE}
|
|
||||||
--
|
|
||||||
-- The @{Detection#DETECTION_UNITS} class will detect units within the battle zone.
|
|
||||||
-- It will build a DetectedItems list filled with DetectedItems. Each DetectedItem will contain a field Set, which contains a @{Set#SET_UNIT} containing ONE @{UNIT} object reference.
|
|
||||||
-- Beware that when the amount of units detected is large, the DetectedItems list will be large also.
|
|
||||||
--
|
|
||||||
-- # 3) @{Detection#DETECTION_TYPES} class, extends @{Detection#DETECTION_BASE}
|
|
||||||
--
|
|
||||||
-- The @{Detection#DETECTION_TYPES} class will detect units within the battle zone.
|
|
||||||
-- It will build a DetectedItems[] list filled with DetectedItems, grouped by the type of units detected.
|
|
||||||
-- Each DetectedItem will contain a field Set, which contains a @{Set#SET_UNIT} containing ONE @{UNIT} object reference.
|
|
||||||
-- Beware that when the amount of different types detected is large, the DetectedItems[] list will be large also.
|
|
||||||
--
|
|
||||||
-- # 4) @{Detection#DETECTION_AREAS} class, extends @{Detection#DETECTION_BASE}
|
|
||||||
--
|
|
||||||
-- The @{Detection#DETECTION_AREAS} class will detect units within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s),
|
|
||||||
-- and will build a list (table) of @{Set#SET_UNIT}s containing the @{Unit#UNIT}s detected.
|
|
||||||
-- The class is group the detected units within zones given a DetectedZoneRange parameter.
|
|
||||||
-- A set with multiple detected zones will be created as there are groups of units detected.
|
|
||||||
--
|
|
||||||
-- ## 4.1) Retrieve the Detected Unit Sets and Detected Zones
|
|
||||||
--
|
|
||||||
-- The methods to manage the DetectedItems[].Set(s) are implemented in @{Detection#DECTECTION_BASE} and
|
|
||||||
-- the methods to manage the DetectedItems[].Zone(s) is implemented in @{Detection#DETECTION_AREAS}.
|
|
||||||
--
|
|
||||||
-- Retrieve the DetectedItems[].Set with the method @{Detection#DETECTION_BASE.GetDetectedSet}(). A @{Set#SET_UNIT} object will be returned.
|
|
||||||
--
|
|
||||||
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Detection#DETECTION_BASE.GetDetectionZones}().
|
|
||||||
-- To understand the amount of zones created, use the method @{Detection#DETECTION_BASE.GetDetectionZoneCount}().
|
|
||||||
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
|
|
||||||
--
|
|
||||||
-- ## 4.4) Flare or Smoke detected units
|
|
||||||
--
|
|
||||||
-- Use the methods @{Detection#DETECTION_AREAS.FlareDetectedUnits}() or @{Detection#DETECTION_AREAS.SmokeDetectedUnits}() to flare or smoke the detected units when a new detection has taken place.
|
|
||||||
--
|
|
||||||
-- ## 4.5) Flare or Smoke or Bound detected zones
|
|
||||||
--
|
|
||||||
-- Use the methods:
|
|
||||||
--
|
|
||||||
-- * @{Detection#DETECTION_AREAS.FlareDetectedZones}() to flare in a color
|
|
||||||
-- * @{Detection#DETECTION_AREAS.SmokeDetectedZones}() to smoke in a color
|
|
||||||
-- * @{Detection#DETECTION_AREAS.SmokeDetectedZones}() to bound with a tire with a white flag
|
|
||||||
--
|
|
||||||
-- the detected zones when a new detection has taken place.
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- ### Contributions:
|
|
||||||
--
|
|
||||||
-- * Mechanist : Early concept of DETECTION_AREAS.
|
|
||||||
--
|
|
||||||
-- ### Authors:
|
|
||||||
--
|
|
||||||
-- * FlightControl : Analysis, Design, Programming, Testing
|
|
||||||
--
|
|
||||||
-- @module Detection
|
|
||||||
|
|
||||||
|
|
||||||
do -- DETECTION_BASE
|
|
||||||
|
|
||||||
--- DETECTION_BASE class
|
|
||||||
-- @type DETECTION_BASE
|
-- @type DETECTION_BASE
|
||||||
-- @field Core.Set#SET_GROUP DetectionSetGroup The @{Set} of GROUPs in the Forward Air Controller role.
|
-- @field Core.Set#SET_GROUP DetectionSetGroup The @{Set} of GROUPs in the Forward Air Controller role.
|
||||||
-- @field Dcs.DCSTypes#Distance DetectionRange The range till which targets are accepted to be detected.
|
-- @field Dcs.DCSTypes#Distance DetectionRange The range till which targets are accepted to be detected.
|
||||||
@ -26723,7 +26675,12 @@ end
|
|||||||
|
|
||||||
do -- DETECTION_UNITS
|
do -- DETECTION_UNITS
|
||||||
|
|
||||||
--- DETECTION_UNITS class
|
--- # 2) DETECTION_UNITS class, extends @{Detection#DETECTION_BASE}
|
||||||
|
--
|
||||||
|
-- The DETECTION_UNITS class will detect units within the battle zone.
|
||||||
|
-- It will build a DetectedItems list filled with DetectedItems. Each DetectedItem will contain a field Set, which contains a @{Set#SET_UNIT} containing ONE @{UNIT} object reference.
|
||||||
|
-- Beware that when the amount of units detected is large, the DetectedItems list will be large also.
|
||||||
|
--
|
||||||
-- @type DETECTION_UNITS
|
-- @type DETECTION_UNITS
|
||||||
-- @field Dcs.DCSTypes#Distance DetectionRange The range till which targets are detected.
|
-- @field Dcs.DCSTypes#Distance DetectionRange The range till which targets are detected.
|
||||||
-- @extends #DETECTION_BASE
|
-- @extends #DETECTION_BASE
|
||||||
@ -26933,7 +26890,13 @@ end
|
|||||||
|
|
||||||
do -- DETECTION_TYPES
|
do -- DETECTION_TYPES
|
||||||
|
|
||||||
--- DETECTION_TYPES class
|
--- # 3) DETECTION_TYPES class, extends @{Detection#DETECTION_BASE}
|
||||||
|
--
|
||||||
|
-- The DETECTION_TYPES class will detect units within the battle zone.
|
||||||
|
-- It will build a DetectedItems[] list filled with DetectedItems, grouped by the type of units detected.
|
||||||
|
-- Each DetectedItem will contain a field Set, which contains a @{Set#SET_UNIT} containing ONE @{UNIT} object reference.
|
||||||
|
-- Beware that when the amount of different types detected is large, the DetectedItems[] list will be large also.
|
||||||
|
--
|
||||||
-- @type DETECTION_TYPES
|
-- @type DETECTION_TYPES
|
||||||
-- @extends #DETECTION_BASE
|
-- @extends #DETECTION_BASE
|
||||||
DETECTION_TYPES = {
|
DETECTION_TYPES = {
|
||||||
@ -27116,7 +27079,38 @@ end
|
|||||||
|
|
||||||
do -- DETECTION_AREAS
|
do -- DETECTION_AREAS
|
||||||
|
|
||||||
--- DETECTION_AREAS class
|
--- # 4) DETECTION_AREAS class, extends @{Detection#DETECTION_BASE}
|
||||||
|
--
|
||||||
|
-- The DETECTION_AREAS class will detect units within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s),
|
||||||
|
-- and will build a list (table) of @{Set#SET_UNIT}s containing the @{Unit#UNIT}s detected.
|
||||||
|
-- The class is group the detected units within zones given a DetectedZoneRange parameter.
|
||||||
|
-- A set with multiple detected zones will be created as there are groups of units detected.
|
||||||
|
--
|
||||||
|
-- ## 4.1) Retrieve the Detected Unit Sets and Detected Zones
|
||||||
|
--
|
||||||
|
-- The methods to manage the DetectedItems[].Set(s) are implemented in @{Detection#DECTECTION_BASE} and
|
||||||
|
-- the methods to manage the DetectedItems[].Zone(s) is implemented in @{Detection#DETECTION_AREAS}.
|
||||||
|
--
|
||||||
|
-- Retrieve the DetectedItems[].Set with the method @{Detection#DETECTION_BASE.GetDetectedSet}(). A @{Set#SET_UNIT} object will be returned.
|
||||||
|
--
|
||||||
|
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Detection#DETECTION_BASE.GetDetectionZones}().
|
||||||
|
-- To understand the amount of zones created, use the method @{Detection#DETECTION_BASE.GetDetectionZoneCount}().
|
||||||
|
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
|
||||||
|
--
|
||||||
|
-- ## 4.4) Flare or Smoke detected units
|
||||||
|
--
|
||||||
|
-- Use the methods @{Detection#DETECTION_AREAS.FlareDetectedUnits}() or @{Detection#DETECTION_AREAS.SmokeDetectedUnits}() to flare or smoke the detected units when a new detection has taken place.
|
||||||
|
--
|
||||||
|
-- ## 4.5) Flare or Smoke or Bound detected zones
|
||||||
|
--
|
||||||
|
-- Use the methods:
|
||||||
|
--
|
||||||
|
-- * @{Detection#DETECTION_AREAS.FlareDetectedZones}() to flare in a color
|
||||||
|
-- * @{Detection#DETECTION_AREAS.SmokeDetectedZones}() to smoke in a color
|
||||||
|
-- * @{Detection#DETECTION_AREAS.SmokeDetectedZones}() to bound with a tire with a white flag
|
||||||
|
--
|
||||||
|
-- the detected zones when a new detection has taken place.
|
||||||
|
--
|
||||||
-- @type DETECTION_AREAS
|
-- @type DETECTION_AREAS
|
||||||
-- @field Dcs.DCSTypes#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
-- @field Dcs.DCSTypes#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
||||||
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Unit}s, @{Zone}s, the center @{Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
|
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Unit}s, @{Zone}s, the center @{Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
|
||||||
@ -27861,8 +27855,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Single-Player:**Yes** / Multi-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** --
|
--- **AI** -- **Air Patrolling or Staging.**
|
||||||
-- **Air Patrolling or Staging.**
|
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
@ -28800,8 +28793,7 @@ function AI_PATROL_ZONE:OnPilotDead( EventData )
|
|||||||
self:__PilotDead( 1, EventData )
|
self:__PilotDead( 1, EventData )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--- Single-Player:**Yes** / Multi-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** --
|
--- **AI** -- **Provide Close Air Support to friendly ground troops.**
|
||||||
-- **Provide Close Air Support to friendly ground troops.**
|
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
@ -29375,7 +29367,7 @@ function AI_CAS_ZONE:OnEventDead( EventData )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Single-Player:**Yes** / Multi-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Execute Combat Air Patrol (CAP).**
|
--- **AI** - **Execute Combat Air Patrol (CAP).**
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
@ -31625,11 +31617,18 @@ do -- ACT_ROUTE_ZONE
|
|||||||
end
|
end
|
||||||
|
|
||||||
end -- ACT_ROUTE_ZONE
|
end -- ACT_ROUTE_ZONE
|
||||||
--- (SP) (MP) (FSM) Account for (Detect, count and report) DCS events occuring on DCS objects (units).
|
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occuring on @{Unit}s.
|
||||||
|
--
|
||||||
|
-- 
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # @{#ACT_ACCOUNT} FSM class, extends @{Fsm#FSM_PROCESS}
|
-- @module Account
|
||||||
|
|
||||||
|
|
||||||
|
do -- ACT_ACCOUNT
|
||||||
|
|
||||||
|
--- # @{#ACT_ACCOUNT} FSM class, extends @{Fsm#FSM_PROCESS}
|
||||||
--
|
--
|
||||||
-- ## ACT_ACCOUNT state machine:
|
-- ## ACT_ACCOUNT state machine:
|
||||||
--
|
--
|
||||||
@ -31638,32 +31637,24 @@ end -- ACT_ROUTE_ZONE
|
|||||||
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
||||||
-- but will have **different implementation behaviour** upon each event or state transition.
|
-- but will have **different implementation behaviour** upon each event or state transition.
|
||||||
--
|
--
|
||||||
-- ### ACT_ACCOUNT **Events**:
|
-- ### ACT_ACCOUNT States
|
||||||
--
|
--
|
||||||
-- These are the events defined in this class:
|
-- * **Asigned**: The player is assigned.
|
||||||
|
-- * **Waiting**: Waiting for an event.
|
||||||
|
-- * **Report**: Reporting.
|
||||||
|
-- * **Account**: Account for an event.
|
||||||
|
-- * **Accounted**: All events have been accounted for, end of the process.
|
||||||
|
-- * **Failed**: Failed the process.
|
||||||
--
|
--
|
||||||
-- * **Start**: The process is started. The process will go into the Report state.
|
-- ### ACT_ACCOUNT Events
|
||||||
-- * **Event**: A relevant event has occured that needs to be accounted for. The process will go into the Account state.
|
|
||||||
-- * **Report**: The process is reporting to the player the accounting status of the DCS events.
|
|
||||||
-- * **More**: There are more DCS events that need to be accounted for. The process will go back into the Report state.
|
|
||||||
-- * **NoMore**: There are no more DCS events that need to be accounted for. The process will go into the Success state.
|
|
||||||
--
|
--
|
||||||
-- ### ACT_ACCOUNT **Event methods**:
|
-- * **Start**: Start the process.
|
||||||
--
|
-- * **Wait**: Wait for an event.
|
||||||
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
-- * **Report**: Report the status of the accounting.
|
||||||
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
-- * **Event**: An event happened, process the event.
|
||||||
--
|
-- * **More**: More targets.
|
||||||
-- * **Immediate**: The event method has exactly the name of the event.
|
-- * **NoMore (*)**: No more targets.
|
||||||
-- * **Delayed**: The event method starts with a __ + the name of the event. The first parameter of the event method is a number value, expressing the delay in seconds when the event will be executed.
|
-- * **Fail (*)**: The action process has failed.
|
||||||
--
|
|
||||||
-- ### ACT_ACCOUNT **States**:
|
|
||||||
--
|
|
||||||
-- * **Assigned**: The player is assigned to the task. This is the initialization state for the process.
|
|
||||||
-- * **Waiting**: the process is waiting for a DCS event to occur within the simulator. This state is set automatically.
|
|
||||||
-- * **Report**: The process is Reporting to the players in the group of the unit. This state is set automatically every 30 seconds.
|
|
||||||
-- * **Account**: The relevant DCS event has occurred, and is accounted for.
|
|
||||||
-- * **Success (*)**: All DCS events were accounted for.
|
|
||||||
-- * **Failed (*)**: The process has failed.
|
|
||||||
--
|
--
|
||||||
-- (*) End states of the process.
|
-- (*) End states of the process.
|
||||||
--
|
--
|
||||||
@ -31682,26 +31673,6 @@ end -- ACT_ROUTE_ZONE
|
|||||||
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
||||||
-- These state transition methods need to provide a return value, which is specified at the function description.
|
-- These state transition methods need to provide a return value, which is specified at the function description.
|
||||||
--
|
--
|
||||||
-- # 1) @{#ACT_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#ACT_ACCOUNT}
|
|
||||||
--
|
|
||||||
-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
|
||||||
-- The process is given a @{Set} of units that will be tracked upon successful destruction.
|
|
||||||
-- The process will end after each target has been successfully destroyed.
|
|
||||||
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- ## ACT_ACCOUNT_DEADS constructor:
|
|
||||||
--
|
|
||||||
-- * @{#ACT_ACCOUNT_DEADS.New}(): Creates a new ACT_ACCOUNT_DEADS object.
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- @module Account
|
|
||||||
|
|
||||||
|
|
||||||
do -- ACT_ACCOUNT
|
|
||||||
|
|
||||||
--- ACT_ACCOUNT class
|
|
||||||
-- @type ACT_ACCOUNT
|
-- @type ACT_ACCOUNT
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends Core.Fsm#FSM_PROCESS
|
-- @extends Core.Fsm#FSM_PROCESS
|
||||||
@ -31783,7 +31754,18 @@ end -- ACT_ACCOUNT
|
|||||||
|
|
||||||
do -- ACT_ACCOUNT_DEADS
|
do -- ACT_ACCOUNT_DEADS
|
||||||
|
|
||||||
--- ACT_ACCOUNT_DEADS class
|
--- # @{#ACT_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#ACT_ACCOUNT}
|
||||||
|
--
|
||||||
|
-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
||||||
|
-- The process is given a @{Set} of units that will be tracked upon successful destruction.
|
||||||
|
-- The process will end after each target has been successfully destroyed.
|
||||||
|
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- ## ACT_ACCOUNT_DEADS constructor:
|
||||||
|
--
|
||||||
|
-- * @{#ACT_ACCOUNT_DEADS.New}(): Creates a new ACT_ACCOUNT_DEADS object.
|
||||||
|
--
|
||||||
-- @type ACT_ACCOUNT_DEADS
|
-- @type ACT_ACCOUNT_DEADS
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends #ACT_ACCOUNT
|
-- @extends #ACT_ACCOUNT
|
||||||
@ -31827,7 +31809,7 @@ do -- ACT_ACCOUNT_DEADS
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, From, Event, To )
|
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, Task, From, Event, To )
|
||||||
self:E( { ProcessUnit, From, Event, To } )
|
self:E( { ProcessUnit, From, Event, To } )
|
||||||
|
|
||||||
self:Message( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed." )
|
self:Message( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed." )
|
||||||
@ -31840,17 +31822,21 @@ do -- ACT_ACCOUNT_DEADS
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, From, Event, To, EventData )
|
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Task, From, Event, To, EventData )
|
||||||
self:T( { ProcessUnit, EventData, From, Event, To } )
|
self:T( { ProcessUnit, EventData, From, Event, To } )
|
||||||
|
|
||||||
self:T({self.Controllable})
|
self:T({self.Controllable})
|
||||||
|
|
||||||
self.TargetSetUnit:Flush()
|
self.TargetSetUnit:Flush()
|
||||||
|
|
||||||
|
self:T( { "Before sending Message", EventData.IniUnitName, self.TargetSetUnit:FindUnit( EventData.IniUnitName ) } )
|
||||||
if self.TargetSetUnit:FindUnit( EventData.IniUnitName ) then
|
if self.TargetSetUnit:FindUnit( EventData.IniUnitName ) then
|
||||||
|
self:T( "Sending Message" )
|
||||||
local TaskGroup = ProcessUnit:GetGroup()
|
local TaskGroup = ProcessUnit:GetGroup()
|
||||||
|
self.TargetSetUnit:Remove( EventData.IniUnitName )
|
||||||
self:Message( "You hit a target. Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:Count() .. " targets ( " .. self.TargetSetUnit:GetUnitTypesText() .. " ) left to be destroyed." )
|
self:Message( "You hit a target. Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:Count() .. " targets ( " .. self.TargetSetUnit:GetUnitTypesText() .. " ) left to be destroyed." )
|
||||||
end
|
end
|
||||||
|
self:T( { "After sending Message" } )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
@ -31859,9 +31845,9 @@ do -- ACT_ACCOUNT_DEADS
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, From, Event, To, EventData )
|
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Task, From, Event, To )
|
||||||
|
|
||||||
if self.TargetSetUnit:Count() > 1 then
|
if self.TargetSetUnit:Count() > 0 then
|
||||||
self:__More( 1 )
|
self:__More( 1 )
|
||||||
else
|
else
|
||||||
self:__NoMore( 1 )
|
self:__NoMore( 1 )
|
||||||
@ -34671,7 +34657,7 @@ do -- TASK_A2G_DISPATCHER
|
|||||||
local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed...
|
local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed...
|
||||||
if TargetSetUnit then
|
if TargetSetUnit then
|
||||||
local Task = TASK_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", ItemID ), TargetSetUnit )
|
local Task = TASK_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", ItemID ), TargetSetUnit )
|
||||||
--Task:SetTargetZone( DetectedZone )
|
Task:SetTargetZone( DetectedZone )
|
||||||
Task:SetDispatcher( self )
|
Task:SetDispatcher( self )
|
||||||
CASTask = Mission:AddTask( Task )
|
CASTask = Mission:AddTask( Task )
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user