Undone the Templating crap. It is much better now. Users will understand ...

This commit is contained in:
FlightControl
2016-12-09 12:34:28 +01:00
parent 618fdb8405
commit 50e69e07fb
20 changed files with 1064 additions and 54148 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2,16 +2,16 @@
--
-- ===
--
-- # @{#FSMT_ACCOUNT} FSM class, extends @{Fsm.Fsm#FSM_TEMPLATE}
-- # @{#FSM_ACCOUNT} FSM class, extends @{Fsm.Fsm#FSM_PROCESS}
--
-- ## FSMT_ACCOUNT state machine:
-- ## FSM_ACCOUNT state machine:
--
-- 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.
-- 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.
--
-- ### FSMT_ACCOUNT **Events**:
-- ### FSM_ACCOUNT **Events**:
--
-- 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.
-- * **NoMore**: There are no more DCS events that need to be accounted for. The process will go into the Success state.
--
-- ### FSMT_ACCOUNT **Event methods**:
-- ### FSM_ACCOUNT **Event methods**:
--
-- 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:
@@ -29,7 +29,7 @@
-- * **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.
--
-- ### FSMT_ACCOUNT **States**:
-- ### FSM_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.
@@ -40,7 +40,7 @@
--
-- (*) End states of the process.
--
-- ### FSMT_ACCOUNT state transition methods:
-- ### FSM_ACCOUNT state transition methods:
--
-- 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:
@@ -55,41 +55,41 @@
-- 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.
--
-- # 1) @{#FSMT_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#FSMT_ACCOUNT}
-- # 1) @{#FSM_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#FSM_ACCOUNT}
--
-- The FSMT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
-- The FSM_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.
--
--
-- ## FSMT_ACCOUNT_DEADS constructor:
-- ## FSM_ACCOUNT_DEADS constructor:
--
-- * @{#FSMT_ACCOUNT_DEADS.New}(): Creates a new FSMT_ACCOUNT_DEADS object.
-- * @{#FSM_ACCOUNT_DEADS.New}(): Creates a new FSM_ACCOUNT_DEADS object.
--
-- ===
--
-- @module Account
do -- FSMT_ACCOUNT
do -- FSM_ACCOUNT
--- FSMT_ACCOUNT class
-- @type FSMT_ACCOUNT
--- FSM_ACCOUNT class
-- @type FSM_ACCOUNT
-- @field Set#SET_UNIT TargetSetUnit
-- @extends Fsm.Fsm#FSM_TEMPLATE
FSMT_ACCOUNT = {
ClassName = "FSMT_ACCOUNT",
-- @extends Fsm.Fsm#FSM_PROCESS
FSM_ACCOUNT = {
ClassName = "FSM_ACCOUNT",
TargetSetUnit = nil,
}
--- Creates a new DESTROY process.
-- @param #FSMT_ACCOUNT self
-- @return #FSMT_ACCOUNT
function FSMT_ACCOUNT:New()
-- @param #FSM_ACCOUNT self
-- @return #FSM_ACCOUNT
function FSM_ACCOUNT:New()
-- Inherits from BASE
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "FSMT_ACCOUNT" ) ) -- Fsm.Fsm#FSM_TEMPLATE
local self = BASE:Inherit( self, FSM_PROCESS:New() ) -- Fsm.Fsm#FSM_PROCESS
self:AddTransition( "Assigned", "Start", "Waiting")
self:AddTransition( "*", "Wait", "Waiting")
@@ -110,12 +110,12 @@ do -- FSMT_ACCOUNT
--- Process Events
--- StateMachine callback function
-- @param #FSMT_ACCOUNT self
-- @param #FSM_ACCOUNT self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ACCOUNT:onafterStart( ProcessUnit, Event, From, To )
function FSM_ACCOUNT:onafterStart( ProcessUnit, Event, From, To )
self:EventOnDead( self.onfuncEventDead )
@@ -124,12 +124,12 @@ do -- FSMT_ACCOUNT
--- StateMachine callback function
-- @param #FSMT_ACCOUNT self
-- @param #FSM_ACCOUNT self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To )
function FSM_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To )
if self.DisplayCount >= self.DisplayInterval then
self:Report()
@@ -142,53 +142,59 @@ do -- FSMT_ACCOUNT
end
--- StateMachine callback function
-- @param #FSMT_ACCOUNT self
-- @param #FSM_ACCOUNT self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event )
function FSM_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event )
self:__NoMore( 1 )
end
end -- FSMT_ACCOUNT
end -- FSM_ACCOUNT
do -- FSMT_ACCOUNT_DEADS
do -- FSM_ACCOUNT_DEADS
--- FSMT_ACCOUNT_DEADS class
-- @type FSMT_ACCOUNT_DEADS
--- FSM_ACCOUNT_DEADS class
-- @type FSM_ACCOUNT_DEADS
-- @field Set#SET_UNIT TargetSetUnit
-- @extends #FSMT_ACCOUNT
FSMT_ACCOUNT_DEADS = {
ClassName = "FSMT_ACCOUNT_DEADS",
-- @extends #FSM_ACCOUNT
FSM_ACCOUNT_DEADS = {
ClassName = "FSM_ACCOUNT_DEADS",
TargetSetUnit = nil,
}
--- Creates a new DESTROY process.
-- @param #FSMT_ACCOUNT_DEADS self
-- @param #FSM_ACCOUNT_DEADS self
-- @param Set#SET_UNIT TargetSetUnit
-- @param #string TaskName
function FSMT_ACCOUNT_DEADS:New( TargetSetUnit, TaskName )
function FSM_ACCOUNT_DEADS:New( TargetSetUnit, TaskName )
-- Inherits from BASE
local self = BASE:Inherit( self, FSMT_ACCOUNT:New() ) -- #FSMT_ACCOUNT_DEADS
self:SetParameters( {
TargetSetUnit = TargetSetUnit,
TaskName = TaskName,
DisplayInterval = 30,
DisplayCount = 30,
DisplayMessage = true,
DisplayTime = 10, -- 10 seconds is the default
DisplayCategory = "HQ", -- Targets is the default display category
} )
local self = BASE:Inherit( self, FSM_ACCOUNT:New() ) -- #FSM_ACCOUNT_DEADS
self.TargetSetUnit = TargetSetUnit
self.TaskName = TaskName
self.DisplayInterval = 30
self.DisplayCount = 30
self.DisplayMessage = true
self.DisplayTime = 10 -- 10 seconds is the default
self.DisplayCategory = "HQ" -- Targets is the default display category
return self
end
function FSM_ACCOUNT_DEADS:Init( FsmAccount )
self.TargetSetUnit = FsmAccount.TargetSetUnit
self.TaskName = FsmAccount.TaskName
end
function FSMT_ACCOUNT_DEADS:_Destructor()
function FSM_ACCOUNT_DEADS:_Destructor()
self:E("_Destructor")
self:EventRemoveAll()
@@ -198,12 +204,12 @@ do -- FSMT_ACCOUNT_DEADS
--- Process Events
--- StateMachine callback function
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
-- @param #FSM_ASSIGN_MENU_ACCEPT self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To )
function FSM_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
local TaskGroup = ProcessUnit:GetGroup()
@@ -212,12 +218,12 @@ do -- FSMT_ACCOUNT_DEADS
--- StateMachine callback function
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
-- @param #FSM_ASSIGN_MENU_ACCEPT self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, EventData )
function FSM_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, EventData )
self:T( { ProcessUnit, EventData, Event, From, To } )
self:T({self.Controllable})
@@ -232,12 +238,12 @@ do -- FSMT_ACCOUNT_DEADS
end
--- StateMachine callback function
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
-- @param #FSM_ASSIGN_MENU_ACCEPT self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, EventData )
function FSM_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, EventData )
if self.TargetSetUnit:Count() > 0 then
self:__More( 1 )
@@ -248,9 +254,9 @@ do -- FSMT_ACCOUNT_DEADS
--- DCS Events
--- @param #FSMT_ACCOUNT_DEADS self
--- @param #FSM_ACCOUNT_DEADS self
-- @param Event#EVENTDATA EventData
function FSMT_ACCOUNT_DEADS:onfuncEventDead( EventData )
function FSM_ACCOUNT_DEADS:onfuncEventDead( EventData )
self:T( { "EventDead", EventData } )
if EventData.IniDCSUnit then
@@ -258,4 +264,4 @@ do -- FSMT_ACCOUNT_DEADS
end
end
end -- FSMT_ACCOUNT DEADS
end -- FSM_ACCOUNT DEADS

