diff --git a/Moose Development/Moose/Functional/AIBalancer.lua b/Moose Development/Moose/AI/AI_Balancer.lua similarity index 95% rename from Moose Development/Moose/Functional/AIBalancer.lua rename to Moose Development/Moose/AI/AI_Balancer.lua index 4cd5f6e21..f443fea20 100644 --- a/Moose Development/Moose/Functional/AIBalancer.lua +++ b/Moose Development/Moose/AI/AI_Balancer.lua @@ -2,15 +2,15 @@ -- -- === -- --- 1) @{Functional.AIBalancer#AIBALANCER} class, extends @{Fsm.Fsm#FSM_SET} +-- 1) @{AI.AI_Balancer#AIBALANCER} class, extends @{Core.Fsm#FSM_SET} -- =================================================================================== --- The @{Functional.AIBalancer#AIBALANCER} class monitors and manages as many AI GROUPS as there are +-- The @{AI.AI_Balancer#AIBALANCER} class monitors and manages as many AI GROUPS as there are -- CLIENTS in a SET_CLIENT collection not occupied by players. -- The AIBALANCER class manages internally a collection of AI management objects, which govern the behaviour -- of the underlying AI GROUPS. -- --- The parent class @{Fsm.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM) --- and calls for each event the state transition methods providing the internal @{Fsm.Fsm#FSM_SET.Set} object containing the +-- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM) +-- and calls for each event the state transition methods providing the internal @{Core.Fsm#FSM_SET.Set} object containing the -- SET_GROUP and additional event parameters provided during the event. -- -- 1.1) AIBALANCER construction method @@ -67,14 +67,14 @@ -- -- * FlightControl: Framework Design & Programming -- --- @module AIBalancer +-- @module AI_Balancer --- AIBALANCER class -- @type AIBALANCER -- @field Core.Set#SET_CLIENT SetClient --- @extends Fsm.Fsm#FSM_SET +-- @extends Core.Fsm#FSM_SET AIBALANCER = { ClassName = "AIBALANCER", PatrolZones = {}, @@ -91,7 +91,7 @@ AIBALANCER = { function AIBALANCER:New( SetClient, SpawnAI ) -- Inherits from BASE - local self = BASE:Inherit( self, FSM_SET:New( SET_GROUP:New() ) ) -- Fsm.Fsm#FSM_SET + local self = BASE:Inherit( self, FSM_SET:New( SET_GROUP:New() ) ) -- Core.Fsm#FSM_SET self:SetStartState( "None" ) self:AddTransition( "*", "Start", "Monitoring" ) diff --git a/Moose Development/Moose/Fsm/Cargo.lua b/Moose Development/Moose/AI/AI_Cargo.lua similarity index 99% rename from Moose Development/Moose/Fsm/Cargo.lua rename to Moose Development/Moose/AI/AI_Cargo.lua index 334d8b751..f76a753c4 100644 --- a/Moose Development/Moose/Fsm/Cargo.lua +++ b/Moose Development/Moose/AI/AI_Cargo.lua @@ -12,7 +12,7 @@ -- -- * CARGO_GROUPED, represented by a Group of CARGO_UNITs. -- --- 1) @{Fsm.Cargo#CARGO_BASE} class, extends @{Fsm.Fsm#FSM_PROCESS} +-- 1) @{AI.AI_Cargo#CARGO_BASE} class, extends @{Core.Fsm#FSM_PROCESS} -- ========================================================================== -- The @{#CARGO_BASE} class defines the core functions that defines a cargo object within MOOSE. -- A cargo is a logical object defined that is available for transport, and has a life status within a simulation. @@ -185,7 +185,7 @@ CARGOS = {} do -- CARGO_BASE --- @type CARGO_BASE - -- @extends Fsm.Fsm#FSM_PROCESS + -- @extends Core.Fsm#FSM_PROCESS -- @field #string Type A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers. -- @field #string Name A string defining the name of the cargo. The name is the unique identifier of the cargo. -- @field #number Weight A number defining the weight of the cargo. The weight is expressed in kg. @@ -224,7 +224,7 @@ do -- CARGO_BASE -- @return #CARGO_BASE function CARGO_BASE:New( Type, Name, Weight, ReportRadius, NearRadius ) - local self = BASE:Inherit( self, FSM:New() ) -- Fsm.Fsm#FSM_CONTROLLABLE + local self = BASE:Inherit( self, FSM:New() ) -- Core.Fsm#FSM_CONTROLLABLE self:F( { Type, Name, Weight, ReportRadius, NearRadius } ) self:SetStartState( "UnLoaded" ) @@ -803,7 +803,7 @@ end do -- CARGO_GROUP --- @type CARGO_GROUP - -- @extends Fsm.Cargo#CARGO_BASE + -- @extends AI.AI_Cargo#CARGO_BASE -- @field Set#SET_BASE CargoSet A set of cargo objects. -- @field #string Name A string defining the name of the cargo group. The name is the unique identifier of the cargo. CARGO_GROUP = { @@ -834,7 +834,7 @@ end -- CARGO_GROUP do -- CARGO_GROUPED --- @type CARGO_GROUPED - -- @extends Fsm.Cargo#CARGO_GROUP + -- @extends AI.AI_Cargo#CARGO_GROUP CARGO_GROUPED = { ClassName = "CARGO_GROUPED", } diff --git a/Moose Development/Moose/Fsm/Patrol.lua b/Moose Development/Moose/AI/AI_Patrol.lua similarity index 98% rename from Moose Development/Moose/Fsm/Patrol.lua rename to Moose Development/Moose/AI/AI_Patrol.lua index 2b1a52c4c..3a76374b2 100644 --- a/Moose Development/Moose/Fsm/Patrol.lua +++ b/Moose Development/Moose/AI/AI_Patrol.lua @@ -2,7 +2,7 @@ -- -- === -- --- 1) @{#PATROLZONE} class, extends @{Fsm.Fsm#FSM} +-- 1) @{#PATROLZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE} -- ================================================================ -- The @{#PATROLZONE} class implements the core functions to patrol a @{Zone} by an AIR @{Controllable} @{Group}. -- The patrol algorithm works that for each airplane patrolling, upon arrival at the patrol zone, @@ -155,7 +155,7 @@ -- @field Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @field Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @field Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. --- @extends Fsm.Fsm#FSM_CONTROLLABLE +-- @extends Core.Fsm#FSM_CONTROLLABLE PATROLZONE = { ClassName = "PATROLZONE", } @@ -178,7 +178,7 @@ PATROLZONE = { function PATROLZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) -- Inherits from BASE - local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- Fsm.Fsm#FSM_CONTROLLABLE + local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- Core.Fsm#FSM_CONTROLLABLE self:SetStartState( "None" ) self:AddTransition( "*", "Start", "Route" ) @@ -345,7 +345,7 @@ function PATROLZONE:onenterRoute() self.Controllable:SetState( self.Controllable, "PatrolZone", self ) self.Controllable:WayPointFunction( #PatrolRoute, 1, "_NewPatrolRoute" ) - --- NOW FSM_ROUTE THE GROUP! + --- NOW ACT_ROUTE THE GROUP! self.Controllable:WayPointExecute( 1 ) self:__Patrol( 30 ) diff --git a/Moose Development/Moose/Fsm/FsmAccount.lua b/Moose Development/Moose/Actions/Act_Account.lua similarity index 79% rename from Moose Development/Moose/Fsm/FsmAccount.lua rename to Moose Development/Moose/Actions/Act_Account.lua index 53644df7e..8b8d914f1 100644 --- a/Moose Development/Moose/Fsm/FsmAccount.lua +++ b/Moose Development/Moose/Actions/Act_Account.lua @@ -2,16 +2,16 @@ -- -- === -- --- # @{#FSM_ACCOUNT} FSM class, extends @{Fsm.Fsm#FSM_PROCESS} +-- # @{#ACT_ACCOUNT} FSM class, extends @{Core.Fsm#FSM_PROCESS} -- --- ## FSM_ACCOUNT state machine: +-- ## ACT_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. -- --- ### FSM_ACCOUNT **Events**: +-- ### ACT_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. -- --- ### FSM_ACCOUNT **Event methods**: +-- ### ACT_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. -- --- ### FSM_ACCOUNT **States**: +-- ### ACT_ACCOUNT **States**: -- -- * **Assigned**: The player is assigned to the task. This is the initialization state for the process. -- * **Waiting**: the process is waiting for a DCS event to occur within the simulator. This state is set automatically. @@ -40,7 +40,7 @@ -- -- (*) End states of the process. -- --- ### FSM_ACCOUNT state transition methods: +-- ### ACT_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) @{#FSM_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#FSM_ACCOUNT} +-- # 1) @{#ACT_ACCOUNT_DEADS} FSM class, extends @{Fsm.Account#ACT_ACCOUNT} -- --- The FSM_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units. +-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units. -- The process is given a @{Set} of units that will be tracked upon successful destruction. -- The process will end after each target has been successfully destroyed. -- Each successful dead will trigger an Account state transition that can be scored, modified or administered. -- -- --- ## FSM_ACCOUNT_DEADS constructor: +-- ## ACT_ACCOUNT_DEADS constructor: -- --- * @{#FSM_ACCOUNT_DEADS.New}(): Creates a new FSM_ACCOUNT_DEADS object. +-- * @{#ACT_ACCOUNT_DEADS.New}(): Creates a new ACT_ACCOUNT_DEADS object. -- -- === -- -- @module Account -do -- FSM_ACCOUNT +do -- ACT_ACCOUNT - --- FSM_ACCOUNT class - -- @type FSM_ACCOUNT + --- ACT_ACCOUNT class + -- @type ACT_ACCOUNT -- @field Set#SET_UNIT TargetSetUnit - -- @extends Fsm.Fsm#FSM_PROCESS - FSM_ACCOUNT = { - ClassName = "FSM_ACCOUNT", + -- @extends Core.Fsm#FSM_PROCESS + ACT_ACCOUNT = { + ClassName = "ACT_ACCOUNT", TargetSetUnit = nil, } --- Creates a new DESTROY process. - -- @param #FSM_ACCOUNT self - -- @return #FSM_ACCOUNT - function FSM_ACCOUNT:New() + -- @param #ACT_ACCOUNT self + -- @return #ACT_ACCOUNT + function ACT_ACCOUNT:New() -- Inherits from BASE - local self = BASE:Inherit( self, FSM_PROCESS:New() ) -- Fsm.Fsm#FSM_PROCESS + local self = BASE:Inherit( self, FSM_PROCESS:New() ) -- Core.Fsm#FSM_PROCESS self:AddTransition( "Assigned", "Start", "Waiting") self:AddTransition( "*", "Wait", "Waiting") @@ -110,12 +110,12 @@ do -- FSM_ACCOUNT --- Process Events --- StateMachine callback function - -- @param #FSM_ACCOUNT self + -- @param #ACT_ACCOUNT self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ACCOUNT:onafterStart( ProcessUnit, Event, From, To ) + function ACT_ACCOUNT:onafterStart( ProcessUnit, Event, From, To ) self:EventOnDead( self.onfuncEventDead ) @@ -124,12 +124,12 @@ do -- FSM_ACCOUNT --- StateMachine callback function - -- @param #FSM_ACCOUNT self + -- @param #ACT_ACCOUNT self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To ) + function ACT_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To ) if self.DisplayCount >= self.DisplayInterval then self:Report() @@ -142,37 +142,37 @@ do -- FSM_ACCOUNT end --- StateMachine callback function - -- @param #FSM_ACCOUNT self + -- @param #ACT_ACCOUNT self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event ) + function ACT_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event ) self:__NoMore( 1 ) end -end -- FSM_ACCOUNT +end -- ACT_ACCOUNT -do -- FSM_ACCOUNT_DEADS +do -- ACT_ACCOUNT_DEADS - --- FSM_ACCOUNT_DEADS class - -- @type FSM_ACCOUNT_DEADS + --- ACT_ACCOUNT_DEADS class + -- @type ACT_ACCOUNT_DEADS -- @field Set#SET_UNIT TargetSetUnit - -- @extends #FSM_ACCOUNT - FSM_ACCOUNT_DEADS = { - ClassName = "FSM_ACCOUNT_DEADS", + -- @extends #ACT_ACCOUNT + ACT_ACCOUNT_DEADS = { + ClassName = "ACT_ACCOUNT_DEADS", TargetSetUnit = nil, } --- Creates a new DESTROY process. - -- @param #FSM_ACCOUNT_DEADS self + -- @param #ACT_ACCOUNT_DEADS self -- @param Set#SET_UNIT TargetSetUnit -- @param #string TaskName - function FSM_ACCOUNT_DEADS:New( TargetSetUnit, TaskName ) + function ACT_ACCOUNT_DEADS:New( TargetSetUnit, TaskName ) -- Inherits from BASE - local self = BASE:Inherit( self, FSM_ACCOUNT:New() ) -- #FSM_ACCOUNT_DEADS + local self = BASE:Inherit( self, ACT_ACCOUNT:New() ) -- #ACT_ACCOUNT_DEADS self.TargetSetUnit = TargetSetUnit self.TaskName = TaskName @@ -186,7 +186,7 @@ do -- FSM_ACCOUNT_DEADS return self end - function FSM_ACCOUNT_DEADS:Init( FsmAccount ) + function ACT_ACCOUNT_DEADS:Init( FsmAccount ) self.TargetSetUnit = FsmAccount.TargetSetUnit self.TaskName = FsmAccount.TaskName @@ -194,7 +194,7 @@ do -- FSM_ACCOUNT_DEADS - function FSM_ACCOUNT_DEADS:_Destructor() + function ACT_ACCOUNT_DEADS:_Destructor() self:E("_Destructor") self:EventRemoveAll() @@ -204,12 +204,12 @@ do -- FSM_ACCOUNT_DEADS --- Process Events --- StateMachine callback function - -- @param #FSM_ACCOUNT_DEADS self + -- @param #ACT_ACCOUNT_DEADS self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To ) + function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To ) self:E( { ProcessUnit, Event, From, To } ) self:Message( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed." ) @@ -217,12 +217,12 @@ do -- FSM_ACCOUNT_DEADS --- StateMachine callback function - -- @param #FSM_ACCOUNT_DEADS self + -- @param #ACT_ACCOUNT_DEADS self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, EventData ) + function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, EventData ) self:T( { ProcessUnit, EventData, Event, From, To } ) self:T({self.Controllable}) @@ -237,12 +237,12 @@ do -- FSM_ACCOUNT_DEADS end --- StateMachine callback function - -- @param #FSM_ACCOUNT_DEADS self + -- @param #ACT_ACCOUNT_DEADS self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, EventData ) + function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, EventData ) if self.TargetSetUnit:Count() > 0 then self:__More( 1 ) @@ -253,9 +253,9 @@ do -- FSM_ACCOUNT_DEADS --- DCS Events - --- @param #FSM_ACCOUNT_DEADS self + --- @param #ACT_ACCOUNT_DEADS self -- @param Event#EVENTDATA EventData - function FSM_ACCOUNT_DEADS:onfuncEventDead( EventData ) + function ACT_ACCOUNT_DEADS:onfuncEventDead( EventData ) self:T( { "EventDead", EventData } ) if EventData.IniDCSUnit then @@ -263,4 +263,4 @@ do -- FSM_ACCOUNT_DEADS end end -end -- FSM_ACCOUNT DEADS +end -- ACT_ACCOUNT DEADS diff --git a/Moose Development/Moose/Fsm/FsmAssign.lua b/Moose Development/Moose/Actions/Act_Assign.lua similarity index 70% rename from Moose Development/Moose/Fsm/FsmAssign.lua rename to Moose Development/Moose/Actions/Act_Assign.lua index 71d5063d3..a1303fcf5 100644 --- a/Moose Development/Moose/Fsm/FsmAssign.lua +++ b/Moose Development/Moose/Actions/Act_Assign.lua @@ -2,16 +2,16 @@ -- -- === -- --- # @{#FSM_ASSIGN} FSM template class, extends @{Fsm.Fsm#FSM_PROCESS} +-- # @{#ACT_ASSIGN} FSM template class, extends @{Core.Fsm#FSM_PROCESS} -- --- ## FSM_ASSIGN state machine: +-- ## ACT_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. -- --- ### FSM_ASSIGN **Events**: +-- ### ACT_ASSIGN **Events**: -- -- These are the events defined in this class: -- @@ -19,7 +19,7 @@ -- * **Assign**: Assign the task. -- * **Reject**: Reject the task.. -- --- ### FSM_ASSIGN **Event methods**: +-- ### ACT_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. -- --- ### FSM_ASSIGN **States**: +-- ### ACT_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. -- --- ### FSM_ASSIGN state transition methods: +-- ### ACT_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) @{#FSM_ASSIGN_ACCEPT} class, extends @{Fsm.Assign#FSM_ASSIGN} +-- # 1) @{#ACT_ASSIGN_ACCEPT} class, extends @{Fsm.Assign#ACT_ASSIGN} -- --- The FSM_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task. +-- The ACT_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task. -- --- ## 1.1) FSM_ASSIGN_ACCEPT constructor: +-- ## 1.1) ACT_ASSIGN_ACCEPT constructor: -- --- * @{#FSM_ASSIGN_ACCEPT.New}(): Creates a new FSM_ASSIGN_ACCEPT object. +-- * @{#ACT_ASSIGN_ACCEPT.New}(): Creates a new ACT_ASSIGN_ACCEPT object. -- -- === -- --- # 2) @{#FSM_ASSIGN_MENU_ACCEPT} class, extends @{Fsm.Assign#FSM_ASSIGN} +-- # 2) @{#ACT_ASSIGN_MENU_ACCEPT} class, extends @{Fsm.Assign#ACT_ASSIGN} -- --- The FSM_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option. +-- The ACT_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) FSM_ASSIGN_MENU_ACCEPT constructor: +-- ## 2.1) ACT_ASSIGN_MENU_ACCEPT constructor: -- ----------------------------------------- -- --- * @{#FSM_ASSIGN_MENU_ACCEPT.New}(): Creates a new FSM_ASSIGN_MENU_ACCEPT object. +-- * @{#ACT_ASSIGN_MENU_ACCEPT.New}(): Creates a new ACT_ASSIGN_MENU_ACCEPT object. -- -- === -- -- @module Assign -do -- FSM_ASSIGN +do -- ACT_ASSIGN - --- FSM_ASSIGN class - -- @type FSM_ASSIGN - -- @field Tasking.Task#TASK_BASE Task + --- ACT_ASSIGN class + -- @type ACT_ASSIGN + -- @field Tasking.Task#TASK Task -- @field Wrapper.Unit#UNIT ProcessUnit -- @field Core.Zone#ZONE_BASE TargetZone - -- @extends Fsm.Fsm#FSM_PROCESS - FSM_ASSIGN = { - ClassName = "FSM_ASSIGN", + -- @extends Core.Fsm#FSM_PROCESS + ACT_ASSIGN = { + ClassName = "ACT_ASSIGN", } --- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted. - -- @param #FSM_ASSIGN self - -- @return #FSM_ASSIGN The task acceptance process. - function FSM_ASSIGN:New() + -- @param #ACT_ASSIGN self + -- @return #ACT_ASSIGN The task acceptance process. + function ACT_ASSIGN:New() -- Inherits from BASE - local self = BASE:Inherit( self, FSM_PROCESS:New( "FSM_ASSIGN" ) ) -- Fsm.Fsm#FSM_PROCESS + local self = BASE:Inherit( self, FSM_PROCESS:New( "ACT_ASSIGN" ) ) -- Core.Fsm#FSM_PROCESS self:AddTransition( "UnAssigned", "Start", "Waiting" ) self:AddTransition( "Waiting", "Assign", "Assigned" ) @@ -115,59 +115,59 @@ do -- FSM_ASSIGN return self end -end -- FSM_ASSIGN +end -- ACT_ASSIGN -do -- FSM_ASSIGN_ACCEPT +do -- ACT_ASSIGN_ACCEPT - --- FSM_ASSIGN_ACCEPT class - -- @type FSM_ASSIGN_ACCEPT - -- @field Tasking.Task#TASK_BASE Task + --- ACT_ASSIGN_ACCEPT class + -- @type ACT_ASSIGN_ACCEPT + -- @field Tasking.Task#TASK Task -- @field Wrapper.Unit#UNIT ProcessUnit -- @field Core.Zone#ZONE_BASE TargetZone - -- @extends #FSM_ASSIGN - FSM_ASSIGN_ACCEPT = { - ClassName = "FSM_ASSIGN_ACCEPT", + -- @extends #ACT_ASSIGN + ACT_ASSIGN_ACCEPT = { + ClassName = "ACT_ASSIGN_ACCEPT", } --- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted. - -- @param #FSM_ASSIGN_ACCEPT self + -- @param #ACT_ASSIGN_ACCEPT self -- @param #string TaskBriefing - function FSM_ASSIGN_ACCEPT:New( TaskBriefing ) + function ACT_ASSIGN_ACCEPT:New( TaskBriefing ) - local self = BASE:Inherit( self, FSM_ASSIGN:New() ) -- #FSM_ASSIGN_ACCEPT + local self = BASE:Inherit( self, ACT_ASSIGN:New() ) -- #ACT_ASSIGN_ACCEPT self.TaskBriefing = TaskBriefing return self end - function FSM_ASSIGN_ACCEPT:Init( FsmAssign ) + function ACT_ASSIGN_ACCEPT:Init( FsmAssign ) self.TaskBriefing = FsmAssign.TaskBriefing end --- StateMachine callback function - -- @param #FSM_ASSIGN_ACCEPT self + -- @param #ACT_ASSIGN_ACCEPT self -- @param Wrapper.Unit#UNIT ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To ) + function ACT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To ) self:E( { ProcessUnit, Event, From, To } ) self:__Assign( 1 ) end --- StateMachine callback function - -- @param #FSM_ASSIGN_ACCEPT self + -- @param #ACT_ASSIGN_ACCEPT self -- @param Wrapper.Unit#UNIT ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, Event, From, To ) + function ACT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, Event, From, To ) env.info( "in here" ) self:E( { ProcessUnit, Event, From, To } ) @@ -178,30 +178,30 @@ do -- FSM_ASSIGN_ACCEPT self.Task:Assign() end -end -- FSM_ASSIGN_ACCEPT +end -- ACT_ASSIGN_ACCEPT -do -- FSM_ASSIGN_MENU_ACCEPT +do -- ACT_ASSIGN_MENU_ACCEPT - --- FSM_ASSIGN_MENU_ACCEPT class - -- @type FSM_ASSIGN_MENU_ACCEPT - -- @field Tasking.Task#TASK_BASE Task + --- ACT_ASSIGN_MENU_ACCEPT class + -- @type ACT_ASSIGN_MENU_ACCEPT + -- @field Tasking.Task#TASK Task -- @field Wrapper.Unit#UNIT ProcessUnit -- @field Core.Zone#ZONE_BASE TargetZone - -- @extends #FSM_ASSIGN - FSM_ASSIGN_MENU_ACCEPT = { - ClassName = "FSM_ASSIGN_MENU_ACCEPT", + -- @extends #ACT_ASSIGN + ACT_ASSIGN_MENU_ACCEPT = { + ClassName = "ACT_ASSIGN_MENU_ACCEPT", } --- Init. - -- @param #FSM_ASSIGN_MENU_ACCEPT self + -- @param #ACT_ASSIGN_MENU_ACCEPT self -- @param #string TaskName -- @param #string TaskBriefing - -- @return #FSM_ASSIGN_MENU_ACCEPT self - function FSM_ASSIGN_MENU_ACCEPT:New( TaskName, TaskBriefing ) + -- @return #ACT_ASSIGN_MENU_ACCEPT self + function ACT_ASSIGN_MENU_ACCEPT:New( TaskName, TaskBriefing ) -- Inherits from BASE - local self = BASE:Inherit( self, FSM_ASSIGN:New() ) -- #FSM_ASSIGN_MENU_ACCEPT + local self = BASE:Inherit( self, ACT_ASSIGN:New() ) -- #ACT_ASSIGN_MENU_ACCEPT self.TaskName = TaskName self.TaskBriefing = TaskBriefing @@ -209,7 +209,7 @@ do -- FSM_ASSIGN_MENU_ACCEPT return self end - function FSM_ASSIGN_MENU_ACCEPT:Init( FsmAssign ) + function ACT_ASSIGN_MENU_ACCEPT:Init( FsmAssign ) self.TaskName = FsmAssign.TaskName self.TaskBriefing = FsmAssign.TaskBriefing @@ -217,11 +217,11 @@ do -- FSM_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. - -- @param #FSM_ASSIGN_MENU_ACCEPT self + -- @param #ACT_ASSIGN_MENU_ACCEPT self -- @param #string TaskName -- @param #string TaskBriefing - -- @return #FSM_ASSIGN_MENU_ACCEPT self - function FSM_ASSIGN_MENU_ACCEPT:Init( TaskName, TaskBriefing ) + -- @return #ACT_ASSIGN_MENU_ACCEPT self + function ACT_ASSIGN_MENU_ACCEPT:Init( TaskName, TaskBriefing ) self.TaskBriefing = TaskBriefing self.TaskName = TaskName @@ -230,12 +230,12 @@ do -- FSM_ASSIGN_MENU_ACCEPT end --- StateMachine callback function - -- @param #FSM_ASSIGN_MENU_ACCEPT self + -- @param #ACT_ASSIGN_MENU_ACCEPT self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To ) + function ACT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To ) self:E( { ProcessUnit, Event, From, To } ) self:Message( "Access the radio menu to accept the task. You have 30 seconds or the assignment will be cancelled." ) @@ -248,40 +248,40 @@ do -- FSM_ASSIGN_MENU_ACCEPT end --- Menu function. - -- @param #FSM_ASSIGN_MENU_ACCEPT self - function FSM_ASSIGN_MENU_ACCEPT:MenuAssign() + -- @param #ACT_ASSIGN_MENU_ACCEPT self + function ACT_ASSIGN_MENU_ACCEPT:MenuAssign() self:E( ) self:__Assign( 1 ) end --- Menu function. - -- @param #FSM_ASSIGN_MENU_ACCEPT self - function FSM_ASSIGN_MENU_ACCEPT:MenuReject() + -- @param #ACT_ASSIGN_MENU_ACCEPT self + function ACT_ASSIGN_MENU_ACCEPT:MenuReject() self:E( ) self:__Reject( 1 ) end --- StateMachine callback function - -- @param #FSM_ASSIGN_MENU_ACCEPT self + -- @param #ACT_ASSIGN_MENU_ACCEPT self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To ) + function ACT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To ) self:E( { ProcessUnit.UnitNameEvent, From, To } ) self.Menu:Remove() end --- StateMachine callback function - -- @param #FSM_ASSIGN_MENU_ACCEPT self + -- @param #ACT_ASSIGN_MENU_ACCEPT self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To ) + function ACT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To ) self:E( { ProcessUnit.UnitName, Event, From, To } ) self.Menu:Remove() @@ -290,4 +290,4 @@ do -- FSM_ASSIGN_MENU_ACCEPT ProcessUnit:Destroy() end -end -- FSM_ASSIGN_MENU_ACCEPT +end -- ACT_ASSIGN_MENU_ACCEPT diff --git a/Moose Development/Moose/Fsm/FsmSmoke.lua b/Moose Development/Moose/Actions/Act_Assist.lua similarity index 77% rename from Moose Development/Moose/Fsm/FsmSmoke.lua rename to Moose Development/Moose/Actions/Act_Assist.lua index dedbe5e84..105a22bd4 100644 --- a/Moose Development/Moose/Fsm/FsmSmoke.lua +++ b/Moose Development/Moose/Actions/Act_Assist.lua @@ -2,23 +2,23 @@ -- -- === -- --- # @{#FSM_SMOKE} FSM class, extends @{Fsm.Fsm#FSM_PROCESS} +-- # @{#ACT_ASSIST} FSM class, extends @{Core.Fsm#FSM_PROCESS} -- --- ## FSM_SMOKE state machine: +-- ## ACT_ASSIST 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. -- --- ### FSM_SMOKE **Events**: +-- ### ACT_ASSIST **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. -- --- ### FSM_SMOKE **Event methods**: +-- ### ACT_ASSIST **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. -- --- ### FSM_SMOKE **States**: +-- ### ACT_ASSIST **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. -- --- ### FSM_SMOKE state transition methods: +-- ### ACT_ASSIST 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) @{#FSM_SMOKE_TARGETS_ZONE} class, extends @{Fsm.Route#FSM_SMOKE} +-- # 1) @{#ACT_ASSIST_SMOKE_TARGETS_ZONE} class, extends @{Fsm.Route#ACT_ASSIST} -- --- The FSM_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Zone}. +-- The ACT_ASSIST_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) FSM_SMOKE_TARGETS_ZONE constructor: +-- # 1.1) ACT_ASSIST_SMOKE_TARGETS_ZONE constructor: -- --- * @{#FSM_SMOKE_TARGETS_ZONE.New}(): Creates a new FSM_SMOKE_TARGETS_ZONE object. +-- * @{#ACT_ASSIST_SMOKE_TARGETS_ZONE.New}(): Creates a new ACT_ASSIST_SMOKE_TARGETS_ZONE object. -- -- === -- -- @module Smoke -do -- FSM_SMOKE +do -- ACT_ASSIST - --- FSM_SMOKE class - -- @type FSM_SMOKE - -- @extends Fsm.Fsm#FSM_PROCESS - FSM_SMOKE = { - ClassName = "FSM_SMOKE", + --- ACT_ASSIST class + -- @type ACT_ASSIST + -- @extends Core.Fsm#FSM_PROCESS + ACT_ASSIST = { + ClassName = "ACT_ASSIST", } --- 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 #FSM_SMOKE self - -- @return #FSM_SMOKE - function FSM_SMOKE:New() + -- @param #ACT_ASSIST self + -- @return #ACT_ASSIST + function ACT_ASSIST:New() -- Inherits from BASE - local self = BASE:Inherit( self, FSM_PROCESS:New( "FSM_SMOKE" ) ) -- Fsm.Fsm#FSM_PROCESS + local self = BASE:Inherit( self, FSM_PROCESS:New( "ACT_ASSIST" ) ) -- Core.Fsm#FSM_PROCESS self:AddTransition( "None", "Start", "AwaitSmoke" ) self:AddTransition( "AwaitSmoke", "Next", "Smoking" ) @@ -100,12 +100,12 @@ do -- FSM_SMOKE --- Task Events --- StateMachine callback function - -- @param #FSM_SMOKE self + -- @param #ACT_ASSIST self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_SMOKE:onafterStart( ProcessUnit, Event, From, To ) + function ACT_ASSIST:onafterStart( ProcessUnit, Event, From, To ) local ProcessGroup = ProcessUnit:GetGroup() local MissionMenu = self:GetMission():GetMissionMenu( ProcessGroup ) @@ -128,18 +128,18 @@ do -- FSM_SMOKE end -do -- FSM_SMOKE_TARGETS_ZONE +do -- ACT_ASSIST_SMOKE_TARGETS_ZONE - --- FSM_SMOKE_TARGETS_ZONE class - -- @type FSM_SMOKE_TARGETS_ZONE + --- ACT_ASSIST_SMOKE_TARGETS_ZONE class + -- @type ACT_ASSIST_SMOKE_TARGETS_ZONE -- @field Set#SET_UNIT TargetSetUnit -- @field Core.Zone#ZONE_BASE TargetZone - -- @extends #FSM_SMOKE - FSM_SMOKE_TARGETS_ZONE = { - ClassName = "FSM_SMOKE_TARGETS_ZONE", + -- @extends #ACT_ASSIST + ACT_ASSIST_SMOKE_TARGETS_ZONE = { + ClassName = "ACT_ASSIST_SMOKE_TARGETS_ZONE", } --- function FSM_SMOKE_TARGETS_ZONE:_Destructor() +-- function ACT_ASSIST_SMOKE_TARGETS_ZONE:_Destructor() -- self:E("_Destructor") -- -- self.Menu:Remove() @@ -147,11 +147,11 @@ do -- FSM_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 #FSM_SMOKE_TARGETS_ZONE self + -- @param #ACT_ASSIST_SMOKE_TARGETS_ZONE self -- @param Set#SET_UNIT TargetSetUnit -- @param Core.Zone#ZONE_BASE TargetZone - function FSM_SMOKE_TARGETS_ZONE:New( TargetSetUnit, TargetZone ) - local self = BASE:Inherit( self, FSM_SMOKE:New() ) -- #FSM_SMOKE + function ACT_ASSIST_SMOKE_TARGETS_ZONE:New( TargetSetUnit, TargetZone ) + local self = BASE:Inherit( self, ACT_ASSIST:New() ) -- #ACT_ASSIST self.TargetSetUnit = TargetSetUnit self.TargetZone = TargetZone @@ -159,18 +159,18 @@ do -- FSM_SMOKE_TARGETS_ZONE return self end - function FSM_SMOKE_TARGETS_ZONE:Init( FsmSmoke ) + function ACT_ASSIST_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 #FSM_SMOKE_TARGETS_ZONE self + -- @param #ACT_ASSIST_SMOKE_TARGETS_ZONE self -- @param Set#SET_UNIT TargetSetUnit -- @param Core.Zone#ZONE_BASE TargetZone - -- @return #FSM_SMOKE_TARGETS_ZONE self - function FSM_SMOKE_TARGETS_ZONE:Init( TargetSetUnit, TargetZone ) + -- @return #ACT_ASSIST_SMOKE_TARGETS_ZONE self + function ACT_ASSIST_SMOKE_TARGETS_ZONE:Init( TargetSetUnit, TargetZone ) self.TargetSetUnit = TargetSetUnit self.TargetZone = TargetZone @@ -179,12 +179,12 @@ do -- FSM_SMOKE_TARGETS_ZONE end --- StateMachine callback function - -- @param #FSM_SMOKE_TARGETS_ZONE self + -- @param #ACT_ASSIST_SMOKE_TARGETS_ZONE self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To ) + function ACT_ASSIST_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To ) self.TargetSetUnit:ForEachUnit( --- @param Wrapper.Unit#UNIT SmokeUnit diff --git a/Moose Development/Moose/Fsm/Process_JTAC.lua b/Moose Development/Moose/Actions/Act_JTAC.lua similarity index 96% rename from Moose Development/Moose/Fsm/Process_JTAC.lua rename to Moose Development/Moose/Actions/Act_JTAC.lua index e1a8bcc44..592ee5e7e 100644 --- a/Moose Development/Moose/Fsm/Process_JTAC.lua +++ b/Moose Development/Moose/Actions/Act_JTAC.lua @@ -4,7 +4,7 @@ -- @type PROCESS_JTAC -- @field Wrapper.Unit#UNIT ProcessUnit -- @field Core.Set#SET_UNIT TargetSetUnit --- @extends Fsm.Fsm#FSM_PROCESS +-- @extends Core.Fsm#FSM_PROCESS PROCESS_JTAC = { ClassName = "PROCESS_JTAC", Fsm = {}, @@ -66,7 +66,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_JTAC self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -77,7 +77,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_JTAC self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -123,7 +123,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_JTAC self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -147,7 +147,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_JTAC self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -174,7 +174,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_JTAC self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To diff --git a/Moose Development/Moose/Fsm/Process_Pickup.lua b/Moose Development/Moose/Actions/Act_Pickup.lua similarity index 94% rename from Moose Development/Moose/Fsm/Process_Pickup.lua rename to Moose Development/Moose/Actions/Act_Pickup.lua index 846aacf8e..ca79ccfdc 100644 --- a/Moose Development/Moose/Fsm/Process_Pickup.lua +++ b/Moose Development/Moose/Actions/Act_Pickup.lua @@ -4,7 +4,7 @@ -- @type PROCESS_PICKUP -- @field Wrapper.Unit#UNIT ProcessUnit -- @field Core.Set#SET_UNIT TargetSetUnit --- @extends Fsm.Fsm#FSM_PROCESS +-- @extends Core.Fsm#FSM_PROCESS PROCESS_PICKUP = { ClassName = "PROCESS_PICKUP", Fsm = {}, @@ -57,7 +57,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_PICKUP self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -68,7 +68,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_PICKUP self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -89,7 +89,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_PICKUP self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -115,7 +115,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_PICKUP self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -126,7 +126,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_PICKUP self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -139,7 +139,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_PICKUP self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -151,7 +151,7 @@ end --- StateMachine callback function for a PROCESS -- @param #PROCESS_PICKUP self --- @param Fsm.Fsm#FSM_PROCESS Fsm +-- @param Core.Fsm#FSM_PROCESS Fsm -- @param #string Event -- @param #string From -- @param #string To diff --git a/Moose Development/Moose/Fsm/FsmRoute.lua b/Moose Development/Moose/Actions/Act_Route.lua similarity index 82% rename from Moose Development/Moose/Fsm/FsmRoute.lua rename to Moose Development/Moose/Actions/Act_Route.lua index 742138174..d2598b6c2 100644 --- a/Moose Development/Moose/Fsm/FsmRoute.lua +++ b/Moose Development/Moose/Actions/Act_Route.lua @@ -2,16 +2,16 @@ -- -- === -- --- # @{#FSM_ROUTE} FSM class, extends @{Fsm.Fsm#FSM_PROCESS} +-- # @{#ACT_ROUTE} FSM class, extends @{Core.Fsm#FSM_PROCESS} -- --- ## FSM_ROUTE state machine: +-- ## ACT_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. -- --- ### FSM_ROUTE **Events**: +-- ### ACT_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. -- --- ### FSM_ROUTE **Event methods**: +-- ### ACT_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. -- --- ### FSM_ROUTE **States**: +-- ### ACT_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. -- --- ### FSM_ROUTE state transition methods: +-- ### ACT_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) @{#FSM_ROUTE_ZONE} class, extends @{Fsm.Route#FSM_ROUTE} +-- # 1) @{#ACT_ROUTE_ZONE} class, extends @{Fsm.Route#ACT_ROUTE} -- --- The FSM_ROUTE_ZONE class implements the core functions to route an AIR @{Controllable} player @{Unit} to a @{Zone}. +-- The ACT_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) FSM_ROUTE_ZONE constructor: +-- # 1.1) ACT_ROUTE_ZONE constructor: -- --- * @{#FSM_ROUTE_ZONE.New}(): Creates a new FSM_ROUTE_ZONE object. +-- * @{#ACT_ROUTE_ZONE.New}(): Creates a new ACT_ROUTE_ZONE object. -- -- === -- -- @module Route -do -- FSM_ROUTE +do -- ACT_ROUTE - --- FSM_ROUTE class - -- @type FSM_ROUTE + --- ACT_ROUTE class + -- @type ACT_ROUTE -- @field Tasking.Task#TASK TASK -- @field Wrapper.Unit#UNIT ProcessUnit -- @field Core.Zone#ZONE_BASE TargetZone - -- @extends Fsm.Fsm#FSM_PROCESS - FSM_ROUTE = { - ClassName = "FSM_ROUTE", + -- @extends Core.Fsm#FSM_PROCESS + ACT_ROUTE = { + ClassName = "ACT_ROUTE", } --- Creates a new routing state machine. The process will route a CLIENT to a ZONE until the CLIENT is within that ZONE. - -- @param #FSM_ROUTE self - -- @return #FSM_ROUTE self - function FSM_ROUTE:New() + -- @param #ACT_ROUTE self + -- @return #ACT_ROUTE self + function ACT_ROUTE:New() -- Inherits from BASE - local self = BASE:Inherit( self, FSM_PROCESS:New( "FSM_ROUTE" ) ) -- Fsm.Fsm#FSM_PROCESS + local self = BASE:Inherit( self, FSM_PROCESS:New( "ACT_ROUTE" ) ) -- Core.Fsm#FSM_PROCESS self:AddTransition( "None", "Start", "Routing" ) self:AddTransition( "*", "Report", "Reporting" ) @@ -118,32 +118,32 @@ do -- FSM_ROUTE --- Task Events --- StateMachine callback function - -- @param #FSM_ROUTE self + -- @param #ACT_ROUTE self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ROUTE:onafterStart( ProcessUnit, Event, From, To ) + function ACT_ROUTE:onafterStart( ProcessUnit, Event, From, To ) self:__Route( 1 ) end --- Check if the controllable has arrived. - -- @param #FSM_ROUTE self + -- @param #ACT_ROUTE self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @return #boolean - function FSM_ROUTE:onfuncHasArrived( ProcessUnit ) + function ACT_ROUTE:onfuncHasArrived( ProcessUnit ) return false end --- StateMachine callback function - -- @param #FSM_ROUTE self + -- @param #ACT_ROUTE self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ROUTE:onbeforeRoute( ProcessUnit, Event, From, To ) + function ACT_ROUTE:onbeforeRoute( ProcessUnit, Event, From, To ) if ProcessUnit:IsAlive() then local HasArrived = self:onfuncHasArrived( ProcessUnit ) -- Polymorphic @@ -172,28 +172,28 @@ do -- FSM_ROUTE end -end -- FSM_ROUTE +end -- ACT_ROUTE -do -- FSM_ROUTE_ZONE +do -- ACT_ROUTE_ZONE - --- FSM_ROUTE_ZONE class - -- @type FSM_ROUTE_ZONE + --- ACT_ROUTE_ZONE class + -- @type ACT_ROUTE_ZONE -- @field Tasking.Task#TASK TASK -- @field Wrapper.Unit#UNIT ProcessUnit -- @field Core.Zone#ZONE_BASE TargetZone - -- @extends #FSM_ROUTE - FSM_ROUTE_ZONE = { - ClassName = "FSM_ROUTE_ZONE", + -- @extends #ACT_ROUTE + ACT_ROUTE_ZONE = { + ClassName = "ACT_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 #FSM_ROUTE_ZONE self + -- @param #ACT_ROUTE_ZONE self -- @param Core.Zone#ZONE_BASE TargetZone - function FSM_ROUTE_ZONE:New( TargetZone ) - local self = BASE:Inherit( self, FSM_ROUTE:New() ) -- #FSM_ROUTE_ZONE + function ACT_ROUTE_ZONE:New( TargetZone ) + local self = BASE:Inherit( self, ACT_ROUTE:New() ) -- #ACT_ROUTE_ZONE self.TargetZone = TargetZone @@ -205,7 +205,7 @@ do -- FSM_ROUTE_ZONE return self end - function FSM_ROUTE_ZONE:Init( FsmRoute ) + function ACT_ROUTE_ZONE:Init( FsmRoute ) self.TargetZone = FsmRoute.TargetZone self.DisplayInterval = 30 @@ -215,10 +215,10 @@ do -- FSM_ROUTE_ZONE end --- Method override to check if the controllable has arrived. - -- @param #FSM_ROUTE self + -- @param #ACT_ROUTE self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @return #boolean - function FSM_ROUTE_ZONE:onfuncHasArrived( ProcessUnit ) + function ACT_ROUTE_ZONE:onfuncHasArrived( ProcessUnit ) if ProcessUnit:IsInZone( self.TargetZone ) then local RouteText = "You have arrived within the zone." @@ -231,12 +231,12 @@ do -- FSM_ROUTE_ZONE --- Task Events --- StateMachine callback function - -- @param #FSM_ROUTE_ZONE self + -- @param #ACT_ROUTE_ZONE self -- @param Wrapper.Controllable#CONTROLLABLE ProcessUnit -- @param #string Event -- @param #string From -- @param #string To - function FSM_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To ) + function ACT_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To ) local ZoneVec2 = self.TargetZone:GetVec2() local ZonePointVec2 = POINT_VEC2:New( ZoneVec2.x, ZoneVec2.y ) @@ -246,4 +246,4 @@ do -- FSM_ROUTE_ZONE self:Message( RouteText ) end -end -- FSM_ROUTE_ZONE +end -- ACT_ROUTE_ZONE diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index ebbfb67dd..e0cfd57ae 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -90,24 +90,6 @@ FORMATION = { ---- The base constructor. This is the top top class of all classed defined within the MOOSE. --- Any new class needs to be derived from this class for proper inheritance. --- @param #BASE self --- @return #BASE The new instance of the BASE class. --- @usage --- -- This declares the constructor of the class TASK, inheriting from BASE. --- --- TASK constructor --- -- @param #TASK self --- -- @param Parameter The parameter of the New constructor. --- -- @return #TASK self --- function TASK:New( Parameter ) --- --- local self = BASE:Inherit( self, BASE:New() ) --- --- self.Variable = Parameter --- --- return self --- end -- @todo need to investigate if the deepCopy is really needed... Don't think so. function BASE:New() local self = routines.utils.deepCopy( self ) -- Create a new self instance diff --git a/Moose Development/Moose/Fsm/Fsm.lua b/Moose Development/Moose/Core/Fsm.lua similarity index 96% rename from Moose Development/Moose/Fsm/Fsm.lua rename to Moose Development/Moose/Core/Fsm.lua index 4ed84e5b7..ee4563e39 100644 --- a/Moose Development/Moose/Fsm/Fsm.lua +++ b/Moose Development/Moose/Core/Fsm.lua @@ -85,7 +85,7 @@ do -- FSM end --- Set the default @{Process} template with key ProcessName providing the ProcessClass and the process object when it is assigned to a @{Controllable} by the task. - -- @return Fsm.Fsm#FSM_PROCESS + -- @return Core.Fsm#FSM_PROCESS function FSM:AddProcess( From, Event, Process, ReturnEvents ) self:E( { From, Event, Process, ReturnEvents } ) @@ -386,7 +386,7 @@ do -- FSM_CONTROLLABLE --- FSM_CONTROLLABLE class -- @type FSM_CONTROLLABLE -- @field Wrapper.Controllable#CONTROLLABLE Controllable - -- @extends Fsm.Fsm#FSM + -- @extends Core.Fsm#FSM FSM_CONTROLLABLE = { ClassName = "FSM_CONTROLLABLE", } @@ -399,7 +399,7 @@ do -- FSM_CONTROLLABLE function FSM_CONTROLLABLE:New( FSMT, Controllable ) -- Inherits from BASE - local self = BASE:Inherit( self, FSM:New( FSMT ) ) -- Fsm.Fsm#FSM_CONTROLLABLE + local self = BASE:Inherit( self, FSM:New( FSMT ) ) -- Core.Fsm#FSM_CONTROLLABLE if Controllable then self:SetControllable( Controllable ) @@ -449,8 +449,8 @@ do -- FSM_PROCESS --- FSM_PROCESS class -- @type FSM_PROCESS - -- @field Tasking.Task#TASK_BASE Task - -- @extends Fsm.Fsm#FSM_CONTROLLABLE + -- @field Tasking.Task#TASK Task + -- @extends Core.Fsm#FSM_CONTROLLABLE FSM_PROCESS = { ClassName = "FSM_PROCESS", } @@ -460,7 +460,7 @@ do -- FSM_PROCESS -- @return #FSM_PROCESS function FSM_PROCESS:New( Controllable, Task ) - local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- Fsm.Fsm#FSM_PROCESS + local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- Core.Fsm#FSM_PROCESS self:F( Controllable, Task ) @@ -479,7 +479,7 @@ do -- FSM_PROCESS function FSM_PROCESS:Copy( Controllable, Task ) self:E( { self:GetClassNameAndID() } ) - local NewFsm = self:New( Controllable, Task ) -- Fsm.Fsm#FSM_PROCESS + local NewFsm = self:New( Controllable, Task ) -- Core.Fsm#FSM_PROCESS NewFsm:Assign( Controllable, Task ) @@ -517,7 +517,7 @@ do -- FSM_PROCESS --- Sets the task of the process. -- @param #FSM_PROCESS self - -- @param Tasking.Task#TASK_BASE Task + -- @param Tasking.Task#TASK Task -- @return #FSM_PROCESS function FSM_PROCESS:SetTask( Task ) @@ -528,7 +528,7 @@ do -- FSM_PROCESS --- Gets the task of the process. -- @param #FSM_PROCESS self - -- @return Tasking.Task#TASK_BASE + -- @return Tasking.Task#TASK function FSM_PROCESS:GetTask() return self.Task @@ -566,7 +566,7 @@ end --- Assign the process to a @{Unit} and activate the process. -- @param #FSM_PROCESS self - -- @param Task.Tasking#TASK_BASE Task + -- @param Task.Tasking#TASK Task -- @param Wrapper.Unit#UNIT ProcessUnit -- @return #FSM_PROCESS self function FSM_PROCESS:Assign( ProcessUnit, Task ) @@ -645,8 +645,8 @@ do -- FSM_TASK --- FSM_TASK class -- @type FSM_TASK - -- @field Tasking.Task#TASK_BASE Task - -- @extends Fsm.Fsm#FSM + -- @field Tasking.Task#TASK Task + -- @extends Core.Fsm#FSM FSM_TASK = { ClassName = "FSM_TASK", } @@ -654,12 +654,12 @@ do -- FSM_TASK --- Creates a new FSM_TASK object. -- @param #FSM_TASK self -- @param #table FSMT - -- @param Tasking.Task#TASK_BASE Task + -- @param Tasking.Task#TASK Task -- @param Wrapper.Unit#UNIT TaskUnit -- @return #FSM_TASK function FSM_TASK:New( FSMT ) - local self = BASE:Inherit( self, FSM_CONTROLLABLE:New( FSMT ) ) -- Fsm.Fsm#FSM_TASK + local self = BASE:Inherit( self, FSM_CONTROLLABLE:New( FSMT ) ) -- Core.Fsm#FSM_TASK self["onstatechange"] = self.OnStateChange @@ -680,7 +680,7 @@ do -- FSM_SET --- FSM_SET class -- @type FSM_SET -- @field Core.Set#SET_BASE Set - -- @extends Fsm.Fsm#FSM + -- @extends Core.Fsm#FSM FSM_SET = { ClassName = "FSM_SET", } @@ -693,7 +693,7 @@ do -- FSM_SET function FSM_SET:New( FSMSet ) -- Inherits from BASE - local self = BASE:Inherit( self, FSM:New() ) -- Fsm.Fsm#FSM_SET + local self = BASE:Inherit( self, FSM:New() ) -- Core.Fsm#FSM_SET if FSMSet then self:Set( FSMSet ) diff --git a/Moose Development/Moose/Fsm/Process.lua b/Moose Development/Moose/Fsm/Process.lua deleted file mode 100644 index 0774d0f57..000000000 --- a/Moose Development/Moose/Fsm/Process.lua +++ /dev/null @@ -1,45 +0,0 @@ ---- @module Process - ---- The PROCESS class --- @type PROCESS --- @field Tasking.Task#TASK_BASE ProcessTask --- @field Wrapper.Group#GROUP ProcessGroup --- @field Core.Menu#MENU_GROUP MissionMenu --- @field #string ProcessName --- @extends Fsm.Fsm#FSM_CONTROLLABLE -PROCESS = { - ClassName = "PROCESS", - NextEvent = nil, - Scores = {}, -} - ---- Instantiates a new TASK Base. Should never be used. Interface Class. --- @param #PROCESS self --- @param #string ProcessName --- @param Wrapper.Unit#UNIT ProcessUnit (Optional) If provided, it defines the UNIT for which the process is running. --- @return #PROCESS -function PROCESS:New( FSMT, ProcessName, ProcessUnit ) - local self = BASE:Inherit( self, FSM_PROCESS:New( FSMT, ProcessUnit ) ) - self:F() - - if ProcessUnit then - self.ProcessGroup = ProcessUnit:GetGroup() - end - - --self.MissionMenu = Task.Mission:GetMissionMenu( self.ProcessGroup ) - self.ProcessName = ProcessName - - - return self -end - ---- Gets the Group of the process. --- @param #PROCESS self --- @return Wrapper.Group#GROUP -function PROCESS:GetGroup() - - return self.ProcessGroup -end - - - diff --git a/Moose Development/Moose/Moose.lua b/Moose Development/Moose/Moose.lua index 3dc6792af..0c176de88 100644 --- a/Moose Development/Moose/Moose.lua +++ b/Moose Development/Moose/Moose.lua @@ -15,6 +15,7 @@ Include.File( "Core/Database" ) Include.File( "Core/Set" ) Include.File( "Core/Point" ) Include.File( "Core/Message" ) +Include.File( "Core/Fsm" ) --- Wrapper Classes Include.File( "Wrapper/Object" ) @@ -37,18 +38,17 @@ Include.File( "Functional/Escort" ) Include.File( "Functional/MissileTrainer" ) Include.File( "Functional/AirbasePolice" ) Include.File( "Functional/Detection" ) -Include.File( "Functional/AIBalancer" ) + +--- AI Classes +Include.File( "AI/AI_Balancer" ) +Include.File( "AI/AI_Patrol" ) +Include.File( "AI/AI_Cargo" ) --- Fsm Classes -Include.File( "Fsm/Fsm" ) -Include.File( "Fsm/Process" ) -Include.File( "Fsm/Process_JTAC" ) -Include.File( "Fsm/Patrol" ) -Include.File( "Fsm/Cargo" ) -Include.File( "Fsm/FsmAssign" ) -Include.File( "Fsm/FsmRoute" ) -Include.File( "Fsm/FsmAccount" ) -Include.File( "Fsm/FsmSmoke" ) +Include.File( "Actions/Act_Assign" ) +Include.File( "Actions/Act_Route" ) +Include.File( "Actions/Act_Account" ) +Include.File( "Actions/Act_Smoke" ) --- Task Handling Classes Include.File( "Tasking/CommandCenter" ) diff --git a/Moose Development/Moose/Tasking/CommandCenter.lua b/Moose Development/Moose/Tasking/CommandCenter.lua index 747cadfdb..34a5ffad3 100644 --- a/Moose Development/Moose/Tasking/CommandCenter.lua +++ b/Moose Development/Moose/Tasking/CommandCenter.lua @@ -110,7 +110,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName ) -- The PlayerUnit will be UnAssigned from the Task. -- When there is no Unit left running the Task, the Task goes into Abort... self:EventOnPlayerLeaveUnit( - --- @param #TASK_BASE self + --- @param #TASK self -- @param Core.Event#EVENTDATA EventData function( self, EventData ) local PlayerUnit = EventData.IniUnit @@ -124,7 +124,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName ) -- The PlayerUnit will be UnAssigned from the Task. -- When there is no Unit left running the Task, the Task goes into Abort... self:EventOnCrash( - --- @param #TASK_BASE self + --- @param #TASK self -- @param Core.Event#EVENTDATA EventData function( self, EventData ) local PlayerUnit = EventData.IniUnit diff --git a/Moose Development/Moose/Tasking/DetectionManager.lua b/Moose Development/Moose/Tasking/DetectionManager.lua index 86d1e4435..d40836b6c 100644 --- a/Moose Development/Moose/Tasking/DetectionManager.lua +++ b/Moose Development/Moose/Tasking/DetectionManager.lua @@ -317,7 +317,7 @@ do -- DETECTION_DISPATCHER --- Creates a CAS task when there are targets for it. -- @param #DETECTION_DISPATCHER self -- @param Functional.Detection#DETECTION_AREAS.DetectedArea DetectedArea - -- @return Tasking.Task#TASK_BASE + -- @return Tasking.Task#TASK function DETECTION_DISPATCHER:EvaluateCAS( DetectedArea ) self:F( { DetectedArea.AreaID } ) @@ -345,7 +345,7 @@ do -- DETECTION_DISPATCHER --- Creates a BAI task when there are targets for it. -- @param #DETECTION_DISPATCHER self -- @param Functional.Detection#DETECTION_AREAS.DetectedArea DetectedArea - -- @return Tasking.Task#TASK_BASE + -- @return Tasking.Task#TASK function DETECTION_DISPATCHER:EvaluateBAI( DetectedArea, FriendlyCoalition ) self:F( { DetectedArea.AreaID } ) @@ -374,9 +374,9 @@ do -- DETECTION_DISPATCHER -- Can only occur when the DetectedArea is Changed AND the state of the Task is "Planned". -- @param #DETECTION_DISPATCHER self -- @param Tasking.Mission#MISSION Mission - -- @param Tasking.Task#TASK_BASE Task + -- @param Tasking.Task#TASK Task -- @param Functional.Detection#DETECTION_AREAS.DetectedArea DetectedArea - -- @return Tasking.Task#TASK_BASE + -- @return Tasking.Task#TASK function DETECTION_DISPATCHER:EvaluateRemoveTask( Mission, Task, DetectedArea ) if Task then diff --git a/Moose Development/Moose/Tasking/Mission.lua b/Moose Development/Moose/Tasking/Mission.lua index 2ea3d7638..c0ae13e21 100644 --- a/Moose Development/Moose/Tasking/Mission.lua +++ b/Moose Development/Moose/Tasking/Mission.lua @@ -7,7 +7,7 @@ -- @field #MISSION.Clients _Clients -- @field Core.Menu#MENU_COALITION MissionMenu -- @field #string MissionBriefing --- @extends Fsm.Fsm#FSM +-- @extends Core.Fsm#FSM MISSION = { ClassName = "MISSION", Name = "", @@ -40,7 +40,7 @@ MISSION = { -- @return #MISSION self function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefing, MissionCoalition ) - local self = BASE:Inherit( self, FSM:New() ) -- Fsm.Fsm#FSM + local self = BASE:Inherit( self, FSM:New() ) -- Core.Fsm#FSM self:SetStartState( "Idle" ) @@ -72,7 +72,7 @@ end function MISSION:onbeforeComplete( Event, From, To ) for TaskID, Task in pairs( self:GetTasks() ) do - local Task = Task -- Tasking.Task#TASK_BASE + local Task = Task -- Tasking.Task#TASK if not Task:IsStateSuccess() and not Task:IsStateFailed() and not Task:IsStateAborted() and not Task:IsStateCancelled() then return false -- Mission cannot be completed. Other Tasks are still active. end @@ -110,7 +110,7 @@ function MISSION:JoinUnit( PlayerUnit ) local PlayerUnitAdded = false for TaskID, Task in pairs( self:GetTasks() ) do - local Task = Task -- Tasking.Task#TASK_BASE + local Task = Task -- Tasking.Task#TASK if Task:JoinUnit( PlayerUnit ) then PlayerUnitAdded = true end @@ -184,7 +184,7 @@ function MISSION:GetGroups() local SetGroup = SET_GROUP:New() for TaskID, Task in pairs( self:GetTasks() ) do - local Task = Task -- Tasking.Task#TASK_BASE + local Task = Task -- Tasking.Task#TASK local GroupSet = Task:GetGroups() GroupSet:ForEachGroup( function( TaskGroup ) @@ -205,7 +205,7 @@ function MISSION:SetMenu() self:F() for _, Task in pairs( self:GetTasks() ) do - local Task = Task -- Tasking.Task#TASK_BASE + local Task = Task -- Tasking.Task#TASK Task:SetMenu() end end @@ -220,13 +220,13 @@ end --- Sets the Assigned Task menu. -- @param #MISSION self --- @param Tasking.Task#TASK_BASE Task +-- @param Tasking.Task#TASK Task -- @param #string MenuText The menu text. -- @return #MISSION self function MISSION:SetAssignedMenu( Task ) for _, Task in pairs( self.Tasks ) do - local Task = Task -- Tasking.Task#TASK_BASE + local Task = Task -- Tasking.Task#TASK Task:RemoveMenu() Task:SetAssignedMenu() end @@ -235,7 +235,7 @@ end --- Removes a Task menu. -- @param #MISSION self --- @param Tasking.Task#TASK_BASE Task +-- @param Tasking.Task#TASK Task -- @return #MISSION self function MISSION:RemoveTaskMenu( Task ) @@ -271,7 +271,7 @@ end --- Get the TASK identified by the TaskNumber from the Mission. This function is useful in GoalFunctions. -- @param #string TaskName The Name of the @{Task} within the @{Mission}. --- @return Tasking.Task#TASK_BASE The Task +-- @return Tasking.Task#TASK The Task -- @return #nil Returns nil if no task was found. function MISSION:GetTask( TaskName ) self:F( { TaskName } ) @@ -284,8 +284,8 @@ end -- Note that there can be multiple @{Task}s registered to be completed. -- Each Task can be set a certain Goals. The Mission will not be completed until all Goals are reached. -- @param #MISSION self --- @param Tasking.Task#TASK_BASE Task is the @{Task} object. --- @return Tasking.Task#TASK_BASE The task added. +-- @param Tasking.Task#TASK Task is the @{Task} object. +-- @return Tasking.Task#TASK The task added. function MISSION:AddTask( Task ) local TaskName = Task:GetTaskName() @@ -304,7 +304,7 @@ end -- Note that there can be multiple @{Task}s registered to be completed. -- Each Task can be set a certain Goals. The Mission will not be completed until all Goals are reached. -- @param #MISSION self --- @param Tasking.Task#TASK_BASE Task is the @{Task} object. +-- @param Tasking.Task#TASK Task is the @{Task} object. -- @return #nil The cleaned Task reference. function MISSION:RemoveTask( Task ) @@ -326,8 +326,8 @@ end --- Return the next @{Task} ID to be completed within the @{Mission}. -- @param #MISSION self --- @param Tasking.Task#TASK_BASE Task is the @{Task} object. --- @return Tasking.Task#TASK_BASE The task added. +-- @param Tasking.Task#TASK Task is the @{Task} object. +-- @return Tasking.Task#TASK The task added. function MISSION:GetNextTaskID( Task ) local TaskName = Task:GetTaskName() @@ -413,7 +413,7 @@ function MISSION:HasGroup( TaskGroup ) local Has = false for TaskID, Task in pairs( self:GetTasks() ) do - local Task = Task -- Tasking.Task#TASK_BASE + local Task = Task -- Tasking.Task#TASK if Task:HasGroup( TaskGroup ) then Has = true break @@ -439,7 +439,7 @@ function MISSION:ReportSummary() -- Determine how many tasks are remaining. local TasksRemaining = 0 for TaskID, Task in pairs( self:GetTasks() ) do - local Task = Task -- Tasking.Task#TASK_BASE + local Task = Task -- Tasking.Task#TASK if Task:IsStateSuccess() or Task:IsStateFailed() then else TasksRemaining = TasksRemaining + 1 @@ -469,7 +469,7 @@ function MISSION:ReportOverview() -- Determine how many tasks are remaining. local TasksRemaining = 0 for TaskID, Task in pairs( self:GetTasks() ) do - local Task = Task -- Tasking.Task#TASK_BASE + local Task = Task -- Tasking.Task#TASK Report:Add( "- " .. Task:ReportSummary() ) end @@ -494,7 +494,7 @@ function MISSION:ReportDetails() -- Determine how many tasks are remaining. local TasksRemaining = 0 for TaskID, Task in pairs( self:GetTasks() ) do - local Task = Task -- Tasking.Task#TASK_BASE + local Task = Task -- Tasking.Task#TASK Report:Add( Task:ReportDetails() ) end diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index 55c64ccfe..b5b4fa110 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -1,19 +1,19 @@ ---- This module contains the TASK_BASE class. +--- This module contains the TASK class. -- --- 1) @{#TASK_BASE} class, extends @{Core.Base#BASE} +-- 1) @{#TASK} class, extends @{Core.Base#BASE} -- ============================================ --- 1.1) The @{#TASK_BASE} class implements the methods for task orchestration within MOOSE. +-- 1.1) The @{#TASK} class implements the methods for task orchestration within MOOSE. -- ---------------------------------------------------------------------------------------- -- The class provides a couple of methods to: -- --- * @{#TASK_BASE.AssignToGroup}():Assign a task to a group (of players). --- * @{#TASK_BASE.AddProcess}():Add a @{Process} to a task. --- * @{#TASK_BASE.RemoveProcesses}():Remove a running @{Process} from a running task. --- * @{#TASK_BASE.SetStateMachine}():Set a @{Fsm} to a task. --- * @{#TASK_BASE.RemoveStateMachine}():Remove @{Fsm} from a task. --- * @{#TASK_BASE.HasStateMachine}():Enquire if the task has a @{Fsm} --- * @{#TASK_BASE.AssignToUnit}(): Assign a task to a unit. (Needs to be implemented in the derived classes from @{#TASK_BASE}. --- * @{#TASK_BASE.UnAssignFromUnit}(): Unassign the task from a unit. +-- * @{#TASK.AssignToGroup}():Assign a task to a group (of players). +-- * @{#TASK.AddProcess}():Add a @{Process} to a task. +-- * @{#TASK.RemoveProcesses}():Remove a running @{Process} from a running task. +-- * @{#TASK.SetStateMachine}():Set a @{Fsm} to a task. +-- * @{#TASK.RemoveStateMachine}():Remove @{Fsm} from a task. +-- * @{#TASK.HasStateMachine}():Enquire if the task has a @{Fsm} +-- * @{#TASK.AssignToUnit}(): Assign a task to a unit. (Needs to be implemented in the derived classes from @{#TASK}. +-- * @{#TASK.UnAssignFromUnit}(): Unassign the task from a unit. -- -- 1.2) Set and enquire task status (beyond the task state machine processing). -- ---------------------------------------------------------------------------- @@ -37,7 +37,7 @@ -- 1.3) Add scoring when reaching a certain task status: -- ----------------------------------------------------- -- Upon reaching a certain task status in a task, additional scoring can be given. If the Mission has a scoring system attached, the scores will be added to the mission scoring. --- Use the method @{#TASK_BASE.AddScore}() to add scores when a status is reached. +-- Use the method @{#TASK.AddScore}() to add scores when a status is reached. -- -- 1.4) Task briefing: -- ------------------- @@ -49,17 +49,17 @@ -- -- @module Task ---- The TASK_BASE class --- @type TASK_BASE +--- The TASK class +-- @type TASK -- @field Core.Scheduler#SCHEDULER TaskScheduler -- @field Tasking.Mission#MISSION Mission -- @field Core.Set#SET_GROUP SetGroup The Set of Groups assigned to the Task --- @field Fsm.Fsm#FSM_PROCESS FsmTemplate +-- @field Core.Fsm#FSM_PROCESS FsmTemplate -- @field Tasking.Mission#MISSION Mission -- @field Tasking.CommandCenter#COMMANDCENTER CommandCenter --- @extends Fsm.Fsm#FSM_TASK -TASK_BASE = { - ClassName = "TASK_BASE", +-- @extends Core.Fsm#FSM_TASK +TASK = { + ClassName = "TASK", TaskScheduler = nil, ProcessClasses = {}, -- The container of the Process classes that will be used to create and assign new processes for the task to ProcessUnits. Processes = {}, -- The container of actual process objects instantiated and assigned to ProcessUnits. @@ -72,85 +72,85 @@ TASK_BASE = { CommandCenter = nil, } ---- FSM PlayerAborted event handler prototype for TASK_BASE. --- @function [parent=#TASK_BASE] OnAfterPlayerAborted --- @param #TASK_BASE self +--- FSM PlayerAborted event handler prototype for TASK. +-- @function [parent=#TASK] OnAfterPlayerAborted +-- @param #TASK self -- @param Wrapper.Unit#UNIT PlayerUnit The Unit of the Player when he went back to spectators or left the mission. -- @param #string PlayerName The name of the Player. ---- FSM PlayerCrashed event handler prototype for TASK_BASE. --- @function [parent=#TASK_BASE] OnAfterPlayerCrashed --- @param #TASK_BASE self +--- FSM PlayerCrashed event handler prototype for TASK. +-- @function [parent=#TASK] OnAfterPlayerCrashed +-- @param #TASK self -- @param Wrapper.Unit#UNIT PlayerUnit The Unit of the Player when he crashed in the mission. -- @param #string PlayerName The name of the Player. ---- FSM PlayerDead event handler prototype for TASK_BASE. --- @function [parent=#TASK_BASE] OnAfterPlayerDead --- @param #TASK_BASE self +--- FSM PlayerDead event handler prototype for TASK. +-- @function [parent=#TASK] OnAfterPlayerDead +-- @param #TASK self -- @param Wrapper.Unit#UNIT PlayerUnit The Unit of the Player when he died in the mission. -- @param #string PlayerName The name of the Player. ---- FSM Fail synchronous event function for TASK_BASE. +--- FSM Fail synchronous event function for TASK. -- Use this event to Fail the Task. --- @function [parent=#TASK_BASE] Fail --- @param #TASK_BASE self +-- @function [parent=#TASK] Fail +-- @param #TASK self ---- FSM Fail asynchronous event function for TASK_BASE. +--- FSM Fail asynchronous event function for TASK. -- Use this event to Fail the Task. --- @function [parent=#TASK_BASE] __Fail --- @param #TASK_BASE self +-- @function [parent=#TASK] __Fail +-- @param #TASK self ---- FSM Abort synchronous event function for TASK_BASE. +--- FSM Abort synchronous event function for TASK. -- Use this event to Abort the Task. --- @function [parent=#TASK_BASE] Abort --- @param #TASK_BASE self +-- @function [parent=#TASK] Abort +-- @param #TASK self ---- FSM Abort asynchronous event function for TASK_BASE. +--- FSM Abort asynchronous event function for TASK. -- Use this event to Abort the Task. --- @function [parent=#TASK_BASE] __Abort --- @param #TASK_BASE self +-- @function [parent=#TASK] __Abort +-- @param #TASK self ---- FSM Success synchronous event function for TASK_BASE. +--- FSM Success synchronous event function for TASK. -- Use this event to make the Task a Success. --- @function [parent=#TASK_BASE] Success --- @param #TASK_BASE self +-- @function [parent=#TASK] Success +-- @param #TASK self ---- FSM Success asynchronous event function for TASK_BASE. +--- FSM Success asynchronous event function for TASK. -- Use this event to make the Task a Success. --- @function [parent=#TASK_BASE] __Success --- @param #TASK_BASE self +-- @function [parent=#TASK] __Success +-- @param #TASK self ---- FSM Cancel synchronous event function for TASK_BASE. +--- FSM Cancel synchronous event function for TASK. -- Use this event to Cancel the Task. --- @function [parent=#TASK_BASE] Cancel --- @param #TASK_BASE self +-- @function [parent=#TASK] Cancel +-- @param #TASK self ---- FSM Cancel asynchronous event function for TASK_BASE. +--- FSM Cancel asynchronous event function for TASK. -- Use this event to Cancel the Task. --- @function [parent=#TASK_BASE] __Cancel --- @param #TASK_BASE self +-- @function [parent=#TASK] __Cancel +-- @param #TASK self ---- FSM Replan synchronous event function for TASK_BASE. +--- FSM Replan synchronous event function for TASK. -- Use this event to Replan the Task. --- @function [parent=#TASK_BASE] Replan --- @param #TASK_BASE self +-- @function [parent=#TASK] Replan +-- @param #TASK self ---- FSM Replan asynchronous event function for TASK_BASE. +--- FSM Replan asynchronous event function for TASK. -- Use this event to Replan the Task. --- @function [parent=#TASK_BASE] __Replan --- @param #TASK_BASE self +-- @function [parent=#TASK] __Replan +-- @param #TASK self ---- Instantiates a new TASK_BASE. Should never be used. Interface Class. --- @param #TASK_BASE self +--- Instantiates a new TASK. Should never be used. Interface Class. +-- @param #TASK self -- @param Tasking.Mission#MISSION Mission The mission wherein the Task is registered. -- @param Core.Set#SET_GROUP SetGroupAssign The set of groups for which the Task can be assigned. -- @param #string TaskName The name of the Task -- @param #string TaskType The type of the Task --- @return #TASK_BASE self -function TASK_BASE:New( Mission, SetGroupAssign, TaskName, TaskType ) +-- @return #TASK self +function TASK:New( Mission, SetGroupAssign, TaskName, TaskType ) - local self = BASE:Inherit( self, FSM_TASK:New() ) -- Fsm.Fsm#FSM_TASK + local self = BASE:Inherit( self, FSM_TASK:New() ) -- Core.Fsm#FSM_TASK self:SetStartState( "Planned" ) self:AddTransition( "Planned", "Assign", "Assigned" ) @@ -189,7 +189,7 @@ function TASK_BASE:New( Mission, SetGroupAssign, TaskName, TaskType ) -- The Task is UnAssigned from the Unit. -- When there is no Unit left running the Task, and all of the Players crashed, the Task goes into Failed ... -- self:EventOnCrash( --- --- @param #TASK_BASE self +-- --- @param #TASK self -- -- @param Core.Event#EVENTDATA EventData -- function( self, EventData ) -- self:E( "In LeaveUnit" ) @@ -213,17 +213,17 @@ function TASK_BASE:New( Mission, SetGroupAssign, TaskName, TaskType ) end --- Get the Task FSM Process Template --- @param #TASK_BASE self --- @return Fsm.Fsm#FSM_PROCESS -function TASK_BASE:GetUnitProcess() +-- @param #TASK self +-- @return Core.Fsm#FSM_PROCESS +function TASK:GetUnitProcess() return self.FsmTemplate end --- Sets the Task FSM Process Template --- @param #TASK_BASE self --- @param Fsm.Fsm#FSM_PROCESS -function TASK_BASE:SetUnitProcess( FsmTemplate ) +-- @param #TASK self +-- @param Core.Fsm#FSM_PROCESS +function TASK:SetUnitProcess( FsmTemplate ) self.FsmTemplate = FsmTemplate end @@ -232,10 +232,10 @@ end -- For each Group within the Task, the Unit is check if it can join the Task. -- If the Unit was not part of the Task, false is returned. -- If the Unit is part of the Task, true is returned. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player joining the Mission. -- @return #boolean true if Unit is part of the Task. -function TASK_BASE:JoinUnit( PlayerUnit ) +function TASK:JoinUnit( PlayerUnit ) self:F( { PlayerUnit = PlayerUnit } ) local PlayerUnitAdded = false @@ -268,10 +268,10 @@ end --- Abort a PlayerUnit from a Task. -- If the Unit was not part of the Task, false is returned. -- If the Unit is part of the Task, true is returned. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player aborting the Task. -- @return #boolean true if Unit is part of the Task. -function TASK_BASE:AbortUnit( PlayerUnit ) +function TASK:AbortUnit( PlayerUnit ) self:F( { PlayerUnit = PlayerUnit } ) local PlayerUnitAborted = false @@ -306,10 +306,10 @@ end --- A PlayerUnit crashed in a Task. Abort the Player. -- If the Unit was not part of the Task, false is returned. -- If the Unit is part of the Task, true is returned. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player aborting the Task. -- @return #boolean true if Unit is part of the Task. -function TASK_BASE:CrashUnit( PlayerUnit ) +function TASK:CrashUnit( PlayerUnit ) self:F( { PlayerUnit = PlayerUnit } ) local PlayerUnitCrashed = false @@ -344,28 +344,28 @@ end --- Gets the Mission to where the TASK belongs. --- @param #TASK_BASE self +-- @param #TASK self -- @return Tasking.Mission#MISSION -function TASK_BASE:GetMission() +function TASK:GetMission() return self.Mission end --- Gets the SET_GROUP assigned to the TASK. --- @param #TASK_BASE self +-- @param #TASK self -- @return Core.Set#SET_GROUP -function TASK_BASE:GetGroups() +function TASK:GetGroups() return self.SetGroup end --- Assign the @{Task}to a @{Group}. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Group#GROUP TaskGroup --- @return #TASK_BASE -function TASK_BASE:AssignToGroup( TaskGroup ) +-- @return #TASK +function TASK:AssignToGroup( TaskGroup ) self:F2( TaskGroup:GetName() ) local TaskGroupName = TaskGroup:GetName() @@ -389,10 +389,10 @@ function TASK_BASE:AssignToGroup( TaskGroup ) end --- --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Group#GROUP FindGroup -- @return #boolean -function TASK_BASE:HasGroup( FindGroup ) +function TASK:HasGroup( FindGroup ) self:GetGroups():FilterOnce() -- Ensure that the filter is updated. return self:GetGroups():IsIncludeObject( FindGroup ) @@ -400,16 +400,16 @@ function TASK_BASE:HasGroup( FindGroup ) end --- Assign the @{Task} to an alive @{Unit}. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Unit#UNIT TaskUnit --- @return #TASK_BASE self -function TASK_BASE:AssignToUnit( TaskUnit ) +-- @return #TASK self +function TASK:AssignToUnit( TaskUnit ) self:F( TaskUnit:GetName() ) local FsmTemplate = self:GetUnitProcess() -- Assign a new FsmUnit to TaskUnit. - local FsmUnit = self:SetStateMachine( TaskUnit, FsmTemplate:Copy( TaskUnit, self ) ) -- Fsm.Fsm#FSM_PROCESS + local FsmUnit = self:SetStateMachine( TaskUnit, FsmTemplate:Copy( TaskUnit, self ) ) -- Core.Fsm#FSM_PROCESS self:E({"Address FsmUnit", tostring( FsmUnit ) } ) FsmUnit:SetStartState( "Planned" ) @@ -419,10 +419,10 @@ function TASK_BASE:AssignToUnit( TaskUnit ) end --- UnAssign the @{Task} from an alive @{Unit}. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Unit#UNIT TaskUnit --- @return #TASK_BASE self -function TASK_BASE:UnAssignFromUnit( TaskUnit ) +-- @return #TASK self +function TASK:UnAssignFromUnit( TaskUnit ) self:F( TaskUnit ) self:RemoveStateMachine( TaskUnit ) @@ -431,8 +431,8 @@ function TASK_BASE:UnAssignFromUnit( TaskUnit ) end --- Send a message of the @{Task} to the assigned @{Group}s. --- @param #TASK_BASE self -function TASK_BASE:MessageToGroups( Message ) +-- @param #TASK self +function TASK:MessageToGroups( Message ) self:F( { Message = Message } ) local Mission = self:GetMission() @@ -445,8 +445,8 @@ end --- Send the briefng message of the @{Task} to the assigned @{Group}s. --- @param #TASK_BASE self -function TASK_BASE:SendBriefingToAssignedGroups() +-- @param #TASK self +function TASK:SendBriefingToAssignedGroups() self:F2() for TaskGroupName, TaskGroup in pairs( self.SetGroup:GetSet() ) do @@ -459,8 +459,8 @@ end --- Assign the @{Task} from the @{Group}s. --- @param #TASK_BASE self -function TASK_BASE:UnAssignFromGroups() +-- @param #TASK self +function TASK:UnAssignFromGroups() self:F2() for TaskGroupName, TaskGroup in pairs( self.SetGroup:GetSet() ) do @@ -481,10 +481,10 @@ function TASK_BASE:UnAssignFromGroups() end --- Returns if the @{Task} is assigned to the Group. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Group#GROUP TaskGroup -- @return #boolean -function TASK_BASE:IsAssignedToGroup( TaskGroup ) +function TASK:IsAssignedToGroup( TaskGroup ) local TaskGroupName = TaskGroup:GetName() @@ -498,9 +498,9 @@ function TASK_BASE:IsAssignedToGroup( TaskGroup ) end --- Returns if the @{Task} has still alive and assigned Units. --- @param #TASK_BASE self +-- @param #TASK self -- @return #boolean -function TASK_BASE:HasAliveUnits() +function TASK:HasAliveUnits() self:F() for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do @@ -521,8 +521,8 @@ function TASK_BASE:HasAliveUnits() end --- Set the menu options of the @{Task} to all the groups in the SetGroup. --- @param #TASK_BASE self -function TASK_BASE:SetMenu() +-- @param #TASK self +function TASK:SetMenu() self:F() self.SetGroup:Flush() @@ -536,9 +536,9 @@ end --- Remove the menu options of the @{Task} to all the groups in the SetGroup. --- @param #TASK_BASE self --- @return #TASK_BASE self -function TASK_BASE:RemoveMenu() +-- @param #TASK self +-- @return #TASK self +function TASK:RemoveMenu() for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do self:RemoveMenuForGroup( TaskGroup ) @@ -547,8 +547,8 @@ end --- Set the Menu for a Group --- @param #TASK_BASE self -function TASK_BASE:SetMenuForGroup( TaskGroup ) +-- @param #TASK self +function TASK:SetMenuForGroup( TaskGroup ) if not self:IsAssignedToGroup( TaskGroup ) then self:SetPlannedMenuForGroup( TaskGroup, self:GetTaskName() ) @@ -559,11 +559,11 @@ end --- Set the planned menu option of the @{Task}. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Group#GROUP TaskGroup -- @param #string MenuText The menu text. --- @return #TASK_BASE self -function TASK_BASE:SetPlannedMenuForGroup( TaskGroup, MenuText ) +-- @return #TASK self +function TASK:SetPlannedMenuForGroup( TaskGroup, MenuText ) self:E( TaskGroup:GetName() ) local Mission = self:GetMission() @@ -577,10 +577,10 @@ function TASK_BASE:SetPlannedMenuForGroup( TaskGroup, MenuText ) end --- Set the assigned menu options of the @{Task}. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Group#GROUP TaskGroup --- @return #TASK_BASE self -function TASK_BASE:SetAssignedMenuForGroup( TaskGroup ) +-- @return #TASK self +function TASK:SetAssignedMenuForGroup( TaskGroup ) self:E( TaskGroup:GetName() ) local Mission = self:GetMission() @@ -595,10 +595,10 @@ function TASK_BASE:SetAssignedMenuForGroup( TaskGroup ) end --- Remove the menu option of the @{Task} for a @{Group}. --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Group#GROUP TaskGroup --- @return #TASK_BASE self -function TASK_BASE:RemoveMenuForGroup( TaskGroup ) +-- @return #TASK self +function TASK:RemoveMenuForGroup( TaskGroup ) local Mission = self:GetMission() local MissionName = Mission:GetName() @@ -607,7 +607,7 @@ function TASK_BASE:RemoveMenuForGroup( TaskGroup ) MissionMenu:Remove() end -function TASK_BASE.MenuAssignToGroup( MenuParam ) +function TASK.MenuAssignToGroup( MenuParam ) local self = MenuParam.self local TaskGroup = MenuParam.TaskGroup @@ -617,7 +617,7 @@ function TASK_BASE.MenuAssignToGroup( MenuParam ) self:AssignToGroup( TaskGroup ) end -function TASK_BASE.MenuTaskStatus( MenuParam ) +function TASK.MenuTaskStatus( MenuParam ) local self = MenuParam.self local TaskGroup = MenuParam.TaskGroup @@ -625,7 +625,7 @@ function TASK_BASE.MenuTaskStatus( MenuParam ) --self:AssignToGroup( TaskGroup ) end -function TASK_BASE.MenuTaskAbort( MenuParam ) +function TASK.MenuTaskAbort( MenuParam ) local self = MenuParam.self local TaskGroup = MenuParam.TaskGroup @@ -636,9 +636,9 @@ end --- Returns the @{Task} name. --- @param #TASK_BASE self +-- @param #TASK self -- @return #string TaskName -function TASK_BASE:GetTaskName() +function TASK:GetTaskName() return self.TaskName end @@ -646,10 +646,10 @@ end --- Get the default or currently assigned @{Process} template with key ProcessName. --- @param #TASK_BASE self +-- @param #TASK self -- @param #string ProcessName --- @return Fsm.Fsm#FSM_PROCESS -function TASK_BASE:GetProcessTemplate( ProcessName ) +-- @return Core.Fsm#FSM_PROCESS +function TASK:GetProcessTemplate( ProcessName ) local ProcessTemplate = self.ProcessClasses[ProcessName] @@ -660,10 +660,10 @@ end -- TODO: Obscolete? --- Fail processes from @{Task} with key @{Unit} --- @param #TASK_BASE self +-- @param #TASK self -- @param #string TaskUnitName --- @return #TASK_BASE self -function TASK_BASE:FailProcesses( TaskUnitName ) +-- @return #TASK self +function TASK:FailProcesses( TaskUnitName ) for ProcessID, ProcessData in pairs( self.Processes[TaskUnitName] ) do local Process = ProcessData @@ -672,10 +672,10 @@ function TASK_BASE:FailProcesses( TaskUnitName ) end --- Add a FiniteStateMachine to @{Task} with key Task@{Unit} --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Unit#UNIT TaskUnit --- @return #TASK_BASE self -function TASK_BASE:SetStateMachine( TaskUnit, Fsm ) +-- @return #TASK self +function TASK:SetStateMachine( TaskUnit, Fsm ) self:F( { TaskUnit, self.Fsm[TaskUnit] ~= nil } ) self.Fsm[TaskUnit] = Fsm @@ -684,10 +684,10 @@ function TASK_BASE:SetStateMachine( TaskUnit, Fsm ) end --- Remove FiniteStateMachines from @{Task} with key Task@{Unit} --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Unit#UNIT TaskUnit --- @return #TASK_BASE self -function TASK_BASE:RemoveStateMachine( TaskUnit ) +-- @return #TASK self +function TASK:RemoveStateMachine( TaskUnit ) self:F( { TaskUnit, self.Fsm[TaskUnit] ~= nil } ) self.Fsm[TaskUnit] = nil @@ -696,10 +696,10 @@ function TASK_BASE:RemoveStateMachine( TaskUnit ) end --- Checks if there is a FiniteStateMachine assigned to Task@{Unit} for @{Task} --- @param #TASK_BASE self +-- @param #TASK self -- @param Wrapper.Unit#UNIT TaskUnit --- @return #TASK_BASE self -function TASK_BASE:HasStateMachine( TaskUnit ) +-- @return #TASK self +function TASK:HasStateMachine( TaskUnit ) self:F( { TaskUnit, self.Fsm[TaskUnit] ~= nil } ) return ( self.Fsm[TaskUnit] ~= nil ) @@ -707,17 +707,17 @@ end --- Gets the Scoring of the task --- @param #TASK_BASE self +-- @param #TASK self -- @return Functional.Scoring#SCORING Scoring -function TASK_BASE:GetScoring() +function TASK:GetScoring() return self.Mission:GetScoring() end --- Gets the Task Index, which is a combination of the Task type, the Task name. --- @param #TASK_BASE self +-- @param #TASK self -- @return #string The Task ID -function TASK_BASE:GetTaskIndex() +function TASK:GetTaskIndex() local TaskType = self:GetType() local TaskName = self:GetName() @@ -726,137 +726,137 @@ function TASK_BASE:GetTaskIndex() end --- Sets the Name of the Task --- @param #TASK_BASE self +-- @param #TASK self -- @param #string TaskName -function TASK_BASE:SetName( TaskName ) +function TASK:SetName( TaskName ) self.TaskName = TaskName end --- Gets the Name of the Task --- @param #TASK_BASE self +-- @param #TASK self -- @return #string The Task Name -function TASK_BASE:GetName() +function TASK:GetName() return self.TaskName end --- Sets the Type of the Task --- @param #TASK_BASE self +-- @param #TASK self -- @param #string TaskType -function TASK_BASE:SetType( TaskType ) +function TASK:SetType( TaskType ) self.TaskType = TaskType end --- Gets the Type of the Task --- @param #TASK_BASE self +-- @param #TASK self -- @return #string TaskType -function TASK_BASE:GetType() +function TASK:GetType() return self.TaskType end --- Sets the ID of the Task --- @param #TASK_BASE self +-- @param #TASK self -- @param #string TaskID -function TASK_BASE:SetID( TaskID ) +function TASK:SetID( TaskID ) self.TaskID = TaskID end --- Gets the ID of the Task --- @param #TASK_BASE self +-- @param #TASK self -- @return #string TaskID -function TASK_BASE:GetID() +function TASK:GetID() return self.TaskID end --- Sets a @{Task} to status **Success**. --- @param #TASK_BASE self -function TASK_BASE:StateSuccess() +-- @param #TASK self +function TASK:StateSuccess() self:SetState( self, "State", "Success" ) return self end --- Is the @{Task} status **Success**. --- @param #TASK_BASE self -function TASK_BASE:IsStateSuccess() +-- @param #TASK self +function TASK:IsStateSuccess() return self:Is( "Success" ) end --- Sets a @{Task} to status **Failed**. --- @param #TASK_BASE self -function TASK_BASE:StateFailed() +-- @param #TASK self +function TASK:StateFailed() self:SetState( self, "State", "Failed" ) return self end --- Is the @{Task} status **Failed**. --- @param #TASK_BASE self -function TASK_BASE:IsStateFailed() +-- @param #TASK self +function TASK:IsStateFailed() return self:Is( "Failed" ) end --- Sets a @{Task} to status **Planned**. --- @param #TASK_BASE self -function TASK_BASE:StatePlanned() +-- @param #TASK self +function TASK:StatePlanned() self:SetState( self, "State", "Planned" ) return self end --- Is the @{Task} status **Planned**. --- @param #TASK_BASE self -function TASK_BASE:IsStatePlanned() +-- @param #TASK self +function TASK:IsStatePlanned() return self:Is( "Planned" ) end --- Sets a @{Task} to status **Assigned**. --- @param #TASK_BASE self -function TASK_BASE:StateAssigned() +-- @param #TASK self +function TASK:StateAssigned() self:SetState( self, "State", "Assigned" ) return self end --- Is the @{Task} status **Assigned**. --- @param #TASK_BASE self -function TASK_BASE:IsStateAssigned() +-- @param #TASK self +function TASK:IsStateAssigned() return self:Is( "Assigned" ) end --- Sets a @{Task} to status **Hold**. --- @param #TASK_BASE self -function TASK_BASE:StateHold() +-- @param #TASK self +function TASK:StateHold() self:SetState( self, "State", "Hold" ) return self end --- Is the @{Task} status **Hold**. --- @param #TASK_BASE self -function TASK_BASE:IsStateHold() +-- @param #TASK self +function TASK:IsStateHold() return self:Is( "Hold" ) end --- Sets a @{Task} to status **Replanned**. --- @param #TASK_BASE self -function TASK_BASE:StateReplanned() +-- @param #TASK self +function TASK:StateReplanned() self:SetState( self, "State", "Replanned" ) return self end --- Is the @{Task} status **Replanned**. --- @param #TASK_BASE self -function TASK_BASE:IsStateReplanned() +-- @param #TASK self +function TASK:IsStateReplanned() return self:Is( "Replanned" ) end --- Gets the @{Task} status. --- @param #TASK_BASE self -function TASK_BASE:GetStateString() +-- @param #TASK self +function TASK:GetStateString() return self:GetState( self, "State" ) end --- Sets a @{Task} briefing. --- @param #TASK_BASE self +-- @param #TASK self -- @param #string TaskBriefing --- @return #TASK_BASE self -function TASK_BASE:SetBriefing( TaskBriefing ) +-- @return #TASK self +function TASK:SetBriefing( TaskBriefing ) self.TaskBriefing = TaskBriefing return self end @@ -865,11 +865,11 @@ end --- FSM function for a TASK --- @param #TASK_BASE self +-- @param #TASK self -- @param #string Event -- @param #string From -- @param #string To -function TASK_BASE:onenterAssigned( Event, From, To ) +function TASK:onenterAssigned( Event, From, To ) self:E("Task Assigned") @@ -879,11 +879,11 @@ end --- FSM function for a TASK --- @param #TASK_BASE self +-- @param #TASK self -- @param #string Event -- @param #string From -- @param #string To -function TASK_BASE:onenterSuccess( Event, From, To ) +function TASK:onenterSuccess( Event, From, To ) self:E( "Task Success" ) @@ -896,11 +896,11 @@ end --- FSM function for a TASK --- @param #TASK_BASE self +-- @param #TASK self -- @param #string Event -- @param #string From -- @param #string To -function TASK_BASE:onenterAborted( Event, From, To ) +function TASK:onenterAborted( Event, From, To ) self:E( "Task Aborted" ) @@ -910,11 +910,11 @@ function TASK_BASE:onenterAborted( Event, From, To ) end --- FSM function for a TASK --- @param #TASK_BASE self +-- @param #TASK self -- @param #string Event -- @param #string From -- @param #string To -function TASK_BASE:onenterFailed( Event, From, To ) +function TASK:onenterFailed( Event, From, To ) self:E( "Task Failed" ) @@ -924,11 +924,11 @@ function TASK_BASE:onenterFailed( Event, From, To ) end --- FSM function for a TASK --- @param #TASK_BASE self +-- @param #TASK self -- @param #string Event -- @param #string From -- @param #string To -function TASK_BASE:onstatechange( Event, From, To ) +function TASK:onstatechange( Event, From, To ) if self:IsTrace() then MESSAGE:New( "@ Task " .. self.TaskName .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll() @@ -948,9 +948,9 @@ do -- Reporting --- Create a summary report of the Task. -- List the Task Name and Status --- @param #TASK_BASE self +-- @param #TASK self -- @return #string -function TASK_BASE:ReportSummary() +function TASK:ReportSummary() local Report = REPORT:New() @@ -968,9 +968,9 @@ end --- Create a detailed report of the Task. -- List the Task Status, and the Players assigned to the Task. --- @param #TASK_BASE self +-- @param #TASK self -- @return #string -function TASK_BASE:ReportDetails() +function TASK:ReportDetails() local Report = REPORT:New() diff --git a/Moose Development/Moose/Tasking/TaskMenu.lua b/Moose Development/Moose/Tasking/TaskMenu.lua index 64c14cd0a..7b81bdcac 100644 --- a/Moose Development/Moose/Tasking/TaskMenu.lua +++ b/Moose Development/Moose/Tasking/TaskMenu.lua @@ -47,7 +47,7 @@ end --- StateMachine callback function for a TASK2 -- @param #TASK2_MENU_CLIENT self --- @param Fsm.Fsm#FSM_TASK Fsm +-- @param Core.Fsm#FSM_TASK Fsm -- @param #string Event -- @param #string From -- @param #string To @@ -71,7 +71,7 @@ end --- StateMachine callback function for a TASK2 -- @param #TASK2_MENU_CLIENT self --- @param Fsm.Fsm#FSM_TASK Fsm +-- @param Core.Fsm#FSM_TASK Fsm -- @param #string Event -- @param #string From -- @param #string To diff --git a/Moose Development/Moose/Tasking/Task_A2G.lua b/Moose Development/Moose/Tasking/Task_A2G.lua index 3e49e432b..35f49a277 100644 --- a/Moose Development/Moose/Tasking/Task_A2G.lua +++ b/Moose Development/Moose/Tasking/Task_A2G.lua @@ -1,14 +1,14 @@ --- (AI) (SP) (MP) Tasking for Air to Ground Processes. -- --- 1) @{#TASK_A2G} class, extends @{Tasking.Task#TASK_BASE} +-- 1) @{#TASK_A2G} class, extends @{Tasking.Task#TASK} -- ================================================= -- The @{#TASK_A2G} class defines a CAS or BAI task of a @{Set} of Target Units, --- located at a Target Zone, based on the tasking capabilities defined in @{Tasking.Task#TASK_BASE}. +-- located at a Target Zone, based on the tasking capabilities defined in @{Tasking.Task#TASK}. -- The TASK_A2G is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses: -- -- * **None**: Start of the process --- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#FSM_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#FSM_ROUTE} is started to route the active Units in the Group to the attack zone. +-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_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#ACT_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. -- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ. -- @@ -23,7 +23,7 @@ do -- TASK_A2G --- The TASK_A2G class -- @type TASK_A2G - -- @extends Tasking.Task#TASK_BASE + -- @extends Tasking.Task#TASK TASK_A2G = { ClassName = "TASK_A2G", } @@ -38,7 +38,7 @@ do -- TASK_A2G -- @param Core.Zone#ZONE_BASE TargetZone -- @return #TASK_A2G self function TASK_A2G:New( Mission, SetGroup, TaskName, TaskType, TargetSetUnit, TargetZone, FACUnit ) - local self = BASE:Inherit( self, TASK_BASE:New( Mission, SetGroup, TaskName, TaskType ) ) + local self = BASE:Inherit( self, TASK:New( Mission, SetGroup, TaskName, TaskType ) ) self:F() self.TargetSetUnit = TargetSetUnit @@ -47,12 +47,12 @@ do -- TASK_A2G local Fsm = self:GetUnitProcess() - Fsm:AddProcess( "Planned", "Accept", FSM_ASSIGN_ACCEPT:New( "Attack the Area" ), { Assigned = "Route", Rejected = "Eject" } ) - Fsm:AddProcess( "Assigned", "Route", FSM_ROUTE_ZONE:New( self.TargetZone ), { Arrived = "Update" } ) + Fsm:AddProcess( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( "Attack the Area" ), { Assigned = "Route", Rejected = "Eject" } ) + Fsm:AddProcess( "Assigned", "Route", ACT_ROUTE_ZONE:New( self.TargetZone ), { Arrived = "Update" } ) Fsm:AddAction ( "Rejected", "Eject", "Planned" ) Fsm:AddAction ( "Arrived", "Update", "Updated" ) - Fsm:AddProcess( "Updated", "Account", FSM_ACCOUNT_DEADS:New( self.TargetSetUnit, "Attack" ), { Accounted = "Success" } ) - Fsm:AddProcess( "Updated", "Smoke", FSM_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) ) + Fsm:AddProcess( "Updated", "Account", ACT_ACCOUNT_DEADS:New( self.TargetSetUnit, "Attack" ), { Accounted = "Success" } ) + Fsm:AddProcess( "Updated", "Smoke", ACT_ASSIST_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) ) --Fsm:AddProcess( "Updated", "JTAC", PROCESS_JTAC:New( self, TaskUnit, self.TargetSetUnit, self.FACUnit ) ) Fsm:AddAction ( "Accounted", "Success", "Success" ) Fsm:AddAction ( "Failed", "Fail", "Failed" ) diff --git a/Moose Development/Moose/Tasking/Task_AIBalancer.lua b/Moose Development/Moose/Tasking/Task_AIBalancer.lua index f78d0504c..43056420f 100644 --- a/Moose Development/Moose/Tasking/Task_AIBalancer.lua +++ b/Moose Development/Moose/Tasking/Task_AIBalancer.lua @@ -2,11 +2,11 @@ -- -- === -- --- 1) @{Functional.AIBalancer#AIBALANCER} class, extends @{Core.Base#BASE} +-- 1) @{AI.AI_Balancer#AIBALANCER} class, extends @{Core.Base#BASE} -- ======================================================= --- The @{Functional.AIBalancer#AIBALANCER} class controls the dynamic spawning of AI GROUPS depending on a SET_CLIENT. +-- The @{AI.AI_Balancer#AIBALANCER} class controls the dynamic spawning of AI GROUPS depending on a SET_CLIENT. -- There will be as many AI GROUPS spawned as there at CLIENTS in SET_CLIENT not spawned. --- The AIBalancer uses the @{PatrolCore.Zone#PATROLZONE} class to make AI patrol an zone until the fuel treshold is reached. +-- The AI_Balancer uses the @{PatrolCore.Zone#PATROLZONE} class to make AI patrol an zone until the fuel treshold is reached. -- -- 1.1) AIBALANCER construction method: -- ------------------------------------ @@ -23,7 +23,7 @@ -- -- 1.3) AIBALANCER allows AI to patrol specific zones: -- --------------------------------------------------- --- Use @{Functional.AIBalancer#AIBALANCER.SetPatrolZone}() to specify a zone where the AI needs to patrol. +-- Use @{AI.AI_Balancer#AIBALANCER.SetPatrolZone}() to specify a zone where the AI needs to patrol. -- -- === -- @@ -61,7 +61,7 @@ -- -- * FlightControl: Framework Design & Programming -- --- @module AIBalancer +-- @module AI_Balancer @@ -157,7 +157,7 @@ function AIBALANCER:SetPatrolZone( PatrolZone, PatrolFloorAltitude, PatrolCeilin ) end ---- Get the @{PatrolZone} object assigned by the @{AIBalancer} object. +--- Get the @{PatrolZone} object assigned by the @{AI_Balancer} object. -- @param #AIBALANCER self -- @return PatrolCore.Zone#PATROLZONE PatrolZone The @{PatrolZone} where the AI needs to patrol. function AIBALANCER:GetPatrolZone() diff --git a/Moose Development/Moose/Tasking/Task_Pickup.lua b/Moose Development/Moose/Tasking/Task_Pickup.lua index cf1e44269..a227ab71d 100644 --- a/Moose Development/Moose/Tasking/Task_Pickup.lua +++ b/Moose Development/Moose/Tasking/Task_Pickup.lua @@ -1,14 +1,14 @@ --- This module contains the TASK_PICKUP classes. -- --- 1) @{#TASK_PICKUP} class, extends @{Tasking.Task#TASK_BASE} +-- 1) @{#TASK_PICKUP} class, extends @{Tasking.Task#TASK} -- =================================================== -- The @{#TASK_PICKUP} class defines a pickup task of a @{Set} of @{CARGO} objects defined within the mission. --- based on the tasking capabilities defined in @{Tasking.Task#TASK_BASE}. +-- based on the tasking capabilities defined in @{Tasking.Task#TASK}. -- The TASK_PICKUP is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses: -- -- * **None**: Start of the process --- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#FSM_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#FSM_ROUTE} is started to route the active Units in the Group to the attack zone. +-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_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#ACT_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. -- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ. -- @@ -23,7 +23,7 @@ do -- TASK_PICKUP --- The TASK_PICKUP class -- @type TASK_PICKUP - -- @extends Tasking.Task#TASK_BASE + -- @extends Tasking.Task#TASK TASK_PICKUP = { ClassName = "TASK_PICKUP", } @@ -38,7 +38,7 @@ do -- TASK_PICKUP -- @param Core.Zone#ZONE_BASE TargetZone -- @return #TASK_PICKUP self function TASK_PICKUP:New( Mission, AssignedSetGroup, TaskName, TaskType ) - local self = BASE:Inherit( self, TASK_BASE:New( Mission, AssignedSetGroup, TaskName, TaskType, "PICKUP" ) ) + local self = BASE:Inherit( self, TASK:New( Mission, AssignedSetGroup, TaskName, TaskType, "PICKUP" ) ) self:F() _EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventPlayerLeaveUnit, self ) @@ -67,7 +67,7 @@ do -- TASK_PICKUP function TASK_PICKUP:AssignToUnit( TaskUnit ) self:F( TaskUnit:GetName() ) - local ProcessAssign = self:AddProcess( TaskUnit, FSM_ASSIGN_ACCEPT:New( self, TaskUnit, self.TaskBriefing ) ) + local ProcessAssign = self:AddProcess( TaskUnit, ACT_ASSIGN_ACCEPT:New( self, TaskUnit, self.TaskBriefing ) ) local ProcessPickup = self:AddProcess( TaskUnit, PROCESS_PICKUP:New( self, self.TaskType, TaskUnit ) ) local Process = self:AddStateMachine( TaskUnit, FSM_TASK:New( self, TaskUnit, { @@ -98,7 +98,7 @@ do -- TASK_PICKUP --- StateMachine callback function for a TASK -- @param #TASK_PICKUP self - -- @param Fsm.Fsm#FSM_TASK Fsm + -- @param Core.Fsm#FSM_TASK Fsm -- @param #string Event -- @param #string From -- @param #string To diff --git a/Moose Development/Moose/Tasking/Task_SEAD.lua b/Moose Development/Moose/Tasking/Task_SEAD.lua index 765c0e0ad..d9acf5157 100644 --- a/Moose Development/Moose/Tasking/Task_SEAD.lua +++ b/Moose Development/Moose/Tasking/Task_SEAD.lua @@ -1,14 +1,14 @@ --- This module contains the TASK_SEAD classes. -- --- 1) @{#TASK_SEAD} class, extends @{Tasking.Task#TASK_BASE} +-- 1) @{#TASK_SEAD} class, extends @{Tasking.Task#TASK} -- ================================================= -- The @{#TASK_SEAD} class defines a SEAD task for a @{Set} of Target Units, located at a Target Zone, --- based on the tasking capabilities defined in @{Tasking.Task#TASK_BASE}. +-- based on the tasking capabilities defined in @{Tasking.Task#TASK}. -- The TASK_SEAD is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses: -- -- * **None**: Start of the process --- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#FSM_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#FSM_ROUTE} is started to route the active Units in the Group to the attack zone. +-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_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#ACT_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. -- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ. -- @@ -25,7 +25,7 @@ do -- TASK_SEAD --- The TASK_SEAD class -- @type TASK_SEAD -- @field Set#SET_UNIT TargetSetUnit - -- @extends Tasking.Task#TASK_BASE + -- @extends Tasking.Task#TASK TASK_SEAD = { ClassName = "TASK_SEAD", } @@ -39,7 +39,7 @@ do -- TASK_SEAD -- @param Core.Zone#ZONE_BASE TargetZone -- @return #TASK_SEAD self function TASK_SEAD:New( Mission, SetGroup, TaskName, TargetSetUnit, TargetZone ) - local self = BASE:Inherit( self, TASK_BASE:New( Mission, SetGroup, TaskName, "SEAD" ) ) -- Tasking.Task_SEAD#TASK_SEAD + local self = BASE:Inherit( self, TASK:New( Mission, SetGroup, TaskName, "SEAD" ) ) -- Tasking.Task_SEAD#TASK_SEAD self:F() self.TargetSetUnit = TargetSetUnit @@ -47,12 +47,12 @@ do -- TASK_SEAD local Fsm = self:GetUnitProcess() - Fsm:AddProcess( "Planned", "Accept", FSM_ASSIGN_ACCEPT:New( self.TaskBriefing ), { Assigned = "Route", Rejected = "Eject" } ) - Fsm:AddProcess( "Assigned", "Route", FSM_ROUTE_ZONE:New( self.TargetZone ), { Arrived = "Update" } ) + Fsm:AddProcess( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( self.TaskBriefing ), { Assigned = "Route", Rejected = "Eject" } ) + Fsm:AddProcess( "Assigned", "Route", ACT_ROUTE_ZONE:New( self.TargetZone ), { Arrived = "Update" } ) Fsm:AddAction ( "Rejected", "Eject", "Planned" ) Fsm:AddAction ( "Arrived", "Update", "Updated" ) - Fsm:AddProcess( "Updated", "Account", FSM_ACCOUNT_DEADS:New( self.TargetSetUnit, "SEAD" ), { Accounted = "Success" } ) - Fsm:AddProcess( "Updated", "Smoke", FSM_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) ) + Fsm:AddProcess( "Updated", "Account", ACT_ACCOUNT_DEADS:New( self.TargetSetUnit, "SEAD" ), { Accounted = "Success" } ) + Fsm:AddProcess( "Updated", "Smoke", ACT_ASSIST_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) ) Fsm:AddAction ( "Accounted", "Success", "Success" ) Fsm:AddAction ( "Failed", "Fail", "Failed" ) diff --git a/Moose Development/Moose/Wrapper/Client.lua b/Moose Development/Moose/Wrapper/Client.lua index 085007ab8..e603afa20 100644 --- a/Moose Development/Moose/Wrapper/Client.lua +++ b/Moose Development/Moose/Wrapper/Client.lua @@ -399,8 +399,8 @@ function CLIENT:IsTransport() return self.ClientTransport end ---- Shows the @{Fsm.Cargo#CARGO} contained within the CLIENT to the player as a message. --- The @{Fsm.Cargo#CARGO} is shown using the @{Core.Message#MESSAGE} distribution system. +--- Shows the @{AI.AI_Cargo#CARGO} contained within the CLIENT to the player as a message. +-- The @{AI.AI_Cargo#CARGO} is shown using the @{Core.Message#MESSAGE} distribution system. -- @param #CLIENT self function CLIENT:ShowCargo() self:F() diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 09368668f..af21429ba 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -970,7 +970,7 @@ function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation, return DCSTask end --- EN-FSM_ROUTE TASKS FOR AIRBORNE CONTROLLABLES +-- EN-ACT_ROUTE TASKS FOR AIRBORNE CONTROLLABLES --- (AIR) Engaging targets of defined types. -- @param #CONTROLLABLE self diff --git a/Moose Development/Old/Stage.lua b/Moose Development/Old/Stage.lua index 5aa3923e1..f6902ab18 100644 --- a/Moose Development/Old/Stage.lua +++ b/Moose Development/Old/Stage.lua @@ -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.START - - _TransportStage.FSM_ROUTE + - _TransportStage.ACT_ROUTE - _TransportStage.LAND - _TransportStage.EXECUTE - _TransportStage.DONE @@ -924,7 +924,7 @@ end _TransportStage = { HOLD = "HOLD", START = "START", - FSM_ROUTE = "FSM_ROUTE", + ACT_ROUTE = "ACT_ROUTE", LANDING = "LANDING", LANDED = "LANDED", EXECUTING = "EXECUTING", @@ -937,7 +937,7 @@ _TransportStage = { _TransportStageMsgTime = { HOLD = 10, START = 60, - FSM_ROUTE = 5, + ACT_ROUTE = 5, LANDING = 10, LANDED = 30, EXECUTING = 30, @@ -950,7 +950,7 @@ _TransportStageMsgTime = { _TransportStageTime = { HOLD = 10, START = 5, - FSM_ROUTE = 5, + ACT_ROUTE = 5, LANDING = 1, LANDED = 1, EXECUTING = 5, diff --git a/Moose Mission Setup/Moose_Create.bat b/Moose Mission Setup/Moose_Create.bat index 1263634b2..7b1ce174b 100644 --- a/Moose Mission Setup/Moose_Create.bat +++ b/Moose Mission Setup/Moose_Create.bat @@ -53,6 +53,7 @@ COPY /b Moose.lua + %1\Core\Database.lua Moose.lua COPY /b Moose.lua + %1\Core\Set.lua Moose.lua COPY /b Moose.lua + %1\Core\Point.lua Moose.lua COPY /b Moose.lua + %1\Core\Message.lua Moose.lua +COPY /b Moose.lua + %1\Core\Fsm.lua Moose.lua rem Wrapper Classes COPY /b Moose.lua + %1\Wrapper\Object.lua Moose.lua @@ -79,7 +80,6 @@ COPY /b Moose.lua + %1\Functional\AIBalancer.lua Moose.lua rem Fsm Classes -COPY /b Moose.lua + %1\Fsm\Fsm.lua Moose.lua COPY /b Moose.lua + %1\Fsm\Process.lua Moose.lua COPY /b Moose.lua + %1\Fsm\Process_JTAC.lua Moose.lua COPY /b Moose.lua + %1\Fsm\Patrol.lua Moose.lua diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua index 0fac8ac6c..4aec78cf6 100644 --- a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua +++ b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua @@ -32,4 +32,4 @@ local RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCa local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) -- Start the AIBALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. -local RU_AIBalancer = AIBALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) +local RU_AI_Balancer = AIBALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua b/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua index dcffa7a2e..9ac9be889 100644 --- a/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua +++ b/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua @@ -33,9 +33,9 @@ local RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCa local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) -- Start the AIBALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. -local RU_AIBalancer = AIBALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) +local RU_AI_Balancer = AIBALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) -function RU_AIBalancer:OnAfterSpawned( SetGroup, Event, From, To, AIGroup ) +function RU_AI_Balancer:OnAfterSpawned( SetGroup, Event, From, To, AIGroup ) local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" ) local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua b/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua index 807ac6a75..573efc284 100644 --- a/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua +++ b/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua @@ -2,23 +2,23 @@ local US_PlanesClientSet = SET_CLIENT:New():FilterCountries( "USA" ):FilterCategories( "plane" ):FilterStart() local US_PlanesSpawn = SPAWN:New( "AI US" ):InitCleanUp( 20 ) -local US_AIBalancer = AIBALANCER:New( US_PlanesClientSet, US_PlanesSpawn ) +local US_AI_Balancer = AIBALANCER:New( US_PlanesClientSet, US_PlanesSpawn ) local RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ):FilterStart() local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) -local RU_AIBalancer = AIBALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) +local RU_AI_Balancer = AIBALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) local RU_AirbasesSet = SET_AIRBASE:New():FilterCoalitions("red"):FilterStart() RU_AirbasesSet:Flush() -RU_AIBalancer:ReturnToNearestAirbases( 10000, RU_AirbasesSet ) ---RU_AIBalancer:ReturnToHomeAirbase( 10000 ) +RU_AI_Balancer:ReturnToNearestAirbases( 10000, RU_AirbasesSet ) +--RU_AI_Balancer:ReturnToHomeAirbase( 10000 ) --local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Blue" ) --local PatrolZoneBlue = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) --local PatrolZoneB = PATROLZONE:New( PatrolZoneBlue, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) ---US_AIBalancer:SetPatrolZone( PatrolZoneB ) +--US_AI_Balancer:SetPatrolZone( PatrolZoneB ) -- --local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Red" ) --local PatrolZoneRed = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) --local PatrolZoneR = PATROLZONE:New( PatrolZoneRed, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) ---RU_AIBalancer:SetPatrolZone( PatrolZoneR ) +--RU_AI_Balancer:SetPatrolZone( PatrolZoneR ) diff --git a/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.lua b/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.lua index 0dadf6ed2..0b7662db9 100644 --- a/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.lua +++ b/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.lua @@ -99,18 +99,18 @@ local TargetSet = SET_UNIT:New():FilterPrefixes( "US Hawk SR" ):FilterOnce() -- Define the zone to where the pilot needs to navigate. local TargetZone = ZONE:New( "Target Zone" ) --- MOOSE contains a TASK_BASE class. Use the TASK class to define a new Task object and attach it to a Mission object. +-- MOOSE contains a TASK class. Use the TASK class to define a new Task object and attach it to a Mission object. -- Here we define a new TaskSEAD object, and attach it to the Mission object. --- ( The TASK_BASE class is the base class for ALL derived Task templates. +-- ( The TASK class is the base class for ALL derived Task templates. -- Task templates are TASK classes that quickly setup a Task scenario with given parameters. ) -- --- The TASK_BASE class is thus the primary task, and a task scenario will need to be provided to the TaskSEAD of the states and events that form the task. --- TASK_BASE gets a couple of parameters: +-- The TASK class is thus the primary task, and a task scenario will need to be provided to the TaskSEAD of the states and events that form the task. +-- TASK gets a couple of parameters: -- 1. The Mission for which the Task needs to be achieved. -- 2. The set of groups of planes that pilots can join. -- 3. The name of the Task... This can be any name, and will be provided when the Pilot joins the task. -- 4. A type of the Task. When Tasks are in state Planned, then a menu can be provided that group the task based on this given type. -local SEADTask = TASK_BASE:New( Mission, SEADSet, "SEAD Radars Vector 1", "SEAD" ) -- Tasking.Task#TASK_BASE +local SEADTask = TASK:New( Mission, SEADSet, "SEAD Radars Vector 1", "SEAD" ) -- Tasking.Task#TASK -- This is now an important part of the Task process definition. -- Each TASK contains a "Process Template". @@ -126,19 +126,19 @@ local SEADProcess = SEADTask:GetUnitProcess() -- Adding a new sub-process to the Task Template. -- At first, the task needs to be accepted by a pilot. --- We use for this the SUB-PROCESS FSM_ASSIGN_ACCEPT. +-- We use for this the SUB-PROCESS ACT_ASSIGN_ACCEPT. -- 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". -- 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 FSM_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 FSM_ASSIGN_ACCEPT process. This table indicates that for a certain return state, a further event needs to be called. +-- 3. The PROCESS derived class. In this case, we use the ACT_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 ACT_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.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. -SEADProcess:AddProcess ( "Planned", "Accept", FSM_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } ) +SEADProcess:AddProcess ( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } ) -- Same, adding a process. -SEADProcess:AddProcess ( "Assigned", "Route", FSM_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } ) +SEADProcess:AddProcess ( "Assigned", "Route", ACT_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } ) -- Adding a new Action... -- Actions define also the flow of the Task, but the actions will need to be programmed within your script. @@ -149,8 +149,8 @@ SEADProcess:AddProcess ( "Assigned", "Route", FSM_ROUTE_ZONE:New( Target -- 3. State To "Planned". After the event has been fired, the FsmSEAD will transition to Planned. SEADProcess:AddTransition ( "Rejected", "Eject", "Planned" ) SEADProcess:AddTransition ( "Arrived", "Update", "Updated" ) -SEADProcess:AddProcess ( "Updated", "Account", FSM_ACCOUNT_DEADS:New( TargetSet, "SEAD" ), { Accounted = "Success" } ) -SEADProcess:AddProcess ( "Updated", "Smoke", FSM_SMOKE_TARGETS_ZONE:New( TargetSet, TargetZone ) ) +SEADProcess:AddProcess ( "Updated", "Account", ACT_ACCOUNT_DEADS:New( TargetSet, "SEAD" ), { Accounted = "Success" } ) +SEADProcess:AddProcess ( "Updated", "Smoke", ACT_ASSIST_SMOKE_TARGETS_ZONE:New( TargetSet, TargetZone ) ) SEADProcess:AddTransition ( "Accounted", "Success", "Success" ) SEADProcess:AddTransition ( "*", "Fail", "Failed" ) @@ -181,7 +181,7 @@ function SEADTask:OnAfterPlayerCrashed( PlayerUnit, PlayerName ) end -local TaskSEAD2 = TASK_BASE:New( Mission, SEADSet, "SEAD Radars Vector 2", "SEAD" ) -- Tasking.Task#TASK_BASE +local TaskSEAD2 = TASK:New( Mission, SEADSet, "SEAD Radars Vector 2", "SEAD" ) -- Tasking.Task#TASK TaskSEAD2:SetUnitProcess( SEADTask:GetUnitProcess():Copy() ) Mission:AddTask( TaskSEAD2 )