mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Got SEAD tasking working now with new Process Templates...
This commit is contained in:
@@ -20,15 +20,15 @@
|
|||||||
-- The CARGO_BASE is a state machine: it manages the different events and states of the cargo.
|
-- The CARGO_BASE is a state machine: it manages the different events and states of the cargo.
|
||||||
-- All derived classes from CARGO_BASE follow the same state machine, expose the same cargo event functions, and provide the same cargo states.
|
-- All derived classes from CARGO_BASE follow the same state machine, expose the same cargo event functions, and provide the same cargo states.
|
||||||
--
|
--
|
||||||
-- ## 1.2.1) CARBO_BASE Events:
|
-- ## 1.2.1) CARGO_BASE Events:
|
||||||
--
|
--
|
||||||
-- * @{#CARBO_BASE.Board}( ToCarrier ): Boards the cargo to a carrier.
|
-- * @{#CARGO_BASE.Board}( ToCarrier ): Boards the cargo to a carrier.
|
||||||
-- * @{#CARBO_BASE.Load}( ToCarrier ): Loads the cargo into a carrier, regardless of its position.
|
-- * @{#CARGO_BASE.Load}( ToCarrier ): Loads the cargo into a carrier, regardless of its position.
|
||||||
-- * @{#CARBO_BASE.UnBoard}( ToPointVec2 ): UnBoard the cargo from a carrier. This will trigger a movement of the cargo to the option ToPointVec2.
|
-- * @{#CARGO_BASE.UnBoard}( ToPointVec2 ): UnBoard the cargo from a carrier. This will trigger a movement of the cargo to the option ToPointVec2.
|
||||||
-- * @{#CARBO_BASE.UnLoad}( ToPointVec2 ): UnLoads the cargo from a carrier.
|
-- * @{#CARGO_BASE.UnLoad}( ToPointVec2 ): UnLoads the cargo from a carrier.
|
||||||
-- * @{#CARBO_BASE.Dead}( Controllable ): The cargo is dead. The cargo process will be ended.
|
-- * @{#CARGO_BASE.Dead}( Controllable ): The cargo is dead. The cargo process will be ended.
|
||||||
--
|
--
|
||||||
-- ## 1.2.2) CARBO_BASE States:
|
-- ## 1.2.2) CARGO_BASE States:
|
||||||
--
|
--
|
||||||
-- * **UnLoaded**: The cargo is unloaded from a carrier.
|
-- * **UnLoaded**: The cargo is unloaded from a carrier.
|
||||||
-- * **Boarding**: The cargo is currently boarding (= running) into a carrier.
|
-- * **Boarding**: The cargo is currently boarding (= running) into a carrier.
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
-- * **Dead**: The cargo is dead ...
|
-- * **Dead**: The cargo is dead ...
|
||||||
-- * **End**: The process has come to an end.
|
-- * **End**: The process has come to an end.
|
||||||
--
|
--
|
||||||
-- ## 1.2.3) CARBO_BASE state transition methods:
|
-- ## 1.2.3) CARGO_BASE state transition methods:
|
||||||
--
|
--
|
||||||
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
||||||
-- There are 2 moments when state transition methods will be called by the state machine:
|
-- There are 2 moments when state transition methods will be called by the state machine:
|
||||||
@@ -72,14 +72,14 @@
|
|||||||
|
|
||||||
--- Boards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo to the Carrier.
|
--- Boards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo to the Carrier.
|
||||||
-- The cargo must be in the **UnLoaded** state.
|
-- The cargo must be in the **UnLoaded** state.
|
||||||
-- @function [parent=#CARBO_BASE] Board
|
-- @function [parent=#CARGO_BASE] Board
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
-- @param Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
||||||
|
|
||||||
--- Boards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo to the Carrier.
|
--- Boards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo to the Carrier.
|
||||||
-- The cargo must be in the **UnLoaded** state.
|
-- The cargo must be in the **UnLoaded** state.
|
||||||
-- @function [parent=#CARBO_BASE] __Board
|
-- @function [parent=#CARGO_BASE] __Board
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
||||||
-- @param Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
-- @param Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
||||||
|
|
||||||
@@ -88,14 +88,14 @@
|
|||||||
|
|
||||||
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
|
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
|
||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARBO_BASE] UnBoard
|
-- @function [parent=#CARGO_BASE] UnBoard
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
-- @param Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
||||||
|
|
||||||
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
|
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
|
||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARBO_BASE] __UnBoard
|
-- @function [parent=#CARGO_BASE] __UnBoard
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
||||||
-- @param Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
-- @param Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
|
||||||
|
|
||||||
@@ -104,14 +104,14 @@
|
|||||||
|
|
||||||
--- Loads the cargo to a Carrier. The event will load the cargo into the Carrier regardless of its position. There will be no movement simulated of the cargo loading.
|
--- Loads the cargo to a Carrier. The event will load the cargo into the Carrier regardless of its position. There will be no movement simulated of the cargo loading.
|
||||||
-- The cargo must be in the **UnLoaded** state.
|
-- The cargo must be in the **UnLoaded** state.
|
||||||
-- @function [parent=#CARBO_BASE] Load
|
-- @function [parent=#CARGO_BASE] Load
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
-- @param Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
||||||
|
|
||||||
--- Loads the cargo to a Carrier. The event will load the cargo into the Carrier regardless of its position. There will be no movement simulated of the cargo loading.
|
--- Loads the cargo to a Carrier. The event will load the cargo into the Carrier regardless of its position. There will be no movement simulated of the cargo loading.
|
||||||
-- The cargo must be in the **UnLoaded** state.
|
-- The cargo must be in the **UnLoaded** state.
|
||||||
-- @function [parent=#CARBO_BASE] __Load
|
-- @function [parent=#CARGO_BASE] __Load
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
||||||
-- @param Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
-- @param Controllable#CONTROLLABLE ToCarrier The Carrier that will hold the cargo.
|
||||||
|
|
||||||
@@ -120,14 +120,14 @@
|
|||||||
|
|
||||||
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
|
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
|
||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARBO_BASE] UnLoad
|
-- @function [parent=#CARGO_BASE] UnLoad
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
-- @param Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
||||||
|
|
||||||
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
|
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
|
||||||
-- The cargo must be in the **Loaded** state.
|
-- The cargo must be in the **Loaded** state.
|
||||||
-- @function [parent=#CARBO_BASE] __UnLoad
|
-- @function [parent=#CARGO_BASE] __UnLoad
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
-- @param #number DelaySeconds The amount of seconds to delay the action.
|
||||||
-- @param Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
-- @param Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
|
||||||
|
|
||||||
@@ -135,46 +135,46 @@
|
|||||||
|
|
||||||
-- UnLoaded
|
-- UnLoaded
|
||||||
|
|
||||||
--- @function [parent=#CARBO_BASE] OnBeforeUnLoaded
|
--- @function [parent=#CARGO_BASE] OnBeforeUnLoaded
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE Controllable
|
-- @param Controllable#CONTROLLABLE Controllable
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
|
|
||||||
--- @function [parent=#CARBO_BASE] OnAfterUnLoaded
|
--- @function [parent=#CARGO_BASE] OnAfterUnLoaded
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE Controllable
|
-- @param Controllable#CONTROLLABLE Controllable
|
||||||
|
|
||||||
-- Loaded
|
-- Loaded
|
||||||
|
|
||||||
--- @function [parent=#CARBO_BASE] OnBeforeLoaded
|
--- @function [parent=#CARGO_BASE] OnBeforeLoaded
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE Controllable
|
-- @param Controllable#CONTROLLABLE Controllable
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
|
|
||||||
--- @function [parent=#CARBO_BASE] OnAfterLoaded
|
--- @function [parent=#CARGO_BASE] OnAfterLoaded
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE Controllable
|
-- @param Controllable#CONTROLLABLE Controllable
|
||||||
|
|
||||||
-- Boarding
|
-- Boarding
|
||||||
|
|
||||||
--- @function [parent=#CARBO_BASE] OnBeforeBoarding
|
--- @function [parent=#CARGO_BASE] OnBeforeBoarding
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE Controllable
|
-- @param Controllable#CONTROLLABLE Controllable
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
|
|
||||||
--- @function [parent=#CARBO_BASE] OnAfterBoarding
|
--- @function [parent=#CARGO_BASE] OnAfterBoarding
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE Controllable
|
-- @param Controllable#CONTROLLABLE Controllable
|
||||||
|
|
||||||
-- UnBoarding
|
-- UnBoarding
|
||||||
|
|
||||||
--- @function [parent=#CARBO_BASE] OnBeforeUnBoarding
|
--- @function [parent=#CARGO_BASE] OnBeforeUnBoarding
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE Controllable
|
-- @param Controllable#CONTROLLABLE Controllable
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
|
|
||||||
--- @function [parent=#CARBO_BASE] OnAfterUnBoarding
|
--- @function [parent=#CARGO_BASE] OnAfterUnBoarding
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Controllable#CONTROLLABLE Controllable
|
-- @param Controllable#CONTROLLABLE Controllable
|
||||||
|
|
||||||
|
|
||||||
@@ -182,9 +182,9 @@
|
|||||||
|
|
||||||
CARGOS = {}
|
CARGOS = {}
|
||||||
|
|
||||||
do -- CARBO_BASE
|
do -- CARGO_BASE
|
||||||
|
|
||||||
--- @type CARBO_BASE
|
--- @type CARGO_BASE
|
||||||
-- @extends StateMachine#STATEMACHINE_PROCESS
|
-- @extends StateMachine#STATEMACHINE_PROCESS
|
||||||
-- @field #string Type A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.
|
-- @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 #string Name A string defining the name of the cargo. The name is the unique identifier of the cargo.
|
||||||
@@ -197,8 +197,8 @@ do -- CARBO_BASE
|
|||||||
-- @field #boolean Moveable This flag defines if the cargo is moveable.
|
-- @field #boolean Moveable This flag defines if the cargo is moveable.
|
||||||
-- @field #boolean Representable This flag defines if the cargo can be represented by a DCS Unit.
|
-- @field #boolean Representable This flag defines if the cargo can be represented by a DCS Unit.
|
||||||
-- @field #boolean Containable This flag defines if the cargo can be contained within a DCS Unit.
|
-- @field #boolean Containable This flag defines if the cargo can be contained within a DCS Unit.
|
||||||
CARBO_BASE = {
|
CARGO_BASE = {
|
||||||
ClassName = "CARBO_BASE",
|
ClassName = "CARGO_BASE",
|
||||||
Type = nil,
|
Type = nil,
|
||||||
Name = nil,
|
Name = nil,
|
||||||
Weight = nil,
|
Weight = nil,
|
||||||
@@ -210,19 +210,19 @@ do -- CARBO_BASE
|
|||||||
Containable = false,
|
Containable = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @type CARBO_BASE.CargoObjects
|
--- @type CARGO_BASE.CargoObjects
|
||||||
-- @map < #string, Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo.
|
-- @map < #string, Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo.
|
||||||
|
|
||||||
|
|
||||||
--- CARBO_BASE Constructor. This class is an abstract class and should not be instantiated.
|
--- CARGO_BASE Constructor. This class is an abstract class and should not be instantiated.
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param #string Type
|
-- @param #string Type
|
||||||
-- @param #string Name
|
-- @param #string Name
|
||||||
-- @param #number Weight
|
-- @param #number Weight
|
||||||
-- @param #number ReportRadius (optional)
|
-- @param #number ReportRadius (optional)
|
||||||
-- @param #number NearRadius (optional)
|
-- @param #number NearRadius (optional)
|
||||||
-- @return #CARBO_BASE
|
-- @return #CARGO_BASE
|
||||||
function CARBO_BASE:New( Type, Name, Weight, ReportRadius, NearRadius )
|
function CARGO_BASE:New( Type, Name, Weight, ReportRadius, NearRadius )
|
||||||
|
|
||||||
FSMT = {
|
FSMT = {
|
||||||
initial = 'UnLoaded',
|
initial = 'UnLoaded',
|
||||||
@@ -238,7 +238,7 @@ function CARBO_BASE:New( Type, Name, Weight, ReportRadius, NearRadius )
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local self = BASE:Inherit( self, STATEMACHINE_PROCESS:New( FSMT ) ) -- #CARBO_BASE
|
local self = BASE:Inherit( self, STATEMACHINE_PROCESS:New( FSMT ) ) -- #CARGO_BASE
|
||||||
self:F( { Type, Name, Weight, ReportRadius, NearRadius } )
|
self:F( { Type, Name, Weight, ReportRadius, NearRadius } )
|
||||||
|
|
||||||
|
|
||||||
@@ -263,20 +263,20 @@ function CARBO_BASE:New( Type, Name, Weight, ReportRadius, NearRadius )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Template method to spawn a new representation of the CARBO_BASE in the simulator.
|
--- Template method to spawn a new representation of the CARGO_BASE in the simulator.
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @return #CARBO_BASE
|
-- @return #CARGO_BASE
|
||||||
function CARBO_BASE:Spawn( PointVec2 )
|
function CARGO_BASE:Spawn( PointVec2 )
|
||||||
self:F()
|
self:F()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Check if CargoCarrier is near the Cargo to be Loaded.
|
--- Check if CargoCarrier is near the Cargo to be Loaded.
|
||||||
-- @param #CARBO_BASE self
|
-- @param #CARGO_BASE self
|
||||||
-- @param Point#POINT_VEC2 PointVec2
|
-- @param Point#POINT_VEC2 PointVec2
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function CARBO_BASE:IsNear( PointVec2 )
|
function CARGO_BASE:IsNear( PointVec2 )
|
||||||
self:F( { PointVec2 } )
|
self:F( { PointVec2 } )
|
||||||
|
|
||||||
local Distance = PointVec2:DistanceFromPointVec2( self.CargoObject:GetPointVec2() )
|
local Distance = PointVec2:DistanceFromPointVec2( self.CargoObject:GetPointVec2() )
|
||||||
@@ -294,7 +294,7 @@ end
|
|||||||
do -- CARGO_REPRESENTABLE
|
do -- CARGO_REPRESENTABLE
|
||||||
|
|
||||||
--- @type CARGO_REPRESENTABLE
|
--- @type CARGO_REPRESENTABLE
|
||||||
-- @extends #CARBO_BASE
|
-- @extends #CARGO_BASE
|
||||||
CARGO_REPRESENTABLE = {
|
CARGO_REPRESENTABLE = {
|
||||||
ClassName = "CARGO_REPRESENTABLE"
|
ClassName = "CARGO_REPRESENTABLE"
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,7 @@ do -- CARGO_REPRESENTABLE
|
|||||||
-- @param #number NearRadius (optional)
|
-- @param #number NearRadius (optional)
|
||||||
-- @return #CARGO_REPRESENTABLE
|
-- @return #CARGO_REPRESENTABLE
|
||||||
function CARGO_REPRESENTABLE:New( CargoObject, Type, Name, Weight, ReportRadius, NearRadius )
|
function CARGO_REPRESENTABLE:New( CargoObject, Type, Name, Weight, ReportRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARBO_BASE:New( Type, Name, Weight, ReportRadius, NearRadius ) ) -- #CARBO_BASE
|
local self = BASE:Inherit( self, CARGO_BASE:New( Type, Name, Weight, ReportRadius, NearRadius ) ) -- #CARGO_BASE
|
||||||
self:F( { Type, Name, Weight, ReportRadius, NearRadius } )
|
self:F( { Type, Name, Weight, ReportRadius, NearRadius } )
|
||||||
|
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- CARBO_BASE
|
end -- CARGO_BASE
|
||||||
|
|
||||||
do -- CARGO_UNIT
|
do -- CARGO_UNIT
|
||||||
|
|
||||||
@@ -816,7 +816,7 @@ end
|
|||||||
do -- CARGO_GROUP
|
do -- CARGO_GROUP
|
||||||
|
|
||||||
--- @type CARGO_GROUP
|
--- @type CARGO_GROUP
|
||||||
-- @extends Cargo#CARBO_BASE
|
-- @extends Cargo#CARGO_BASE
|
||||||
-- @field Set#SET_BASE CargoSet A set of cargo objects.
|
-- @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.
|
-- @field #string Name A string defining the name of the cargo group. The name is the unique identifier of the cargo.
|
||||||
CARGO_GROUP = {
|
CARGO_GROUP = {
|
||||||
@@ -833,7 +833,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #number NearRadius (optional)
|
-- @param #number NearRadius (optional)
|
||||||
-- @return #CARGO_GROUP
|
-- @return #CARGO_GROUP
|
||||||
function CARGO_GROUP:New( CargoSet, Type, Name, ReportRadius, NearRadius )
|
function CARGO_GROUP:New( CargoSet, Type, Name, ReportRadius, NearRadius )
|
||||||
local self = BASE:Inherit( self, CARBO_BASE:New( Type, Name, 0, ReportRadius, NearRadius ) ) -- #CARGO_GROUP
|
local self = BASE:Inherit( self, CARGO_BASE:New( Type, Name, 0, ReportRadius, NearRadius ) ) -- #CARGO_GROUP
|
||||||
self:F( { Type, Name, ReportRadius, NearRadius } )
|
self:F( { Type, Name, ReportRadius, NearRadius } )
|
||||||
|
|
||||||
self.CargoSet = CargoSet
|
self.CargoSet = CargoSet
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ function PATROLZONE:onenterRoute()
|
|||||||
self.Controllable:SetState( self.Controllable, "PatrolZone", self )
|
self.Controllable:SetState( self.Controllable, "PatrolZone", self )
|
||||||
self.Controllable:WayPointFunction( #PatrolRoute, 1, "_NewPatrolRoute" )
|
self.Controllable:WayPointFunction( #PatrolRoute, 1, "_NewPatrolRoute" )
|
||||||
|
|
||||||
--- NOW ROUTE THE GROUP!
|
--- NOW PROCESS_ROUTE THE GROUP!
|
||||||
self.Controllable:WayPointExecute( 1 )
|
self.Controllable:WayPointExecute( 1 )
|
||||||
|
|
||||||
self:__Patrol( 30 )
|
self:__Patrol( 30 )
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
--- The PROCESS class
|
--- The PROCESS class
|
||||||
-- @type PROCESS
|
-- @type PROCESS
|
||||||
|
-- @field Task#TASK_BASE ProcessTask
|
||||||
-- @field Group#GROUP ProcessGroup
|
-- @field Group#GROUP ProcessGroup
|
||||||
-- @field Menu#MENU_GROUP MissionMenu
|
-- @field Menu#MENU_GROUP MissionMenu
|
||||||
-- @field Task#TASK_BASE Task
|
|
||||||
-- @field #string ProcessName
|
-- @field #string ProcessName
|
||||||
-- @extends StateMachine#STATEMACHINE_CONTROLLABLE
|
-- @extends StateMachine#STATEMACHINE_CONTROLLABLE
|
||||||
PROCESS = {
|
PROCESS = {
|
||||||
@@ -16,8 +16,8 @@ PROCESS = {
|
|||||||
--- Instantiates a new TASK Base. Should never be used. Interface Class.
|
--- Instantiates a new TASK Base. Should never be used. Interface Class.
|
||||||
-- @param #PROCESS self
|
-- @param #PROCESS self
|
||||||
-- @param #string ProcessName
|
-- @param #string ProcessName
|
||||||
-- @param Unit#UNIT ProcessUnit
|
-- @param Unit#UNIT ProcessUnit (Optional) If provided, it defines the UNIT for which the process is running.
|
||||||
-- @return #PROCESS self
|
-- @return #PROCESS
|
||||||
function PROCESS:New( FSMT, ProcessName, ProcessUnit )
|
function PROCESS:New( FSMT, ProcessName, ProcessUnit )
|
||||||
local self = BASE:Inherit( self, STATEMACHINE_CONTROLLABLE:New( FSMT, ProcessUnit ) )
|
local self = BASE:Inherit( self, STATEMACHINE_CONTROLLABLE:New( FSMT, ProcessUnit ) )
|
||||||
self:F()
|
self:F()
|
||||||
@@ -32,13 +32,50 @@ function PROCESS:New( FSMT, ProcessName, ProcessUnit )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Gets the Group of the process.
|
||||||
|
-- @param #PROCESS self
|
||||||
|
-- @return Group#GROUP
|
||||||
|
function PROCESS:GetGroup()
|
||||||
|
|
||||||
|
return self.ProcessGroup
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sets the task of the process.
|
||||||
|
-- @param #PROCESS self
|
||||||
|
-- @param Tasking.Task#TASK_BASE ProcessTask
|
||||||
|
-- @return #PROCESS
|
||||||
|
function PROCESS:SetTask( ProcessTask )
|
||||||
|
|
||||||
|
self.ProcessTask = ProcessTask
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets the task of the process.
|
||||||
|
-- @param #PROCESS self
|
||||||
|
-- @return Task#TASK_BASE
|
||||||
|
function PROCESS:GetTask()
|
||||||
|
|
||||||
|
return self.ProcessTask
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets the mission of the process.
|
||||||
|
-- @param #PROCESS self
|
||||||
|
-- @return Mission#MISSION
|
||||||
|
function PROCESS:GetMission()
|
||||||
|
|
||||||
|
return self.ProcessTask.Mission
|
||||||
|
end
|
||||||
|
|
||||||
--- Assign the process to a @{Unit} and activate the process.
|
--- Assign the process to a @{Unit} and activate the process.
|
||||||
-- @param #PROCESS self
|
-- @param #PROCESS self
|
||||||
-- @param Unit#UNIT ProcessUnit
|
-- @param Unit#UNIT ProcessUnit
|
||||||
-- @return #PROCESS self
|
-- @return #PROCESS self
|
||||||
function PROCESS:Assign( ProcessUnit )
|
function PROCESS:Assign( ProcessTask, ProcessUnit )
|
||||||
|
|
||||||
self:SetControllable( ProcessUnit )
|
self:SetControllable( ProcessUnit )
|
||||||
|
self:SetTask( ProcessTask )
|
||||||
|
|
||||||
self.ProcessGroup = ProcessUnit:GetGroup()
|
self.ProcessGroup = ProcessUnit:GetGroup()
|
||||||
--self:Activate()
|
--self:Activate()
|
||||||
|
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
--- @module Process_Smoke
|
|
||||||
|
|
||||||
do -- PROCESS_SMOKE_TARGETS
|
|
||||||
|
|
||||||
--- PROCESS_SMOKE_TARGETS class
|
|
||||||
-- @type PROCESS_SMOKE_TARGETS
|
|
||||||
-- @field Task#TASK_BASE Task
|
|
||||||
-- @field Unit#UNIT ProcessUnit
|
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
|
||||||
-- @extends Task2#TASK2
|
|
||||||
PROCESS_SMOKE_TARGETS = {
|
|
||||||
ClassName = "PROCESS_SMOKE_TARGETS",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new task assignment state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
|
||||||
-- @param #PROCESS_SMOKE_TARGETS self
|
|
||||||
-- @param Task#TASK Task
|
|
||||||
-- @param Unit#UNIT Unit
|
|
||||||
-- @return #PROCESS_SMOKE_TARGETS self
|
|
||||||
function PROCESS_SMOKE_TARGETS:New( Task, ProcessUnit, TargetSetUnit, TargetZone )
|
|
||||||
|
|
||||||
local FSMT = {
|
|
||||||
initial = 'None',
|
|
||||||
events = {
|
|
||||||
{ name = 'Start', from = 'None', to = 'AwaitSmoke' },
|
|
||||||
{ name = 'Next', from = 'AwaitSmoke', to = 'Smoking' },
|
|
||||||
{ name = 'Next', from = 'Smoking', to = 'AwaitSmoke' },
|
|
||||||
{ name = 'Fail', from = 'Smoking', to = 'Failed' },
|
|
||||||
{ name = 'Fail', from = 'AwaitSmoke', to = 'Failed' },
|
|
||||||
{ name = 'Fail', from = 'None', to = 'Failed' },
|
|
||||||
},
|
|
||||||
callbacks = {
|
|
||||||
onStart = self.OnStart,
|
|
||||||
onNext = self.OnNext,
|
|
||||||
onSmoking = self.OnSmoking,
|
|
||||||
},
|
|
||||||
endstates = {
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Inherits from BASE
|
|
||||||
local self = BASE:Inherit( self, PROCESS:New( FSMT, ProcessUnit, "SMOKE_TARGETS" ) ) -- #PROCESS_SMOKE_TARGETS
|
|
||||||
|
|
||||||
self.TargetSetUnit = TargetSetUnit
|
|
||||||
self.TargetZone = TargetZone
|
|
||||||
|
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- StateMachine callback function
|
|
||||||
-- @param #PROCESS_SMOKE_TARGETS self
|
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
|
||||||
-- @param #string Event
|
|
||||||
-- @param #string From
|
|
||||||
-- @param #string To
|
|
||||||
function PROCESS_SMOKE_TARGETS:OnStart( ProcessUnit, Event, From, To )
|
|
||||||
self:E( { Event, From, To, ProcessUnit.UnitName} )
|
|
||||||
|
|
||||||
self:E("Set smoke menu")
|
|
||||||
|
|
||||||
local ProcessGroup = ProcessUnit:GetGroup()
|
|
||||||
--local MissionMenu = self.Task.Mission:GetMissionMenu( ProcessGroup )
|
|
||||||
|
|
||||||
local function MenuSmoke( MenuParam )
|
|
||||||
self:E( MenuParam )
|
|
||||||
local self = MenuParam.self
|
|
||||||
local SmokeColor = MenuParam.SmokeColor
|
|
||||||
self.SmokeColor = SmokeColor
|
|
||||||
self:__Next( 1 )
|
|
||||||
end
|
|
||||||
|
|
||||||
--self.Menu = MENU_GROUP:New( ProcessGroup, "Target acquisition", MissionMenu )
|
|
||||||
--self.MenuSmokeBlue = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop blue smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.Blue } )
|
|
||||||
--self.MenuSmokeGreen = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop green smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.Green } )
|
|
||||||
--self.MenuSmokeOrange = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop Orange smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.Orange } )
|
|
||||||
--self.MenuSmokeRed = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop Red smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.Red } )
|
|
||||||
--self.MenuSmokeWhite = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop White smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.White } )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- StateMachine callback function
|
|
||||||
-- @param #PROCESS_SMOKE_TARGETS self
|
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
|
||||||
-- @param #string Event
|
|
||||||
-- @param #string From
|
|
||||||
-- @param #string To
|
|
||||||
function PROCESS_SMOKE_TARGETS:OnSmoking( ProcessUnit, Event, From, To )
|
|
||||||
self:E( { Event, From, To, ProcessUnit.UnitName} )
|
|
||||||
|
|
||||||
self.TargetSetUnit:ForEachUnit(
|
|
||||||
--- @param Unit#UNIT SmokeUnit
|
|
||||||
function( SmokeUnit )
|
|
||||||
if math.random( 1, ( 100 * self.TargetSetUnit:Count() ) / 4 ) <= 100 then
|
|
||||||
SCHEDULER:New( self,
|
|
||||||
function()
|
|
||||||
if SmokeUnit:IsAlive() then
|
|
||||||
SmokeUnit:Smoke( self.SmokeColor, 150 )
|
|
||||||
end
|
|
||||||
end, {}, math.random( 10, 60 )
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -39,16 +39,18 @@ Include.File( "Functional/AirbasePolice" )
|
|||||||
Include.File( "Functional/Detection" )
|
Include.File( "Functional/Detection" )
|
||||||
Include.File( "Functional/AIBalancer" )
|
Include.File( "Functional/AIBalancer" )
|
||||||
|
|
||||||
--- Process Classes
|
--- Fsm Classes
|
||||||
Include.File( "Fsm/Process" )
|
Include.File( "Fsm/Process" )
|
||||||
Include.File( "Fsm/Assign" )
|
|
||||||
Include.File( "Fsm/Route" )
|
|
||||||
Include.File( "Fsm/Process_Smoke" )
|
|
||||||
Include.File( "Fsm/Account" )
|
|
||||||
Include.File( "Fsm/Process_JTAC" )
|
Include.File( "Fsm/Process_JTAC" )
|
||||||
Include.File( "Fsm/Patrol" )
|
Include.File( "Fsm/Patrol" )
|
||||||
Include.File( "Fsm/Cargo" )
|
Include.File( "Fsm/Cargo" )
|
||||||
|
|
||||||
|
--- Process Classes
|
||||||
|
Include.File( "Process/Assign" )
|
||||||
|
Include.File( "Process/Route" )
|
||||||
|
Include.File( "Process/Account" )
|
||||||
|
Include.File( "Process/Smoke" )
|
||||||
|
|
||||||
--- Task Handling Classes
|
--- Task Handling Classes
|
||||||
Include.File( "Tasking/Mission" )
|
Include.File( "Tasking/Mission" )
|
||||||
Include.File( "Tasking/Task" )
|
Include.File( "Tasking/Task" )
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # @{#ACCOUNT} FSM class, extends @{Process#PROCESS}
|
-- # @{#PROCESS_ACCOUNT} FSM class, extends @{Process#PROCESS}
|
||||||
--
|
--
|
||||||
-- ## ACCOUNT state machine:
|
-- ## PROCESS_ACCOUNT state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
||||||
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
||||||
-- but will have **different implementation behaviour** upon each event or state transition.
|
-- but will have **different implementation behaviour** upon each event or state transition.
|
||||||
--
|
--
|
||||||
-- ### ACCOUNT **Events**:
|
-- ### PROCESS_ACCOUNT **Events**:
|
||||||
--
|
--
|
||||||
-- These are the events defined in this class:
|
-- These are the events defined in this class:
|
||||||
--
|
--
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
-- * **More**: There are more DCS events that need to be accounted for. The process will go back into the Report state.
|
-- * **More**: There are more DCS events that need to be accounted for. The process will go back into the Report state.
|
||||||
-- * **NoMore**: There are no more DCS events that need to be accounted for. The process will go into the Success state.
|
-- * **NoMore**: There are no more DCS events that need to be accounted for. The process will go into the Success state.
|
||||||
--
|
--
|
||||||
-- ### ACCOUNT **Event methods**:
|
-- ### PROCESS_ACCOUNT **Event methods**:
|
||||||
--
|
--
|
||||||
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
||||||
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
-- * **Immediate**: The event method has exactly the name of the event.
|
-- * **Immediate**: The event method has exactly the name of the event.
|
||||||
-- * **Delayed**: The event method starts with a __ + the name of the event. The first parameter of the event method is a number value, expressing the delay in seconds when the event will be executed.
|
-- * **Delayed**: The event method starts with a __ + the name of the event. The first parameter of the event method is a number value, expressing the delay in seconds when the event will be executed.
|
||||||
--
|
--
|
||||||
-- ### ACCOUNT **States**:
|
-- ### PROCESS_ACCOUNT **States**:
|
||||||
--
|
--
|
||||||
-- * **Assigned**: The player is assigned to the task. This is the initialization state for the process.
|
-- * **Assigned**: The player is assigned to the task. This is the initialization state for the process.
|
||||||
-- * **Waiting**: the process is waiting for a DCS event to occur within the simulator. This state is set automatically.
|
-- * **Waiting**: the process is waiting for a DCS event to occur within the simulator. This state is set automatically.
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
--
|
--
|
||||||
-- (*) End states of the process.
|
-- (*) End states of the process.
|
||||||
--
|
--
|
||||||
-- ### ACCOUNT state transition methods:
|
-- ### PROCESS_ACCOUNT state transition methods:
|
||||||
--
|
--
|
||||||
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
||||||
-- There are 2 moments when state transition methods will be called by the state machine:
|
-- There are 2 moments when state transition methods will be called by the state machine:
|
||||||
@@ -55,38 +55,38 @@
|
|||||||
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
-- The state transition method needs to start with the name **OnAfter + the name of the state**.
|
||||||
-- These state transition methods need to provide a return value, which is specified at the function description.
|
-- These state transition methods need to provide a return value, which is specified at the function description.
|
||||||
--
|
--
|
||||||
-- # 1) @{#ACCOUNT_DEADS} FSM class, extends @{Account#ACCOUNT}
|
-- # 1) @{#PROCESS_ACCOUNT_DEADS} FSM class, extends @{Account#PROCESS_ACCOUNT}
|
||||||
--
|
--
|
||||||
-- The ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
-- The PROCESS_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
|
||||||
-- The process is given a @{Set} of units that will be tracked upon successful destruction.
|
-- The process is given a @{Set} of units that will be tracked upon successful destruction.
|
||||||
-- The process will end after each target has been successfully destroyed.
|
-- The process will end after each target has been successfully destroyed.
|
||||||
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
|
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- ## ACCOUNT_DEADS constructor:
|
-- ## PROCESS_ACCOUNT_DEADS constructor:
|
||||||
--
|
--
|
||||||
-- * @{#ACCOUNT_DEADS.New}(): Creates a new ACCOUNT_DEADS object.
|
-- * @{#PROCESS_ACCOUNT_DEADS.New}(): Creates a new PROCESS_ACCOUNT_DEADS object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Account
|
-- @module Account
|
||||||
|
|
||||||
|
|
||||||
do -- ACCOUNT
|
do -- PROCESS_ACCOUNT
|
||||||
|
|
||||||
--- ACCOUNT class
|
--- PROCESS_ACCOUNT class
|
||||||
-- @type ACCOUNT
|
-- @type PROCESS_ACCOUNT
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends Process#PROCESS
|
-- @extends Fsm.Process#PROCESS
|
||||||
ACCOUNT = {
|
PROCESS_ACCOUNT = {
|
||||||
ClassName = "ACCOUNT",
|
ClassName = "PROCESS_ACCOUNT",
|
||||||
TargetSetUnit = nil,
|
TargetSetUnit = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new DESTROY process.
|
--- Creates a new DESTROY process.
|
||||||
-- @param #ACCOUNT self
|
-- @param #PROCESS_ACCOUNT self
|
||||||
-- @return #ACCOUNT
|
-- @return #PROCESS_ACCOUNT
|
||||||
function ACCOUNT:New()
|
function PROCESS_ACCOUNT:New()
|
||||||
|
|
||||||
local FSMT = {
|
local FSMT = {
|
||||||
initial = 'Assigned',
|
initial = 'Assigned',
|
||||||
@@ -103,7 +103,7 @@ do -- ACCOUNT
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, PROCESS:New( FSMT, "ACCOUNT" ) ) -- #ACCOUNT
|
local self = BASE:Inherit( self, PROCESS:New( FSMT, "PROCESS_ACCOUNT" ) ) -- #PROCESS_ACCOUNT
|
||||||
|
|
||||||
self.DisplayInterval = 30
|
self.DisplayInterval = 30
|
||||||
self.DisplayCount = 30
|
self.DisplayCount = 30
|
||||||
@@ -117,23 +117,23 @@ do -- ACCOUNT
|
|||||||
--- Process Events
|
--- Process Events
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ACCOUNT self
|
-- @param #PROCESS_ACCOUNT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACCOUNT:onafterStart( ProcessUnit, Event, From, To )
|
function PROCESS_ACCOUNT:onafterStart( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
self:__Wait( 1 )
|
self:__Wait( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ACCOUNT self
|
-- @param #PROCESS_ACCOUNT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To )
|
function PROCESS_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
if self.DisplayCount >= self.DisplayInterval then
|
if self.DisplayCount >= self.DisplayInterval then
|
||||||
self:Report()
|
self:Report()
|
||||||
@@ -146,39 +146,39 @@ do -- ACCOUNT
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ACCOUNT self
|
-- @param #PROCESS_ACCOUNT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event )
|
function PROCESS_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event )
|
||||||
|
|
||||||
self:__NoMore( 1 )
|
self:__NoMore( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- ACCOUNT
|
end -- PROCESS_ACCOUNT
|
||||||
|
|
||||||
do -- ACCOUNT_DEADS
|
do -- PROCESS_ACCOUNT_DEADS
|
||||||
|
|
||||||
--- ACCOUNT_DEADS class
|
--- PROCESS_ACCOUNT_DEADS class
|
||||||
-- @type ACCOUNT_DEADS
|
-- @type PROCESS_ACCOUNT_DEADS
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends Process#PROCESS
|
-- @extends Process#PROCESS
|
||||||
ACCOUNT_DEADS = {
|
PROCESS_ACCOUNT_DEADS = {
|
||||||
ClassName = "ACCOUNT_DEADS",
|
ClassName = "PROCESS_ACCOUNT_DEADS",
|
||||||
TargetSetUnit = nil,
|
TargetSetUnit = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new DESTROY process.
|
--- Creates a new DESTROY process.
|
||||||
-- @param #ACCOUNT_DEADS self
|
-- @param #PROCESS_ACCOUNT_DEADS self
|
||||||
-- @param Set#SET_UNIT TargetSetUnit
|
-- @param Set#SET_UNIT TargetSetUnit
|
||||||
-- @param #string TaskName
|
-- @param #string TaskName
|
||||||
-- @return #ACCOUNT_DEADS self
|
-- @return #PROCESS_ACCOUNT_DEADS self
|
||||||
function ACCOUNT_DEADS:New( TargetSetUnit, TaskName )
|
function PROCESS_ACCOUNT_DEADS:New( TargetSetUnit, TaskName )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, ACCOUNT:New() ) -- #ACCOUNT_DEADS
|
local self = BASE:Inherit( self, PROCESS_ACCOUNT:New() ) -- #PROCESS_ACCOUNT_DEADS
|
||||||
|
|
||||||
self.TargetSetUnit = TargetSetUnit
|
self.TargetSetUnit = TargetSetUnit
|
||||||
self.TaskName = TaskName
|
self.TaskName = TaskName
|
||||||
@@ -191,12 +191,12 @@ do -- ACCOUNT_DEADS
|
|||||||
--- Process Events
|
--- Process Events
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ASSIGN_MENU_ACCEPT self
|
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To )
|
function PROCESS_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
local TaskGroup = ProcessUnit:GetGroup()
|
local TaskGroup = ProcessUnit:GetGroup()
|
||||||
MESSAGE:New( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed.", 5, "HQ" ):ToGroup( TaskGroup )
|
MESSAGE:New( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed.", 5, "HQ" ):ToGroup( TaskGroup )
|
||||||
@@ -204,12 +204,12 @@ do -- ACCOUNT_DEADS
|
|||||||
|
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ASSIGN_MENU_ACCEPT self
|
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, Event )
|
function PROCESS_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, Event )
|
||||||
|
|
||||||
self.TargetSetUnit:Flush()
|
self.TargetSetUnit:Flush()
|
||||||
|
|
||||||
@@ -221,12 +221,12 @@ do -- ACCOUNT_DEADS
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ASSIGN_MENU_ACCEPT self
|
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, Event )
|
function PROCESS_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, Event )
|
||||||
|
|
||||||
if self.TargetSetUnit:Count() > 0 then
|
if self.TargetSetUnit:Count() > 0 then
|
||||||
self:__More( 1 )
|
self:__More( 1 )
|
||||||
@@ -237,13 +237,13 @@ do -- ACCOUNT_DEADS
|
|||||||
|
|
||||||
--- DCS Events
|
--- DCS Events
|
||||||
|
|
||||||
--- @param #ACCOUNT_DEADS self
|
--- @param #PROCESS_ACCOUNT_DEADS self
|
||||||
-- @param Event#EVENTDATA Event
|
-- @param Event#EVENTDATA Event
|
||||||
function ACCOUNT_DEADS:EventDead( Event )
|
function PROCESS_ACCOUNT_DEADS:EventDead( Event )
|
||||||
|
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
self:__Event( 1 )
|
self:__Event( 1 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- ACCOUNT DEADS
|
end -- PROCESS_ACCOUNT DEADS
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # @{#ASSIGN} FSM class, extends @{Process#PROCESS}
|
-- # @{#PROCESS_ASSIGN} FSM class, extends @{Process#PROCESS}
|
||||||
--
|
--
|
||||||
-- ## ASSIGN state machine:
|
-- ## PROCESS_ASSIGN state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
||||||
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
||||||
-- but will have **different implementation behaviour** upon each event or state transition.
|
-- but will have **different implementation behaviour** upon each event or state transition.
|
||||||
--
|
--
|
||||||
-- ### ASSIGN **Events**:
|
-- ### PROCESS_ASSIGN **Events**:
|
||||||
--
|
--
|
||||||
-- These are the events defined in this class:
|
-- These are the events defined in this class:
|
||||||
--
|
--
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
-- * **Assign**: Assign the task.
|
-- * **Assign**: Assign the task.
|
||||||
-- * **Reject**: Reject the task..
|
-- * **Reject**: Reject the task..
|
||||||
--
|
--
|
||||||
-- ### ASSIGN **Event methods**:
|
-- ### PROCESS_ASSIGN **Event methods**:
|
||||||
--
|
--
|
||||||
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
||||||
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
-- * **Immediate**: The event method has exactly the name of the event.
|
-- * **Immediate**: The event method has exactly the name of the event.
|
||||||
-- * **Delayed**: The event method starts with a __ + the name of the event. The first parameter of the event method is a number value, expressing the delay in seconds when the event will be executed.
|
-- * **Delayed**: The event method starts with a __ + the name of the event. The first parameter of the event method is a number value, expressing the delay in seconds when the event will be executed.
|
||||||
--
|
--
|
||||||
-- ### ASSIGN **States**:
|
-- ### PROCESS_ASSIGN **States**:
|
||||||
--
|
--
|
||||||
-- * **UnAssigned**: The player has not accepted the task.
|
-- * **UnAssigned**: The player has not accepted the task.
|
||||||
-- * **Assigned (*)**: The player has accepted the task.
|
-- * **Assigned (*)**: The player has accepted the task.
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
--
|
--
|
||||||
-- (*) End states of the process.
|
-- (*) End states of the process.
|
||||||
--
|
--
|
||||||
-- ### ASSIGN state transition methods:
|
-- ### PROCESS_ASSIGN state transition methods:
|
||||||
--
|
--
|
||||||
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
||||||
-- There are 2 moments when state transition methods will be called by the state machine:
|
-- There are 2 moments when state transition methods will be called by the state machine:
|
||||||
@@ -54,49 +54,49 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#ASSIGN_ACCEPT} class, extends @{Assign#ASSIGN}
|
-- # 1) @{#PROCESS_ASSIGN_ACCEPT} class, extends @{Assign#PROCESS_ASSIGN}
|
||||||
--
|
--
|
||||||
-- The ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
|
-- The PROCESS_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
|
||||||
--
|
--
|
||||||
-- ## 1.1) ASSIGN_ACCEPT constructor:
|
-- ## 1.1) PROCESS_ASSIGN_ACCEPT constructor:
|
||||||
--
|
--
|
||||||
-- * @{#ASSIGN_ACCEPT.New}(): Creates a new ASSIGN_ACCEPT object.
|
-- * @{#PROCESS_ASSIGN_ACCEPT.New}(): Creates a new PROCESS_ASSIGN_ACCEPT object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 2) @{#ASSIGN_MENU_ACCEPT} class, extends @{Assign#ASSIGN}
|
-- # 2) @{#PROCESS_ASSIGN_MENU_ACCEPT} class, extends @{Assign#PROCESS_ASSIGN}
|
||||||
--
|
--
|
||||||
-- The ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
|
-- The PROCESS_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
|
||||||
-- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task.
|
-- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task.
|
||||||
-- The assignment type also allows to reject the task.
|
-- The assignment type also allows to reject the task.
|
||||||
--
|
--
|
||||||
-- ## 2.1) ASSIGN_MENU_ACCEPT constructor:
|
-- ## 2.1) PROCESS_ASSIGN_MENU_ACCEPT constructor:
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
--
|
--
|
||||||
-- * @{#ASSIGN_MENU_ACCEPT.New}(): Creates a new ASSIGN_MENU_ACCEPT object.
|
-- * @{#PROCESS_ASSIGN_MENU_ACCEPT.New}(): Creates a new PROCESS_ASSIGN_MENU_ACCEPT object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Assign
|
-- @module Assign
|
||||||
|
|
||||||
|
|
||||||
do -- ASSIGN
|
do -- PROCESS_ASSIGN
|
||||||
|
|
||||||
--- ASSIGN class
|
--- PROCESS_ASSIGN class
|
||||||
-- @type ASSIGN
|
-- @type PROCESS_ASSIGN
|
||||||
-- @field Task#TASK_BASE Task
|
-- @field Task#TASK_BASE Task
|
||||||
-- @field Unit#UNIT ProcessUnit
|
-- @field Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends Process#PROCESS
|
-- @extends Fsm.Process#PROCESS
|
||||||
ASSIGN = {
|
PROCESS_ASSIGN = {
|
||||||
ClassName = "ASSIGN",
|
ClassName = "PROCESS_ASSIGN",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
|
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
|
||||||
-- @param #ASSIGN self
|
-- @param #PROCESS_ASSIGN self
|
||||||
-- @return #ASSIGN The task acceptance process.
|
-- @return #PROCESS_ASSIGN The task acceptance process.
|
||||||
function ASSIGN:New()
|
function PROCESS_ASSIGN:New()
|
||||||
|
|
||||||
local FSMT = {
|
local FSMT = {
|
||||||
initial = 'UnAssigned',
|
initial = 'UnAssigned',
|
||||||
@@ -112,36 +112,36 @@ do -- ASSIGN
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, PROCESS:New( FSMT, "ASSIGN" ) ) -- #ASSIGN
|
local self = BASE:Inherit( self, PROCESS:New( FSMT, "PROCESS_ASSIGN" ) ) -- #PROCESS_ASSIGN
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- ASSIGN
|
end -- PROCESS_ASSIGN
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do -- ASSIGN_ACCEPT
|
do -- PROCESS_ASSIGN_ACCEPT
|
||||||
|
|
||||||
--- ASSIGN_ACCEPT class
|
--- PROCESS_ASSIGN_ACCEPT class
|
||||||
-- @type ASSIGN_ACCEPT
|
-- @type PROCESS_ASSIGN_ACCEPT
|
||||||
-- @field Task#TASK_BASE Task
|
-- @field Task#TASK_BASE Task
|
||||||
-- @field Unit#UNIT ProcessUnit
|
-- @field Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends Process#PROCESS
|
-- @extends Process#PROCESS
|
||||||
ASSIGN_ACCEPT = {
|
PROCESS_ASSIGN_ACCEPT = {
|
||||||
ClassName = "ASSIGN_ACCEPT",
|
ClassName = "PROCESS_ASSIGN_ACCEPT",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
|
--- Creates a new task assignment state machine. The process will accept the task by default, no player intervention accepted.
|
||||||
-- @param #ASSIGN_ACCEPT self
|
-- @param #PROCESS_ASSIGN_ACCEPT self
|
||||||
-- @param #string TaskBriefing
|
-- @param #string TaskBriefing
|
||||||
-- @return #ASSIGN_ACCEPT The task acceptance process.
|
-- @return #PROCESS_ASSIGN_ACCEPT The task acceptance process.
|
||||||
function ASSIGN_ACCEPT:New( TaskBriefing )
|
function PROCESS_ASSIGN_ACCEPT:New( TaskBriefing )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, ASSIGN:New() ) -- #ASSIGN_ACCEPT
|
local self = BASE:Inherit( self, PROCESS_ASSIGN:New() ) -- #PROCESS_ASSIGN_ACCEPT
|
||||||
|
|
||||||
self.TaskBriefing = TaskBriefing
|
self.TaskBriefing = TaskBriefing
|
||||||
|
|
||||||
@@ -150,12 +150,12 @@ do -- ASSIGN_ACCEPT
|
|||||||
|
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ASSIGN_ACCEPT self
|
-- @param #PROCESS_ASSIGN_ACCEPT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
|
function PROCESS_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
|
||||||
self:E( { ProcessUnit, Event, From, To } )
|
self:E( { ProcessUnit, Event, From, To } )
|
||||||
|
|
||||||
MESSAGE:New( self.TaskBriefing, 30, "Task Assignment" ):ToGroup( ProcessUnit:GetGroup() )
|
MESSAGE:New( self.TaskBriefing, 30, "Task Assignment" ):ToGroup( ProcessUnit:GetGroup() )
|
||||||
@@ -163,31 +163,31 @@ do -- ASSIGN_ACCEPT
|
|||||||
self:__Assign( 1 )
|
self:__Assign( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- ASSIGN_ACCEPT
|
end -- PROCESS_ASSIGN_ACCEPT
|
||||||
|
|
||||||
|
|
||||||
do -- ASSIGN_MENU_ACCEPT
|
do -- PROCESS_ASSIGN_MENU_ACCEPT
|
||||||
|
|
||||||
--- ASSIGN_MENU_ACCEPT class
|
--- PROCESS_ASSIGN_MENU_ACCEPT class
|
||||||
-- @type ASSIGN_MENU_ACCEPT
|
-- @type PROCESS_ASSIGN_MENU_ACCEPT
|
||||||
-- @field Task#TASK_BASE Task
|
-- @field Task#TASK_BASE Task
|
||||||
-- @field Unit#UNIT ProcessUnit
|
-- @field Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends Task2#TASK2
|
-- @extends #PROCESS_ASSIGN
|
||||||
ASSIGN_MENU_ACCEPT = {
|
PROCESS_ASSIGN_MENU_ACCEPT = {
|
||||||
ClassName = "ASSIGN_MENU_ACCEPT",
|
ClassName = "PROCESS_ASSIGN_MENU_ACCEPT",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new task assignment state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
--- Creates a new task assignment state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
||||||
-- @param #ASSIGN_MENU_ACCEPT self
|
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param #string TaskName
|
-- @param #string TaskName
|
||||||
-- @param #string TaskBriefing
|
-- @param #string TaskBriefing
|
||||||
-- @return #ASSIGN_MENU_ACCEPT self
|
-- @return #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
function ASSIGN_MENU_ACCEPT:New( TaskName, TaskBriefing )
|
function PROCESS_ASSIGN_MENU_ACCEPT:New( TaskName, TaskBriefing )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, ASSIGN:New() ) -- #ASSIGN_MENU_ACCEPT
|
local self = BASE:Inherit( self, PROCESS_ASSIGN:New() ) -- #PROCESS_ASSIGN_MENU_ACCEPT
|
||||||
|
|
||||||
self.TaskBriefing = TaskBriefing
|
self.TaskBriefing = TaskBriefing
|
||||||
self.TaskName = TaskName
|
self.TaskName = TaskName
|
||||||
@@ -196,12 +196,12 @@ do -- ASSIGN_MENU_ACCEPT
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ASSIGN_MENU_ACCEPT self
|
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
|
function PROCESS_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
|
||||||
self:E( { ProcessUnit, Event, From, To } )
|
self:E( { ProcessUnit, Event, From, To } )
|
||||||
|
|
||||||
MESSAGE:New( self.TaskBriefing .. "\nAccess the radio menu to accept the task. You have 30 seconds or the assignment will be cancelled.", 30, "Task Assignment" ):ToGroup( ProcessUnit:GetGroup() )
|
MESSAGE:New( self.TaskBriefing .. "\nAccess the radio menu to accept the task. You have 30 seconds or the assignment will be cancelled.", 30, "Task Assignment" ):ToGroup( ProcessUnit:GetGroup() )
|
||||||
@@ -214,40 +214,40 @@ do -- ASSIGN_MENU_ACCEPT
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Menu function.
|
--- Menu function.
|
||||||
-- @param #ASSIGN_MENU_ACCEPT self
|
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
function ASSIGN_MENU_ACCEPT:MenuAssign()
|
function PROCESS_ASSIGN_MENU_ACCEPT:MenuAssign()
|
||||||
self:E( )
|
self:E( )
|
||||||
|
|
||||||
self:__Assign( 1 )
|
self:__Assign( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Menu function.
|
--- Menu function.
|
||||||
-- @param #ASSIGN_MENU_ACCEPT self
|
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
function ASSIGN_MENU_ACCEPT:MenuReject()
|
function PROCESS_ASSIGN_MENU_ACCEPT:MenuReject()
|
||||||
self:E( )
|
self:E( )
|
||||||
|
|
||||||
self:__Reject( 1 )
|
self:__Reject( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ASSIGN_MENU_ACCEPT self
|
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To )
|
function PROCESS_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To )
|
||||||
self:E( { ProcessUnit.UnitNameEvent, From, To } )
|
self:E( { ProcessUnit.UnitNameEvent, From, To } )
|
||||||
|
|
||||||
self.Menu:Remove()
|
self.Menu:Remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ASSIGN_MENU_ACCEPT self
|
-- @param #PROCESS_ASSIGN_MENU_ACCEPT self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To )
|
function PROCESS_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To )
|
||||||
self:E( { ProcessUnit.UnitName, Event, From, To } )
|
self:E( { ProcessUnit.UnitName, Event, From, To } )
|
||||||
|
|
||||||
self.Menu:Remove()
|
self.Menu:Remove()
|
||||||
@@ -256,4 +256,4 @@ do -- ASSIGN_MENU_ACCEPT
|
|||||||
ProcessUnit:Destroy()
|
ProcessUnit:Destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- ASSIGN_MENU_ACCEPT
|
end -- PROCESS_ASSIGN_MENU_ACCEPT
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # @{#ROUTE} FSM class, extends @{Process#PROCESS}
|
-- # @{#PROCESS_ROUTE} FSM class, extends @{Process#PROCESS}
|
||||||
--
|
--
|
||||||
-- ## ROUTE state machine:
|
-- ## PROCESS_ROUTE state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
||||||
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
||||||
-- but will have **different implementation behaviour** upon each event or state transition.
|
-- but will have **different implementation behaviour** upon each event or state transition.
|
||||||
--
|
--
|
||||||
-- ### ROUTE **Events**:
|
-- ### PROCESS_ROUTE **Events**:
|
||||||
--
|
--
|
||||||
-- These are the events defined in this class:
|
-- These are the events defined in this class:
|
||||||
--
|
--
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
-- * **More**: There are more route points that need to be followed. The process will go back into the Report state.
|
-- * **More**: There are more route points that need to be followed. The process will go back into the Report state.
|
||||||
-- * **NoMore**: There are no more route points that need to be followed. The process will go into the Success state.
|
-- * **NoMore**: There are no more route points that need to be followed. The process will go into the Success state.
|
||||||
--
|
--
|
||||||
-- ### ROUTE **Event methods**:
|
-- ### PROCESS_ROUTE **Event methods**:
|
||||||
--
|
--
|
||||||
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
||||||
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
-- * **Immediate**: The event method has exactly the name of the event.
|
-- * **Immediate**: The event method has exactly the name of the event.
|
||||||
-- * **Delayed**: The event method starts with a __ + the name of the event. The first parameter of the event method is a number value, expressing the delay in seconds when the event will be executed.
|
-- * **Delayed**: The event method starts with a __ + the name of the event. The first parameter of the event method is a number value, expressing the delay in seconds when the event will be executed.
|
||||||
--
|
--
|
||||||
-- ### ROUTE **States**:
|
-- ### PROCESS_ROUTE **States**:
|
||||||
--
|
--
|
||||||
-- * **None**: The controllable did not receive route commands.
|
-- * **None**: The controllable did not receive route commands.
|
||||||
-- * **Arrived (*)**: The controllable has arrived at a route point.
|
-- * **Arrived (*)**: The controllable has arrived at a route point.
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
--
|
--
|
||||||
-- (*) End states of the process.
|
-- (*) End states of the process.
|
||||||
--
|
--
|
||||||
-- ### ROUTE state transition methods:
|
-- ### PROCESS_ROUTE state transition methods:
|
||||||
--
|
--
|
||||||
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
||||||
-- There are 2 moments when state transition methods will be called by the state machine:
|
-- There are 2 moments when state transition methods will be called by the state machine:
|
||||||
@@ -60,38 +60,38 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- # 1) @{#ROUTE_ZONE} class, extends @{Route#ROUTE}
|
-- # 1) @{#PROCESS_ROUTE_ZONE} class, extends @{Route#PROCESS_ROUTE}
|
||||||
--
|
--
|
||||||
-- The ROUTE_ZONE class implements the core functions to route an AIR @{Controllable} player @{Unit} to a @{Zone}.
|
-- The PROCESS_ROUTE_ZONE class implements the core functions to route an AIR @{Controllable} player @{Unit} to a @{Zone}.
|
||||||
-- The player receives on perioding times messages with the coordinates of the route to follow.
|
-- The player receives on perioding times messages with the coordinates of the route to follow.
|
||||||
-- Upon arrival at the zone, a confirmation of arrival is sent, and the process will be ended.
|
-- Upon arrival at the zone, a confirmation of arrival is sent, and the process will be ended.
|
||||||
--
|
--
|
||||||
-- # 1.1) ROUTE_ZONE constructor:
|
-- # 1.1) PROCESS_ROUTE_ZONE constructor:
|
||||||
--
|
--
|
||||||
-- * @{#ROUTE_ZONE.New}(): Creates a new ROUTE_ZONE object.
|
-- * @{#PROCESS_ROUTE_ZONE.New}(): Creates a new PROCESS_ROUTE_ZONE object.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Route
|
-- @module Route
|
||||||
|
|
||||||
|
|
||||||
do -- ROUTE
|
do -- PROCESS_ROUTE
|
||||||
|
|
||||||
--- ROUTE class
|
--- PROCESS_ROUTE class
|
||||||
-- @type ROUTE
|
-- @type PROCESS_ROUTE
|
||||||
-- @field Task#TASK TASK
|
-- @field Task#TASK TASK
|
||||||
-- @field Unit#UNIT ProcessUnit
|
-- @field Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends Task2#TASK2
|
-- @extends Fsm.Process#PROCESS
|
||||||
ROUTE = {
|
PROCESS_ROUTE = {
|
||||||
ClassName = "ROUTE",
|
ClassName = "PROCESS_ROUTE",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new routing state machine. The task will route a CLIENT to a ZONE until the CLIENT is within that ZONE.
|
--- Creates a new routing state machine. The process will route a CLIENT to a ZONE until the CLIENT is within that ZONE.
|
||||||
-- @param #ROUTE self
|
-- @param #PROCESS_ROUTE self
|
||||||
-- @return #ROUTE self
|
-- @return #PROCESS_ROUTE self
|
||||||
function ROUTE:New()
|
function PROCESS_ROUTE:New()
|
||||||
|
|
||||||
|
|
||||||
local FSMT = {
|
local FSMT = {
|
||||||
@@ -112,7 +112,7 @@ do -- ROUTE
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, PROCESS:New( FSMT, "ROUTE" ) ) -- #ROUTE
|
local self = BASE:Inherit( self, PROCESS:New( FSMT, "PROCESS_ROUTE" ) ) -- #PROCESS_ROUTE
|
||||||
|
|
||||||
self.DisplayInterval = 30
|
self.DisplayInterval = 30
|
||||||
self.DisplayCount = 30
|
self.DisplayCount = 30
|
||||||
@@ -126,31 +126,31 @@ do -- ROUTE
|
|||||||
--- Task Events
|
--- Task Events
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ROUTE self
|
-- @param #PROCESS_ROUTE self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ROUTE:onafterStart( ProcessUnit, Event, From, To )
|
function PROCESS_ROUTE:onafterStart( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
self:__Route( 1 )
|
self:__Route( 1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if the controllable has arrived.
|
--- Check if the controllable has arrived.
|
||||||
-- @param #ROUTE self
|
-- @param #PROCESS_ROUTE self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function ROUTE:HasArrived( ProcessUnit )
|
function PROCESS_ROUTE:HasArrived( ProcessUnit )
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ROUTE self
|
-- @param #PROCESS_ROUTE self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ROUTE:onafterRoute( ProcessUnit, Event, From, To )
|
function PROCESS_ROUTE:onafterRoute( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
if ProcessUnit:IsAlive() then
|
if ProcessUnit:IsAlive() then
|
||||||
local HasArrived = self:HasArrived( ProcessUnit )
|
local HasArrived = self:HasArrived( ProcessUnit )
|
||||||
@@ -174,30 +174,30 @@ do -- ROUTE
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- ROUTE
|
end -- PROCESS_ROUTE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do -- ROUTE_ZONE
|
do -- PROCESS_ROUTE_ZONE
|
||||||
|
|
||||||
--- ROUTE_ZONE class
|
--- PROCESS_ROUTE_ZONE class
|
||||||
-- @type ROUTE_ZONE
|
-- @type PROCESS_ROUTE_ZONE
|
||||||
-- @field Task#TASK TASK
|
-- @field Task#TASK TASK
|
||||||
-- @field Unit#UNIT ProcessUnit
|
-- @field Unit#UNIT ProcessUnit
|
||||||
-- @field Zone#ZONE_BASE TargetZone
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
-- @extends Task2#TASK2
|
-- @extends Process.Route#PROCESS_ROUTE
|
||||||
ROUTE_ZONE = {
|
PROCESS_ROUTE_ZONE = {
|
||||||
ClassName = "ROUTE_ZONE",
|
ClassName = "PROCESS_ROUTE_ZONE",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new routing state machine. The task will route a controllable to a ZONE until the controllable is within that ZONE.
|
--- Creates a new routing state machine. The task will route a controllable to a ZONE until the controllable is within that ZONE.
|
||||||
-- @param #ROUTE_ZONE self
|
-- @param #PROCESS_ROUTE_ZONE self
|
||||||
-- @param Zone#ZONE_BASE TargetZone
|
-- @param Zone#ZONE_BASE TargetZone
|
||||||
-- @return #ROUTE_ZONE self
|
-- @return #PROCESS_ROUTE_ZONE self
|
||||||
function ROUTE_ZONE:New( TargetZone )
|
function PROCESS_ROUTE_ZONE:New( TargetZone )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, ROUTE:New() ) -- #ROUTE_ZONE
|
local self = BASE:Inherit( self, PROCESS_ROUTE:New() ) -- #PROCESS_ROUTE_ZONE
|
||||||
|
|
||||||
self.TargetZone = TargetZone
|
self.TargetZone = TargetZone
|
||||||
|
|
||||||
@@ -205,22 +205,22 @@ do -- ROUTE_ZONE
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Method override to check if the controllable has arrived.
|
--- Method override to check if the controllable has arrived.
|
||||||
-- @param #ROUTE self
|
-- @param #PROCESS_ROUTE self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
function ROUTE_ZONE:HasArrived( ProcessUnit )
|
function PROCESS_ROUTE_ZONE:HasArrived( ProcessUnit )
|
||||||
return ProcessUnit:IsInZone( self.TargetZone )
|
return ProcessUnit:IsInZone( self.TargetZone )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Task Events
|
--- Task Events
|
||||||
|
|
||||||
--- StateMachine callback function
|
--- StateMachine callback function
|
||||||
-- @param #ROUTE_ZONE self
|
-- @param #PROCESS_ROUTE_ZONE self
|
||||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To )
|
function PROCESS_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
local ZoneVec2 = self.TargetZone:GetVec2()
|
local ZoneVec2 = self.TargetZone:GetVec2()
|
||||||
local ZonePointVec2 = POINT_VEC2:New( ZoneVec2.x, ZoneVec2.y )
|
local ZonePointVec2 = POINT_VEC2:New( ZoneVec2.x, ZoneVec2.y )
|
||||||
@@ -230,4 +230,4 @@ do -- ROUTE_ZONE
|
|||||||
MESSAGE:New( RouteText, self.DisplayTime, self.DisplayCategory ):ToGroup( ProcessUnit:GetGroup() )
|
MESSAGE:New( RouteText, self.DisplayTime, self.DisplayCategory ):ToGroup( ProcessUnit:GetGroup() )
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- ROUTE_ZONE
|
end -- PROCESS_ROUTE_ZONE
|
||||||
188
Moose Development/Moose/Process/Smoke.lua
Normal file
188
Moose Development/Moose/Process/Smoke.lua
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
--- (SP) (MP) (FSM) Route AI or players through waypoints or to zones.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- # @{#PROCESS_SMOKE} FSM class, extends @{Process#PROCESS}
|
||||||
|
--
|
||||||
|
-- ## PROCESS_SMOKE state machine:
|
||||||
|
--
|
||||||
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
|
-- All derived classes from this class will start with the class name, followed by a \_. See the relevant derived class descriptions below.
|
||||||
|
-- Each derived class follows exactly the same process, using the same events and following the same state transitions,
|
||||||
|
-- but will have **different implementation behaviour** upon each event or state transition.
|
||||||
|
--
|
||||||
|
-- ### PROCESS_SMOKE **Events**:
|
||||||
|
--
|
||||||
|
-- These are the events defined in this class:
|
||||||
|
--
|
||||||
|
-- * **Start**: The process is started.
|
||||||
|
-- * **Next**: The process is smoking the targets in the given zone.
|
||||||
|
--
|
||||||
|
-- ### PROCESS_SMOKE **Event methods**:
|
||||||
|
--
|
||||||
|
-- Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions occurring in the process.
|
||||||
|
-- There are two types of event methods, which you can use to influence the normal mechanisms in the state machine:
|
||||||
|
--
|
||||||
|
-- * **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.
|
||||||
|
--
|
||||||
|
-- ### PROCESS_SMOKE **States**:
|
||||||
|
--
|
||||||
|
-- * **None**: The controllable did not receive route commands.
|
||||||
|
-- * **AwaitSmoke (*)**: The process is awaiting to smoke the targets in the zone.
|
||||||
|
-- * **Smoking (*)**: The process is smoking the targets in the zone.
|
||||||
|
-- * **Failed (*)**: The process has failed.
|
||||||
|
--
|
||||||
|
-- (*) End states of the process.
|
||||||
|
--
|
||||||
|
-- ### PROCESS_SMOKE state transition methods:
|
||||||
|
--
|
||||||
|
-- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state.
|
||||||
|
-- There are 2 moments when state transition methods will be called by the state machine:
|
||||||
|
--
|
||||||
|
-- * **Before** the state transition.
|
||||||
|
-- The state transition method needs to start with the name **OnBefore + the name of the state**.
|
||||||
|
-- If the state transition method returns false, then the processing of the state transition will not be done!
|
||||||
|
-- If you want to change the behaviour of the AIControllable at this event, return false,
|
||||||
|
-- but then you'll need to specify your own logic using the AIControllable!
|
||||||
|
--
|
||||||
|
-- * **After** the state transition.
|
||||||
|
-- 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) @{#PROCESS_SMOKE_TARGETS_ZONE} class, extends @{Route#PROCESS_SMOKE}
|
||||||
|
--
|
||||||
|
-- The PROCESS_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) PROCESS_SMOKE_TARGETS_ZONE constructor:
|
||||||
|
--
|
||||||
|
-- * @{#PROCESS_SMOKE_TARGETS_ZONE.New}(): Creates a new PROCESS_SMOKE_TARGETS_ZONE object.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- @module Smoke
|
||||||
|
|
||||||
|
do -- PROCESS_SMOKE
|
||||||
|
|
||||||
|
--- PROCESS_SMOKE class
|
||||||
|
-- @type PROCESS_SMOKE
|
||||||
|
-- @extends Fsm.Process#PROCESS
|
||||||
|
PROCESS_SMOKE = {
|
||||||
|
ClassName = "PROCESS_SMOKE",
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
||||||
|
-- @param #PROCESS_SMOKE self
|
||||||
|
-- @return #PROCESS_SMOKE
|
||||||
|
function PROCESS_SMOKE:New()
|
||||||
|
|
||||||
|
local FSMT = {
|
||||||
|
initial = 'None',
|
||||||
|
events = {
|
||||||
|
{ name = 'Start', from = 'None', to = 'AwaitSmoke' },
|
||||||
|
{ name = 'Next', from = 'AwaitSmoke', to = 'Smoking' },
|
||||||
|
{ name = 'Next', from = 'Smoking', to = 'AwaitSmoke' },
|
||||||
|
{ name = 'Stop', from = '*', to = 'Success' },
|
||||||
|
{ name = 'Fail', from = 'Smoking', to = 'Failed' },
|
||||||
|
{ name = 'Fail', from = 'AwaitSmoke', to = 'Failed' },
|
||||||
|
{ name = 'Fail', from = 'None', to = 'Failed' },
|
||||||
|
},
|
||||||
|
endstates = {
|
||||||
|
'Failed', 'Success'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Inherits from BASE
|
||||||
|
local self = BASE:Inherit( self, PROCESS:New( FSMT, "PROCESS_SMOKE" ) ) -- #PROCESS_SMOKE
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Task Events
|
||||||
|
|
||||||
|
--- StateMachine callback function
|
||||||
|
-- @param #PROCESS_SMOKE self
|
||||||
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string To
|
||||||
|
function PROCESS_SMOKE:onafterStart( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
|
local ProcessGroup = self:GetGroup()
|
||||||
|
local MissionMenu = self:GetMission():GetMissionMenu( ProcessGroup )
|
||||||
|
|
||||||
|
local function MenuSmoke( MenuParam )
|
||||||
|
self:E( MenuParam )
|
||||||
|
local self = MenuParam.self
|
||||||
|
local SmokeColor = MenuParam.SmokeColor
|
||||||
|
self.SmokeColor = SmokeColor
|
||||||
|
self:__Next( 1 )
|
||||||
|
end
|
||||||
|
|
||||||
|
self.Menu = MENU_GROUP:New( ProcessGroup, "Target acquisition", MissionMenu )
|
||||||
|
self.MenuSmokeBlue = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop blue smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.Blue } )
|
||||||
|
self.MenuSmokeGreen = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop green smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.Green } )
|
||||||
|
self.MenuSmokeOrange = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop Orange smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.Orange } )
|
||||||
|
self.MenuSmokeRed = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop Red smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.Red } )
|
||||||
|
self.MenuSmokeWhite = MENU_GROUP_COMMAND:New( ProcessGroup, "Drop White smoke on targets", self.Menu, MenuSmoke, { self = self, SmokeColor = SMOKECOLOR.White } )
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
do -- PROCESS_SMOKE_TARGETS_ZONE
|
||||||
|
|
||||||
|
--- PROCESS_SMOKE_TARGETS_ZONE class
|
||||||
|
-- @type PROCESS_SMOKE_TARGETS_ZONE
|
||||||
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
|
-- @field Zone#ZONE_BASE TargetZone
|
||||||
|
-- @extends #PROCESS_SMOKE
|
||||||
|
PROCESS_SMOKE_TARGETS_ZONE = {
|
||||||
|
ClassName = "PROCESS_SMOKE_TARGETS_ZONE",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
||||||
|
-- @param #PROCESS_SMOKE_TARGETS_ZONE self
|
||||||
|
-- @param Set#SET_UNIT TargetSetUnit
|
||||||
|
-- @param Zone#ZONE_BASE TargetZone
|
||||||
|
-- @return #PROCESS_SMOKE_TARGETS_ZONE self
|
||||||
|
function PROCESS_SMOKE_TARGETS_ZONE:New( TargetSetUnit, TargetZone )
|
||||||
|
|
||||||
|
local self = BASE:Inherit( self, PROCESS_SMOKE:New() ) -- #PROCESS_SMOKE
|
||||||
|
|
||||||
|
self.TargetSetUnit = TargetSetUnit
|
||||||
|
self.TargetZone = TargetZone
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- StateMachine callback function
|
||||||
|
-- @param #PROCESS_SMOKE_TARGETS_ZONE self
|
||||||
|
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string To
|
||||||
|
function PROCESS_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To )
|
||||||
|
|
||||||
|
self.TargetSetUnit:ForEachUnit(
|
||||||
|
--- @param Unit#UNIT SmokeUnit
|
||||||
|
function( SmokeUnit )
|
||||||
|
if math.random( 1, ( 100 * self.TargetSetUnit:Count() ) / 4 ) <= 100 then
|
||||||
|
SCHEDULER:New( self,
|
||||||
|
function()
|
||||||
|
if SmokeUnit:IsAlive() then
|
||||||
|
SmokeUnit:Smoke( self.SmokeColor, 150 )
|
||||||
|
end
|
||||||
|
end, {}, math.random( 10, 60 )
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
-- @field Mission#MISSION Mission
|
-- @field Mission#MISSION Mission
|
||||||
-- @field StateMachine#STATEMACHINE Fsm
|
-- @field StateMachine#STATEMACHINE Fsm
|
||||||
-- @field Set#SET_GROUP SetGroup The Set of Groups assigned to the Task
|
-- @field Set#SET_GROUP SetGroup The Set of Groups assigned to the Task
|
||||||
-- @extends Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
TASK_BASE = {
|
TASK_BASE = {
|
||||||
ClassName = "TASK_BASE",
|
ClassName = "TASK_BASE",
|
||||||
TaskScheduler = nil,
|
TaskScheduler = nil,
|
||||||
@@ -418,8 +418,9 @@ function TASK_BASE:AssignProcess( ProcessUnit, ProcessName )
|
|||||||
ProcessTemplate = self:GetProcessTemplate( ProcessName )
|
ProcessTemplate = self:GetProcessTemplate( ProcessName )
|
||||||
|
|
||||||
self:E( "Deepcopy" )
|
self:E( "Deepcopy" )
|
||||||
local Process = UTILS.DeepCopy( ProcessTemplate ) -- Process#PROCESS
|
-- This statement copies the process template assigned to the task and creates a new process.
|
||||||
Process:Assign( ProcessUnit )
|
local Process = UTILS.DeepCopy( ProcessTemplate ) -- Fsm.Process#PROCESS
|
||||||
|
Process:Assign( self, ProcessUnit )
|
||||||
|
|
||||||
self.Processes = self.Processes or {}
|
self.Processes = self.Processes or {}
|
||||||
self.Processes[ProcessUnitName] = self.Processes[ProcessUnitName] or {}
|
self.Processes[ProcessUnitName] = self.Processes[ProcessUnitName] or {}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ do -- TASK_A2G
|
|||||||
|
|
||||||
--- The TASK_A2G class
|
--- The TASK_A2G class
|
||||||
-- @type TASK_A2G
|
-- @type TASK_A2G
|
||||||
-- @extends Task#TASK_BASE
|
-- @extends Tasking.Task#TASK_BASE
|
||||||
TASK_A2G = {
|
TASK_A2G = {
|
||||||
ClassName = "TASK_A2G",
|
ClassName = "TASK_A2G",
|
||||||
}
|
}
|
||||||
@@ -45,6 +45,13 @@ do -- TASK_A2G
|
|||||||
self.TargetZone = TargetZone
|
self.TargetZone = TargetZone
|
||||||
self.FACUnit = FACUnit
|
self.FACUnit = FACUnit
|
||||||
|
|
||||||
|
self:SetProcessTemplate( "PROCESS_ASSIGN", PROCESS_ASSIGN_ACCEPT:New( self.TaskBriefing ) )
|
||||||
|
self:SetProcessTemplate( "PROCESS_ROUTE", PROCESS_ROUTE_ZONE:New( self.TargetZone ) )
|
||||||
|
self:SetProcessTemplate( "PROCESS_ACCOUNT", PROCESS_ACCOUNT_DEADS:New( self.TargetSetUnit, "A2G" ) )
|
||||||
|
|
||||||
|
local ProcessSmoke = self:AddProcess( TaskUnit, PROCESS_SMOKE_TARGETS_ZONE:New( self, TaskUnit, self.TargetSetUnit, self.TargetZone ) )
|
||||||
|
local ProcessJTAC = self:AddProcess( TaskUnit, PROCESS_JTAC:New( self, TaskUnit, self.TargetSetUnit, self.FACUnit ) )
|
||||||
|
|
||||||
_EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventPlayerLeaveUnit, self )
|
_EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventPlayerLeaveUnit, self )
|
||||||
_EVENTDISPATCHER:OnDead( self._EventDead, self )
|
_EVENTDISPATCHER:OnDead( self._EventDead, self )
|
||||||
_EVENTDISPATCHER:OnCrash( self._EventDead, self )
|
_EVENTDISPATCHER:OnCrash( self._EventDead, self )
|
||||||
@@ -71,11 +78,11 @@ do -- TASK_A2G
|
|||||||
function TASK_A2G:AssignToUnit( TaskUnit )
|
function TASK_A2G:AssignToUnit( TaskUnit )
|
||||||
self:F( TaskUnit:GetName() )
|
self:F( TaskUnit:GetName() )
|
||||||
|
|
||||||
local ProcessAssign = self:AddProcess( TaskUnit, PROCESS_ASSIGN_ACCEPT:New( self, TaskUnit, self.TaskBriefing ) )
|
local ProcessAssign = self:AssignProcess( TaskUnit, "PROCESS_ASSIGN" )
|
||||||
local ProcessRoute = self:AddProcess( TaskUnit, PROCESS_ROUTE:New( self, TaskUnit, self.TargetZone ) )
|
local ProcessRoute = self:AssignProcess( TaskUnit, "PROCESS_ROUTE" )
|
||||||
local ProcessDestroy = self:AddProcess( TaskUnit, PROCESS_DESTROY:New( self, self.TaskType, TaskUnit, self.TargetSetUnit ) )
|
local ProcessDestroy = self:AssignProcess( TaskUnit, "PROCESS_ACCOUNT" )
|
||||||
local ProcessSmoke = self:AddProcess( TaskUnit, PROCESS_SMOKE_TARGETS:New( self, TaskUnit, self.TargetSetUnit, self.TargetZone ) )
|
--local ProcessSmoke = self:AddProcess( TaskUnit, PROCESS_SMOKE_TARGETS_ZONE:New( self, TaskUnit, self.TargetSetUnit, self.TargetZone ) )
|
||||||
local ProcessJTAC = self:AddProcess( TaskUnit, PROCESS_JTAC:New( self, TaskUnit, self.TargetSetUnit, self.FACUnit ) )
|
--local ProcessJTAC = self:AddProcess( TaskUnit, PROCESS_JTAC:New( self, TaskUnit, self.TargetSetUnit, self.FACUnit ) )
|
||||||
|
|
||||||
local Process = self:AddStateMachine( TaskUnit, STATEMACHINE_TASK:New( self, TaskUnit, {
|
local Process = self:AddStateMachine( TaskUnit, STATEMACHINE_TASK:New( self, TaskUnit, {
|
||||||
initial = 'None',
|
initial = 'None',
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ do -- TASK_SEAD
|
|||||||
--- The TASK_SEAD class
|
--- The TASK_SEAD class
|
||||||
-- @type TASK_SEAD
|
-- @type TASK_SEAD
|
||||||
-- @field Set#SET_UNIT TargetSetUnit
|
-- @field Set#SET_UNIT TargetSetUnit
|
||||||
-- @extends Task#TASK_BASE
|
-- @extends Tasking.Task#TASK_BASE
|
||||||
TASK_SEAD = {
|
TASK_SEAD = {
|
||||||
ClassName = "TASK_SEAD",
|
ClassName = "TASK_SEAD",
|
||||||
}
|
}
|
||||||
@@ -45,13 +45,11 @@ do -- TASK_SEAD
|
|||||||
self.TargetSetUnit = TargetSetUnit
|
self.TargetSetUnit = TargetSetUnit
|
||||||
self.TargetZone = TargetZone
|
self.TargetZone = TargetZone
|
||||||
|
|
||||||
self:SetProcessTemplate( "ASSIGN", ASSIGN_ACCEPT:New( self.TaskBriefing ) )
|
self:SetProcessTemplate( "ASSIGN", PROCESS_ASSIGN_ACCEPT:New( self.TaskBriefing ) )
|
||||||
self:SetProcessTemplate( "ROUTE", ROUTE_ZONE:New( self.TargetZone ) )
|
self:SetProcessTemplate( "ROUTE", PROCESS_ROUTE_ZONE:New( self.TargetZone ) )
|
||||||
self:SetProcessTemplate( "ACCOUNT", ACCOUNT_DEADS:New( self.TargetSetUnit, "SEAD" ) )
|
self:SetProcessTemplate( "ACCOUNT", PROCESS_ACCOUNT_DEADS:New( self.TargetSetUnit, "SEAD" ) )
|
||||||
|
self:SetProcessTemplate( "SMOKE", PROCESS_SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone ) )
|
||||||
|
|
||||||
-- SMOKE_TARGETS_ZONE:New( self.TargetSetUnit, self.TargetZone )
|
|
||||||
--self:SetProcessClass( "SMOKE", SMOKE_TARGETS_ZONE, self.TargetSetUnit, self.TargetZone )
|
|
||||||
|
|
||||||
_EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventPlayerLeaveUnit, self )
|
_EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventPlayerLeaveUnit, self )
|
||||||
_EVENTDISPATCHER:OnDead( self._EventDead, self )
|
_EVENTDISPATCHER:OnDead( self._EventDead, self )
|
||||||
_EVENTDISPATCHER:OnCrash( self._EventDead, self )
|
_EVENTDISPATCHER:OnCrash( self._EventDead, self )
|
||||||
@@ -81,8 +79,8 @@ do -- TASK_SEAD
|
|||||||
|
|
||||||
local ProcessAssign = self:AssignProcess( TaskUnit, "ASSIGN" )
|
local ProcessAssign = self:AssignProcess( TaskUnit, "ASSIGN" )
|
||||||
local ProcessRoute = self:AssignProcess( TaskUnit, "ROUTE" )
|
local ProcessRoute = self:AssignProcess( TaskUnit, "ROUTE" )
|
||||||
local ProcessSEAD = self:AssignProcess( TaskUnit, "ACCOUNT" )
|
local ProcessAccount = self:AssignProcess( TaskUnit, "ACCOUNT" )
|
||||||
--local ProcessSmoke = self:AssignProcess( TaskUnit, "SMOKE" )
|
local ProcessSmoke = self:AssignProcess( TaskUnit, "SMOKE" )
|
||||||
|
|
||||||
local FSMT = {
|
local FSMT = {
|
||||||
initial = 'None',
|
initial = 'None',
|
||||||
@@ -97,8 +95,8 @@ do -- TASK_SEAD
|
|||||||
subs = {
|
subs = {
|
||||||
Assign = { onstateparent = 'Planned', oneventparent = 'Next', fsm = ProcessAssign, event = 'Start', returnevents = { 'Next', 'Reject' } },
|
Assign = { onstateparent = 'Planned', oneventparent = 'Next', fsm = ProcessAssign, event = 'Start', returnevents = { 'Next', 'Reject' } },
|
||||||
Route = { onstateparent = 'Assigned', oneventparent = 'Next', fsm = ProcessRoute, event = 'Start' },
|
Route = { onstateparent = 'Assigned', oneventparent = 'Next', fsm = ProcessRoute, event = 'Start' },
|
||||||
Sead = { onstateparent = 'Assigned', oneventparent = 'Next', fsm = ProcessSEAD, event = 'Start', returnevents = { 'Next' } },
|
Sead = { onstateparent = 'Assigned', oneventparent = 'Next', fsm = ProcessAccount, event = 'Start', returnevents = { 'Next' } },
|
||||||
--Smoke = { onstateparent = 'Assigned', oneventparent = 'Next', fsm = ProcessSmoke, event = 'Start', }
|
Smoke = { onstateparent = 'Assigned', oneventparent = 'Next', fsm = ProcessSmoke, event = 'Start', }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -968,7 +968,7 @@ function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation,
|
|||||||
return DCSTask
|
return DCSTask
|
||||||
end
|
end
|
||||||
|
|
||||||
-- EN-ROUTE TASKS FOR AIRBORNE CONTROLLABLES
|
-- EN-PROCESS_ROUTE TASKS FOR AIRBORNE CONTROLLABLES
|
||||||
|
|
||||||
--- (AIR) Engaging targets of defined types.
|
--- (AIR) Engaging targets of defined types.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
|
|||||||
@@ -915,7 +915,7 @@ end
|
|||||||
_TransportStage: Defines the different stages of which of transport missions can be in. This table is internal and is used to control the sequence of messages, actions and flow.
|
_TransportStage: Defines the different stages of which of transport missions can be in. This table is internal and is used to control the sequence of messages, actions and flow.
|
||||||
|
|
||||||
- _TransportStage.START
|
- _TransportStage.START
|
||||||
- _TransportStage.ROUTE
|
- _TransportStage.PROCESS_ROUTE
|
||||||
- _TransportStage.LAND
|
- _TransportStage.LAND
|
||||||
- _TransportStage.EXECUTE
|
- _TransportStage.EXECUTE
|
||||||
- _TransportStage.DONE
|
- _TransportStage.DONE
|
||||||
@@ -924,7 +924,7 @@ end
|
|||||||
_TransportStage = {
|
_TransportStage = {
|
||||||
HOLD = "HOLD",
|
HOLD = "HOLD",
|
||||||
START = "START",
|
START = "START",
|
||||||
ROUTE = "ROUTE",
|
PROCESS_ROUTE = "PROCESS_ROUTE",
|
||||||
LANDING = "LANDING",
|
LANDING = "LANDING",
|
||||||
LANDED = "LANDED",
|
LANDED = "LANDED",
|
||||||
EXECUTING = "EXECUTING",
|
EXECUTING = "EXECUTING",
|
||||||
@@ -937,7 +937,7 @@ _TransportStage = {
|
|||||||
_TransportStageMsgTime = {
|
_TransportStageMsgTime = {
|
||||||
HOLD = 10,
|
HOLD = 10,
|
||||||
START = 60,
|
START = 60,
|
||||||
ROUTE = 5,
|
PROCESS_ROUTE = 5,
|
||||||
LANDING = 10,
|
LANDING = 10,
|
||||||
LANDED = 30,
|
LANDED = 30,
|
||||||
EXECUTING = 30,
|
EXECUTING = 30,
|
||||||
@@ -950,7 +950,7 @@ _TransportStageMsgTime = {
|
|||||||
_TransportStageTime = {
|
_TransportStageTime = {
|
||||||
HOLD = 10,
|
HOLD = 10,
|
||||||
START = 5,
|
START = 5,
|
||||||
ROUTE = 5,
|
PROCESS_ROUTE = 5,
|
||||||
LANDING = 1,
|
LANDING = 1,
|
||||||
LANDED = 1,
|
LANDED = 1,
|
||||||
EXECUTING = 5,
|
EXECUTING = 5,
|
||||||
|
|||||||
@@ -15,13 +15,10 @@ local TaskSEAD = TASK_SEAD
|
|||||||
TaskSEAD:AddScore( "Success", "Destroyed all target radars", 250 )
|
TaskSEAD:AddScore( "Success", "Destroyed all target radars", 250 )
|
||||||
TaskSEAD:AddScore( "Failed", "Failed to destroy all target radars", -100 )
|
TaskSEAD:AddScore( "Failed", "Failed to destroy all target radars", -100 )
|
||||||
|
|
||||||
-- ASSIGN_MENU_ACCEPT:New(TaskName,TaskBriefing)
|
local AssignProcess = TaskSEAD:SetProcessTemplate( "ASSIGN", PROCESS_ASSIGN_MENU_ACCEPT:New( "SEAD", "Hello World" ) )
|
||||||
local AssignProcess = TaskSEAD:SetProcessTemplate( "ASSIGN", ASSIGN_MENU_ACCEPT:New( "SEAD", "Hello World" ) )
|
|
||||||
--local AssignProcess = TaskSEAD:SetProcessClass( "ASSIGN", ASSIGN_MENU_ACCEPT, "SEAD", "Hello World" )
|
|
||||||
AssignProcess:AddScore( TaskSEAD, "Assign", "You are assigned to the task", 10 )
|
AssignProcess:AddScore( TaskSEAD, "Assign", "You are assigned to the task", 10 )
|
||||||
|
|
||||||
-- ACCOUNT_DEADS:New(ProcessUnit,TargetSetUnit,TaskName)
|
local AccountProcess = TaskSEAD:SetProcessTemplate( "ACCOUNT", PROCESS_ACCOUNT_DEADS:New( TargetSet, "SEAD" ) )
|
||||||
local AccountProcess = TaskSEAD:SetProcessTemplate( "ACCOUNT", ACCOUNT_DEADS:New( TargetSet, "SEAD" ) )
|
|
||||||
AccountProcess:AddScore( TaskSEAD, "Account", "destroyed a radar", 25 )
|
AccountProcess:AddScore( TaskSEAD, "Account", "destroyed a radar", 25 )
|
||||||
AccountProcess:AddScore( TaskSEAD, "Failed", "failed to destroy a radar", -100 )
|
AccountProcess:AddScore( TaskSEAD, "Failed", "failed to destroy a radar", -100 )
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user