mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
FSM restructuring
This commit is contained in:
@@ -2,16 +2,16 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # @{#PROCESS_ACCOUNT} FSM class, extends @{Process#PROCESS}
|
-- # @{#FSMT_ACCOUNT} FSM class, extends @{Process#PROCESS}
|
||||||
--
|
--
|
||||||
-- ## PROCESS_ACCOUNT state machine:
|
-- ## FSMT_ACCOUNT state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
||||||
-- 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.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ACCOUNT **Events**:
|
-- ### FSMT_ACCOUNT **Events**:
|
||||||
--
|
--
|
||||||
-- These are the events defined in this class:
|
-- These are the events defined in this class:
|
||||||
--
|
--
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
-- * **More**: There are more DCS events that need to be accounted for. The process will go back into the Report state.
|
-- * **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.
|
-- * **NoMore**: There are no more DCS events that need to be accounted for. The process will go into the Success state.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ACCOUNT **Event methods**:
|
-- ### FSMT_ACCOUNT **Event methods**:
|
||||||
--
|
--
|
||||||
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
||||||
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
-- * **Immediate**: The event method has exactly the name of the event.
|
-- * **Immediate**: The event method has exactly the name of the event.
|
||||||
-- * **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.
|
-- * **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.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ACCOUNT **States**:
|
-- ### FSMT_ACCOUNT **States**:
|
||||||
--
|
--
|
||||||
-- * **Assigned**: The player is assigned to the task. This is the initialization state for the process.
|
-- * **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.
|
-- * **Waiting**: the process is waiting for a DCS event to occur within the simulator. This state is set automatically.
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
--
|
--
|
||||||
-- (*) End states of the process.
|
-- (*) End states of the process.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ACCOUNT state transition methods:
|
-- ### FSMT_ACCOUNT state transition methods:
|
||||||
--
|
--
|
||||||
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
||||||
-- There are 2 moments when state transition methods will be called by the state machine:
|
-- There are 2 moments when state transition methods will be called by the state machine:
|
||||||
@@ -55,41 +55,41 @@
|
|||||||
-- 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) @{#PROCESS_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#PROCESS_ACCOUNT}
|
-- # 1) @{#FSMT_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#FSMT_ACCOUNT}
|
||||||
--
|
--
|
||||||
-- The PROCESS_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
-- The FSMT_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 is given a @{Set} of units that will be tracked upon successful destruction.
|
||||||
-- The process will end after each target has been successfully destroyed.
|
-- 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.
|
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ## PROCESS_ACCOUNT_DEADS constructor:
|
-- ## FSMT_ACCOUNT_DEADS constructor:
|
||||||
--
|
--
|
||||||
-- * @{#PROCESS_ACCOUNT_DEADS.New}(): Creates a new PROCESS_ACCOUNT_DEADS object.
|
-- * @{#FSMT_ACCOUNT_DEADS.New}(): Creates a new FSMT_ACCOUNT_DEADS object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Account
|
-- @module Account
|
||||||
|
|
||||||
|
|
||||||
do -- PROCESS_ACCOUNT
|
do -- FSMT_ACCOUNT
|
||||||
|
|
||||||
--- PROCESS_ACCOUNT class
|
--- FSMT_ACCOUNT class
|
||||||
-- @type PROCESS_ACCOUNT
|
-- @type FSMT_ACCOUNT
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends Core.StateMachine#FSM_TEMPLATE
|
-- @extends Core.StateMachine#FSM_TEMPLATE
|
||||||
PROCESS_ACCOUNT = {
|
FSMT_ACCOUNT = {
|
||||||
ClassName = "PROCESS_ACCOUNT",
|
ClassName = "FSMT_ACCOUNT",
|
||||||
TargetSetUnit = nil,
|
TargetSetUnit = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new DESTROY process.
|
--- Creates a new DESTROY process.
|
||||||
-- @param #PROCESS_ACCOUNT self
|
-- @param #FSMT_ACCOUNT self
|
||||||
-- @return #PROCESS_ACCOUNT
|
-- @return #FSMT_ACCOUNT
|
||||||
function PROCESS_ACCOUNT:New()
|
function FSMT_ACCOUNT:New()
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "PROCESS_ACCOUNT" ) ) -- Core.StateMachine#FSM_TEMPLATE
|
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "FSMT_ACCOUNT" ) ) -- Core.StateMachine#FSM_TEMPLATE
|
||||||
|
|
||||||
self:AddTransition( "Assigned", "Start", "Waiting")
|
self:AddTransition( "Assigned", "Start", "Waiting")
|
||||||
self:AddTransition( "*", "Wait", "Waiting")
|
self:AddTransition( "*", "Wait", "Waiting")
|
||||||
@@ -110,12 +110,12 @@ do -- PROCESS_ACCOUNT
|
|||||||
--- Process Events
|
--- Process Events
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ACCOUNT self
|
-- @param #FSMT_ACCOUNT self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ACCOUNT:onafterStart( ProcessUnit, Event, From, To )
|
function FSMT_ACCOUNT:onafterStart( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
self:EventOnDead( self.onfuncEventDead )
|
self:EventOnDead( self.onfuncEventDead )
|
||||||
|
|
||||||
@@ -124,12 +124,12 @@ do -- PROCESS_ACCOUNT
|
|||||||
|
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ACCOUNT self
|
-- @param #FSMT_ACCOUNT self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To )
|
function FSMT_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
if self.DisplayCount >= self.DisplayInterval then
|
if self.DisplayCount >= self.DisplayInterval then
|
||||||
self:Report()
|
self:Report()
|
||||||
@@ -142,37 +142,37 @@ do -- PROCESS_ACCOUNT
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ACCOUNT self
|
-- @param #FSMT_ACCOUNT self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event )
|
function FSMT_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event )
|
||||||
|
|
||||||
self:__NoMore( 1 )
|
self:__NoMore( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- PROCESS_ACCOUNT
|
end -- FSMT_ACCOUNT
|
||||||
|
|
||||||
do -- PROCESS_ACCOUNT_DEADS
|
do -- FSMT_ACCOUNT_DEADS
|
||||||
|
|
||||||
--- PROCESS_ACCOUNT_DEADS class
|
--- FSMT_ACCOUNT_DEADS class
|
||||||
-- @type PROCESS_ACCOUNT_DEADS
|
-- @type FSMT_ACCOUNT_DEADS
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends #PROCESS_ACCOUNT
|
-- @extends #FSMT_ACCOUNT
|
||||||
PROCESS_ACCOUNT_DEADS = {
|
FSMT_ACCOUNT_DEADS = {
|
||||||
ClassName = "PROCESS_ACCOUNT_DEADS",
|
ClassName = "FSMT_ACCOUNT_DEADS",
|
||||||
TargetSetUnit = nil,
|
TargetSetUnit = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new DESTROY process.
|
--- Creates a new DESTROY process.
|
||||||
-- @param #PROCESS_ACCOUNT_DEADS self
|
-- @param #FSMT_ACCOUNT_DEADS self
|
||||||
-- @param Set#SET_UNIT TargetSetUnit
|
-- @param Set#SET_UNIT TargetSetUnit
|
||||||
-- @param #string TaskName
|
-- @param #string TaskName
|
||||||
function PROCESS_ACCOUNT_DEADS:New( TargetSetUnit, TaskName )
|
function FSMT_ACCOUNT_DEADS:New( TargetSetUnit, TaskName )
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, PROCESS_ACCOUNT:New() ) -- #PROCESS_ACCOUNT_DEADS
|
local self = BASE:Inherit( self, FSMT_ACCOUNT:New() ) -- #FSMT_ACCOUNT_DEADS
|
||||||
|
|
||||||
self:SetParameters( {
|
self:SetParameters( {
|
||||||
TargetSetUnit = TargetSetUnit,
|
TargetSetUnit = TargetSetUnit,
|
||||||
@@ -188,7 +188,7 @@ do -- PROCESS_ACCOUNT_DEADS
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function PROCESS_ACCOUNT_DEADS:_Destructor()
|
function FSMT_ACCOUNT_DEADS:_Destructor()
|
||||||
self:E("_Destructor")
|
self:E("_Destructor")
|
||||||
|
|
||||||
self:EventRemoveAll()
|
self:EventRemoveAll()
|
||||||
@@ -198,12 +198,12 @@ do -- PROCESS_ACCOUNT_DEADS
|
|||||||
--- Process Events
|
--- Process Events
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To )
|
function FSMT_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To )
|
||||||
self:E( { ProcessUnit, Event, From, To } )
|
self:E( { ProcessUnit, Event, From, To } )
|
||||||
|
|
||||||
local TaskGroup = ProcessUnit:GetGroup()
|
local TaskGroup = ProcessUnit:GetGroup()
|
||||||
@@ -212,12 +212,12 @@ do -- PROCESS_ACCOUNT_DEADS
|
|||||||
|
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, EventData )
|
function FSMT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, EventData )
|
||||||
self:T( { ProcessUnit, EventData, Event, From, To } )
|
self:T( { ProcessUnit, EventData, Event, From, To } )
|
||||||
|
|
||||||
self:T({self.Controllable})
|
self:T({self.Controllable})
|
||||||
@@ -232,12 +232,12 @@ do -- PROCESS_ACCOUNT_DEADS
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, EventData )
|
function FSMT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, EventData )
|
||||||
|
|
||||||
if self.TargetSetUnit:Count() > 0 then
|
if self.TargetSetUnit:Count() > 0 then
|
||||||
self:__More( 1 )
|
self:__More( 1 )
|
||||||
@@ -248,9 +248,9 @@ do -- PROCESS_ACCOUNT_DEADS
|
|||||||
|
|
||||||
--- DCS Events
|
--- DCS Events
|
||||||
|
|
||||||
--- @param #PROCESS_ACCOUNT_DEADS self
|
--- @param #FSMT_ACCOUNT_DEADS self
|
||||||
-- @param Event#EVENTDATA EventData
|
-- @param Event#EVENTDATA EventData
|
||||||
function PROCESS_ACCOUNT_DEADS:onfuncEventDead( EventData )
|
function FSMT_ACCOUNT_DEADS:onfuncEventDead( EventData )
|
||||||
self:T( { "EventDead", EventData } )
|
self:T( { "EventDead", EventData } )
|
||||||
|
|
||||||
if EventData.IniDCSUnit then
|
if EventData.IniDCSUnit then
|
||||||
@@ -258,4 +258,4 @@ do -- PROCESS_ACCOUNT_DEADS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- PROCESS_ACCOUNT DEADS
|
end -- FSMT_ACCOUNT DEADS
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # @{#PROCESS_ASSIGN} FSM class, extends @{Process#PROCESS}
|
-- # @{#FSMT_ASSIGN} FSM class, extends @{Process#PROCESS}
|
||||||
--
|
--
|
||||||
-- ## PROCESS_ASSIGN state machine:
|
-- ## FSMT_ASSIGN state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
||||||
-- 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.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ASSIGN **Events**:
|
-- ### FSMT_ASSIGN **Events**:
|
||||||
--
|
--
|
||||||
-- These are the events defined in this class:
|
-- These are the events defined in this class:
|
||||||
--
|
--
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
-- * **Assign**: Assign the task.
|
-- * **Assign**: Assign the task.
|
||||||
-- * **Reject**: Reject the task..
|
-- * **Reject**: Reject the task..
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ASSIGN **Event methods**:
|
-- ### FSMT_ASSIGN **Event methods**:
|
||||||
--
|
--
|
||||||
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
||||||
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
-- * **Immediate**: The event method has exactly the name of the event.
|
-- * **Immediate**: The event method has exactly the name of the event.
|
||||||
-- * **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.
|
-- * **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.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ASSIGN **States**:
|
-- ### FSMT_ASSIGN **States**:
|
||||||
--
|
--
|
||||||
-- * **UnAssigned**: The player has not accepted the task.
|
-- * **UnAssigned**: The player has not accepted the task.
|
||||||
-- * **Assigned (*)**: The player has accepted the task.
|
-- * **Assigned (*)**: The player has accepted the task.
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
--
|
--
|
||||||
-- (*) End states of the process.
|
-- (*) End states of the process.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ASSIGN state transition methods:
|
-- ### FSMT_ASSIGN state transition methods:
|
||||||
--
|
--
|
||||||
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
||||||
-- There are 2 moments when state transition methods will be called by the state machine:
|
-- There are 2 moments when state transition methods will be called by the state machine:
|
||||||
@@ -54,52 +54,52 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#PROCESS_ASSIGN_ACCEPT} class, extends @{Fsm.Assign#PROCESS_ASSIGN}
|
-- # 1) @{#FSMT_ASSIGN_ACCEPT} class, extends @{Fsm.Assign#FSMT_ASSIGN}
|
||||||
--
|
--
|
||||||
-- The PROCESS_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
|
-- The FSMT_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
|
||||||
--
|
--
|
||||||
-- ## 1.1) PROCESS_ASSIGN_ACCEPT constructor:
|
-- ## 1.1) FSMT_ASSIGN_ACCEPT constructor:
|
||||||
--
|
--
|
||||||
-- * @{#PROCESS_ASSIGN_ACCEPT.New}(): Creates a new PROCESS_ASSIGN_ACCEPT object.
|
-- * @{#FSMT_ASSIGN_ACCEPT.New}(): Creates a new FSMT_ASSIGN_ACCEPT object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 2) @{#PROCESS_ASSIGN_MENU_ACCEPT} class, extends @{Fsm.Assign#PROCESS_ASSIGN}
|
-- # 2) @{#FSMT_ASSIGN_MENU_ACCEPT} class, extends @{Fsm.Assign#FSMT_ASSIGN}
|
||||||
--
|
--
|
||||||
-- The PROCESS_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
|
-- The FSMT_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
|
||||||
-- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task.
|
-- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task.
|
||||||
-- The assignment type also allows to reject the task.
|
-- The assignment type also allows to reject the task.
|
||||||
--
|
--
|
||||||
-- ## 2.1) PROCESS_ASSIGN_MENU_ACCEPT constructor:
|
-- ## 2.1) FSMT_ASSIGN_MENU_ACCEPT constructor:
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
--
|
--
|
||||||
-- * @{#PROCESS_ASSIGN_MENU_ACCEPT.New}(): Creates a new PROCESS_ASSIGN_MENU_ACCEPT object.
|
-- * @{#FSMT_ASSIGN_MENU_ACCEPT.New}(): Creates a new FSMT_ASSIGN_MENU_ACCEPT object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Assign
|
-- @module Assign
|
||||||
|
|
||||||
|
|
||||||
do -- PROCESS_ASSIGN
|
do -- FSMT_ASSIGN
|
||||||
|
|
||||||
--- PROCESS_ASSIGN class
|
--- FSMT_ASSIGN class
|
||||||
-- @type PROCESS_ASSIGN
|
-- @type FSMT_ASSIGN
|
||||||
-- @field Tasking.Task#TASK_BASE Task
|
-- @field Tasking.Task#TASK_BASE Task
|
||||||
-- @field Wrapper.Unit#UNIT ProcessUnit
|
-- @field Wrapper.Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends Core.StateMachine#FSM_TEMPLATE
|
-- @extends Core.StateMachine#FSM_TEMPLATE
|
||||||
PROCESS_ASSIGN = {
|
FSMT_ASSIGN = {
|
||||||
ClassName = "PROCESS_ASSIGN",
|
ClassName = "FSMT_ASSIGN",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
|
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
|
||||||
-- @param #PROCESS_ASSIGN self
|
-- @param #FSMT_ASSIGN self
|
||||||
-- @return #PROCESS_ASSIGN The task acceptance process.
|
-- @return #FSMT_ASSIGN The task acceptance process.
|
||||||
function PROCESS_ASSIGN:New()
|
function FSMT_ASSIGN:New()
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "PROCESS_ASSIGN" ) ) -- Core.StateMachine#FSM_TEMPLATE
|
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "FSMT_ASSIGN" ) ) -- Core.StateMachine#FSM_TEMPLATE
|
||||||
|
|
||||||
self:AddTransition( "UnAssigned", "Start", "Waiting" )
|
self:AddTransition( "UnAssigned", "Start", "Waiting" )
|
||||||
self:AddTransition( "Waiting", "Assign", "Assigned" )
|
self:AddTransition( "Waiting", "Assign", "Assigned" )
|
||||||
@@ -115,29 +115,29 @@ do -- PROCESS_ASSIGN
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- PROCESS_ASSIGN
|
end -- FSMT_ASSIGN
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do -- PROCESS_ASSIGN_ACCEPT
|
do -- FSMT_ASSIGN_ACCEPT
|
||||||
|
|
||||||
--- PROCESS_ASSIGN_ACCEPT class
|
--- FSMT_ASSIGN_ACCEPT class
|
||||||
-- @type PROCESS_ASSIGN_ACCEPT
|
-- @type FSMT_ASSIGN_ACCEPT
|
||||||
-- @field Tasking.Task#TASK_BASE Task
|
-- @field Tasking.Task#TASK_BASE Task
|
||||||
-- @field Wrapper.Unit#UNIT ProcessUnit
|
-- @field Wrapper.Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends Fsm.Process#PROCESS
|
-- @extends Fsm.Process#PROCESS
|
||||||
PROCESS_ASSIGN_ACCEPT = {
|
FSMT_ASSIGN_ACCEPT = {
|
||||||
ClassName = "PROCESS_ASSIGN_ACCEPT",
|
ClassName = "FSMT_ASSIGN_ACCEPT",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
|
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
|
||||||
-- @param #PROCESS_ASSIGN_ACCEPT self
|
-- @param #FSMT_ASSIGN_ACCEPT self
|
||||||
-- @param #string TaskBriefing
|
-- @param #string TaskBriefing
|
||||||
function PROCESS_ASSIGN_ACCEPT:New( TaskBriefing )
|
function FSMT_ASSIGN_ACCEPT:New( TaskBriefing )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, PROCESS_ASSIGN:New() ) -- #PROCESS_ASSIGN_ACCEPT
|
local self = BASE:Inherit( self, FSMT_ASSIGN:New() ) -- #FSMT_ASSIGN_ACCEPT
|
||||||
|
|
||||||
self:SetParameters( { TaskBriefing = TaskBriefing } )
|
self:SetParameters( { TaskBriefing = TaskBriefing } )
|
||||||
|
|
||||||
@@ -145,12 +145,12 @@ do -- PROCESS_ASSIGN_ACCEPT
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ASSIGN_ACCEPT self
|
-- @param #FSMT_ASSIGN_ACCEPT self
|
||||||
-- @param Wrapper.Unit#UNIT ProcessUnit
|
-- @param Wrapper.Unit#UNIT ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
|
function FSMT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
|
||||||
self:E( { ProcessUnit, Event, From, To } )
|
self:E( { ProcessUnit, Event, From, To } )
|
||||||
|
|
||||||
local ProcessGroup = ProcessUnit:GetGroup()
|
local ProcessGroup = ProcessUnit:GetGroup()
|
||||||
@@ -160,12 +160,12 @@ do -- PROCESS_ASSIGN_ACCEPT
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ASSIGN_ACCEPT self
|
-- @param #FSMT_ASSIGN_ACCEPT self
|
||||||
-- @param Wrapper.Unit#UNIT ProcessUnit
|
-- @param Wrapper.Unit#UNIT ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, Event, From, To )
|
function FSMT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, Event, From, To )
|
||||||
env.info( "in here" )
|
env.info( "in here" )
|
||||||
self:E( { ProcessUnit, Event, From, To } )
|
self:E( { ProcessUnit, Event, From, To } )
|
||||||
|
|
||||||
@@ -176,30 +176,30 @@ do -- PROCESS_ASSIGN_ACCEPT
|
|||||||
self.Task:Assign()
|
self.Task:Assign()
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- PROCESS_ASSIGN_ACCEPT
|
end -- FSMT_ASSIGN_ACCEPT
|
||||||
|
|
||||||
|
|
||||||
do -- PROCESS_ASSIGN_MENU_ACCEPT
|
do -- FSMT_ASSIGN_MENU_ACCEPT
|
||||||
|
|
||||||
--- PROCESS_ASSIGN_MENU_ACCEPT class
|
--- FSMT_ASSIGN_MENU_ACCEPT class
|
||||||
-- @type PROCESS_ASSIGN_MENU_ACCEPT
|
-- @type FSMT_ASSIGN_MENU_ACCEPT
|
||||||
-- @field Tasking.Task#TASK_BASE Task
|
-- @field Tasking.Task#TASK_BASE Task
|
||||||
-- @field Wrapper.Unit#UNIT ProcessUnit
|
-- @field Wrapper.Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends #PROCESS_ASSIGN
|
-- @extends #FSMT_ASSIGN
|
||||||
PROCESS_ASSIGN_MENU_ACCEPT = {
|
FSMT_ASSIGN_MENU_ACCEPT = {
|
||||||
ClassName = "PROCESS_ASSIGN_MENU_ACCEPT",
|
ClassName = "FSMT_ASSIGN_MENU_ACCEPT",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Init.
|
--- Init.
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param #string TaskName
|
-- @param #string TaskName
|
||||||
-- @param #string TaskBriefing
|
-- @param #string TaskBriefing
|
||||||
-- @return #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @return #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
function PROCESS_ASSIGN_MENU_ACCEPT:New( TaskName, TaskBriefing )
|
function FSMT_ASSIGN_MENU_ACCEPT:New( TaskName, TaskBriefing )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, PROCESS_ASSIGN:New() ) -- #PROCESS_ASSIGN_MENU_ACCEPT
|
local self = BASE:Inherit( self, FSMT_ASSIGN:New() ) -- #FSMT_ASSIGN_MENU_ACCEPT
|
||||||
|
|
||||||
self:SetParameters( { TaskName = TaskName, TaskBriefing = TaskBriefing } )
|
self:SetParameters( { TaskName = TaskName, TaskBriefing = TaskBriefing } )
|
||||||
|
|
||||||
@@ -208,11 +208,11 @@ do -- PROCESS_ASSIGN_MENU_ACCEPT
|
|||||||
|
|
||||||
|
|
||||||
--- Creates a new task assignment state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
--- Creates a new task assignment state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param #string TaskName
|
-- @param #string TaskName
|
||||||
-- @param #string TaskBriefing
|
-- @param #string TaskBriefing
|
||||||
-- @return #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @return #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
function PROCESS_ASSIGN_MENU_ACCEPT:Init( TaskName, TaskBriefing )
|
function FSMT_ASSIGN_MENU_ACCEPT:Init( TaskName, TaskBriefing )
|
||||||
|
|
||||||
self.TaskBriefing = TaskBriefing
|
self.TaskBriefing = TaskBriefing
|
||||||
self.TaskName = TaskName
|
self.TaskName = TaskName
|
||||||
@@ -221,12 +221,12 @@ do -- PROCESS_ASSIGN_MENU_ACCEPT
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
|
function FSMT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
|
||||||
self:E( { ProcessUnit, Event, From, To } )
|
self:E( { ProcessUnit, Event, From, To } )
|
||||||
|
|
||||||
MESSAGE:New( self.TaskBriefing .. "\nAccess the radio menu to accept the task. You have 30 seconds or the assignment will be cancelled.", 30, "Task Assignment" ):ToGroup( ProcessUnit:GetGroup() )
|
MESSAGE:New( self.TaskBriefing .. "\nAccess the radio menu to accept the task. You have 30 seconds or the assignment will be cancelled.", 30, "Task Assignment" ):ToGroup( ProcessUnit:GetGroup() )
|
||||||
@@ -239,40 +239,40 @@ do -- PROCESS_ASSIGN_MENU_ACCEPT
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Menu function.
|
--- Menu function.
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
function PROCESS_ASSIGN_MENU_ACCEPT:MenuAssign()
|
function FSMT_ASSIGN_MENU_ACCEPT:MenuAssign()
|
||||||
self:E( )
|
self:E( )
|
||||||
|
|
||||||
self:__Assign( 1 )
|
self:__Assign( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Menu function.
|
--- Menu function.
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
function PROCESS_ASSIGN_MENU_ACCEPT:MenuReject()
|
function FSMT_ASSIGN_MENU_ACCEPT:MenuReject()
|
||||||
self:E( )
|
self:E( )
|
||||||
|
|
||||||
self:__Reject( 1 )
|
self:__Reject( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To )
|
function FSMT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To )
|
||||||
self:E( { ProcessUnit.UnitNameEvent, From, To } )
|
self:E( { ProcessUnit.UnitNameEvent, From, To } )
|
||||||
|
|
||||||
self.Menu:Remove()
|
self.Menu:Remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To )
|
function FSMT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To )
|
||||||
self:E( { ProcessUnit.UnitName, Event, From, To } )
|
self:E( { ProcessUnit.UnitName, Event, From, To } )
|
||||||
|
|
||||||
self.Menu:Remove()
|
self.Menu:Remove()
|
||||||
@@ -281,4 +281,4 @@ do -- PROCESS_ASSIGN_MENU_ACCEPT
|
|||||||
ProcessUnit:Destroy()
|
ProcessUnit:Destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- PROCESS_ASSIGN_MENU_ACCEPT
|
end -- FSMT_ASSIGN_MENU_ACCEPT
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # @{#PROCESS_ROUTE} FSM class, extends @{Process#PROCESS}
|
-- # @{#FSMT_ROUTE} FSM class, extends @{Process#PROCESS}
|
||||||
--
|
--
|
||||||
-- ## PROCESS_ROUTE state machine:
|
-- ## FSMT_ROUTE state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
||||||
-- 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.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ROUTE **Events**:
|
-- ### FSMT_ROUTE **Events**:
|
||||||
--
|
--
|
||||||
-- These are the events defined in this class:
|
-- These are the events defined in this class:
|
||||||
--
|
--
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
-- * **More**: There are more route points that need to be followed. The process will go back into the Report state.
|
-- * **More**: There are more route points that need to be followed. The process will go back into the Report state.
|
||||||
-- * **NoMore**: There are no more route points that need to be followed. The process will go into the Success state.
|
-- * **NoMore**: There are no more route points that need to be followed. The process will go into the Success state.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ROUTE **Event methods**:
|
-- ### FSMT_ROUTE **Event methods**:
|
||||||
--
|
--
|
||||||
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
||||||
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
-- * **Immediate**: The event method has exactly the name of the event.
|
-- * **Immediate**: The event method has exactly the name of the event.
|
||||||
-- * **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.
|
-- * **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.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ROUTE **States**:
|
-- ### FSMT_ROUTE **States**:
|
||||||
--
|
--
|
||||||
-- * **None**: The controllable did not receive route commands.
|
-- * **None**: The controllable did not receive route commands.
|
||||||
-- * **Arrived (*)**: The controllable has arrived at a route point.
|
-- * **Arrived (*)**: The controllable has arrived at a route point.
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
--
|
--
|
||||||
-- (*) End states of the process.
|
-- (*) End states of the process.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_ROUTE state transition methods:
|
-- ### FSMT_ROUTE state transition methods:
|
||||||
--
|
--
|
||||||
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
||||||
-- There are 2 moments when state transition methods will be called by the state machine:
|
-- There are 2 moments when state transition methods will be called by the state machine:
|
||||||
@@ -60,41 +60,41 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#PROCESS_ROUTE_ZONE} class, extends @{Fsm.Route#PROCESS_ROUTE}
|
-- # 1) @{#FSMT_ROUTE_ZONE} class, extends @{Fsm.Route#FSMT_ROUTE}
|
||||||
--
|
--
|
||||||
-- The PROCESS_ROUTE_ZONE class implements the core functions to route an AIR @{Controllable} player @{Unit} to a @{Zone}.
|
-- The FSMT_ROUTE_ZONE class implements the core functions to route an AIR @{Controllable} player @{Unit} to a @{Zone}.
|
||||||
-- The player receives on perioding times messages with the coordinates of the route to follow.
|
-- The player receives on perioding times messages with the coordinates of the route to follow.
|
||||||
-- Upon arrival at the zone, a confirmation of arrival is sent, and the process will be ended.
|
-- Upon arrival at the zone, a confirmation of arrival is sent, and the process will be ended.
|
||||||
--
|
--
|
||||||
-- # 1.1) PROCESS_ROUTE_ZONE constructor:
|
-- # 1.1) FSMT_ROUTE_ZONE constructor:
|
||||||
--
|
--
|
||||||
-- * @{#PROCESS_ROUTE_ZONE.New}(): Creates a new PROCESS_ROUTE_ZONE object.
|
-- * @{#FSMT_ROUTE_ZONE.New}(): Creates a new FSMT_ROUTE_ZONE object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Route
|
-- @module Route
|
||||||
|
|
||||||
|
|
||||||
do -- PROCESS_ROUTE
|
do -- FSMT_ROUTE
|
||||||
|
|
||||||
--- PROCESS_ROUTE class
|
--- FSMT_ROUTE class
|
||||||
-- @type PROCESS_ROUTE
|
-- @type FSMT_ROUTE
|
||||||
-- @field Tasking.Task#TASK TASK
|
-- @field Tasking.Task#TASK TASK
|
||||||
-- @field Wrapper.Unit#UNIT ProcessUnit
|
-- @field Wrapper.Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends Core.StateMachine#FSM_TEMPLATE
|
-- @extends Core.StateMachine#FSM_TEMPLATE
|
||||||
PROCESS_ROUTE = {
|
FSMT_ROUTE = {
|
||||||
ClassName = "PROCESS_ROUTE",
|
ClassName = "FSMT_ROUTE",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new routing state machine. The process will route a CLIENT to a ZONE until the CLIENT is within that ZONE.
|
--- Creates a new routing state machine. The process will route a CLIENT to a ZONE until the CLIENT is within that ZONE.
|
||||||
-- @param #PROCESS_ROUTE self
|
-- @param #FSMT_ROUTE self
|
||||||
-- @return #PROCESS_ROUTE self
|
-- @return #FSMT_ROUTE self
|
||||||
function PROCESS_ROUTE:New()
|
function FSMT_ROUTE:New()
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "PROCESS_ROUTE" ) ) -- Core.StateMachine#FSM_TEMPLATE
|
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "FSMT_ROUTE" ) ) -- Core.StateMachine#FSM_TEMPLATE
|
||||||
|
|
||||||
self:AddTransition( "None", "Start", "Routing" )
|
self:AddTransition( "None", "Start", "Routing" )
|
||||||
self:AddTransition( "*", "Report", "Reporting" )
|
self:AddTransition( "*", "Report", "Reporting" )
|
||||||
@@ -118,32 +118,32 @@ do -- PROCESS_ROUTE
|
|||||||
--- Task Events
|
--- Task Events
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ROUTE self
|
-- @param #FSMT_ROUTE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ROUTE:onafterStart( ProcessUnit, Event, From, To )
|
function FSMT_ROUTE:onafterStart( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
|
|
||||||
self:__Route( 1 )
|
self:__Route( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if the controllable has arrived.
|
--- Check if the controllable has arrived.
|
||||||
-- @param #PROCESS_ROUTE self
|
-- @param #FSMT_ROUTE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function PROCESS_ROUTE:onfuncHasArrived( ProcessUnit )
|
function FSMT_ROUTE:onfuncHasArrived( ProcessUnit )
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ROUTE self
|
-- @param #FSMT_ROUTE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ROUTE:onbeforeRoute( ProcessUnit, Event, From, To )
|
function FSMT_ROUTE:onbeforeRoute( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
if ProcessUnit:IsAlive() then
|
if ProcessUnit:IsAlive() then
|
||||||
local HasArrived = self:onfuncHasArrived( ProcessUnit ) -- Polymorphic
|
local HasArrived = self:onfuncHasArrived( ProcessUnit ) -- Polymorphic
|
||||||
@@ -172,28 +172,28 @@ do -- PROCESS_ROUTE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- PROCESS_ROUTE
|
end -- FSMT_ROUTE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do -- PROCESS_ROUTE_ZONE
|
do -- FSMT_ROUTE_ZONE
|
||||||
|
|
||||||
--- PROCESS_ROUTE_ZONE class
|
--- FSMT_ROUTE_ZONE class
|
||||||
-- @type PROCESS_ROUTE_ZONE
|
-- @type FSMT_ROUTE_ZONE
|
||||||
-- @field Tasking.Task#TASK TASK
|
-- @field Tasking.Task#TASK TASK
|
||||||
-- @field Wrapper.Unit#UNIT ProcessUnit
|
-- @field Wrapper.Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends #PROCESS_ROUTE
|
-- @extends #FSMT_ROUTE
|
||||||
PROCESS_ROUTE_ZONE = {
|
FSMT_ROUTE_ZONE = {
|
||||||
ClassName = "PROCESS_ROUTE_ZONE",
|
ClassName = "FSMT_ROUTE_ZONE",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new routing state machine. The task will route a controllable to a ZONE until the controllable is within that ZONE.
|
--- Creates a new routing state machine. The task will route a controllable to a ZONE until the controllable is within that ZONE.
|
||||||
-- @param #PROCESS_ROUTE_ZONE self
|
-- @param #FSMT_ROUTE_ZONE self
|
||||||
-- @param Zone#ZONE_BASE TargetZone
|
-- @param Zone#ZONE_BASE TargetZone
|
||||||
function PROCESS_ROUTE_ZONE:New( TargetZone )
|
function FSMT_ROUTE_ZONE:New( TargetZone )
|
||||||
local self = BASE:Inherit( self, PROCESS_ROUTE:New() ) -- #PROCESS_ROUTE_ZONE
|
local self = BASE:Inherit( self, FSMT_ROUTE:New() ) -- #FSMT_ROUTE_ZONE
|
||||||
|
|
||||||
self:SetParameters( {
|
self:SetParameters( {
|
||||||
TargetZone = TargetZone,
|
TargetZone = TargetZone,
|
||||||
@@ -208,10 +208,10 @@ do -- PROCESS_ROUTE_ZONE
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Method override to check if the controllable has arrived.
|
--- Method override to check if the controllable has arrived.
|
||||||
-- @param #PROCESS_ROUTE self
|
-- @param #FSMT_ROUTE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function PROCESS_ROUTE_ZONE:onfuncHasArrived( ProcessUnit )
|
function FSMT_ROUTE_ZONE:onfuncHasArrived( ProcessUnit )
|
||||||
|
|
||||||
if ProcessUnit:IsInZone( self.TargetZone ) then
|
if ProcessUnit:IsInZone( self.TargetZone ) then
|
||||||
local RouteText = ProcessUnit:GetCallsign() .. ": You have arrived within the zone!"
|
local RouteText = ProcessUnit:GetCallsign() .. ": You have arrived within the zone!"
|
||||||
@@ -224,12 +224,12 @@ do -- PROCESS_ROUTE_ZONE
|
|||||||
--- Task Events
|
--- Task Events
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_ROUTE_ZONE self
|
-- @param #FSMT_ROUTE_ZONE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To )
|
function FSMT_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
local ZoneVec2 = self.TargetZone:GetVec2()
|
local ZoneVec2 = self.TargetZone:GetVec2()
|
||||||
local ZonePointVec2 = POINT_VEC2:New( ZoneVec2.x, ZoneVec2.y )
|
local ZonePointVec2 = POINT_VEC2:New( ZoneVec2.x, ZoneVec2.y )
|
||||||
@@ -239,4 +239,4 @@ do -- PROCESS_ROUTE_ZONE
|
|||||||
MESSAGE:New( RouteText, self.DisplayTime, self.DisplayCategory ):ToGroup( ProcessUnit:GetGroup() )
|
MESSAGE:New( RouteText, self.DisplayTime, self.DisplayCategory ):ToGroup( ProcessUnit:GetGroup() )
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- PROCESS_ROUTE_ZONE
|
end -- FSMT_ROUTE_ZONE
|
||||||
|
|||||||
@@ -2,23 +2,23 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # @{#PROCESS_SMOKE} FSM class, extends @{Process#PROCESS}
|
-- # @{#FSMT_SMOKE} FSM class, extends @{Process#PROCESS}
|
||||||
--
|
--
|
||||||
-- ## PROCESS_SMOKE state machine:
|
-- ## FSMT_SMOKE state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
||||||
-- 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.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_SMOKE **Events**:
|
-- ### FSMT_SMOKE **Events**:
|
||||||
--
|
--
|
||||||
-- These are the events defined in this class:
|
-- These are the events defined in this class:
|
||||||
--
|
--
|
||||||
-- * **Start**: The process is started.
|
-- * **Start**: The process is started.
|
||||||
-- * **Next**: The process is smoking the targets in the given zone.
|
-- * **Next**: The process is smoking the targets in the given zone.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_SMOKE **Event methods**:
|
-- ### FSMT_SMOKE **Event methods**:
|
||||||
--
|
--
|
||||||
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
||||||
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
-- * **Immediate**: The event method has exactly the name of the event.
|
-- * **Immediate**: The event method has exactly the name of the event.
|
||||||
-- * **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.
|
-- * **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.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_SMOKE **States**:
|
-- ### FSMT_SMOKE **States**:
|
||||||
--
|
--
|
||||||
-- * **None**: The controllable did not receive route commands.
|
-- * **None**: The controllable did not receive route commands.
|
||||||
-- * **AwaitSmoke (*)**: The process is awaiting to smoke the targets in the zone.
|
-- * **AwaitSmoke (*)**: The process is awaiting to smoke the targets in the zone.
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
--
|
--
|
||||||
-- (*) End states of the process.
|
-- (*) End states of the process.
|
||||||
--
|
--
|
||||||
-- ### PROCESS_SMOKE state transition methods:
|
-- ### FSMT_SMOKE state transition methods:
|
||||||
--
|
--
|
||||||
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
||||||
-- There are 2 moments when state transition methods will be called by the state machine:
|
-- There are 2 moments when state transition methods will be called by the state machine:
|
||||||
@@ -52,36 +52,36 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#PROCESS_SMOKE_TARGETS_ZONE} class, extends @{Fsm.Route#PROCESS_SMOKE}
|
-- # 1) @{#FSMT_SMOKE_TARGETS_ZONE} class, extends @{Fsm.Route#FSMT_SMOKE}
|
||||||
--
|
--
|
||||||
-- The PROCESS_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Zone}.
|
-- The FSMT_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Zone}.
|
||||||
-- The targets are smoked within a certain range around each target, simulating a realistic smoking behaviour.
|
-- The targets are smoked within a certain range around each target, simulating a realistic smoking behaviour.
|
||||||
-- At random intervals, a new target is smoked.
|
-- At random intervals, a new target is smoked.
|
||||||
--
|
--
|
||||||
-- # 1.1) PROCESS_SMOKE_TARGETS_ZONE constructor:
|
-- # 1.1) FSMT_SMOKE_TARGETS_ZONE constructor:
|
||||||
--
|
--
|
||||||
-- * @{#PROCESS_SMOKE_TARGETS_ZONE.New}(): Creates a new PROCESS_SMOKE_TARGETS_ZONE object.
|
-- * @{#FSMT_SMOKE_TARGETS_ZONE.New}(): Creates a new FSMT_SMOKE_TARGETS_ZONE object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Smoke
|
-- @module Smoke
|
||||||
|
|
||||||
do -- PROCESS_SMOKE
|
do -- FSMT_SMOKE
|
||||||
|
|
||||||
--- PROCESS_SMOKE class
|
--- FSMT_SMOKE class
|
||||||
-- @type PROCESS_SMOKE
|
-- @type FSMT_SMOKE
|
||||||
-- @extends Core.StateMachine#FSM_TEMPLATE
|
-- @extends Core.StateMachine#FSM_TEMPLATE
|
||||||
PROCESS_SMOKE = {
|
FSMT_SMOKE = {
|
||||||
ClassName = "PROCESS_SMOKE",
|
ClassName = "FSMT_SMOKE",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
||||||
-- @param #PROCESS_SMOKE self
|
-- @param #FSMT_SMOKE self
|
||||||
-- @return #PROCESS_SMOKE
|
-- @return #FSMT_SMOKE
|
||||||
function PROCESS_SMOKE:New()
|
function FSMT_SMOKE:New()
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "PROCESS_SMOKE" ) ) -- Core.StateMachine#FSM_TEMPLATE
|
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "FSMT_SMOKE" ) ) -- Core.StateMachine#FSM_TEMPLATE
|
||||||
|
|
||||||
self:AddTransition( "None", "Start", "AwaitSmoke" )
|
self:AddTransition( "None", "Start", "AwaitSmoke" )
|
||||||
self:AddTransition( "AwaitSmoke", "Next", "Smoking" )
|
self:AddTransition( "AwaitSmoke", "Next", "Smoking" )
|
||||||
@@ -100,12 +100,12 @@ do -- PROCESS_SMOKE
|
|||||||
--- Task Events
|
--- Task Events
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_SMOKE self
|
-- @param #FSMT_SMOKE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_SMOKE:onafterStart( ProcessUnit, Event, From, To )
|
function FSMT_SMOKE:onafterStart( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
local ProcessGroup = ProcessUnit:GetGroup()
|
local ProcessGroup = ProcessUnit:GetGroup()
|
||||||
local MissionMenu = self:GetMission():GetMissionMenu( ProcessGroup )
|
local MissionMenu = self:GetMission():GetMissionMenu( ProcessGroup )
|
||||||
@@ -128,18 +128,18 @@ do -- PROCESS_SMOKE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- PROCESS_SMOKE_TARGETS_ZONE
|
do -- FSMT_SMOKE_TARGETS_ZONE
|
||||||
|
|
||||||
--- PROCESS_SMOKE_TARGETS_ZONE class
|
--- FSMT_SMOKE_TARGETS_ZONE class
|
||||||
-- @type PROCESS_SMOKE_TARGETS_ZONE
|
-- @type FSMT_SMOKE_TARGETS_ZONE
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends #PROCESS_SMOKE
|
-- @extends #FSMT_SMOKE
|
||||||
PROCESS_SMOKE_TARGETS_ZONE = {
|
FSMT_SMOKE_TARGETS_ZONE = {
|
||||||
ClassName = "PROCESS_SMOKE_TARGETS_ZONE",
|
ClassName = "FSMT_SMOKE_TARGETS_ZONE",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- function PROCESS_SMOKE_TARGETS_ZONE:_Destructor()
|
-- function FSMT_SMOKE_TARGETS_ZONE:_Destructor()
|
||||||
-- self:E("_Destructor")
|
-- self:E("_Destructor")
|
||||||
--
|
--
|
||||||
-- self.Menu:Remove()
|
-- self.Menu:Remove()
|
||||||
@@ -147,11 +147,11 @@ do -- PROCESS_SMOKE_TARGETS_ZONE
|
|||||||
-- end
|
-- end
|
||||||
|
|
||||||
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
||||||
-- @param #PROCESS_SMOKE_TARGETS_ZONE self
|
-- @param #FSMT_SMOKE_TARGETS_ZONE self
|
||||||
-- @param Set#SET_UNIT TargetSetUnit
|
-- @param Set#SET_UNIT TargetSetUnit
|
||||||
-- @param Zone#ZONE_BASE TargetZone
|
-- @param Zone#ZONE_BASE TargetZone
|
||||||
function PROCESS_SMOKE_TARGETS_ZONE:New( TargetSetUnit, TargetZone )
|
function FSMT_SMOKE_TARGETS_ZONE:New( TargetSetUnit, TargetZone )
|
||||||
local self = BASE:Inherit( self, PROCESS_SMOKE:New() ) -- #PROCESS_SMOKE
|
local self = BASE:Inherit( self, FSMT_SMOKE:New() ) -- #FSMT_SMOKE
|
||||||
|
|
||||||
self:SetParameters( { TargetSetUnit, TargetZone } )
|
self:SetParameters( { TargetSetUnit, TargetZone } )
|
||||||
|
|
||||||
@@ -159,11 +159,11 @@ do -- PROCESS_SMOKE_TARGETS_ZONE
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
||||||
-- @param #PROCESS_SMOKE_TARGETS_ZONE self
|
-- @param #FSMT_SMOKE_TARGETS_ZONE self
|
||||||
-- @param Set#SET_UNIT TargetSetUnit
|
-- @param Set#SET_UNIT TargetSetUnit
|
||||||
-- @param Zone#ZONE_BASE TargetZone
|
-- @param Zone#ZONE_BASE TargetZone
|
||||||
-- @return #PROCESS_SMOKE_TARGETS_ZONE self
|
-- @return #FSMT_SMOKE_TARGETS_ZONE self
|
||||||
function PROCESS_SMOKE_TARGETS_ZONE:Init( TargetSetUnit, TargetZone )
|
function FSMT_SMOKE_TARGETS_ZONE:Init( TargetSetUnit, TargetZone )
|
||||||
|
|
||||||
self.TargetSetUnit = TargetSetUnit
|
self.TargetSetUnit = TargetSetUnit
|
||||||
self.TargetZone = TargetZone
|
self.TargetZone = TargetZone
|
||||||
@@ -172,12 +172,12 @@ do -- PROCESS_SMOKE_TARGETS_ZONE
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #PROCESS_SMOKE_TARGETS_ZONE self
|
-- @param #FSMT_SMOKE_TARGETS_ZONE self
|
||||||
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function PROCESS_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To )
|
function FSMT_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
self.TargetSetUnit:ForEachUnit(
|
self.TargetSetUnit:ForEachUnit(
|
||||||
--- @param Wrapper.Unit#UNIT SmokeUnit
|
--- @param Wrapper.Unit#UNIT SmokeUnit
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ function PATROLZONE:onenterRoute()
|
|||||||
self.Controllable:SetState( self.Controllable, "PatrolZone", self )
|
self.Controllable:SetState( self.Controllable, "PatrolZone", self )
|
||||||
self.Controllable:WayPointFunction( #PatrolRoute, 1, "_NewPatrolRoute" )
|
self.Controllable:WayPointFunction( #PatrolRoute, 1, "_NewPatrolRoute" )
|
||||||
|
|
||||||
--- NOW PROCESS_ROUTE THE GROUP!
|
--- NOW FSMT_ROUTE THE GROUP!
|
||||||
self.Controllable:WayPointExecute( 1 )
|
self.Controllable:WayPointExecute( 1 )
|
||||||
|
|
||||||
self:__Patrol( 30 )
|
self:__Patrol( 30 )
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
-- The TASK_A2G is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
|
-- The TASK_A2G is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
|
||||||
--
|
--
|
||||||
-- * **None**: Start of the process
|
-- * **None**: Start of the process
|
||||||
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#PROCESS_ASSIGN_ACCEPT} is started to accept the task.
|
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#FSMT_ASSIGN_ACCEPT} is started to accept the task.
|
||||||
-- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#PROCESS_ROUTE} is started to route the active Units in the Group to the attack zone.
|
-- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#FSMT_ROUTE} is started to route the active Units in the Group to the attack zone.
|
||||||
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
|
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
|
||||||
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
|
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
|
||||||
--
|
--
|
||||||
@@ -47,12 +47,12 @@ do -- TASK_A2G
|
|||||||
|
|
||||||
local Fsm = self:GetFsmTemplate()
|
local Fsm = self:GetFsmTemplate()
|
||||||
|
|
||||||
Fsm:AddProcess( "Planned", "Accept", PROCESS_ASSIGN_ACCEPT:New( "Attack the Area" ), { Assigned = "Route", Rejected = "Eject" } )
|
Fsm:AddProcess( "Planned", "Accept", FSMT_ASSIGN_ACCEPT:New( "Attack the Area" ), { Assigned = "Route", Rejected = "Eject" } )
|
||||||
Fsm:AddProcess( "Assigned", "Route", PROCESS_ROUTE_ZONE:New( self.TargetZone ), { Arrived = "Update" } )
|
Fsm:AddProcess( "Assigned", "Route", FSMT_ROUTE_ZONE:New( self.TargetZone ), { Arrived = "Update" } )
|
||||||
Fsm:AddAction ( "Rejected", "Eject", "Planned" )
|
Fsm:AddAction ( "Rejected", "Eject", "Planned" )
|
||||||
Fsm:AddAction ( "Arrived", "Update", "Updated" )
|
Fsm:AddAction ( "Arrived", "Update", "Updated" )
|
||||||
Fsm:AddProcess( "Updated", "Account", PROCESS_ACCOUNT_DEADS:New( self.TargetSetUnit, "Attack" ), { Accounted = "Success" } )
|
Fsm:AddProcess( "Updated", "Account", FSMT_ACCOUNT_DEADS:New( self.TargetSetUnit, "Attack" ), { Accounted = "Success" } )
|
||||||
Fsm:AddProcess( "Updated", "Smoke", PROCESS_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) )
|
Fsm:AddProcess( "Updated", "Smoke", FSMT_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) )
|
||||||
--Fsm:AddProcess( "Updated", "JTAC", PROCESS_JTAC:New( self, TaskUnit, self.TargetSetUnit, self.FACUnit ) )
|
--Fsm:AddProcess( "Updated", "JTAC", PROCESS_JTAC:New( self, TaskUnit, self.TargetSetUnit, self.FACUnit ) )
|
||||||
Fsm:AddAction ( "Accounted", "Success", "Success" )
|
Fsm:AddAction ( "Accounted", "Success", "Success" )
|
||||||
Fsm:AddAction ( "Failed", "Fail", "Failed" )
|
Fsm:AddAction ( "Failed", "Fail", "Failed" )
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
-- The TASK_PICKUP is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
|
-- The TASK_PICKUP is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
|
||||||
--
|
--
|
||||||
-- * **None**: Start of the process
|
-- * **None**: Start of the process
|
||||||
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#PROCESS_ASSIGN_ACCEPT} is started to accept the task.
|
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#FSMT_ASSIGN_ACCEPT} is started to accept the task.
|
||||||
-- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#PROCESS_ROUTE} is started to route the active Units in the Group to the attack zone.
|
-- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#FSMT_ROUTE} is started to route the active Units in the Group to the attack zone.
|
||||||
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
|
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
|
||||||
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
|
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
|
||||||
--
|
--
|
||||||
@@ -67,7 +67,7 @@ do -- TASK_PICKUP
|
|||||||
function TASK_PICKUP:AssignToUnit( TaskUnit )
|
function TASK_PICKUP:AssignToUnit( TaskUnit )
|
||||||
self:F( TaskUnit:GetName() )
|
self:F( TaskUnit:GetName() )
|
||||||
|
|
||||||
local ProcessAssign = self:AddProcess( TaskUnit, PROCESS_ASSIGN_ACCEPT:New( self, TaskUnit, self.TaskBriefing ) )
|
local ProcessAssign = self:AddProcess( TaskUnit, FSMT_ASSIGN_ACCEPT:New( self, TaskUnit, self.TaskBriefing ) )
|
||||||
local ProcessPickup = self:AddProcess( TaskUnit, PROCESS_PICKUP:New( self, self.TaskType, TaskUnit ) )
|
local ProcessPickup = self:AddProcess( TaskUnit, PROCESS_PICKUP:New( self, self.TaskType, TaskUnit ) )
|
||||||
|
|
||||||
local Process = self:AddStateMachine( TaskUnit, FSM_TASK:New( self, TaskUnit, {
|
local Process = self:AddStateMachine( TaskUnit, FSM_TASK:New( self, TaskUnit, {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
-- The TASK_SEAD is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
|
-- The TASK_SEAD is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
|
||||||
--
|
--
|
||||||
-- * **None**: Start of the process
|
-- * **None**: Start of the process
|
||||||
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#PROCESS_ASSIGN_ACCEPT} is started to accept the task.
|
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#FSMT_ASSIGN_ACCEPT} is started to accept the task.
|
||||||
-- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#PROCESS_ROUTE} is started to route the active Units in the Group to the attack zone.
|
-- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#FSMT_ROUTE} is started to route the active Units in the Group to the attack zone.
|
||||||
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
|
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
|
||||||
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
|
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
|
||||||
--
|
--
|
||||||
@@ -47,12 +47,12 @@ do -- TASK_SEAD
|
|||||||
|
|
||||||
local Fsm = self:GetFsmTemplate()
|
local Fsm = self:GetFsmTemplate()
|
||||||
|
|
||||||
Fsm:AddProcess( "Planned", "Accept", PROCESS_ASSIGN_ACCEPT:New( self.TaskBriefing ), { Assigned = "Route", Rejected = "Eject" } )
|
Fsm:AddProcess( "Planned", "Accept", FSMT_ASSIGN_ACCEPT:New( self.TaskBriefing ), { Assigned = "Route", Rejected = "Eject" } )
|
||||||
Fsm:AddProcess( "Assigned", "Route", PROCESS_ROUTE_ZONE:New( self.TargetZone ), { Arrived = "Update" } )
|
Fsm:AddProcess( "Assigned", "Route", FSMT_ROUTE_ZONE:New( self.TargetZone ), { Arrived = "Update" } )
|
||||||
Fsm:AddAction ( "Rejected", "Eject", "Planned" )
|
Fsm:AddAction ( "Rejected", "Eject", "Planned" )
|
||||||
Fsm:AddAction ( "Arrived", "Update", "Updated" )
|
Fsm:AddAction ( "Arrived", "Update", "Updated" )
|
||||||
Fsm:AddProcess( "Updated", "Account", PROCESS_ACCOUNT_DEADS:New( self.TargetSetUnit, "SEAD" ), { Accounted = "Success" } )
|
Fsm:AddProcess( "Updated", "Account", FSMT_ACCOUNT_DEADS:New( self.TargetSetUnit, "SEAD" ), { Accounted = "Success" } )
|
||||||
Fsm:AddProcess( "Updated", "Smoke", PROCESS_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) )
|
Fsm:AddProcess( "Updated", "Smoke", FSMT_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) )
|
||||||
Fsm:AddAction ( "Accounted", "Success", "Success" )
|
Fsm:AddAction ( "Accounted", "Success", "Success" )
|
||||||
Fsm:AddAction ( "Failed", "Fail", "Failed" )
|
Fsm:AddAction ( "Failed", "Fail", "Failed" )
|
||||||
|
|
||||||
|
|||||||
@@ -970,7 +970,7 @@ function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation,
|
|||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
-- EN-PROCESS_ROUTE TASKS FOR AIRBORNE CONTROLLABLES
|
-- EN-FSMT_ROUTE TASKS FOR AIRBORNE CONTROLLABLES
|
||||||
|
|
||||||
--- (AIR) Engaging targets of defined types.
|
--- (AIR) Engaging targets of defined types.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
|
|||||||
@@ -915,7 +915,7 @@ end
|
|||||||
_TransportStage: Defines the different stages of which of transport missions can be in. This table is internal and is used to control the sequence of messages, actions and flow.
|
_TransportStage: Defines the different stages of which of transport missions can be in. This table is internal and is used to control the sequence of messages, actions and flow.
|
||||||
|
|
||||||
- _TransportStage.START
|
- _TransportStage.START
|
||||||
- _TransportStage.PROCESS_ROUTE
|
- _TransportStage.FSMT_ROUTE
|
||||||
- _TransportStage.LAND
|
- _TransportStage.LAND
|
||||||
- _TransportStage.EXECUTE
|
- _TransportStage.EXECUTE
|
||||||
- _TransportStage.DONE
|
- _TransportStage.DONE
|
||||||
@@ -924,7 +924,7 @@ end
|
|||||||
_TransportStage = {
|
_TransportStage = {
|
||||||
HOLD = "HOLD",
|
HOLD = "HOLD",
|
||||||
START = "START",
|
START = "START",
|
||||||
PROCESS_ROUTE = "PROCESS_ROUTE",
|
FSMT_ROUTE = "FSMT_ROUTE",
|
||||||
LANDING = "LANDING",
|
LANDING = "LANDING",
|
||||||
LANDED = "LANDED",
|
LANDED = "LANDED",
|
||||||
EXECUTING = "EXECUTING",
|
EXECUTING = "EXECUTING",
|
||||||
@@ -937,7 +937,7 @@ _TransportStage = {
|
|||||||
_TransportStageMsgTime = {
|
_TransportStageMsgTime = {
|
||||||
HOLD = 10,
|
HOLD = 10,
|
||||||
START = 60,
|
START = 60,
|
||||||
PROCESS_ROUTE = 5,
|
FSMT_ROUTE = 5,
|
||||||
LANDING = 10,
|
LANDING = 10,
|
||||||
LANDED = 30,
|
LANDED = 30,
|
||||||
EXECUTING = 30,
|
EXECUTING = 30,
|
||||||
@@ -950,7 +950,7 @@ _TransportStageMsgTime = {
|
|||||||
_TransportStageTime = {
|
_TransportStageTime = {
|
||||||
HOLD = 10,
|
HOLD = 10,
|
||||||
START = 5,
|
START = 5,
|
||||||
PROCESS_ROUTE = 5,
|
FSMT_ROUTE = 5,
|
||||||
LANDING = 1,
|
LANDING = 1,
|
||||||
LANDED = 1,
|
LANDED = 1,
|
||||||
EXECUTING = 5,
|
EXECUTING = 5,
|
||||||
|
|||||||
@@ -66,19 +66,19 @@ local FsmSEADTemplate = TaskSEAD:GetFsmTemplate()
|
|||||||
|
|
||||||
-- Adding a new sub-process to the Task Template.
|
-- Adding a new sub-process to the Task Template.
|
||||||
-- At first, the task needs to be accepted by a pilot.
|
-- At first, the task needs to be accepted by a pilot.
|
||||||
-- We use for this the SUB-PROCESS PROCESS_ASSIGN_ACCEPT.
|
-- We use for this the SUB-PROCESS FSMT_ASSIGN_ACCEPT.
|
||||||
-- The method on the FsmSEAD AddProcess accepts the following parameters:
|
-- The method on the FsmSEAD AddProcess accepts the following parameters:
|
||||||
-- 1. State From "Planned". When the Fsm is in state "Planned", allow the event "Accept".
|
-- 1. State From "Planned". When the Fsm is in state "Planned", allow the event "Accept".
|
||||||
-- 2. Event "Accept". This event can be triggered through FsmSEAD:Accept() or FsmSEAD:__Accept( 1 ). See documentation on state machines.
|
-- 2. Event "Accept". This event can be triggered through FsmSEAD:Accept() or FsmSEAD:__Accept( 1 ). See documentation on state machines.
|
||||||
-- 3. The PROCESS derived class. In this case, we use the PROCESS_ASSIGN_ACCEPT to accept the task and provide a briefing. So, when the event "Accept" is fired, this process is executed.
|
-- 3. The PROCESS derived class. In this case, we use the FSMT_ASSIGN_ACCEPT to accept the task and provide a briefing. So, when the event "Accept" is fired, this process is executed.
|
||||||
-- 4. A table with the "return" states of the PROCESS_ASSIGN_ACCEPT process. This table indicates that for a certain return state, a further event needs to be called.
|
-- 4. A table with the "return" states of the FSMT_ASSIGN_ACCEPT process. This table indicates that for a certain return state, a further event needs to be called.
|
||||||
-- 4.1 When the return state is Assigned, fire the event in the Task FsmSEAD:Route()
|
-- 4.1 When the return state is Assigned, fire the event in the Task FsmSEAD:Route()
|
||||||
-- 4.2 When the return state is Rejected, fire the event in the Task FsmSEAD:Eject()
|
-- 4.2 When the return state is Rejected, fire the event in the Task FsmSEAD:Eject()
|
||||||
-- All other AddProcess calls are working in a similar manner.
|
-- All other AddProcess calls are working in a similar manner.
|
||||||
FsmSEADTemplate:AddProcess ( "Planned", "Accept", PROCESS_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } )
|
FsmSEADTemplate:AddProcess ( "Planned", "Accept", FSMT_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } )
|
||||||
|
|
||||||
-- Same, adding a process.
|
-- Same, adding a process.
|
||||||
FsmSEADTemplate:AddProcess ( "Assigned", "Route", PROCESS_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } )
|
FsmSEADTemplate:AddProcess ( "Assigned", "Route", FSMT_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } )
|
||||||
|
|
||||||
-- Adding a new Action...
|
-- Adding a new Action...
|
||||||
-- Actions define also the flow of the Task, but the actions will need to be programmed within your script.
|
-- Actions define also the flow of the Task, but the actions will need to be programmed within your script.
|
||||||
@@ -89,8 +89,8 @@ FsmSEADTemplate:AddProcess ( "Assigned", "Route", PROCESS_ROUTE_ZONE:New
|
|||||||
-- 3. State To "Planned". After the event has been fired, the FsmSEAD will transition to Planned.
|
-- 3. State To "Planned". After the event has been fired, the FsmSEAD will transition to Planned.
|
||||||
FsmSEADTemplate:AddTransition ( "Rejected", "Eject", "Planned" )
|
FsmSEADTemplate:AddTransition ( "Rejected", "Eject", "Planned" )
|
||||||
FsmSEADTemplate:AddTransition ( "Arrived", "Update", "Updated" )
|
FsmSEADTemplate:AddTransition ( "Arrived", "Update", "Updated" )
|
||||||
FsmSEADTemplate:AddProcess ( "Updated", "Account", PROCESS_ACCOUNT_DEADS:New( TargetSet, "SEAD" ), { Accounted = "Success" } )
|
FsmSEADTemplate:AddProcess ( "Updated", "Account", FSMT_ACCOUNT_DEADS:New( TargetSet, "SEAD" ), { Accounted = "Success" } )
|
||||||
FsmSEADTemplate:AddProcess ( "Updated", "Smoke", PROCESS_SMOKE_TARGETS_ZONE:New( TargetSet, TargetZone ) )
|
FsmSEADTemplate:AddProcess ( "Updated", "Smoke", FSMT_SMOKE_TARGETS_ZONE:New( TargetSet, TargetZone ) )
|
||||||
FsmSEADTemplate:AddTransition ( "Accounted", "Success", "Success" )
|
FsmSEADTemplate:AddTransition ( "Accounted", "Success", "Success" )
|
||||||
FsmSEADTemplate:AddTransition ( "*", "Fail", "Failed" )
|
FsmSEADTemplate:AddTransition ( "*", "Fail", "Failed" )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user