View File

@@ -2,16 +2,16 @@
--
-- ===
--
-- # @{#FSMT_ASSIGN} FSM template class, extends @{Fsm.Fsm#FSM_TEMPLATE}
-- # @{#FSM_ASSIGN} FSM template class, extends @{Fsm.Fsm#FSM_PROCESS}
--
-- ## FSMT_ASSIGN state machine:
-- ## FSM_ASSIGN state machine:
--
-- 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.
-- 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.
--
-- ### FSMT_ASSIGN **Events**:
-- ### FSM_ASSIGN **Events**:
--
-- These are the events defined in this class:
--
@@ -19,7 +19,7 @@
-- * **Assign**: Assign the task.
-- * **Reject**: Reject the task..
--
-- ### FSMT_ASSIGN **Event methods**:
-- ### FSM_ASSIGN **Event methods**:
--
-- 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:
@@ -27,7 +27,7 @@
-- * **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.
--
-- ### FSMT_ASSIGN **States**:
-- ### FSM_ASSIGN **States**:
--
-- * **UnAssigned**: The player has not accepted the task.
-- * **Assigned (*)**: The player has accepted the task.
@@ -37,7 +37,7 @@
--
-- (*) End states of the process.
--
-- ### FSMT_ASSIGN state transition methods:
-- ### FSM_ASSIGN state transition methods:
--
-- 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:
@@ -54,52 +54,52 @@
--
-- ===
--
-- # 1) @{#FSMT_ASSIGN_ACCEPT} class, extends @{Fsm.Assign#FSMT_ASSIGN}
-- # 1) @{#FSM_ASSIGN_ACCEPT} class, extends @{Fsm.Assign#FSM_ASSIGN}
--
-- The FSMT_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
-- The FSM_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
--
-- ## 1.1) FSMT_ASSIGN_ACCEPT constructor:
-- ## 1.1) FSM_ASSIGN_ACCEPT constructor:
--
-- * @{#FSMT_ASSIGN_ACCEPT.New}(): Creates a new FSMT_ASSIGN_ACCEPT object.
-- * @{#FSM_ASSIGN_ACCEPT.New}(): Creates a new FSM_ASSIGN_ACCEPT object.
--
-- ===
--
-- # 2) @{#FSMT_ASSIGN_MENU_ACCEPT} class, extends @{Fsm.Assign#FSMT_ASSIGN}
-- # 2) @{#FSM_ASSIGN_MENU_ACCEPT} class, extends @{Fsm.Assign#FSM_ASSIGN}
--
-- The FSMT_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
-- The FSM_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.
-- The assignment type also allows to reject the task.
--
-- ## 2.1) FSMT_ASSIGN_MENU_ACCEPT constructor:
-- ## 2.1) FSM_ASSIGN_MENU_ACCEPT constructor:
-- -----------------------------------------
--
-- * @{#FSMT_ASSIGN_MENU_ACCEPT.New}(): Creates a new FSMT_ASSIGN_MENU_ACCEPT object.
-- * @{#FSM_ASSIGN_MENU_ACCEPT.New}(): Creates a new FSM_ASSIGN_MENU_ACCEPT object.
--
-- ===
--
-- @module Assign
do -- FSMT_ASSIGN
do -- FSM_ASSIGN
--- FSMT_ASSIGN class
-- @type FSMT_ASSIGN
--- FSM_ASSIGN class
-- @type FSM_ASSIGN
-- @field Tasking.Task#TASK_BASE Task
-- @field Wrapper.Unit#UNIT ProcessUnit
-- @field Core.Zone#ZONE_BASE TargetZone
-- @extends Fsm.Fsm#FSM_TEMPLATE
FSMT_ASSIGN = {
ClassName = "FSMT_ASSIGN",
-- @extends Fsm.Fsm#FSM_PROCESS
FSM_ASSIGN = {
ClassName = "FSM_ASSIGN",
}
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
-- @param #FSMT_ASSIGN self
-- @return #FSMT_ASSIGN The task acceptance process.
function FSMT_ASSIGN:New()
-- @param #FSM_ASSIGN self
-- @return #FSM_ASSIGN The task acceptance process.
function FSM_ASSIGN:New()
-- Inherits from BASE
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "FSMT_ASSIGN" ) ) -- Fsm.Fsm#FSM_TEMPLATE
local self = BASE:Inherit( self, FSM_PROCESS:New( "FSM_ASSIGN" ) ) -- Fsm.Fsm#FSM_PROCESS
self:AddTransition( "UnAssigned", "Start", "Waiting" )
self:AddTransition( "Waiting", "Assign", "Assigned" )
@@ -115,42 +115,47 @@ do -- FSMT_ASSIGN
return self
end
end -- FSMT_ASSIGN
end -- FSM_ASSIGN
do -- FSMT_ASSIGN_ACCEPT
do -- FSM_ASSIGN_ACCEPT
--- FSMT_ASSIGN_ACCEPT class
-- @type FSMT_ASSIGN_ACCEPT
--- FSM_ASSIGN_ACCEPT class
-- @type FSM_ASSIGN_ACCEPT
-- @field Tasking.Task#TASK_BASE Task
-- @field Wrapper.Unit#UNIT ProcessUnit
-- @field Core.Zone#ZONE_BASE TargetZone
-- @extends #FSMT_ASSIGN
FSMT_ASSIGN_ACCEPT = {
ClassName = "FSMT_ASSIGN_ACCEPT",
-- @extends #FSM_ASSIGN
FSM_ASSIGN_ACCEPT = {
ClassName = "FSM_ASSIGN_ACCEPT",
}
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
-- @param #FSMT_ASSIGN_ACCEPT self
-- @param #FSM_ASSIGN_ACCEPT self
-- @param #string TaskBriefing
function FSMT_ASSIGN_ACCEPT:New( TaskBriefing )
function FSM_ASSIGN_ACCEPT:New( TaskBriefing )
local self = BASE:Inherit( self, FSMT_ASSIGN:New() ) -- #FSMT_ASSIGN_ACCEPT
local self = BASE:Inherit( self, FSM_ASSIGN:New() ) -- #FSM_ASSIGN_ACCEPT
self:SetParameters( { TaskBriefing = TaskBriefing } )
self.TaskBriefing = TaskBriefing
return self
end
function FSM_ASSIGN_ACCEPT:Init( FsmAssign )
self.TaskBriefing = FsmAssign.TaskBriefing
end
--- StateMachine callback function
-- @param #FSMT_ASSIGN_ACCEPT self
-- @param #FSM_ASSIGN_ACCEPT self
-- @param Wrapper.Unit#UNIT ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
function FSM_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
local ProcessGroup = ProcessUnit:GetGroup()
@@ -160,12 +165,12 @@ do -- FSMT_ASSIGN_ACCEPT
end
--- StateMachine callback function
-- @param #FSMT_ASSIGN_ACCEPT self
-- @param #FSM_ASSIGN_ACCEPT self
-- @param Wrapper.Unit#UNIT ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, Event, From, To )
function FSM_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, Event, From, To )
env.info( "in here" )
self:E( { ProcessUnit, Event, From, To } )
@@ -176,43 +181,50 @@ do -- FSMT_ASSIGN_ACCEPT
self.Task:Assign()
end
end -- FSMT_ASSIGN_ACCEPT
end -- FSM_ASSIGN_ACCEPT
do -- FSMT_ASSIGN_MENU_ACCEPT
do -- FSM_ASSIGN_MENU_ACCEPT
--- FSMT_ASSIGN_MENU_ACCEPT class
-- @type FSMT_ASSIGN_MENU_ACCEPT
--- FSM_ASSIGN_MENU_ACCEPT class
-- @type FSM_ASSIGN_MENU_ACCEPT
-- @field Tasking.Task#TASK_BASE Task
-- @field Wrapper.Unit#UNIT ProcessUnit
-- @field Core.Zone#ZONE_BASE TargetZone
-- @extends #FSMT_ASSIGN
FSMT_ASSIGN_MENU_ACCEPT = {
ClassName = "FSMT_ASSIGN_MENU_ACCEPT",
-- @extends #FSM_ASSIGN
FSM_ASSIGN_MENU_ACCEPT = {
ClassName = "FSM_ASSIGN_MENU_ACCEPT",
}
--- Init.
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
-- @param #FSM_ASSIGN_MENU_ACCEPT self
-- @param #string TaskName
-- @param #string TaskBriefing
-- @return #FSMT_ASSIGN_MENU_ACCEPT self
function FSMT_ASSIGN_MENU_ACCEPT:New( TaskName, TaskBriefing )
-- @return #FSM_ASSIGN_MENU_ACCEPT self
function FSM_ASSIGN_MENU_ACCEPT:New( TaskName, TaskBriefing )
-- Inherits from BASE
local self = BASE:Inherit( self, FSMT_ASSIGN:New() ) -- #FSMT_ASSIGN_MENU_ACCEPT
local self = BASE:Inherit( self, FSM_ASSIGN:New() ) -- #FSM_ASSIGN_MENU_ACCEPT
self:SetParameters( { TaskName = TaskName, TaskBriefing = TaskBriefing } )
self.TaskName = TaskName
self.TaskBriefing = TaskBriefing
return self
end
function FSM_ASSIGN_MENU_ACCEPT:Init( FsmAssign )
self.TaskName = FsmAssign.TaskName
self.TaskBriefing = FsmAssign.TaskBriefing
end
--- 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 #FSMT_ASSIGN_MENU_ACCEPT self
-- @param #FSM_ASSIGN_MENU_ACCEPT self
-- @param #string TaskName
-- @param #string TaskBriefing
-- @return #FSMT_ASSIGN_MENU_ACCEPT self
function FSMT_ASSIGN_MENU_ACCEPT:Init( TaskName, TaskBriefing )
-- @return #FSM_ASSIGN_MENU_ACCEPT self
function FSM_ASSIGN_MENU_ACCEPT:Init( TaskName, TaskBriefing )
self.TaskBriefing = TaskBriefing
self.TaskName = TaskName
@@ -221,12 +233,12 @@ do -- FSMT_ASSIGN_MENU_ACCEPT
end
--- StateMachine callback function
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
-- @param #FSM_ASSIGN_MENU_ACCEPT self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
function FSM_ASSIGN_MENU_ACCEPT:onafterStart( 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() )
@@ -239,40 +251,40 @@ do -- FSMT_ASSIGN_MENU_ACCEPT
end
--- Menu function.
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
function FSMT_ASSIGN_MENU_ACCEPT:MenuAssign()
-- @param #FSM_ASSIGN_MENU_ACCEPT self
function FSM_ASSIGN_MENU_ACCEPT:MenuAssign()
self:E( )
self:__Assign( 1 )
end
--- Menu function.
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
function FSMT_ASSIGN_MENU_ACCEPT:MenuReject()
-- @param #FSM_ASSIGN_MENU_ACCEPT self
function FSM_ASSIGN_MENU_ACCEPT:MenuReject()
self:E( )
self:__Reject( 1 )
end
--- StateMachine callback function
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
-- @param #FSM_ASSIGN_MENU_ACCEPT self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To )
function FSM_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To )
self:E( { ProcessUnit.UnitNameEvent, From, To } )
self.Menu:Remove()
end
--- StateMachine callback function
-- @param #FSMT_ASSIGN_MENU_ACCEPT self
-- @param #FSM_ASSIGN_MENU_ACCEPT self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To )
function FSM_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To )
self:E( { ProcessUnit.UnitName, Event, From, To } )
self.Menu:Remove()
@@ -281,4 +293,4 @@ do -- FSMT_ASSIGN_MENU_ACCEPT
ProcessUnit:Destroy()
end
end -- FSMT_ASSIGN_MENU_ACCEPT
end -- FSM_ASSIGN_MENU_ACCEPT

View File

@@ -2,16 +2,16 @@
--
-- ===
--
-- # @{#FSMT_ROUTE} FSM class, extends @{Fsm.Fsm#FSM_TEMPLATE}
-- # @{#FSM_ROUTE} FSM class, extends @{Fsm.Fsm#FSM_PROCESS}
--
-- ## FSMT_ROUTE state machine:
-- ## FSM_ROUTE state machine:
--
-- 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.
-- 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.
--
-- ### FSMT_ROUTE **Events**:
-- ### FSM_ROUTE **Events**:
--
-- 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.
-- * **NoMore**: There are no more route points that need to be followed. The process will go into the Success state.
--
-- ### FSMT_ROUTE **Event methods**:
-- ### FSM_ROUTE **Event methods**:
--
-- 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:
@@ -31,7 +31,7 @@
-- * **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.
--
-- ### FSMT_ROUTE **States**:
-- ### FSM_ROUTE **States**:
--
-- * **None**: The controllable did not receive route commands.
-- * **Arrived (*)**: The controllable has arrived at a route point.
@@ -43,7 +43,7 @@
--
-- (*) End states of the process.
--
-- ### FSMT_ROUTE state transition methods:
-- ### FSM_ROUTE state transition methods:
--
-- 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:
@@ -60,41 +60,41 @@
--
-- ===
--
-- # 1) @{#FSMT_ROUTE_ZONE} class, extends @{Fsm.Route#FSMT_ROUTE}
-- # 1) @{#FSM_ROUTE_ZONE} class, extends @{Fsm.Route#FSM_ROUTE}
--
-- The FSMT_ROUTE_ZONE class implements the core functions to route an AIR @{Controllable} player @{Unit} to a @{Zone}.
-- The FSM_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.
-- Upon arrival at the zone, a confirmation of arrival is sent, and the process will be ended.
--
-- # 1.1) FSMT_ROUTE_ZONE constructor:
-- # 1.1) FSM_ROUTE_ZONE constructor:
--
-- * @{#FSMT_ROUTE_ZONE.New}(): Creates a new FSMT_ROUTE_ZONE object.
-- * @{#FSM_ROUTE_ZONE.New}(): Creates a new FSM_ROUTE_ZONE object.
--
-- ===
--
-- @module Route
do -- FSMT_ROUTE
do -- FSM_ROUTE
--- FSMT_ROUTE class
-- @type FSMT_ROUTE
--- FSM_ROUTE class
-- @type FSM_ROUTE
-- @field Tasking.Task#TASK TASK
-- @field Wrapper.Unit#UNIT ProcessUnit
-- @field Core.Zone#ZONE_BASE TargetZone
-- @extends Fsm.Fsm#FSM_TEMPLATE
FSMT_ROUTE = {
ClassName = "FSMT_ROUTE",
-- @extends Fsm.Fsm#FSM_PROCESS
FSM_ROUTE = {
ClassName = "FSM_ROUTE",
}
--- Creates a new routing state machine. The process will route a CLIENT to a ZONE until the CLIENT is within that ZONE.
-- @param #FSMT_ROUTE self
-- @return #FSMT_ROUTE self
function FSMT_ROUTE:New()
-- @param #FSM_ROUTE self
-- @return #FSM_ROUTE self
function FSM_ROUTE:New()
-- Inherits from BASE
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "FSMT_ROUTE" ) ) -- Fsm.Fsm#FSM_TEMPLATE
local self = BASE:Inherit( self, FSM_PROCESS:New( "FSM_ROUTE" ) ) -- Fsm.Fsm#FSM_PROCESS
self:AddTransition( "None", "Start", "Routing" )
self:AddTransition( "*", "Report", "Reporting" )
@@ -118,32 +118,32 @@ do -- FSMT_ROUTE
--- Task Events
--- StateMachine callback function
-- @param #FSMT_ROUTE self
-- @param #FSM_ROUTE self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ROUTE:onafterStart( ProcessUnit, Event, From, To )
function FSM_ROUTE:onafterStart( ProcessUnit, Event, From, To )
self:__Route( 1 )
end
--- Check if the controllable has arrived.
-- @param #FSMT_ROUTE self
-- @param #FSM_ROUTE self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @return #boolean
function FSMT_ROUTE:onfuncHasArrived( ProcessUnit )
function FSM_ROUTE:onfuncHasArrived( ProcessUnit )
return false
end
--- StateMachine callback function
-- @param #FSMT_ROUTE self
-- @param #FSM_ROUTE self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ROUTE:onbeforeRoute( ProcessUnit, Event, From, To )
function FSM_ROUTE:onbeforeRoute( ProcessUnit, Event, From, To )
if ProcessUnit:IsAlive() then
local HasArrived = self:onfuncHasArrived( ProcessUnit ) -- Polymorphic
@@ -172,46 +172,55 @@ do -- FSMT_ROUTE
end
end -- FSMT_ROUTE
end -- FSM_ROUTE
do -- FSMT_ROUTE_ZONE
do -- FSM_ROUTE_ZONE
--- FSMT_ROUTE_ZONE class
-- @type FSMT_ROUTE_ZONE
--- FSM_ROUTE_ZONE class
-- @type FSM_ROUTE_ZONE
-- @field Tasking.Task#TASK TASK
-- @field Wrapper.Unit#UNIT ProcessUnit
-- @field Core.Zone#ZONE_BASE TargetZone
-- @extends #FSMT_ROUTE
FSMT_ROUTE_ZONE = {
ClassName = "FSMT_ROUTE_ZONE",
-- @extends #FSM_ROUTE
FSM_ROUTE_ZONE = {
ClassName = "FSM_ROUTE_ZONE",
}
--- Creates a new routing state machine. The task will route a controllable to a ZONE until the controllable is within that ZONE.
-- @param #FSMT_ROUTE_ZONE self
-- @param #FSM_ROUTE_ZONE self
-- @param Core.Zone#ZONE_BASE TargetZone
function FSMT_ROUTE_ZONE:New( TargetZone )
local self = BASE:Inherit( self, FSMT_ROUTE:New() ) -- #FSMT_ROUTE_ZONE
function FSM_ROUTE_ZONE:New( TargetZone )
local self = BASE:Inherit( self, FSM_ROUTE:New() ) -- #FSM_ROUTE_ZONE
self:SetParameters( {
TargetZone = TargetZone,
DisplayInterval = 30,
DisplayCount = 30,
DisplayMessage = true,
DisplayTime = 10, -- 10 seconds is the default
DisplayCategory = "HQ", -- Route is the default display category
} )
self.TargetZone = TargetZone
self.DisplayInterval = 30
self.DisplayCount = 30
self.DisplayMessage = true
self.DisplayTime = 10 -- 10 seconds is the default
self.DisplayCategory = "HQ" -- Route is the default display category
return self
end
function FSM_ROUTE_ZONE:Init( FsmRoute )
self.TargetZone = FsmRoute.TargetZone
self.DisplayInterval = 30
self.DisplayCount = 30
self.DisplayMessage = true
self.DisplayTime = 10 -- 10 seconds is the default
self.DisplayCategory = "HQ" -- Route is the default display category
end
--- Method override to check if the controllable has arrived.
-- @param #FSMT_ROUTE self
-- @param #FSM_ROUTE self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @return #boolean
function FSMT_ROUTE_ZONE:onfuncHasArrived( ProcessUnit )
function FSM_ROUTE_ZONE:onfuncHasArrived( ProcessUnit )
if ProcessUnit:IsInZone( self.TargetZone ) then
local RouteText = ProcessUnit:GetCallsign() .. ": You have arrived within the zone!"
@@ -224,12 +233,12 @@ do -- FSMT_ROUTE_ZONE
--- Task Events
--- StateMachine callback function
-- @param #FSMT_ROUTE_ZONE self
-- @param #FSM_ROUTE_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To )
function FSM_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To )
local ZoneVec2 = self.TargetZone:GetVec2()
local ZonePointVec2 = POINT_VEC2:New( ZoneVec2.x, ZoneVec2.y )
@@ -239,4 +248,4 @@ do -- FSMT_ROUTE_ZONE
MESSAGE:New( RouteText, self.DisplayTime, self.DisplayCategory ):ToGroup( ProcessUnit:GetGroup() )
end
end -- FSMT_ROUTE_ZONE
end -- FSM_ROUTE_ZONE

View File

@@ -2,23 +2,23 @@
--
-- ===
--
-- # @{#FSMT_SMOKE} FSM class, extends @{Fsm.Fsm#FSM_TEMPLATE}
-- # @{#FSM_SMOKE} FSM class, extends @{Fsm.Fsm#FSM_PROCESS}
--
-- ## FSMT_SMOKE state machine:
-- ## FSM_SMOKE state machine:
--
-- 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.
-- 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.
--
-- ### FSMT_SMOKE **Events**:
-- ### FSM_SMOKE **Events**:
--
-- These are the events defined in this class:
--
-- * **Start**: The process is started.
-- * **Next**: The process is smoking the targets in the given zone.
--
-- ### FSMT_SMOKE **Event methods**:
-- ### FSM_SMOKE **Event methods**:
--
-- 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:
@@ -26,7 +26,7 @@
-- * **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.
--
-- ### FSMT_SMOKE **States**:
-- ### FSM_SMOKE **States**:
--
-- * **None**: The controllable did not receive route commands.
-- * **AwaitSmoke (*)**: The process is awaiting to smoke the targets in the zone.
@@ -35,7 +35,7 @@
--
-- (*) End states of the process.
--
-- ### FSMT_SMOKE state transition methods:
-- ### FSM_SMOKE state transition methods:
--
-- 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:
@@ -52,36 +52,36 @@
--
-- ===
--
-- # 1) @{#FSMT_SMOKE_TARGETS_ZONE} class, extends @{Fsm.Route#FSMT_SMOKE}
-- # 1) @{#FSM_SMOKE_TARGETS_ZONE} class, extends @{Fsm.Route#FSM_SMOKE}
--
-- The FSMT_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Zone}.
-- The FSM_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.
-- At random intervals, a new target is smoked.
--
-- # 1.1) FSMT_SMOKE_TARGETS_ZONE constructor:
-- # 1.1) FSM_SMOKE_TARGETS_ZONE constructor:
--
-- * @{#FSMT_SMOKE_TARGETS_ZONE.New}(): Creates a new FSMT_SMOKE_TARGETS_ZONE object.
-- * @{#FSM_SMOKE_TARGETS_ZONE.New}(): Creates a new FSM_SMOKE_TARGETS_ZONE object.
--
-- ===
--
-- @module Smoke
do -- FSMT_SMOKE
do -- FSM_SMOKE
--- FSMT_SMOKE class
-- @type FSMT_SMOKE
-- @extends Fsm.Fsm#FSM_TEMPLATE
FSMT_SMOKE = {
ClassName = "FSMT_SMOKE",
--- FSM_SMOKE class
-- @type FSM_SMOKE
-- @extends Fsm.Fsm#FSM_PROCESS
FSM_SMOKE = {
ClassName = "FSM_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.
-- @param #FSMT_SMOKE self
-- @return #FSMT_SMOKE
function FSMT_SMOKE:New()
-- @param #FSM_SMOKE self
-- @return #FSM_SMOKE
function FSM_SMOKE:New()
-- Inherits from BASE
local self = BASE:Inherit( self, FSM_TEMPLATE:New( "FSMT_SMOKE" ) ) -- Fsm.Fsm#FSM_TEMPLATE
local self = BASE:Inherit( self, FSM_PROCESS:New( "FSM_SMOKE" ) ) -- Fsm.Fsm#FSM_PROCESS
self:AddTransition( "None", "Start", "AwaitSmoke" )
self:AddTransition( "AwaitSmoke", "Next", "Smoking" )
@@ -100,12 +100,12 @@ do -- FSMT_SMOKE
--- Task Events
--- StateMachine callback function
-- @param #FSMT_SMOKE self
-- @param #FSM_SMOKE self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_SMOKE:onafterStart( ProcessUnit, Event, From, To )
function FSM_SMOKE:onafterStart( ProcessUnit, Event, From, To )
local ProcessGroup = ProcessUnit:GetGroup()
local MissionMenu = self:GetMission():GetMissionMenu( ProcessGroup )
@@ -128,18 +128,18 @@ do -- FSMT_SMOKE
end
do -- FSMT_SMOKE_TARGETS_ZONE
do -- FSM_SMOKE_TARGETS_ZONE
--- FSMT_SMOKE_TARGETS_ZONE class
-- @type FSMT_SMOKE_TARGETS_ZONE
--- FSM_SMOKE_TARGETS_ZONE class
-- @type FSM_SMOKE_TARGETS_ZONE
-- @field Set#SET_UNIT TargetSetUnit
-- @field Core.Zone#ZONE_BASE TargetZone
-- @extends #FSMT_SMOKE
FSMT_SMOKE_TARGETS_ZONE = {
ClassName = "FSMT_SMOKE_TARGETS_ZONE",
-- @extends #FSM_SMOKE
FSM_SMOKE_TARGETS_ZONE = {
ClassName = "FSM_SMOKE_TARGETS_ZONE",
}
-- function FSMT_SMOKE_TARGETS_ZONE:_Destructor()
-- function FSM_SMOKE_TARGETS_ZONE:_Destructor()
-- self:E("_Destructor")
--
-- self.Menu:Remove()
@@ -147,23 +147,30 @@ do -- FSMT_SMOKE_TARGETS_ZONE
-- 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.
-- @param #FSMT_SMOKE_TARGETS_ZONE self
-- @param #FSM_SMOKE_TARGETS_ZONE self
-- @param Set#SET_UNIT TargetSetUnit
-- @param Core.Zone#ZONE_BASE TargetZone
function FSMT_SMOKE_TARGETS_ZONE:New( TargetSetUnit, TargetZone )
local self = BASE:Inherit( self, FSMT_SMOKE:New() ) -- #FSMT_SMOKE
function FSM_SMOKE_TARGETS_ZONE:New( TargetSetUnit, TargetZone )
local self = BASE:Inherit( self, FSM_SMOKE:New() ) -- #FSM_SMOKE
self:SetParameters( { TargetSetUnit, TargetZone } )
self.TargetSetUnit = TargetSetUnit
self.TargetZone = TargetZone
return self
end
function FSM_SMOKE_TARGETS_ZONE:Init( FsmSmoke )
self.TargetSetUnit = FsmSmoke.TargetSetUnit
self.TargetZone = FsmSmoke.TargetZone
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.
-- @param #FSMT_SMOKE_TARGETS_ZONE self
-- @param #FSM_SMOKE_TARGETS_ZONE self
-- @param Set#SET_UNIT TargetSetUnit
-- @param Core.Zone#ZONE_BASE TargetZone
-- @return #FSMT_SMOKE_TARGETS_ZONE self
function FSMT_SMOKE_TARGETS_ZONE:Init( TargetSetUnit, TargetZone )
-- @return #FSM_SMOKE_TARGETS_ZONE self
function FSM_SMOKE_TARGETS_ZONE:Init( TargetSetUnit, TargetZone )
self.TargetSetUnit = TargetSetUnit
self.TargetZone = TargetZone
@@ -172,12 +179,12 @@ do -- FSMT_SMOKE_TARGETS_ZONE
end
--- StateMachine callback function
-- @param #FSMT_SMOKE_TARGETS_ZONE self
-- @param #FSM_SMOKE_TARGETS_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function FSMT_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To )
function FSM_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To )
self.TargetSetUnit:ForEachUnit(
--- @param Wrapper.Unit#UNIT SmokeUnit

View File

@@ -345,7 +345,7 @@ function PATROLZONE:onenterRoute()
self.Controllable:SetState( self.Controllable, "PatrolZone", self )
self.Controllable:WayPointFunction( #PatrolRoute, 1, "_NewPatrolRoute" )
--- NOW FSMT_ROUTE THE GROUP!
--- NOW FSM_ROUTE THE GROUP!
self.Controllable:WayPointExecute( 1 )
self:__Patrol( 30 )

View File

@@ -4,7 +4,7 @@
-- @type PROCESS_JTAC
-- @field Wrapper.Unit#UNIT ProcessUnit
-- @field Core.Set#SET_UNIT TargetSetUnit
-- @extends Fsm.Fsm#FSM_TEMPLATE
-- @extends Fsm.Fsm#FSM_PROCESS
PROCESS_JTAC = {
ClassName = "PROCESS_JTAC",
Fsm = {},

View File

@@ -4,7 +4,7 @@
-- @type PROCESS_PICKUP
-- @field Wrapper.Unit#UNIT ProcessUnit
-- @field Core.Set#SET_UNIT TargetSetUnit
-- @extends Fsm.Fsm#FSM_TEMPLATE
-- @extends Fsm.Fsm#FSM_PROCESS
PROCESS_PICKUP = {
ClassName = "PROCESS_PICKUP",
Fsm = {},