Merge pull request #178 from FlightControl-Master/Moose-Release

Moose release
This commit is contained in:
Sven Van de Velde 2016-12-21 17:33:24 +01:00 committed by GitHub
commit 0ab77d24b0
97 changed files with 1184 additions and 416 deletions

View File

@ -139,7 +139,7 @@ end
-- @param Core.Set#SET_GROUP SetGroup
-- @param #string ClientName
-- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterSpawning( SetGroup, Event, From, To, ClientName )
function AI_BALANCER:onenterSpawning( SetGroup, From, Event, To, ClientName )
-- OK, Spawn a new group from the default SpawnAI object provided.
local AIGroup = self.SpawnAI:Spawn()
@ -156,7 +156,7 @@ end
--- @param #AI_BALANCER self
-- @param Core.Set#SET_GROUP SetGroup
-- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterDestroying( SetGroup, Event, From, To, AIGroup )
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, AIGroup )
AIGroup:Destroy()
end
@ -164,7 +164,7 @@ end
--- @param #AI_BALANCER self
-- @param Core.Set#SET_GROUP SetGroup
-- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterReturning( SetGroup, Event, From, To, AIGroup )
function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
local AIGroupTemplate = AIGroup:GetTemplate()
if self.ToHomeAirbase == true then

View File

@ -368,7 +368,7 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
function AI_CARGO_UNIT:onenterUnBoarding( Event, From, To, ToPointVec2 )
function AI_CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2 )
self:F()
local Angle = 180
@ -413,8 +413,8 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
function AI_CARGO_UNIT:onleaveUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
local Angle = 180
local Speed = 10
@ -437,8 +437,8 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
function AI_CARGO_UNIT:onafterUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
self.CargoInAir = self.CargoObject:InAir()
@ -462,8 +462,8 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2
function AI_CARGO_UNIT:onenterUnLoaded( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
local Angle = 180
local Speed = 10
@ -500,8 +500,8 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_UNIT:onenterBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_UNIT:onenterBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
local Speed = 10
local Angle = 180
@ -532,8 +532,8 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_UNIT:onleaveBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_UNIT:onleaveBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
if self:IsNear( CargoCarrier:GetPointVec2() ) then
self:__Load( 1, CargoCarrier )
@ -550,7 +550,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_UNIT:onenterLoaded( Event, From, To, CargoCarrier )
function AI_CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
self:F()
self.CargoCarrier = CargoCarrier
@ -568,7 +568,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_UNIT:onafterBoard( Event, From, To, CargoCarrier )
function AI_CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier )
self:F()
self.CargoInAir = self.CargoObject:InAir()
@ -621,7 +621,7 @@ end
-- @param #number Speed
-- @param #number BoardDistance
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterOnBoard( Event, From, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
function AI_CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
self:F()
self.CargoInAir = self.CargoCarrier:InAir()
@ -675,7 +675,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_PACKAGE:onafterOnBoarded( Event, From, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
function AI_CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
self:F()
if self:IsNear( CargoCarrier ) then
@ -695,7 +695,7 @@ end
-- @param #number UnBoardDistance
-- @param #number Radius
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterUnBoard( Event, From, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
function AI_CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
self:F()
self.CargoInAir = self.CargoCarrier:InAir()
@ -733,7 +733,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_PACKAGE:onafterUnBoarded( Event, From, To, CargoCarrier, Speed )
function AI_CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
self:F()
if self:IsNear( CargoCarrier ) then
@ -752,7 +752,7 @@ end
-- @param #number Speed
-- @param #number LoadDistance
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterLoad( Event, From, To, CargoCarrier, Speed, LoadDistance, Angle )
function AI_CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
self:F()
self.CargoCarrier = CargoCarrier
@ -778,7 +778,7 @@ end
-- @param #string To
-- @param #number Distance
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterUnLoad( Event, From, To, CargoCarrier, Speed, Distance, Angle )
function AI_CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
self:F()
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
@ -861,8 +861,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_GROUPED:onenterBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
if From == "UnLoaded" then
@ -884,8 +884,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterLoaded( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_GROUPED:onenterLoaded( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
if From == "UnLoaded" then
-- For each Cargo object within the AI_CARGO_GROUPED, load each cargo to the CargoCarrier.
@ -901,8 +901,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onleaveBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_GROUPED:onleaveBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
local Boarded = true
@ -928,7 +928,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterUnBoarding( Event, From, To, ToPointVec2 )
function AI_CARGO_GROUPED:onenterUnBoarding( From, Event, To, ToPointVec2 )
self:F()
local Timer = 1
@ -954,8 +954,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onleaveUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_GROUPED:onleaveUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
local Angle = 180
local Speed = 10
@ -989,8 +989,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onafterUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_GROUPED:onafterUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
self:__UnLoad( 1, ToPointVec2 )
end
@ -1003,8 +1003,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterUnLoaded( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_GROUPED:onenterUnLoaded( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
if From == "Loaded" then

View File

@ -115,7 +115,7 @@ do -- ACT_ACCOUNT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT:onafterStart( ProcessUnit, Event, From, To )
function ACT_ACCOUNT:onafterStart( ProcessUnit, From, Event, To )
self:EventOnDead( self.onfuncEventDead )
@ -129,7 +129,7 @@ do -- ACT_ACCOUNT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To )
function ACT_ACCOUNT:onenterWaiting( ProcessUnit, From, Event, To )
if self.DisplayCount >= self.DisplayInterval then
self:Report()
@ -147,7 +147,7 @@ do -- ACT_ACCOUNT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event )
function ACT_ACCOUNT:onafterEvent( ProcessUnit, From, Event, To, Event )
self:__NoMore( 1 )
end
@ -209,8 +209,8 @@ do -- ACT_ACCOUNT_DEADS
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, From, Event, To )
self:E( { ProcessUnit, From, Event, To } )
self:Message( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed." )
end
@ -222,8 +222,8 @@ do -- ACT_ACCOUNT_DEADS
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, EventData )
self:T( { ProcessUnit, EventData, Event, From, To } )
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, From, Event, To, EventData )
self:T( { ProcessUnit, EventData, From, Event, To } )
self:T({self.Controllable})
@ -242,7 +242,7 @@ do -- ACT_ACCOUNT_DEADS
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, EventData )
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, From, Event, To, EventData )
if self.TargetSetUnit:Count() > 0 then
self:__More( 1 )

View File

@ -155,8 +155,8 @@ do -- ACT_ASSIGN_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
function ACT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, From, Event, To )
self:E( { ProcessUnit, From, Event, To } )
self:__Assign( 1 )
end
@ -167,9 +167,9 @@ do -- ACT_ASSIGN_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, Event, From, To )
function ACT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, From, Event, To )
env.info( "in here" )
self:E( { ProcessUnit, Event, From, To } )
self:E( { ProcessUnit, From, Event, To } )
local ProcessGroup = ProcessUnit:GetGroup()
@ -235,8 +235,8 @@ do -- ACT_ASSIGN_MENU_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
function ACT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, From, Event, To )
self:E( { ProcessUnit, From, Event, To } )
self:Message( "Access the radio menu to accept the task. You have 30 seconds or the assignment will be cancelled." )
@ -269,8 +269,8 @@ do -- ACT_ASSIGN_MENU_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To )
self:E( { ProcessUnit.UnitNameEvent, From, To } )
function ACT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, From, Event, To )
self:E( { ProcessUnit.UnitNameFrom, Event, To } )
self.Menu:Remove()
end
@ -281,8 +281,8 @@ do -- ACT_ASSIGN_MENU_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To )
self:E( { ProcessUnit.UnitName, Event, From, To } )
function ACT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, From, Event, To )
self:E( { ProcessUnit.UnitName, From, Event, To } )
self.Menu:Remove()
--TODO: need to resolve this problem ... it has to do with the events ...

View File

@ -105,7 +105,7 @@ do -- ACT_ASSIST
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIST:onafterStart( ProcessUnit, Event, From, To )
function ACT_ASSIST:onafterStart( ProcessUnit, From, Event, To )
local ProcessGroup = ProcessUnit:GetGroup()
local MissionMenu = self:GetMission():GetMissionMenu( ProcessGroup )
@ -184,7 +184,7 @@ do -- ACT_ASSIST_SMOKE_TARGETS_ZONE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIST_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To )
function ACT_ASSIST_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, From, Event, To )
self.TargetSetUnit:ForEachUnit(
--- @param Wrapper.Unit#UNIT SmokeUnit

View File

@ -70,7 +70,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function PROCESS_JTAC:OnStart( Fsm, Event, From, To )
function PROCESS_JTAC:OnStart( Fsm, From, Event, To )
self:NextEvent( Fsm.JTACMenuUpdate )
end
@ -81,7 +81,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function PROCESS_JTAC:OnJTACMenuUpdate( Fsm, Event, From, To )
function PROCESS_JTAC:OnJTACMenuUpdate( Fsm, From, Event, To )
local function JTACMenuSpot( MenuParam )
self:E( MenuParam.TargetUnit.UnitName )
@ -127,7 +127,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function PROCESS_JTAC:OnJTACMenuAwait( Fsm, Event, From, To )
function PROCESS_JTAC:OnJTACMenuAwait( Fsm, From, Event, To )
if self.DisplayCount >= self.DisplayInterval then
@ -152,7 +152,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT TargetUnit
function PROCESS_JTAC:OnJTACMenuSpot( Fsm, Event, From, To, TargetUnit )
function PROCESS_JTAC:OnJTACMenuSpot( Fsm, From, Event, To, TargetUnit )
local TargetUnitName = TargetUnit:GetName()
@ -179,7 +179,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT TargetUnit
function PROCESS_JTAC:OnJTACMenuCancel( Fsm, Event, From, To, TargetUnit )
function PROCESS_JTAC:OnJTACMenuCancel( Fsm, From, Event, To, TargetUnit )
local TargetUnitName = TargetUnit:GetName()

View File

@ -61,7 +61,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function PROCESS_PICKUP:OnStart( Fsm, Event, From, To )
function PROCESS_PICKUP:OnStart( Fsm, From, Event, To )
self:NextEvent( Fsm.Start )
end
@ -72,7 +72,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function PROCESS_PICKUP:OnNavigating( Fsm, Event, From, To )
function PROCESS_PICKUP:OnNavigating( Fsm, From, Event, To )
local TaskGroup = self.ProcessUnit:GetGroup()
if self.DisplayCount >= self.DisplayInterval then
@ -94,7 +94,7 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Event#EVENTDATA Event
function PROCESS_PICKUP:OnHitTarget( Fsm, Event, From, To, Event )
function PROCESS_PICKUP:OnHitTarget( Fsm, From, Event, To, Event )
self.TargetSetUnit:Flush()
@ -119,7 +119,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function PROCESS_PICKUP:OnMoreTargets( Fsm, Event, From, To )
function PROCESS_PICKUP:OnMoreTargets( Fsm, From, Event, To )
end
@ -131,7 +131,7 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Event#EVENTDATA DCSEvent
function PROCESS_PICKUP:OnKilled( Fsm, Event, From, To )
function PROCESS_PICKUP:OnKilled( Fsm, From, Event, To )
self:NextEvent( Fsm.Restart )
@ -143,7 +143,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function PROCESS_PICKUP:OnRestart( Fsm, Event, From, To )
function PROCESS_PICKUP:OnRestart( Fsm, From, Event, To )
self:NextEvent( Fsm.Menu )
@ -155,7 +155,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function PROCESS_PICKUP:OnDestroyed( Fsm, Event, From, To )
function PROCESS_PICKUP:OnDestroyed( Fsm, From, Event, To )
end

View File

@ -123,7 +123,7 @@ do -- ACT_ROUTE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ROUTE:onafterStart( ProcessUnit, Event, From, To )
function ACT_ROUTE:onafterStart( ProcessUnit, From, Event, To )
self:__Route( 1 )
@ -143,7 +143,7 @@ do -- ACT_ROUTE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ROUTE:onbeforeRoute( ProcessUnit, Event, From, To )
function ACT_ROUTE:onbeforeRoute( ProcessUnit, From, Event, To )
self:F( { "BeforeRoute 1", self.DisplayCount, self.DisplayInterval } )
if ProcessUnit:IsAlive() then
@ -239,7 +239,7 @@ do -- ACT_ROUTE_ZONE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To )
function ACT_ROUTE_ZONE:onenterReporting( ProcessUnit, From, Event, To )
local ZoneVec2 = self.TargetZone:GetVec2()
local ZonePointVec2 = POINT_VEC2:New( ZoneVec2.x, ZoneVec2.y )

View File

@ -122,13 +122,31 @@
-- * @{#BASE.Inherit}: Inherits from a class.
-- * @{#BASE.GetParent}: Returns the parent object from the object it is handling, or nil if there is no parent object.
--
-- Future
-- ======
-- Further methods may be added to BASE whenever there is a need to make "overall" functions available within MOOSE.
--
-- ====
--
-- ### Author: FlightControl
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
-- * **Added** parts are expressed in bold type face.
-- * _Removed_ parts are expressed in italic type face.
--
-- YYYY-MM-DD: CLASS:**NewFunction**( Params ) replaces CLASS:_OldFunction_( Params )
-- YYYY-MM-DD: CLASS:**NewFunction( Params )** added
--
-- Hereby the change log:
--
-- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
-- * None.
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- @module Base

View File

@ -1,19 +1,80 @@
--- This module contains the FSM class.
--- This module contains the FSM class and derived FSM_ classes.
--
-- This development is based on a state machine implementation made by Conroy Kyle.
-- The state machine can be found here: https://github.com/kyleconroy/lua-state-machine
--
-- I've taken the development and enhanced it to make the state machine hierarchical...
-- I've taken the development and enhanced it (actually rewrote it) to make the state machine hierarchical...
-- It is a fantastic development, this module.
--
-- ===
--
-- 1) @{Workflow#FSM} class, extends @{Core.Base#BASE}
-- ==============================================
-- # 1) @{Core.Fsm#FSM} class, extends @{Core.Base#BASE}
--
-- A Finite State Machine (FSM) defines the rules of transitioning between various States triggered by Events.
--
-- * A **State** defines a moment in the process.
-- * An **Event** describes an action, that can be triggered both internally as externally in the FSM. An Event can be triggered Embedded or Delayed over time.
--
-- ![Test Image](../Presentations/MOOSE - FSM - 1. Concepts/Dia3.jpg)
--
-- An FSM transitions in **4 moments** when an Event is being handled.
-- Each moment can be catched by handling methods defined by the mission designer,
-- that will be called by the FSM while executing the transition.
-- These methods define the flow of the FSM process; because in those methods the FSM Internal Events will be fired.
--
-- * To catch State moments, create methods starting with OnLeave or OnEnter concatenated with the State name.
-- * To catch Event moments, create methods starting with OnBefore or OnAfter concatenated with the Event name.
--
-- ** The OnLeave and OnBefore transition methods may return false to cancel the transition.**
--
-- ![Test Image](../Presentations/MOOSE - FSM - 1. Concepts/Dia4.jpg)
--
-- The FSM creates for each Event **two Event trigger methods**.
-- There are two modes how Events can be triggered, which is **embedded** and **delayed**:
--
-- * The **FSM:Event()** creates an Event that will be processed **embedded** or immediately.
-- * The **FSM:__Event( seconds )** creates an Event that will be processed **delayed** over time, waiting x seconds.
--
-- ![Test Image](../Presentations/MOOSE - FSM - 1. Concepts/Dia5.jpg)
--
-- 1.1) Define the FSM Rules
-- -------------------------
--
-- The FSM can be defined by using 3 methods:
--
-- * @{#FSM.SetStartState}(): Define the **Start State** of the FSM. This is the State the FSM will have when nothing is processed yet.
-- * @{#FSM.AddTransition}(): Adds a new possible Transition Rule to the FSM. A Transition will change the State of the FSM upon the defined triggered Event.
-- * @{#FSM.AddProcess}(): Adds a new Sub-Process FSM to the FSM. A Sub-Process will start the Sub-Process of the FSM upon the defined triggered Event, with multiple possible States as a result.
--
-- ====
--
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
-- * **Added** parts are expressed in bold type face.
-- * _Removed_ parts are expressed in italic type face.
--
-- YYYY-MM-DD: CLASS:**NewFunction**( Params ) replaces CLASS:_OldFunction_( Params )
-- YYYY-MM-DD: CLASS:**NewFunction( Params )** added
--
-- Hereby the change log:
--
-- * 2016-12-18: Released.
--
-- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
-- * None.
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- 1.1) Add or remove objects from the FSM
-- --------------------------------------------
-- @module Fsm
-- @author FlightControl
do -- FSM
@ -238,7 +299,7 @@ do -- FSM
if can then
local from = self.current
local params = { EventName, from, to, ... }
local params = { from, EventName, to, ... }
if self:_call_handler("onbefore" .. EventName, params) == false
or self:_call_handler("onleave" .. from, params) == false then
@ -628,8 +689,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function FSM_PROCESS:onstatechange( ProcessUnit, Event, From, To, Dummy )
self:E( { ProcessUnit, Event, From, To, Dummy, self:IsTrace() } )
function FSM_PROCESS:onstatechange( ProcessUnit, From, Event, To, Dummy )
self:E( { ProcessUnit, From, Event, To, Dummy, self:IsTrace() } )
if self:IsTrace() then
MESSAGE:New( "@ Process " .. self:GetClassNameAndID() .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll()

View File

@ -1,7 +1,7 @@
--- This module contains the SPAWN class.
--
-- 1) @{Functional.Spawn#SPAWN} class, extends @{Core.Base#BASE}
-- =============================================
-- # 1) @{Functional.Spawn#SPAWN} class, extends @{Core.Base#BASE}
--
-- The @{#SPAWN} class allows to spawn dynamically new groups, based on pre-defined initialization settings, modifying the behaviour when groups are spawned.
-- For each group to be spawned, within the mission editor, a group has to be created with the "late activation flag" set. We call this group the *"Spawn Template"* of the SPAWN object.
-- A reference to this Spawn Template needs to be provided when constructing the SPAWN object, by indicating the name of the group within the mission editor in the constructor methods.
@ -24,8 +24,8 @@
-- * It is important to defined BEFORE you spawn new groups, a proper initialization of the SPAWN instance is done with the options you want to use.
-- * When designing a mission, NEVER name groups using a "#" within the name of the group Spawn Template(s), or the SPAWN module logic won't work anymore.
--
-- 1.1) SPAWN construction methods
-- -------------------------------
-- ## 1.1) SPAWN construction methods
--
-- Create a new SPAWN object with the @{#SPAWN.New}() or the @{#SPAWN.NewWithAlias}() methods:
--
-- * @{#SPAWN.New}(): Creates a new SPAWN object taking the name of the group that represents the GROUP Template (definition).
@ -35,8 +35,8 @@
-- The initialization methods will modify this list of groups so that when a group gets spawned, ALL information is already prepared when spawning. This is done for performance reasons.
-- So in principle, the group list will contain all parameters and configurations after initialization, and when groups get actually spawned, this spawning can be done quickly and efficient.
--
-- 1.2) SPAWN initialization methods
-- ---------------------------------
-- ## 1.2) SPAWN initialization methods
--
-- A spawn object will behave differently based on the usage of **initialization** methods, which all start with the **Init** prefix:
--
-- * @{#SPAWN.InitLimit}(): Limits the amount of groups that can be alive at the same time and that can be dynamically spawned.
@ -48,8 +48,8 @@
-- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Unit}s in the @{Group} that is spawned within a **radius band**, given an Outer and Inner radius.
-- * @{#SPAWN.InitRandomizeZones}(): Randomizes the spawning between a predefined list of @{Zone}s that are declared using this function. Each zone can be given a probability factor.
--
-- 1.3) SPAWN spawning methods
-- ---------------------------
-- ## 1.3) SPAWN spawning methods
--
-- Groups can be spawned at different times and methods:
--
-- * @{#SPAWN.Spawn}(): Spawn one new group based on the last spawned index.
@ -64,8 +64,8 @@
-- Note that @{#SPAWN.Spawn} and @{#SPAWN.ReSpawn} return a @{GROUP#GROUP.New} object, that contains a reference to the DCSGroup object.
-- You can use the @{GROUP} object to do further actions with the DCSGroup.
--
-- 1.4) Retrieve alive GROUPs spawned by the SPAWN object
-- ------------------------------------------------------
-- ## 1.4) Retrieve alive GROUPs spawned by the SPAWN object
--
-- The SPAWN class administers which GROUPS it has reserved (in stock) or has created during mission execution.
-- Every time a SPAWN object spawns a new GROUP object, a reference to the GROUP object is added to an internal table of GROUPS.
-- SPAWN provides methods to iterate through that internal GROUP object reference table:
@ -77,8 +77,8 @@
-- You can use the methods @{#SPAWN.GetFirstAliveGroup}() and sequently @{#SPAWN.GetNextAliveGroup}() to iterate through the alive GROUPS within the SPAWN object, and to actions... See the respective methods for an example.
-- The method @{#SPAWN.GetGroupFromIndex}() will return the GROUP object reference from the given Index, dead or alive...
--
-- 1.5) SPAWN object cleaning
-- --------------------------
-- ## 1.5) SPAWN object cleaning
--
-- Sometimes, it will occur during a mission run-time, that ground or especially air objects get damaged, and will while being damged stop their activities, while remaining alive.
-- In such cases, the SPAWN object will just sit there and wait until that group gets destroyed, but most of the time it won't,
-- and it may occur that no new groups are or can be spawned as limits are reached.
@ -89,8 +89,8 @@
-- This models AI that has succesfully returned to their airbase, to restart their combat activities.
-- Check the @{#SPAWN.InitCleanUp}() for further info.
--
-- 1.6) Catch the @{Group} spawn event in a callback function!
-- -----------------------------------------------------------
-- ## 1.6) Catch the @{Group} spawn event in a callback function!
--
-- When using the SpawnScheduled method, new @{Group}s are created following the schedule timing parameters.
-- When a new @{Group} is spawned, you maybe want to execute actions with that group spawned at the spawn event.
-- To SPAWN class supports this functionality through the @{#SPAWN.OnSpawnGroup}( **function( SpawnedGroup ) end ** ) method, which takes a function as a parameter that you can define locally.
@ -100,8 +100,7 @@
--
-- ====
--
-- **API CHANGE HISTORY**
-- ======================
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
@ -177,8 +176,7 @@
--
-- ===
--
-- AUTHORS and CONTRIBUTIONS
-- =========================
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
@ -188,7 +186,6 @@
--
-- * **FlightControl**: Design & Programming
--
--
-- @module Spawn

View File

@ -69,7 +69,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function MISSION:onbeforeComplete( Event, From, To )
function MISSION:onbeforeComplete( From, Event, To )
for TaskID, Task in pairs( self:GetTasks() ) do
local Task = Task -- Tasking.Task#TASK
@ -85,7 +85,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function MISSION:onenterCompleted( Event, From, To )
function MISSION:onenterCompleted( From, Event, To )
self:GetCommandCenter():MessageToCoalition( "Mission " .. self:GetName() .. " has been completed! Good job guys!" )
end

View File

@ -869,7 +869,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterAssigned( Event, From, To )
function TASK:onenterAssigned( From, Event, To )
self:E("Task Assigned")
@ -883,7 +883,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterSuccess( Event, From, To )
function TASK:onenterSuccess( From, Event, To )
self:E( "Task Success" )
@ -900,7 +900,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterAborted( Event, From, To )
function TASK:onenterAborted( From, Event, To )
self:E( "Task Aborted" )
@ -914,7 +914,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterFailed( Event, From, To )
function TASK:onenterFailed( From, Event, To )
self:E( "Task Failed" )
@ -928,7 +928,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onstatechange( Event, From, To )
function TASK:onstatechange( From, Event, To )
if self:IsTrace() then
MESSAGE:New( "@ Task " .. self.TaskName .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll()

View File

@ -103,7 +103,7 @@ do -- TASK_PICKUP
-- @param #string From
-- @param #string To
-- @param Event#EVENTDATA Event
function TASK_PICKUP:OnNext( Fsm, Event, From, To, Event )
function TASK_PICKUP:OnNext( Fsm, From, Event, To, Event )
self:SetState( self, "State", To )

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20161218_1138' )
env.info( 'Moose Generation Timestamp: 20161220_0922' )
local base = _G
Include = {}
@ -2803,27 +2803,27 @@ end
--
-- Note: Normally you would not use the BASE class unless you are extending the MOOSE framework with new classes.
--
-- 1.1) BASE constructor
-- ---------------------
-- ## 1.1) BASE constructor
--
-- Any class derived from BASE, must use the @{Core.Base#BASE.New) constructor within the @{Core.Base#BASE.Inherit) method.
-- See an example at the @{Core.Base#BASE.New} method how this is done.
--
-- 1.2) BASE Trace functionality
-- -----------------------------
-- ## 1.2) BASE Trace functionality
--
-- The BASE class contains trace methods to trace progress within a mission execution of a certain object.
-- Note that these trace methods are inherited by each MOOSE class interiting BASE.
-- As such, each object created from derived class from BASE can use the tracing functions to trace its execution.
--
-- 1.2.1) Tracing functions
-- ------------------------
-- ### 1.2.1) Tracing functions
--
-- There are basically 3 types of tracing methods available within BASE:
--
-- * @{#BASE.F}: Trace the beginning of a function and its given parameters. An F is indicated at column 44 in the DCS.log file.
-- * @{#BASE.T}: Trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.
-- * @{#BASE.E}: Trace an exception within a function giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file. An exception will always be traced.
--
-- 1.2.2) Tracing levels
-- ---------------------
-- ### 1.2.2) Tracing levels
--
-- There are 3 tracing levels within MOOSE.
-- These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects.
--
@ -2834,20 +2834,111 @@ end
-- * @{#BASE.T2}: Trace further logic within a function giving optional variables or parameters with tracing level 2.
-- * @{#BASE.T3}: Trace further logic within a function giving optional variables or parameters with tracing level 3.
--
-- 1.3) BASE Inheritance support
-- ===========================
-- ### 1.2.3) Trace activation.
--
-- Tracing can be activated in several ways:
--
-- * Switch tracing on or off through the @{#BASE.TraceOnOff}() method.
-- * Activate all tracing through the @{#BASE.TraceAll}() method.
-- * Activate only the tracing of a certain class (name) through the @{#BASE.TraceClass}() method.
-- * Activate only the tracing of a certain method of a certain class through the @{#BASE.TraceClassMethod}() method.
-- * Activate only the tracing of a certain level through the @{#BASE.TraceLevel}() method.
-- ### 1.2.4) Check if tracing is on.
--
-- The method @{#BASE.IsTrace}() will validate if tracing is activated or not.
--
-- ## 1.3 DCS simulator Event Handling
--
-- The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator,
-- and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently.
-- Therefore, the BASE class exposes the following event handling functions:
--
-- * @{#BASE.EventOnBirth}(): Handle the birth of a new unit.
-- * @{#BASE.EventOnBaseCaptured}(): Handle the capturing of an airbase or a helipad.
-- * @{#BASE.EventOnCrash}(): Handle the crash of a unit.
-- * @{#BASE.EventOnDead}(): Handle the death of a unit.
-- * @{#BASE.EventOnEjection}(): Handle the ejection of a player out of an airplane.
-- * @{#BASE.EventOnEngineShutdown}(): Handle the shutdown of an engine.
-- * @{#BASE.EventOnEngineStartup}(): Handle the startup of an engine.
-- * @{#BASE.EventOnHit}(): Handle the hit of a shell to a unit.
-- * @{#BASE.EventOnHumanFailure}(): No a clue ...
-- * @{#BASE.EventOnLand}(): Handle the event when a unit lands.
-- * @{#BASE.EventOnMissionStart}(): Handle the start of the mission.
-- * @{#BASE.EventOnPilotDead}(): Handle the event when a pilot is dead.
-- * @{#BASE.EventOnPlayerComment}(): Handle the event when a player posts a comment.
-- * @{#BASE.EventOnPlayerEnterUnit}(): Handle the event when a player enters a unit.
-- * @{#BASE.EventOnPlayerLeaveUnit}(): Handle the event when a player leaves a unit.
-- * @{#BASE.EventOnBirthPlayerMissionEnd}(): Handle the event when a player ends the mission. (Not a clue what that does).
-- * @{#BASE.EventOnRefueling}(): Handle the event when a unit is refueling.
-- * @{#BASE.EventOnShootingEnd}(): Handle the event when a unit starts shooting (guns).
-- * @{#BASE.EventOnShootingStart}(): Handle the event when a unit ends shooting (guns).
-- * @{#BASE.EventOnShot}(): Handle the event when a unit shot a missile.
-- * @{#BASE.EventOnTakeOff}(): Handle the event when a unit takes off from a runway.
-- * @{#BASE.EventOnTookControl}(): Handle the event when a player takes control of a unit.
--
-- The EventOn() methods provide the @{Core.Event#EVENTDATA} structure to the event handling function.
-- The @{Core.Event#EVENTDATA} structure contains an enriched data set of information about the event being handled.
--
-- Find below an example of the prototype how to write an event handling function:
--
-- CommandCenter:EventOnPlayerEnterUnit(
-- --- @param #COMMANDCENTER self
-- -- @param Core.Event#EVENTDATA EventData
-- function( self, EventData )
-- local PlayerUnit = EventData.IniUnit
-- for MissionID, Mission in pairs( self:GetMissions() ) do
-- local Mission = Mission -- Tasking.Mission#MISSION
-- Mission:JoinUnit( PlayerUnit )
-- Mission:ReportDetails()
-- end
-- end
-- )
--
-- Note the function( self, EventData ). It takes two parameters:
--
-- * self = the object that is handling the EventOnPlayerEnterUnit.
-- * EventData = the @{Core.Event#EVENTDATA} structure, containing more information of the Event.
--
-- ## 1.4) Class identification methods
--
-- BASE provides methods to get more information of each object:
--
-- * @{#BASE.GetClassID}(): Gets the ID (number) of the object. Each object created is assigned a number, that is incremented by one.
-- * @{#BASE.GetClassName}(): Gets the name of the object, which is the name of the class the object was instantiated from.
-- * @{#BASE.GetClassNameAndID}(): Gets the name and ID of the object.
--
-- ## 1.10) BASE Inheritance (tree) support
--
-- The following methods are available to support inheritance:
--
-- * @{#BASE.Inherit}: Inherits from a class.
-- * @{#BASE.Inherited}: Returns the parent class from the class.
--
-- Future
-- ======
-- Further methods may be added to BASE whenever there is a need to make "overall" functions available within MOOSE.
--
-- * @{#BASE.GetParent}: Returns the parent object from the object it is handling, or nil if there is no parent object.
--
-- ====
--
-- ### Author: FlightControl
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
-- * **Added** parts are expressed in bold type face.
-- * _Removed_ parts are expressed in italic type face.
--
-- YYYY-MM-DD: CLASS:**NewFunction**( Params ) replaces CLASS:_OldFunction_( Params )
-- YYYY-MM-DD: CLASS:**NewFunction( Params )** added
--
-- Hereby the change log:
--
-- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
-- * None.
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- @module Base
@ -3009,7 +3100,7 @@ function BASE:EventRemoveAll()
return self
end
--- Subscribe to a S_EVENT_SHOT event.
--- Subscribe to a S_EVENT\_SHOT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3020,7 +3111,7 @@ function BASE:EventOnShot( EventFunction )
return self
end
--- Subscribe to a S_EVENT_HIT event.
--- Subscribe to a S_EVENT\_HIT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3031,7 +3122,7 @@ function BASE:EventOnHit( EventFunction )
return self
end
--- Subscribe to a S_EVENT_TAKEOFF event.
--- Subscribe to a S_EVENT\_TAKEOFF event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3042,7 +3133,7 @@ function BASE:EventOnTakeOff( EventFunction )
return self
end
--- Subscribe to a S_EVENT_LAND event.
--- Subscribe to a S_EVENT\_LAND event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3053,7 +3144,7 @@ function BASE:EventOnLand( EventFunction )
return self
end
--- Subscribe to a S_EVENT_CRASH event.
--- Subscribe to a S_EVENT\_CRASH event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3064,7 +3155,7 @@ function BASE:EventOnCrash( EventFunction )
return self
end
--- Subscribe to a S_EVENT_EJECTION event.
--- Subscribe to a S_EVENT\_EJECTION event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3076,7 +3167,7 @@ function BASE:EventOnEjection( EventFunction )
end
--- Subscribe to a S_EVENT_REFUELING event.
--- Subscribe to a S_EVENT\_REFUELING event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3087,7 +3178,7 @@ function BASE:EventOnRefueling( EventFunction )
return self
end
--- Subscribe to a S_EVENT_DEAD event.
--- Subscribe to a S_EVENT\_DEAD event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3098,7 +3189,7 @@ function BASE:EventOnDead( EventFunction )
return self
end
--- Subscribe to a S_EVENT_PILOT_DEAD event.
--- Subscribe to a S_EVENT_PILOT\_DEAD event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3109,7 +3200,7 @@ function BASE:EventOnPilotDead( EventFunction )
return self
end
--- Subscribe to a S_EVENT_BASE_CAPTURED event.
--- Subscribe to a S_EVENT_BASE\_CAPTURED event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3120,7 +3211,7 @@ function BASE:EventOnBaseCaptured( EventFunction )
return self
end
--- Subscribe to a S_EVENT_MISSION_START event.
--- Subscribe to a S_EVENT_MISSION\_START event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3131,7 +3222,7 @@ function BASE:EventOnMissionStart( EventFunction )
return self
end
--- Subscribe to a S_EVENT_MISSION_END event.
--- Subscribe to a S_EVENT_MISSION\_END event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3142,7 +3233,7 @@ function BASE:EventOnPlayerMissionEnd( EventFunction )
return self
end
--- Subscribe to a S_EVENT_TOOK_CONTROL event.
--- Subscribe to a S_EVENT_TOOK\_CONTROL event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3153,7 +3244,7 @@ function BASE:EventOnTookControl( EventFunction )
return self
end
--- Subscribe to a S_EVENT_REFUELING_STOP event.
--- Subscribe to a S_EVENT_REFUELING\_STOP event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3164,7 +3255,7 @@ function BASE:EventOnRefuelingStop( EventFunction )
return self
end
--- Subscribe to a S_EVENT_BIRTH event.
--- Subscribe to a S_EVENT\_BIRTH event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3175,7 +3266,7 @@ function BASE:EventOnBirth( EventFunction )
return self
end
--- Subscribe to a S_EVENT_HUMAN_FAILURE event.
--- Subscribe to a S_EVENT_HUMAN\_FAILURE event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3186,7 +3277,7 @@ function BASE:EventOnHumanFailure( EventFunction )
return self
end
--- Subscribe to a S_EVENT_ENGINE_STARTUP event.
--- Subscribe to a S_EVENT_ENGINE\_STARTUP event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3197,7 +3288,7 @@ function BASE:EventOnEngineStartup( EventFunction )
return self
end
--- Subscribe to a S_EVENT_ENGINE_SHUTDOWN event.
--- Subscribe to a S_EVENT_ENGINE\_SHUTDOWN event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3208,7 +3299,7 @@ function BASE:EventOnEngineShutdown( EventFunction )
return self
end
--- Subscribe to a S_EVENT_PLAYER_ENTER_UNIT event.
--- Subscribe to a S_EVENT_PLAYER_ENTER\_UNIT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3219,7 +3310,7 @@ function BASE:EventOnPlayerEnterUnit( EventFunction )
return self
end
--- Subscribe to a S_EVENT_PLAYER_LEAVE_UNIT event.
--- Subscribe to a S_EVENT_PLAYER_LEAVE\_UNIT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3230,7 +3321,7 @@ function BASE:EventOnPlayerLeaveUnit( EventFunction )
return self
end
--- Subscribe to a S_EVENT_PLAYER_COMMENT event.
--- Subscribe to a S_EVENT_PLAYER\_COMMENT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3241,7 +3332,7 @@ function BASE:EventOnPlayerComment( EventFunction )
return self
end
--- Subscribe to a S_EVENT_SHOOTING_START event.
--- Subscribe to a S_EVENT_SHOOTING\_START event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3252,7 +3343,7 @@ function BASE:EventOnShootingStart( EventFunction )
return self
end
--- Subscribe to a S_EVENT_SHOOTING_END event.
--- Subscribe to a S_EVENT_SHOOTING\_END event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3453,10 +3544,10 @@ end
-- @param #boolean TraceOnOff Switch the tracing on or off.
-- @usage
-- -- Switch the tracing On
-- BASE:TraceOn( true )
-- BASE:TraceOnOff( true )
--
-- -- Switch the tracing Off
-- BASE:TraceOn( false )
-- BASE:TraceOnOff( false )
function BASE:TraceOnOff( TraceOnOff )
_TraceOnOff = TraceOnOff
end
@ -10608,22 +10699,55 @@ end
----- The _MessageQueue object is created when the MESSAGE class module is loaded.
----_MessageQueue = MESSAGEQUEUE:New( 0.5 )
--
--- This module contains the FSM class.
--- This module contains the FSM class and derived FSM_ classes.
--
-- This development is based on a state machine implementation made by Conroy Kyle.
-- The state machine can be found here: https://github.com/kyleconroy/lua-state-machine
--
-- I've taken the development and enhanced it to make the state machine hierarchical...
-- I've taken the development and enhanced it (actually rewrote it) to make the state machine hierarchical...
-- It is a fantastic development, this module.
--
-- ===
--
-- 1) @{Workflow#FSM} class, extends @{Core.Base#BASE}
-- ==============================================
-- # 1) @{Core.Fsm#FSM} class, extends @{Core.Base#BASE}
--
-- A Finite State Machine (FSM) defines the rules of transitioning between various States triggered by Events.
-- * A **State** defines a moment in the process.
-- * An **Event** describes an action, that can be triggered both internally as externally in the FSM. An Event can be triggered Embedded or Delayed over time.
--
--
-- 1.1) Add or remove objects from the FSM
-- --------------------------------------------
--
-- ====
--
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
-- * **Added** parts are expressed in bold type face.
-- * _Removed_ parts are expressed in italic type face.
--
-- YYYY-MM-DD: CLASS:**NewFunction**( Params ) replaces CLASS:_OldFunction_( Params )
-- YYYY-MM-DD: CLASS:**NewFunction( Params )** added
--
-- Hereby the change log:
--
-- * 2016-12-18: Released.
--
-- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
-- * None.
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- @module Fsm
-- @author FlightControl
do -- FSM
@ -10848,7 +10972,7 @@ do -- FSM
if can then
local from = self.current
local params = { EventName, from, to, ... }
local params = { from, EventName, to, ... }
if self:_call_handler("onbefore" .. EventName, params) == false
or self:_call_handler("onleave" .. from, params) == false then
@ -11238,8 +11362,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function FSM_PROCESS:onstatechange( ProcessUnit, Event, From, To, Dummy )
self:E( { ProcessUnit, Event, From, To, Dummy, self:IsTrace() } )
function FSM_PROCESS:onstatechange( ProcessUnit, From, Event, To, Dummy )
self:E( { ProcessUnit, From, Event, To, Dummy, self:IsTrace() } )
if self:IsTrace() then
MESSAGE:New( "@ Process " .. self:GetClassNameAndID() .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll()
@ -17788,8 +17912,8 @@ end
--- This module contains the SPAWN class.
--
-- 1) @{Functional.Spawn#SPAWN} class, extends @{Core.Base#BASE}
-- =============================================
-- # 1) @{Functional.Spawn#SPAWN} class, extends @{Core.Base#BASE}
--
-- The @{#SPAWN} class allows to spawn dynamically new groups, based on pre-defined initialization settings, modifying the behaviour when groups are spawned.
-- For each group to be spawned, within the mission editor, a group has to be created with the "late activation flag" set. We call this group the *"Spawn Template"* of the SPAWN object.
-- A reference to this Spawn Template needs to be provided when constructing the SPAWN object, by indicating the name of the group within the mission editor in the constructor methods.
@ -17812,8 +17936,8 @@ end
-- * It is important to defined BEFORE you spawn new groups, a proper initialization of the SPAWN instance is done with the options you want to use.
-- * When designing a mission, NEVER name groups using a "#" within the name of the group Spawn Template(s), or the SPAWN module logic won't work anymore.
--
-- 1.1) SPAWN construction methods
-- -------------------------------
-- ## 1.1) SPAWN construction methods
--
-- Create a new SPAWN object with the @{#SPAWN.New}() or the @{#SPAWN.NewWithAlias}() methods:
--
-- * @{#SPAWN.New}(): Creates a new SPAWN object taking the name of the group that represents the GROUP Template (definition).
@ -17823,8 +17947,8 @@ end
-- The initialization methods will modify this list of groups so that when a group gets spawned, ALL information is already prepared when spawning. This is done for performance reasons.
-- So in principle, the group list will contain all parameters and configurations after initialization, and when groups get actually spawned, this spawning can be done quickly and efficient.
--
-- 1.2) SPAWN initialization methods
-- ---------------------------------
-- ## 1.2) SPAWN initialization methods
--
-- A spawn object will behave differently based on the usage of **initialization** methods, which all start with the **Init** prefix:
--
-- * @{#SPAWN.InitLimit}(): Limits the amount of groups that can be alive at the same time and that can be dynamically spawned.
@ -17836,8 +17960,8 @@ end
-- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Unit}s in the @{Group} that is spawned within a **radius band**, given an Outer and Inner radius.
-- * @{#SPAWN.InitRandomizeZones}(): Randomizes the spawning between a predefined list of @{Zone}s that are declared using this function. Each zone can be given a probability factor.
--
-- 1.3) SPAWN spawning methods
-- ---------------------------
-- ## 1.3) SPAWN spawning methods
--
-- Groups can be spawned at different times and methods:
--
-- * @{#SPAWN.Spawn}(): Spawn one new group based on the last spawned index.
@ -17852,8 +17976,8 @@ end
-- Note that @{#SPAWN.Spawn} and @{#SPAWN.ReSpawn} return a @{GROUP#GROUP.New} object, that contains a reference to the DCSGroup object.
-- You can use the @{GROUP} object to do further actions with the DCSGroup.
--
-- 1.4) Retrieve alive GROUPs spawned by the SPAWN object
-- ------------------------------------------------------
-- ## 1.4) Retrieve alive GROUPs spawned by the SPAWN object
--
-- The SPAWN class administers which GROUPS it has reserved (in stock) or has created during mission execution.
-- Every time a SPAWN object spawns a new GROUP object, a reference to the GROUP object is added to an internal table of GROUPS.
-- SPAWN provides methods to iterate through that internal GROUP object reference table:
@ -17865,8 +17989,8 @@ end
-- You can use the methods @{#SPAWN.GetFirstAliveGroup}() and sequently @{#SPAWN.GetNextAliveGroup}() to iterate through the alive GROUPS within the SPAWN object, and to actions... See the respective methods for an example.
-- The method @{#SPAWN.GetGroupFromIndex}() will return the GROUP object reference from the given Index, dead or alive...
--
-- 1.5) SPAWN object cleaning
-- --------------------------
-- ## 1.5) SPAWN object cleaning
--
-- Sometimes, it will occur during a mission run-time, that ground or especially air objects get damaged, and will while being damged stop their activities, while remaining alive.
-- In such cases, the SPAWN object will just sit there and wait until that group gets destroyed, but most of the time it won't,
-- and it may occur that no new groups are or can be spawned as limits are reached.
@ -17877,8 +18001,8 @@ end
-- This models AI that has succesfully returned to their airbase, to restart their combat activities.
-- Check the @{#SPAWN.InitCleanUp}() for further info.
--
-- 1.6) Catch the @{Group} spawn event in a callback function!
-- -----------------------------------------------------------
-- ## 1.6) Catch the @{Group} spawn event in a callback function!
--
-- When using the SpawnScheduled method, new @{Group}s are created following the schedule timing parameters.
-- When a new @{Group} is spawned, you maybe want to execute actions with that group spawned at the spawn event.
-- To SPAWN class supports this functionality through the @{#SPAWN.OnSpawnGroup}( **function( SpawnedGroup ) end ** ) method, which takes a function as a parameter that you can define locally.
@ -17888,8 +18012,7 @@ end
--
-- ====
--
-- **API CHANGE HISTORY**
-- ======================
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
@ -17965,8 +18088,7 @@ end
--
-- ===
--
-- AUTHORS and CONTRIBUTIONS
-- =========================
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
@ -17976,7 +18098,6 @@ end
--
-- * **FlightControl**: Design & Programming
--
--
-- @module Spawn
@ -23925,7 +24046,7 @@ end
-- @param Core.Set#SET_GROUP SetGroup
-- @param #string ClientName
-- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterSpawning( SetGroup, Event, From, To, ClientName )
function AI_BALANCER:onenterSpawning( SetGroup, From, Event, To, ClientName )
-- OK, Spawn a new group from the default SpawnAI object provided.
local AIGroup = self.SpawnAI:Spawn()
@ -23942,7 +24063,7 @@ end
--- @param #AI_BALANCER self
-- @param Core.Set#SET_GROUP SetGroup
-- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterDestroying( SetGroup, Event, From, To, AIGroup )
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, AIGroup )
AIGroup:Destroy()
end
@ -23950,7 +24071,7 @@ end
--- @param #AI_BALANCER self
-- @param Core.Set#SET_GROUP SetGroup
-- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterReturning( SetGroup, Event, From, To, AIGroup )
function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
local AIGroupTemplate = AIGroup:GetTemplate()
if self.ToHomeAirbase == true then
@ -24788,7 +24909,7 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
function AI_CARGO_UNIT:onenterUnBoarding( Event, From, To, ToPointVec2 )
function AI_CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2 )
self:F()
local Angle = 180
@ -24833,8 +24954,8 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
function AI_CARGO_UNIT:onleaveUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
local Angle = 180
local Speed = 10
@ -24857,8 +24978,8 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
function AI_CARGO_UNIT:onafterUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
self.CargoInAir = self.CargoObject:InAir()
@ -24882,8 +25003,8 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2
function AI_CARGO_UNIT:onenterUnLoaded( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
local Angle = 180
local Speed = 10
@ -24920,8 +25041,8 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_UNIT:onenterBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_UNIT:onenterBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
local Speed = 10
local Angle = 180
@ -24952,8 +25073,8 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_UNIT:onleaveBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_UNIT:onleaveBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
if self:IsNear( CargoCarrier:GetPointVec2() ) then
self:__Load( 1, CargoCarrier )
@ -24970,7 +25091,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_UNIT:onenterLoaded( Event, From, To, CargoCarrier )
function AI_CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
self:F()
self.CargoCarrier = CargoCarrier
@ -24988,7 +25109,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_UNIT:onafterBoard( Event, From, To, CargoCarrier )
function AI_CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier )
self:F()
self.CargoInAir = self.CargoObject:InAir()
@ -25041,7 +25162,7 @@ end
-- @param #number Speed
-- @param #number BoardDistance
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterOnBoard( Event, From, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
function AI_CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
self:F()
self.CargoInAir = self.CargoCarrier:InAir()
@ -25095,7 +25216,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_PACKAGE:onafterOnBoarded( Event, From, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
function AI_CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
self:F()
if self:IsNear( CargoCarrier ) then
@ -25115,7 +25236,7 @@ end
-- @param #number UnBoardDistance
-- @param #number Radius
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterUnBoard( Event, From, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
function AI_CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
self:F()
self.CargoInAir = self.CargoCarrier:InAir()
@ -25153,7 +25274,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_PACKAGE:onafterUnBoarded( Event, From, To, CargoCarrier, Speed )
function AI_CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
self:F()
if self:IsNear( CargoCarrier ) then
@ -25172,7 +25293,7 @@ end
-- @param #number Speed
-- @param #number LoadDistance
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterLoad( Event, From, To, CargoCarrier, Speed, LoadDistance, Angle )
function AI_CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
self:F()
self.CargoCarrier = CargoCarrier
@ -25198,7 +25319,7 @@ end
-- @param #string To
-- @param #number Distance
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterUnLoad( Event, From, To, CargoCarrier, Speed, Distance, Angle )
function AI_CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
self:F()
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
@ -25281,8 +25402,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_GROUPED:onenterBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
if From == "UnLoaded" then
@ -25304,8 +25425,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterLoaded( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_GROUPED:onenterLoaded( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
if From == "UnLoaded" then
-- For each Cargo object within the AI_CARGO_GROUPED, load each cargo to the CargoCarrier.
@ -25321,8 +25442,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onleaveBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_GROUPED:onleaveBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
local Boarded = true
@ -25348,7 +25469,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterUnBoarding( Event, From, To, ToPointVec2 )
function AI_CARGO_GROUPED:onenterUnBoarding( From, Event, To, ToPointVec2 )
self:F()
local Timer = 1
@ -25374,8 +25495,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onleaveUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_GROUPED:onleaveUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
local Angle = 180
local Speed = 10
@ -25409,8 +25530,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onafterUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_GROUPED:onafterUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
self:__UnLoad( 1, ToPointVec2 )
end
@ -25423,8 +25544,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterUnLoaded( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_GROUPED:onenterUnLoaded( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
if From == "Loaded" then
@ -25600,8 +25721,8 @@ do -- ACT_ASSIGN_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
function ACT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, From, Event, To )
self:E( { ProcessUnit, From, Event, To } )
self:__Assign( 1 )
end
@ -25612,9 +25733,9 @@ do -- ACT_ASSIGN_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, Event, From, To )
function ACT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, From, Event, To )
env.info( "in here" )
self:E( { ProcessUnit, Event, From, To } )
self:E( { ProcessUnit, From, Event, To } )
local ProcessGroup = ProcessUnit:GetGroup()
@ -25680,8 +25801,8 @@ do -- ACT_ASSIGN_MENU_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
function ACT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, From, Event, To )
self:E( { ProcessUnit, From, Event, To } )
self:Message( "Access the radio menu to accept the task. You have 30 seconds or the assignment will be cancelled." )
@ -25714,8 +25835,8 @@ do -- ACT_ASSIGN_MENU_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To )
self:E( { ProcessUnit.UnitNameEvent, From, To } )
function ACT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, From, Event, To )
self:E( { ProcessUnit.UnitNameFrom, Event, To } )
self.Menu:Remove()
end
@ -25726,8 +25847,8 @@ do -- ACT_ASSIGN_MENU_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To )
self:E( { ProcessUnit.UnitName, Event, From, To } )
function ACT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, From, Event, To )
self:E( { ProcessUnit.UnitName, From, Event, To } )
self.Menu:Remove()
--TODO: need to resolve this problem ... it has to do with the events ...
@ -25861,7 +25982,7 @@ do -- ACT_ROUTE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ROUTE:onafterStart( ProcessUnit, Event, From, To )
function ACT_ROUTE:onafterStart( ProcessUnit, From, Event, To )
self:__Route( 1 )
@ -25881,7 +26002,7 @@ do -- ACT_ROUTE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ROUTE:onbeforeRoute( ProcessUnit, Event, From, To )
function ACT_ROUTE:onbeforeRoute( ProcessUnit, From, Event, To )
self:F( { "BeforeRoute 1", self.DisplayCount, self.DisplayInterval } )
if ProcessUnit:IsAlive() then
@ -25977,7 +26098,7 @@ do -- ACT_ROUTE_ZONE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To )
function ACT_ROUTE_ZONE:onenterReporting( ProcessUnit, From, Event, To )
local ZoneVec2 = self.TargetZone:GetVec2()
local ZonePointVec2 = POINT_VEC2:New( ZoneVec2.x, ZoneVec2.y )
@ -26105,7 +26226,7 @@ do -- ACT_ACCOUNT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT:onafterStart( ProcessUnit, Event, From, To )
function ACT_ACCOUNT:onafterStart( ProcessUnit, From, Event, To )
self:EventOnDead( self.onfuncEventDead )
@ -26119,7 +26240,7 @@ do -- ACT_ACCOUNT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To )
function ACT_ACCOUNT:onenterWaiting( ProcessUnit, From, Event, To )
if self.DisplayCount >= self.DisplayInterval then
self:Report()
@ -26137,7 +26258,7 @@ do -- ACT_ACCOUNT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event )
function ACT_ACCOUNT:onafterEvent( ProcessUnit, From, Event, To, Event )
self:__NoMore( 1 )
end
@ -26199,8 +26320,8 @@ do -- ACT_ACCOUNT_DEADS
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, From, Event, To )
self:E( { ProcessUnit, From, Event, To } )
self:Message( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed." )
end
@ -26212,8 +26333,8 @@ do -- ACT_ACCOUNT_DEADS
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, EventData )
self:T( { ProcessUnit, EventData, Event, From, To } )
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, From, Event, To, EventData )
self:T( { ProcessUnit, EventData, From, Event, To } )
self:T({self.Controllable})
@ -26232,7 +26353,7 @@ do -- ACT_ACCOUNT_DEADS
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, EventData )
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, From, Event, To, EventData )
if self.TargetSetUnit:Count() > 0 then
self:__More( 1 )
@ -26361,7 +26482,7 @@ do -- ACT_ASSIST
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIST:onafterStart( ProcessUnit, Event, From, To )
function ACT_ASSIST:onafterStart( ProcessUnit, From, Event, To )
local ProcessGroup = ProcessUnit:GetGroup()
local MissionMenu = self:GetMission():GetMissionMenu( ProcessGroup )
@ -26440,7 +26561,7 @@ do -- ACT_ASSIST_SMOKE_TARGETS_ZONE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIST_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To )
function ACT_ASSIST_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, From, Event, To )
self.TargetSetUnit:ForEachUnit(
--- @param Wrapper.Unit#UNIT SmokeUnit
@ -26808,7 +26929,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function MISSION:onbeforeComplete( Event, From, To )
function MISSION:onbeforeComplete( From, Event, To )
for TaskID, Task in pairs( self:GetTasks() ) do
local Task = Task -- Tasking.Task#TASK
@ -26824,7 +26945,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function MISSION:onenterCompleted( Event, From, To )
function MISSION:onenterCompleted( From, Event, To )
self:GetCommandCenter():MessageToCoalition( "Mission " .. self:GetName() .. " has been completed! Good job guys!" )
end
@ -28562,7 +28683,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterAssigned( Event, From, To )
function TASK:onenterAssigned( From, Event, To )
self:E("Task Assigned")
@ -28576,7 +28697,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterSuccess( Event, From, To )
function TASK:onenterSuccess( From, Event, To )
self:E( "Task Success" )
@ -28593,7 +28714,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterAborted( Event, From, To )
function TASK:onenterAborted( From, Event, To )
self:E( "Task Aborted" )
@ -28607,7 +28728,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterFailed( Event, From, To )
function TASK:onenterFailed( From, Event, To )
self:E( "Task Failed" )
@ -28621,7 +28742,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onstatechange( Event, From, To )
function TASK:onstatechange( From, Event, To )
if self:IsTrace() then
MESSAGE:New( "@ Task " .. self.TaskName .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll()

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20161218_1138' )
env.info( 'Moose Generation Timestamp: 20161220_0922' )
local base = _G
Include = {}
@ -2803,27 +2803,27 @@ end
--
-- Note: Normally you would not use the BASE class unless you are extending the MOOSE framework with new classes.
--
-- 1.1) BASE constructor
-- ---------------------
-- ## 1.1) BASE constructor
--
-- Any class derived from BASE, must use the @{Core.Base#BASE.New) constructor within the @{Core.Base#BASE.Inherit) method.
-- See an example at the @{Core.Base#BASE.New} method how this is done.
--
-- 1.2) BASE Trace functionality
-- -----------------------------
-- ## 1.2) BASE Trace functionality
--
-- The BASE class contains trace methods to trace progress within a mission execution of a certain object.
-- Note that these trace methods are inherited by each MOOSE class interiting BASE.
-- As such, each object created from derived class from BASE can use the tracing functions to trace its execution.
--
-- 1.2.1) Tracing functions
-- ------------------------
-- ### 1.2.1) Tracing functions
--
-- There are basically 3 types of tracing methods available within BASE:
--
-- * @{#BASE.F}: Trace the beginning of a function and its given parameters. An F is indicated at column 44 in the DCS.log file.
-- * @{#BASE.T}: Trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.
-- * @{#BASE.E}: Trace an exception within a function giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file. An exception will always be traced.
--
-- 1.2.2) Tracing levels
-- ---------------------
-- ### 1.2.2) Tracing levels
--
-- There are 3 tracing levels within MOOSE.
-- These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects.
--
@ -2834,20 +2834,111 @@ end
-- * @{#BASE.T2}: Trace further logic within a function giving optional variables or parameters with tracing level 2.
-- * @{#BASE.T3}: Trace further logic within a function giving optional variables or parameters with tracing level 3.
--
-- 1.3) BASE Inheritance support
-- ===========================
-- ### 1.2.3) Trace activation.
--
-- Tracing can be activated in several ways:
--
-- * Switch tracing on or off through the @{#BASE.TraceOnOff}() method.
-- * Activate all tracing through the @{#BASE.TraceAll}() method.
-- * Activate only the tracing of a certain class (name) through the @{#BASE.TraceClass}() method.
-- * Activate only the tracing of a certain method of a certain class through the @{#BASE.TraceClassMethod}() method.
-- * Activate only the tracing of a certain level through the @{#BASE.TraceLevel}() method.
-- ### 1.2.4) Check if tracing is on.
--
-- The method @{#BASE.IsTrace}() will validate if tracing is activated or not.
--
-- ## 1.3 DCS simulator Event Handling
--
-- The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator,
-- and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently.
-- Therefore, the BASE class exposes the following event handling functions:
--
-- * @{#BASE.EventOnBirth}(): Handle the birth of a new unit.
-- * @{#BASE.EventOnBaseCaptured}(): Handle the capturing of an airbase or a helipad.
-- * @{#BASE.EventOnCrash}(): Handle the crash of a unit.
-- * @{#BASE.EventOnDead}(): Handle the death of a unit.
-- * @{#BASE.EventOnEjection}(): Handle the ejection of a player out of an airplane.
-- * @{#BASE.EventOnEngineShutdown}(): Handle the shutdown of an engine.
-- * @{#BASE.EventOnEngineStartup}(): Handle the startup of an engine.
-- * @{#BASE.EventOnHit}(): Handle the hit of a shell to a unit.
-- * @{#BASE.EventOnHumanFailure}(): No a clue ...
-- * @{#BASE.EventOnLand}(): Handle the event when a unit lands.
-- * @{#BASE.EventOnMissionStart}(): Handle the start of the mission.
-- * @{#BASE.EventOnPilotDead}(): Handle the event when a pilot is dead.
-- * @{#BASE.EventOnPlayerComment}(): Handle the event when a player posts a comment.
-- * @{#BASE.EventOnPlayerEnterUnit}(): Handle the event when a player enters a unit.
-- * @{#BASE.EventOnPlayerLeaveUnit}(): Handle the event when a player leaves a unit.
-- * @{#BASE.EventOnBirthPlayerMissionEnd}(): Handle the event when a player ends the mission. (Not a clue what that does).
-- * @{#BASE.EventOnRefueling}(): Handle the event when a unit is refueling.
-- * @{#BASE.EventOnShootingEnd}(): Handle the event when a unit starts shooting (guns).
-- * @{#BASE.EventOnShootingStart}(): Handle the event when a unit ends shooting (guns).
-- * @{#BASE.EventOnShot}(): Handle the event when a unit shot a missile.
-- * @{#BASE.EventOnTakeOff}(): Handle the event when a unit takes off from a runway.
-- * @{#BASE.EventOnTookControl}(): Handle the event when a player takes control of a unit.
--
-- The EventOn() methods provide the @{Core.Event#EVENTDATA} structure to the event handling function.
-- The @{Core.Event#EVENTDATA} structure contains an enriched data set of information about the event being handled.
--
-- Find below an example of the prototype how to write an event handling function:
--
-- CommandCenter:EventOnPlayerEnterUnit(
-- --- @param #COMMANDCENTER self
-- -- @param Core.Event#EVENTDATA EventData
-- function( self, EventData )
-- local PlayerUnit = EventData.IniUnit
-- for MissionID, Mission in pairs( self:GetMissions() ) do
-- local Mission = Mission -- Tasking.Mission#MISSION
-- Mission:JoinUnit( PlayerUnit )
-- Mission:ReportDetails()
-- end
-- end
-- )
--
-- Note the function( self, EventData ). It takes two parameters:
--
-- * self = the object that is handling the EventOnPlayerEnterUnit.
-- * EventData = the @{Core.Event#EVENTDATA} structure, containing more information of the Event.
--
-- ## 1.4) Class identification methods
--
-- BASE provides methods to get more information of each object:
--
-- * @{#BASE.GetClassID}(): Gets the ID (number) of the object. Each object created is assigned a number, that is incremented by one.
-- * @{#BASE.GetClassName}(): Gets the name of the object, which is the name of the class the object was instantiated from.
-- * @{#BASE.GetClassNameAndID}(): Gets the name and ID of the object.
--
-- ## 1.10) BASE Inheritance (tree) support
--
-- The following methods are available to support inheritance:
--
-- * @{#BASE.Inherit}: Inherits from a class.
-- * @{#BASE.Inherited}: Returns the parent class from the class.
--
-- Future
-- ======
-- Further methods may be added to BASE whenever there is a need to make "overall" functions available within MOOSE.
--
-- * @{#BASE.GetParent}: Returns the parent object from the object it is handling, or nil if there is no parent object.
--
-- ====
--
-- ### Author: FlightControl
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
-- * **Added** parts are expressed in bold type face.
-- * _Removed_ parts are expressed in italic type face.
--
-- YYYY-MM-DD: CLASS:**NewFunction**( Params ) replaces CLASS:_OldFunction_( Params )
-- YYYY-MM-DD: CLASS:**NewFunction( Params )** added
--
-- Hereby the change log:
--
-- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
-- * None.
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- @module Base
@ -3009,7 +3100,7 @@ function BASE:EventRemoveAll()
return self
end
--- Subscribe to a S_EVENT_SHOT event.
--- Subscribe to a S_EVENT\_SHOT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3020,7 +3111,7 @@ function BASE:EventOnShot( EventFunction )
return self
end
--- Subscribe to a S_EVENT_HIT event.
--- Subscribe to a S_EVENT\_HIT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3031,7 +3122,7 @@ function BASE:EventOnHit( EventFunction )
return self
end
--- Subscribe to a S_EVENT_TAKEOFF event.
--- Subscribe to a S_EVENT\_TAKEOFF event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3042,7 +3133,7 @@ function BASE:EventOnTakeOff( EventFunction )
return self
end
--- Subscribe to a S_EVENT_LAND event.
--- Subscribe to a S_EVENT\_LAND event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3053,7 +3144,7 @@ function BASE:EventOnLand( EventFunction )
return self
end
--- Subscribe to a S_EVENT_CRASH event.
--- Subscribe to a S_EVENT\_CRASH event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3064,7 +3155,7 @@ function BASE:EventOnCrash( EventFunction )
return self
end
--- Subscribe to a S_EVENT_EJECTION event.
--- Subscribe to a S_EVENT\_EJECTION event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3076,7 +3167,7 @@ function BASE:EventOnEjection( EventFunction )
end
--- Subscribe to a S_EVENT_REFUELING event.
--- Subscribe to a S_EVENT\_REFUELING event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3087,7 +3178,7 @@ function BASE:EventOnRefueling( EventFunction )
return self
end
--- Subscribe to a S_EVENT_DEAD event.
--- Subscribe to a S_EVENT\_DEAD event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3098,7 +3189,7 @@ function BASE:EventOnDead( EventFunction )
return self
end
--- Subscribe to a S_EVENT_PILOT_DEAD event.
--- Subscribe to a S_EVENT_PILOT\_DEAD event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3109,7 +3200,7 @@ function BASE:EventOnPilotDead( EventFunction )
return self
end
--- Subscribe to a S_EVENT_BASE_CAPTURED event.
--- Subscribe to a S_EVENT_BASE\_CAPTURED event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3120,7 +3211,7 @@ function BASE:EventOnBaseCaptured( EventFunction )
return self
end
--- Subscribe to a S_EVENT_MISSION_START event.
--- Subscribe to a S_EVENT_MISSION\_START event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3131,7 +3222,7 @@ function BASE:EventOnMissionStart( EventFunction )
return self
end
--- Subscribe to a S_EVENT_MISSION_END event.
--- Subscribe to a S_EVENT_MISSION\_END event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3142,7 +3233,7 @@ function BASE:EventOnPlayerMissionEnd( EventFunction )
return self
end
--- Subscribe to a S_EVENT_TOOK_CONTROL event.
--- Subscribe to a S_EVENT_TOOK\_CONTROL event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3153,7 +3244,7 @@ function BASE:EventOnTookControl( EventFunction )
return self
end
--- Subscribe to a S_EVENT_REFUELING_STOP event.
--- Subscribe to a S_EVENT_REFUELING\_STOP event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3164,7 +3255,7 @@ function BASE:EventOnRefuelingStop( EventFunction )
return self
end
--- Subscribe to a S_EVENT_BIRTH event.
--- Subscribe to a S_EVENT\_BIRTH event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3175,7 +3266,7 @@ function BASE:EventOnBirth( EventFunction )
return self
end
--- Subscribe to a S_EVENT_HUMAN_FAILURE event.
--- Subscribe to a S_EVENT_HUMAN\_FAILURE event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3186,7 +3277,7 @@ function BASE:EventOnHumanFailure( EventFunction )
return self
end
--- Subscribe to a S_EVENT_ENGINE_STARTUP event.
--- Subscribe to a S_EVENT_ENGINE\_STARTUP event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3197,7 +3288,7 @@ function BASE:EventOnEngineStartup( EventFunction )
return self
end
--- Subscribe to a S_EVENT_ENGINE_SHUTDOWN event.
--- Subscribe to a S_EVENT_ENGINE\_SHUTDOWN event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3208,7 +3299,7 @@ function BASE:EventOnEngineShutdown( EventFunction )
return self
end
--- Subscribe to a S_EVENT_PLAYER_ENTER_UNIT event.
--- Subscribe to a S_EVENT_PLAYER_ENTER\_UNIT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3219,7 +3310,7 @@ function BASE:EventOnPlayerEnterUnit( EventFunction )
return self
end
--- Subscribe to a S_EVENT_PLAYER_LEAVE_UNIT event.
--- Subscribe to a S_EVENT_PLAYER_LEAVE\_UNIT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3230,7 +3321,7 @@ function BASE:EventOnPlayerLeaveUnit( EventFunction )
return self
end
--- Subscribe to a S_EVENT_PLAYER_COMMENT event.
--- Subscribe to a S_EVENT_PLAYER\_COMMENT event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3241,7 +3332,7 @@ function BASE:EventOnPlayerComment( EventFunction )
return self
end
--- Subscribe to a S_EVENT_SHOOTING_START event.
--- Subscribe to a S_EVENT_SHOOTING\_START event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3252,7 +3343,7 @@ function BASE:EventOnShootingStart( EventFunction )
return self
end
--- Subscribe to a S_EVENT_SHOOTING_END event.
--- Subscribe to a S_EVENT_SHOOTING\_END event.
-- @param #BASE self
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @return #BASE
@ -3453,10 +3544,10 @@ end
-- @param #boolean TraceOnOff Switch the tracing on or off.
-- @usage
-- -- Switch the tracing On
-- BASE:TraceOn( true )
-- BASE:TraceOnOff( true )
--
-- -- Switch the tracing Off
-- BASE:TraceOn( false )
-- BASE:TraceOnOff( false )
function BASE:TraceOnOff( TraceOnOff )
_TraceOnOff = TraceOnOff
end
@ -10608,22 +10699,55 @@ end
----- The _MessageQueue object is created when the MESSAGE class module is loaded.
----_MessageQueue = MESSAGEQUEUE:New( 0.5 )
--
--- This module contains the FSM class.
--- This module contains the FSM class and derived FSM_ classes.
--
-- This development is based on a state machine implementation made by Conroy Kyle.
-- The state machine can be found here: https://github.com/kyleconroy/lua-state-machine
--
-- I've taken the development and enhanced it to make the state machine hierarchical...
-- I've taken the development and enhanced it (actually rewrote it) to make the state machine hierarchical...
-- It is a fantastic development, this module.
--
-- ===
--
-- 1) @{Workflow#FSM} class, extends @{Core.Base#BASE}
-- ==============================================
-- # 1) @{Core.Fsm#FSM} class, extends @{Core.Base#BASE}
--
-- A Finite State Machine (FSM) defines the rules of transitioning between various States triggered by Events.
-- * A **State** defines a moment in the process.
-- * An **Event** describes an action, that can be triggered both internally as externally in the FSM. An Event can be triggered Embedded or Delayed over time.
--
--
-- 1.1) Add or remove objects from the FSM
-- --------------------------------------------
--
-- ====
--
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
-- * **Added** parts are expressed in bold type face.
-- * _Removed_ parts are expressed in italic type face.
--
-- YYYY-MM-DD: CLASS:**NewFunction**( Params ) replaces CLASS:_OldFunction_( Params )
-- YYYY-MM-DD: CLASS:**NewFunction( Params )** added
--
-- Hereby the change log:
--
-- * 2016-12-18: Released.
--
-- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
-- * None.
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- @module Fsm
-- @author FlightControl
do -- FSM
@ -10848,7 +10972,7 @@ do -- FSM
if can then
local from = self.current
local params = { EventName, from, to, ... }
local params = { from, EventName, to, ... }
if self:_call_handler("onbefore" .. EventName, params) == false
or self:_call_handler("onleave" .. from, params) == false then
@ -11238,8 +11362,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function FSM_PROCESS:onstatechange( ProcessUnit, Event, From, To, Dummy )
self:E( { ProcessUnit, Event, From, To, Dummy, self:IsTrace() } )
function FSM_PROCESS:onstatechange( ProcessUnit, From, Event, To, Dummy )
self:E( { ProcessUnit, From, Event, To, Dummy, self:IsTrace() } )
if self:IsTrace() then
MESSAGE:New( "@ Process " .. self:GetClassNameAndID() .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll()
@ -17788,8 +17912,8 @@ end
--- This module contains the SPAWN class.
--
-- 1) @{Functional.Spawn#SPAWN} class, extends @{Core.Base#BASE}
-- =============================================
-- # 1) @{Functional.Spawn#SPAWN} class, extends @{Core.Base#BASE}
--
-- The @{#SPAWN} class allows to spawn dynamically new groups, based on pre-defined initialization settings, modifying the behaviour when groups are spawned.
-- For each group to be spawned, within the mission editor, a group has to be created with the "late activation flag" set. We call this group the *"Spawn Template"* of the SPAWN object.
-- A reference to this Spawn Template needs to be provided when constructing the SPAWN object, by indicating the name of the group within the mission editor in the constructor methods.
@ -17812,8 +17936,8 @@ end
-- * It is important to defined BEFORE you spawn new groups, a proper initialization of the SPAWN instance is done with the options you want to use.
-- * When designing a mission, NEVER name groups using a "#" within the name of the group Spawn Template(s), or the SPAWN module logic won't work anymore.
--
-- 1.1) SPAWN construction methods
-- -------------------------------
-- ## 1.1) SPAWN construction methods
--
-- Create a new SPAWN object with the @{#SPAWN.New}() or the @{#SPAWN.NewWithAlias}() methods:
--
-- * @{#SPAWN.New}(): Creates a new SPAWN object taking the name of the group that represents the GROUP Template (definition).
@ -17823,8 +17947,8 @@ end
-- The initialization methods will modify this list of groups so that when a group gets spawned, ALL information is already prepared when spawning. This is done for performance reasons.
-- So in principle, the group list will contain all parameters and configurations after initialization, and when groups get actually spawned, this spawning can be done quickly and efficient.
--
-- 1.2) SPAWN initialization methods
-- ---------------------------------
-- ## 1.2) SPAWN initialization methods
--
-- A spawn object will behave differently based on the usage of **initialization** methods, which all start with the **Init** prefix:
--
-- * @{#SPAWN.InitLimit}(): Limits the amount of groups that can be alive at the same time and that can be dynamically spawned.
@ -17836,8 +17960,8 @@ end
-- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Unit}s in the @{Group} that is spawned within a **radius band**, given an Outer and Inner radius.
-- * @{#SPAWN.InitRandomizeZones}(): Randomizes the spawning between a predefined list of @{Zone}s that are declared using this function. Each zone can be given a probability factor.
--
-- 1.3) SPAWN spawning methods
-- ---------------------------
-- ## 1.3) SPAWN spawning methods
--
-- Groups can be spawned at different times and methods:
--
-- * @{#SPAWN.Spawn}(): Spawn one new group based on the last spawned index.
@ -17852,8 +17976,8 @@ end
-- Note that @{#SPAWN.Spawn} and @{#SPAWN.ReSpawn} return a @{GROUP#GROUP.New} object, that contains a reference to the DCSGroup object.
-- You can use the @{GROUP} object to do further actions with the DCSGroup.
--
-- 1.4) Retrieve alive GROUPs spawned by the SPAWN object
-- ------------------------------------------------------
-- ## 1.4) Retrieve alive GROUPs spawned by the SPAWN object
--
-- The SPAWN class administers which GROUPS it has reserved (in stock) or has created during mission execution.
-- Every time a SPAWN object spawns a new GROUP object, a reference to the GROUP object is added to an internal table of GROUPS.
-- SPAWN provides methods to iterate through that internal GROUP object reference table:
@ -17865,8 +17989,8 @@ end
-- You can use the methods @{#SPAWN.GetFirstAliveGroup}() and sequently @{#SPAWN.GetNextAliveGroup}() to iterate through the alive GROUPS within the SPAWN object, and to actions... See the respective methods for an example.
-- The method @{#SPAWN.GetGroupFromIndex}() will return the GROUP object reference from the given Index, dead or alive...
--
-- 1.5) SPAWN object cleaning
-- --------------------------
-- ## 1.5) SPAWN object cleaning
--
-- Sometimes, it will occur during a mission run-time, that ground or especially air objects get damaged, and will while being damged stop their activities, while remaining alive.
-- In such cases, the SPAWN object will just sit there and wait until that group gets destroyed, but most of the time it won't,
-- and it may occur that no new groups are or can be spawned as limits are reached.
@ -17877,8 +18001,8 @@ end
-- This models AI that has succesfully returned to their airbase, to restart their combat activities.
-- Check the @{#SPAWN.InitCleanUp}() for further info.
--
-- 1.6) Catch the @{Group} spawn event in a callback function!
-- -----------------------------------------------------------
-- ## 1.6) Catch the @{Group} spawn event in a callback function!
--
-- When using the SpawnScheduled method, new @{Group}s are created following the schedule timing parameters.
-- When a new @{Group} is spawned, you maybe want to execute actions with that group spawned at the spawn event.
-- To SPAWN class supports this functionality through the @{#SPAWN.OnSpawnGroup}( **function( SpawnedGroup ) end ** ) method, which takes a function as a parameter that you can define locally.
@ -17888,8 +18012,7 @@ end
--
-- ====
--
-- **API CHANGE HISTORY**
-- ======================
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
@ -17965,8 +18088,7 @@ end
--
-- ===
--
-- AUTHORS and CONTRIBUTIONS
-- =========================
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
@ -17976,7 +18098,6 @@ end
--
-- * **FlightControl**: Design & Programming
--
--
-- @module Spawn
@ -23925,7 +24046,7 @@ end
-- @param Core.Set#SET_GROUP SetGroup
-- @param #string ClientName
-- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterSpawning( SetGroup, Event, From, To, ClientName )
function AI_BALANCER:onenterSpawning( SetGroup, From, Event, To, ClientName )
-- OK, Spawn a new group from the default SpawnAI object provided.
local AIGroup = self.SpawnAI:Spawn()
@ -23942,7 +24063,7 @@ end
--- @param #AI_BALANCER self
-- @param Core.Set#SET_GROUP SetGroup
-- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterDestroying( SetGroup, Event, From, To, AIGroup )
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, AIGroup )
AIGroup:Destroy()
end
@ -23950,7 +24071,7 @@ end
--- @param #AI_BALANCER self
-- @param Core.Set#SET_GROUP SetGroup
-- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterReturning( SetGroup, Event, From, To, AIGroup )
function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
local AIGroupTemplate = AIGroup:GetTemplate()
if self.ToHomeAirbase == true then
@ -24788,7 +24909,7 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
function AI_CARGO_UNIT:onenterUnBoarding( Event, From, To, ToPointVec2 )
function AI_CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2 )
self:F()
local Angle = 180
@ -24833,8 +24954,8 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
function AI_CARGO_UNIT:onleaveUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
local Angle = 180
local Speed = 10
@ -24857,8 +24978,8 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
function AI_CARGO_UNIT:onafterUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
self.CargoInAir = self.CargoObject:InAir()
@ -24882,8 +25003,8 @@ end
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2
function AI_CARGO_UNIT:onenterUnLoaded( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
local Angle = 180
local Speed = 10
@ -24920,8 +25041,8 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_UNIT:onenterBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_UNIT:onenterBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
local Speed = 10
local Angle = 180
@ -24952,8 +25073,8 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_UNIT:onleaveBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_UNIT:onleaveBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
if self:IsNear( CargoCarrier:GetPointVec2() ) then
self:__Load( 1, CargoCarrier )
@ -24970,7 +25091,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_UNIT:onenterLoaded( Event, From, To, CargoCarrier )
function AI_CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
self:F()
self.CargoCarrier = CargoCarrier
@ -24988,7 +25109,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_UNIT:onafterBoard( Event, From, To, CargoCarrier )
function AI_CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier )
self:F()
self.CargoInAir = self.CargoObject:InAir()
@ -25041,7 +25162,7 @@ end
-- @param #number Speed
-- @param #number BoardDistance
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterOnBoard( Event, From, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
function AI_CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
self:F()
self.CargoInAir = self.CargoCarrier:InAir()
@ -25095,7 +25216,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_PACKAGE:onafterOnBoarded( Event, From, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
function AI_CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
self:F()
if self:IsNear( CargoCarrier ) then
@ -25115,7 +25236,7 @@ end
-- @param #number UnBoardDistance
-- @param #number Radius
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterUnBoard( Event, From, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
function AI_CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
self:F()
self.CargoInAir = self.CargoCarrier:InAir()
@ -25153,7 +25274,7 @@ end
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
function AI_CARGO_PACKAGE:onafterUnBoarded( Event, From, To, CargoCarrier, Speed )
function AI_CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
self:F()
if self:IsNear( CargoCarrier ) then
@ -25172,7 +25293,7 @@ end
-- @param #number Speed
-- @param #number LoadDistance
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterLoad( Event, From, To, CargoCarrier, Speed, LoadDistance, Angle )
function AI_CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
self:F()
self.CargoCarrier = CargoCarrier
@ -25198,7 +25319,7 @@ end
-- @param #string To
-- @param #number Distance
-- @param #number Angle
function AI_CARGO_PACKAGE:onafterUnLoad( Event, From, To, CargoCarrier, Speed, Distance, Angle )
function AI_CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
self:F()
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
@ -25281,8 +25402,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_GROUPED:onenterBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
if From == "UnLoaded" then
@ -25304,8 +25425,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterLoaded( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_GROUPED:onenterLoaded( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
if From == "UnLoaded" then
-- For each Cargo object within the AI_CARGO_GROUPED, load each cargo to the CargoCarrier.
@ -25321,8 +25442,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onleaveBoarding( Event, From, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, Event, From, To } )
function AI_CARGO_GROUPED:onleaveBoarding( From, Event, To, CargoCarrier )
self:F( { CargoCarrier.UnitName, From, Event, To } )
local Boarded = true
@ -25348,7 +25469,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterUnBoarding( Event, From, To, ToPointVec2 )
function AI_CARGO_GROUPED:onenterUnBoarding( From, Event, To, ToPointVec2 )
self:F()
local Timer = 1
@ -25374,8 +25495,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onleaveUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_GROUPED:onleaveUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
local Angle = 180
local Speed = 10
@ -25409,8 +25530,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onafterUnBoarding( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_GROUPED:onafterUnBoarding( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
self:__UnLoad( 1, ToPointVec2 )
end
@ -25423,8 +25544,8 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function AI_CARGO_GROUPED:onenterUnLoaded( Event, From, To, ToPointVec2 )
self:F( { ToPointVec2, Event, From, To } )
function AI_CARGO_GROUPED:onenterUnLoaded( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } )
if From == "Loaded" then
@ -25600,8 +25721,8 @@ do -- ACT_ASSIGN_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
function ACT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, From, Event, To )
self:E( { ProcessUnit, From, Event, To } )
self:__Assign( 1 )
end
@ -25612,9 +25733,9 @@ do -- ACT_ASSIGN_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, Event, From, To )
function ACT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, From, Event, To )
env.info( "in here" )
self:E( { ProcessUnit, Event, From, To } )
self:E( { ProcessUnit, From, Event, To } )
local ProcessGroup = ProcessUnit:GetGroup()
@ -25680,8 +25801,8 @@ do -- ACT_ASSIGN_MENU_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
function ACT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, From, Event, To )
self:E( { ProcessUnit, From, Event, To } )
self:Message( "Access the radio menu to accept the task. You have 30 seconds or the assignment will be cancelled." )
@ -25714,8 +25835,8 @@ do -- ACT_ASSIGN_MENU_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, Event, From, To )
self:E( { ProcessUnit.UnitNameEvent, From, To } )
function ACT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, From, Event, To )
self:E( { ProcessUnit.UnitNameFrom, Event, To } )
self.Menu:Remove()
end
@ -25726,8 +25847,8 @@ do -- ACT_ASSIGN_MENU_ACCEPT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, Event, From, To )
self:E( { ProcessUnit.UnitName, Event, From, To } )
function ACT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, From, Event, To )
self:E( { ProcessUnit.UnitName, From, Event, To } )
self.Menu:Remove()
--TODO: need to resolve this problem ... it has to do with the events ...
@ -25861,7 +25982,7 @@ do -- ACT_ROUTE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ROUTE:onafterStart( ProcessUnit, Event, From, To )
function ACT_ROUTE:onafterStart( ProcessUnit, From, Event, To )
self:__Route( 1 )
@ -25881,7 +26002,7 @@ do -- ACT_ROUTE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ROUTE:onbeforeRoute( ProcessUnit, Event, From, To )
function ACT_ROUTE:onbeforeRoute( ProcessUnit, From, Event, To )
self:F( { "BeforeRoute 1", self.DisplayCount, self.DisplayInterval } )
if ProcessUnit:IsAlive() then
@ -25977,7 +26098,7 @@ do -- ACT_ROUTE_ZONE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ROUTE_ZONE:onenterReporting( ProcessUnit, Event, From, To )
function ACT_ROUTE_ZONE:onenterReporting( ProcessUnit, From, Event, To )
local ZoneVec2 = self.TargetZone:GetVec2()
local ZonePointVec2 = POINT_VEC2:New( ZoneVec2.x, ZoneVec2.y )
@ -26105,7 +26226,7 @@ do -- ACT_ACCOUNT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT:onafterStart( ProcessUnit, Event, From, To )
function ACT_ACCOUNT:onafterStart( ProcessUnit, From, Event, To )
self:EventOnDead( self.onfuncEventDead )
@ -26119,7 +26240,7 @@ do -- ACT_ACCOUNT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT:onenterWaiting( ProcessUnit, Event, From, To )
function ACT_ACCOUNT:onenterWaiting( ProcessUnit, From, Event, To )
if self.DisplayCount >= self.DisplayInterval then
self:Report()
@ -26137,7 +26258,7 @@ do -- ACT_ACCOUNT
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT:onafterEvent( ProcessUnit, Event, From, To, Event )
function ACT_ACCOUNT:onafterEvent( ProcessUnit, From, Event, To, Event )
self:__NoMore( 1 )
end
@ -26199,8 +26320,8 @@ do -- ACT_ACCOUNT_DEADS
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, Event, From, To )
self:E( { ProcessUnit, Event, From, To } )
function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, From, Event, To )
self:E( { ProcessUnit, From, Event, To } )
self:Message( "Your group with assigned " .. self.TaskName .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed." )
end
@ -26212,8 +26333,8 @@ do -- ACT_ACCOUNT_DEADS
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, Event, From, To, EventData )
self:T( { ProcessUnit, EventData, Event, From, To } )
function ACT_ACCOUNT_DEADS:onenterAccount( ProcessUnit, From, Event, To, EventData )
self:T( { ProcessUnit, EventData, From, Event, To } )
self:T({self.Controllable})
@ -26232,7 +26353,7 @@ do -- ACT_ACCOUNT_DEADS
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, Event, From, To, EventData )
function ACT_ACCOUNT_DEADS:onafterEvent( ProcessUnit, From, Event, To, EventData )
if self.TargetSetUnit:Count() > 0 then
self:__More( 1 )
@ -26361,7 +26482,7 @@ do -- ACT_ASSIST
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIST:onafterStart( ProcessUnit, Event, From, To )
function ACT_ASSIST:onafterStart( ProcessUnit, From, Event, To )
local ProcessGroup = ProcessUnit:GetGroup()
local MissionMenu = self:GetMission():GetMissionMenu( ProcessGroup )
@ -26440,7 +26561,7 @@ do -- ACT_ASSIST_SMOKE_TARGETS_ZONE
-- @param #string Event
-- @param #string From
-- @param #string To
function ACT_ASSIST_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, Event, From, To )
function ACT_ASSIST_SMOKE_TARGETS_ZONE:onenterSmoking( ProcessUnit, From, Event, To )
self.TargetSetUnit:ForEachUnit(
--- @param Wrapper.Unit#UNIT SmokeUnit
@ -26808,7 +26929,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function MISSION:onbeforeComplete( Event, From, To )
function MISSION:onbeforeComplete( From, Event, To )
for TaskID, Task in pairs( self:GetTasks() ) do
local Task = Task -- Tasking.Task#TASK
@ -26824,7 +26945,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function MISSION:onenterCompleted( Event, From, To )
function MISSION:onenterCompleted( From, Event, To )
self:GetCommandCenter():MessageToCoalition( "Mission " .. self:GetName() .. " has been completed! Good job guys!" )
end
@ -28562,7 +28683,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterAssigned( Event, From, To )
function TASK:onenterAssigned( From, Event, To )
self:E("Task Assigned")
@ -28576,7 +28697,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterSuccess( Event, From, To )
function TASK:onenterSuccess( From, Event, To )
self:E( "Task Success" )
@ -28593,7 +28714,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterAborted( Event, From, To )
function TASK:onenterAborted( From, Event, To )
self:E( "Task Aborted" )
@ -28607,7 +28728,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onenterFailed( Event, From, To )
function TASK:onenterFailed( From, Event, To )
self:E( "Task Failed" )
@ -28621,7 +28742,7 @@ end
-- @param #string Event
-- @param #string From
-- @param #string To
function TASK:onstatechange( Event, From, To )
function TASK:onstatechange( From, Event, To )
if self:IsTrace() then
MESSAGE:New( "@ Task " .. self.TaskName .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll()

View File

@ -35,7 +35,7 @@ local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
local RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
function RU_AI_Balancer:OnAfterSpawned( SetGroup, Event, From, To, AIGroup )
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" )
local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )

View File

@ -126,7 +126,7 @@ local SEADTask = TASK:New(
-- The reason why this is done, is that each unit as a role within the Task, and can have different status.
-- Therefore, the FsmSEAD is a TEMPLATE PROCESS of the TASK, and must be designed as a UNIT with a player is executing that PROCESS.
local SEADProcess = SEADTask:GetUnitProcess()
local SEADProcess = SEADTask:GetUnitProcess() -- #SEADProcess
-- Adding a new sub-process to the Task Template.
-- At first, the task needs to be accepted by a pilot.
@ -139,10 +139,90 @@ local SEADProcess = SEADTask:GetUnitProcess()
-- 4.1 When the return state is Assigned, fire the event in the Task FsmSEAD:Route()
-- 4.2 When the return state is Rejected, fire the event in the Task FsmSEAD:Eject()
-- All other AddProcess calls are working in a similar manner.
SEADProcess:AddProcess ( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } )
--SEADProcess:AddProcess ( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } )
do SEADProcess:AddProcess( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } ) -- FSM SUB for type SEADProcess.
--- OnLeave State Transition for Planned.
-- @function [parent=#SEADProcess] OnLeavePlanned
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnBefore State Transition for Accept.
-- @function [parent=#SEADProcess] OnBeforeAccept
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter State Transition for Accept.
-- @function [parent=#SEADProcess] OnAfterAccept
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Embedded Event Trigger for Accept.
-- @function [parent=#SEADProcess] Accept
-- @param #SEADProcess self
--- Delayed Event Trigger for Accept
-- @function [parent=#SEADProcess] __Accept
-- @param #SEADProcess self
-- @param #number Delay The delay in seconds.
end -- SEADProcess
-- Same, adding a process.
SEADProcess:AddProcess ( "Assigned", "Route", ACT_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } )
--SEADProcess:AddProcess ( "Assigned", "Route", ACT_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } )
do SEADProcess:AddProcess( "Assigned", "Route", ACT_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } ) -- FSM SUB for type SEADProcess.
--- OnLeave State Transition for Assigned.
-- @function [parent=#SEADProcess] OnLeaveAssigned
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnBefore State Transition for Route.
-- @function [parent=#SEADProcess] OnBeforeRoute
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter State Transition for Route.
-- @function [parent=#SEADProcess] OnAfterRoute
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Embedded Event Trigger for Route.
-- @function [parent=#SEADProcess] Route
-- @param #SEADProcess self
--- Delayed Event Trigger for Route
-- @function [parent=#SEADProcess] __Route
-- @param #SEADProcess self
-- @param #number Delay The delay in seconds.
end -- SEADProcess
-- Adding a new Action...
-- Actions define also the flow of the Task, but the actions will need to be programmed within your script.
@ -151,12 +231,272 @@ SEADProcess:AddProcess ( "Assigned", "Route", ACT_ROUTE_ZONE:New( Target
-- 1. State From "Rejected". When the FsmSEAD is in state "Rejected", the event "Eject" can be fired.
-- 2. Event "Eject". This event can be triggered synchronously through FsmSEAD:Eject() or asynchronously through FsmSEAD:__Eject(secs).
-- 3. State To "Planned". After the event has been fired, the FsmSEAD will transition to Planned.
SEADProcess:AddTransition ( "Rejected", "Eject", "Planned" )
SEADProcess:AddTransition ( "Arrived", "Update", "Updated" )
SEADProcess:AddProcess ( "Updated", "Account", ACT_ACCOUNT_DEADS:New( TargetSet, "SEAD" ), { Accounted = "Success" } )
SEADProcess:AddProcess ( "Updated", "Smoke", ACT_ASSIST_SMOKE_TARGETS_ZONE:New( TargetSet, TargetZone ) )
SEADProcess:AddTransition ( "Accounted", "Success", "Success" )
SEADProcess:AddTransition ( "*", "Fail", "Failed" )
do SEADProcess:AddTransition( "Rejected", "Eject", "Planned" ) -- FSM_CONTROLLABLE TRANSITION for type SEADProcess.
--- OnLeave State Transition for Rejected.
-- @function [parent=#SEADProcess] OnLeaveRejected
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnEnter State Transition for Planned.
-- @function [parent=#SEADProcess] OnEnterPlanned
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- OnBefore State Transition for Eject.
-- @function [parent=#SEADProcess] OnBeforeEject
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter State Transition for Eject.
-- @function [parent=#SEADProcess] OnAfterEject
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #SEADProcess self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Embedded Event Trigger for Eject.
-- @function [parent=#SEADProcess] Eject
-- @param #SEADProcess self
--- Delayed Event Trigger for Eject
-- @function [parent=#SEADProcess] __Eject
-- @param #SEADProcess self
-- @param #number Delay The delay in seconds.
end -- SEADProcess
do SEADProcess:AddTransition( "Arrived", "Update", "Updated" ) -- FSM_CONTROLLABLE TRANSITION for type SEADProcess.
SEADProcess:AddTransition( "Arrived", "Update", "Updated" )
--- OnLeave State Transition for Arrived.
-- @function [parent=#SEADProcess] OnLeaveArrived
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnEnter State Transition for Updated.
-- @function [parent=#SEADProcess] OnEnterUpdated
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- OnBefore State Transition for Update.
-- @function [parent=#SEADProcess] OnBeforeUpdate
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter State Transition for Update.
-- @function [parent=#SEADProcess] OnAfterUpdate
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #SEADProcess self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Embedded Event Trigger for Update.
-- @function [parent=#SEADProcess] Update
-- @param #SEADProcess self
--- Delayed Event Trigger for Update
-- @function [parent=#SEADProcess] __Update
-- @param #SEADProcess self
-- @param #number Delay The delay in seconds.
end -- SEADProcess
do SEADProcess:AddProcess( "Updated", "Account", ACT_ACCOUNT_DEADS:New( TargetSet, "SEAD" ), { Accounted = "Success" } ) -- FSM_CONTROLLABLE Process for #SEADProcess.
--- OnLeave State Transition for Updated.
-- @function [parent=#SEADProcess] OnLeaveUpdated
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnBefore State Transition for Account.
-- @function [parent=#SEADProcess] OnBeforeAccount
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter State Transition for Account.
-- @function [parent=#SEADProcess] OnAfterAccount
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Embedded Event Trigger for Account.
-- @function [parent=#SEADProcess] Account
-- @param #SEADProcess self
--- Delayed Event Trigger for Account
-- @function [parent=#SEADProcess] __Account
-- @param #SEADProcess self
-- @param #number Delay The delay in seconds.
end -- SEADProcess
do SEADProcess:AddProcess( "Updated", "Smoke", ACT_ASSIST_SMOKE_TARGETS_ZONE:New( TargetSet, TargetZone ) ) -- FSM_CONTROLLABLE Process for #SEADProcess.
--- OnLeave State Transition for Updated.
-- @function [parent=#SEADProcess] OnLeaveUpdated
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnBefore State Transition for Smoke.
-- @function [parent=#SEADProcess] OnBeforeSmoke
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter State Transition for Smoke.
-- @function [parent=#SEADProcess] OnAfterSmoke
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Embedded Event Trigger for Smoke.
-- @function [parent=#SEADProcess] Smoke
-- @param #SEADProcess self
--- Delayed Event Trigger for Smoke
-- @function [parent=#SEADProcess] __Smoke
-- @param #SEADProcess self
-- @param #number Delay The delay in seconds.
end -- SEADProcess
do SEADProcess:AddTransition( "Accounted", "Success", "Success" ) -- FSM_CONTROLLABLE Transition for type #SEADProcess.
--- OnLeave State Transition for Accounted.
-- @function [parent=#SEADProcess] OnLeaveAccounted
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnEnter State Transition for Success.
-- @function [parent=#SEADProcess] OnEnterSuccess
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- OnBefore State Transition for Success.
-- @function [parent=#SEADProcess] OnBeforeSuccess
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter State Transition for Success.
-- @function [parent=#SEADProcess] OnAfterSuccess
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #SEADProcess self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Embedded Event Trigger for Success.
-- @function [parent=#SEADProcess] Success
-- @param #SEADProcess self
--- Delayed Event Trigger for Success
-- @function [parent=#SEADProcess] __Success
-- @param #SEADProcess self
-- @param #number Delay The delay in seconds.
end -- SEADProcess
do SEADProcess:AddTransition( "*", "Fail", "Failed" ) -- FSM_CONTROLLABLE Transition for type #SEADProcess.
--- OnLeave State Transition for *.
-- @function [parent=#SEADProcess] OnLeave*
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnEnter State Transition for Failed.
-- @function [parent=#SEADProcess] OnEnterFailed
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- OnBefore State Transition for Fail.
-- @function [parent=#SEADProcess] OnBeforeFail
-- @param #SEADProcess self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter State Transition for Fail.
-- @function [parent=#SEADProcess] OnAfterFail
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #SEADProcess self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Embedded Event Trigger for Fail.
-- @function [parent=#SEADProcess] Fail
-- @param #SEADProcess self
--- Delayed Event Trigger for Fail
-- @function [parent=#SEADProcess] __Fail
-- @param #SEADProcess self
-- @param #number Delay The delay in seconds.
end -- SEADProcess
SEADProcess:AddScoreProcess( "Updated", "Account", "Account", "destroyed a radar", 25 )
SEADProcess:AddScoreProcess( "Updated", "Account", "Failed", "failed to destroy a radar", -10 )
@ -166,7 +506,7 @@ SEADProcess:AddScoreProcess( "Updated", "Account", "Failed", "failed to destroy
SEADProcess:AddScore( "Success", "Destroyed all target radars", 250 )
SEADProcess:AddScore( "Failed", "Failed to destroy all target radars", -100 )
function SEADProcess:onenterUpdated( TaskUnit )
function SEADProcess:OnEnterUpdated(Controllable,From,Event,To)
self:E( { self } )
self:Account()
self:Smoke()

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 KiB

View File

@ -238,7 +238,7 @@ SET_GROUP and additional event parameters provided during the event.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_BALANCER).onenterDestroying">AI_BALANCER:onenterDestroying(SetGroup, AIGroup, Event, From, To)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_BALANCER).onenterDestroying">AI_BALANCER:onenterDestroying(SetGroup, AIGroup, From, Event, To)</a></td>
<td class="summary">
</td>
@ -250,13 +250,13 @@ SET_GROUP and additional event parameters provided during the event.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_BALANCER).onenterReturning">AI_BALANCER:onenterReturning(SetGroup, AIGroup, Event, From, To)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_BALANCER).onenterReturning">AI_BALANCER:onenterReturning(SetGroup, AIGroup, From, Event, To)</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_BALANCER).onenterSpawning">AI_BALANCER:onenterSpawning(SetGroup, ClientName, AIGroup, Event, From, To)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_BALANCER).onenterSpawning">AI_BALANCER:onenterSpawning(SetGroup, ClientName, AIGroup, From, Event, To)</a></td>
<td class="summary">
</td>
@ -487,7 +487,7 @@ The SET of <a href="Core.Set.html##(SET_AIRBASE)">Core.Set#SET_AIRBASE</a>s to e
<dt>
<a id="#(AI_BALANCER).onenterDestroying" >
<strong>AI_BALANCER:onenterDestroying(SetGroup, AIGroup, Event, From, To)</strong>
<strong>AI_BALANCER:onenterDestroying(SetGroup, AIGroup, From, Event, To)</strong>
</a>
</dt>
<dd>
@ -508,12 +508,12 @@ The SET of <a href="Core.Set.html##(SET_AIRBASE)">Core.Set#SET_AIRBASE</a>s to e
</li>
<li>
<p><code><em> Event </em></code>: </p>
<p><code><em> From </em></code>: </p>
</li>
<li>
<p><code><em> From </em></code>: </p>
<p><code><em> Event </em></code>: </p>
</li>
<li>
@ -549,7 +549,7 @@ The SET of <a href="Core.Set.html##(SET_AIRBASE)">Core.Set#SET_AIRBASE</a>s to e
<dt>
<a id="#(AI_BALANCER).onenterReturning" >
<strong>AI_BALANCER:onenterReturning(SetGroup, AIGroup, Event, From, To)</strong>
<strong>AI_BALANCER:onenterReturning(SetGroup, AIGroup, From, Event, To)</strong>
</a>
</dt>
<dd>
@ -570,12 +570,12 @@ The SET of <a href="Core.Set.html##(SET_AIRBASE)">Core.Set#SET_AIRBASE</a>s to e
</li>
<li>
<p><code><em> Event </em></code>: </p>
<p><code><em> From </em></code>: </p>
</li>
<li>
<p><code><em> From </em></code>: </p>
<p><code><em> Event </em></code>: </p>
</li>
<li>
@ -590,7 +590,7 @@ The SET of <a href="Core.Set.html##(SET_AIRBASE)">Core.Set#SET_AIRBASE</a>s to e
<dt>
<a id="#(AI_BALANCER).onenterSpawning" >
<strong>AI_BALANCER:onenterSpawning(SetGroup, ClientName, AIGroup, Event, From, To)</strong>
<strong>AI_BALANCER:onenterSpawning(SetGroup, ClientName, AIGroup, From, Event, To)</strong>
</a>
</dt>
<dd>
@ -616,12 +616,12 @@ The SET of <a href="Core.Set.html##(SET_AIRBASE)">Core.Set#SET_AIRBASE</a>s to e
</li>
<li>
<p><code><em> Event </em></code>: </p>
<p><code><em> From </em></code>: </p>
</li>
<li>
<p><code><em> From </em></code>: </p>
<p><code><em> Event </em></code>: </p>
</li>
<li>

View File

@ -225,12 +225,37 @@ The <a href="Core.Event.html##(EVENTDATA)">Core.Event#EVENTDATA</a> structure co
<li><a href="##(BASE).GetParent">BASE.GetParent</a>: Returns the parent object from the object it is handling, or nil if there is no parent object.</li>
</ul>
<h1>Future</h1>
<p>Further methods may be added to BASE whenever there is a need to make "overall" functions available within MOOSE.</p>
<hr/>
<h1><strong>API CHANGE HISTORY</strong></h1>
<p>The underlying change log documents the API changes. Please read this carefully. The following notation is used:</p>
<ul>
<li><strong>Added</strong> parts are expressed in bold type face.</li>
<li><em>Removed</em> parts are expressed in italic type face.</li>
</ul>
<p>YYYY-MM-DD: CLASS:<strong>NewFunction</strong>( Params ) replaces CLASS:<em>OldFunction</em>( Params )
YYYY-MM-DD: CLASS:<strong>NewFunction( Params )</strong> added</p>
<p>Hereby the change log:</p>
<hr/>
<h3>Author: FlightControl</h3>
<h1><strong>AUTHORS and CONTRIBUTIONS</strong></h1>
<h3>Contributions:</h3>
<ul>
<li>None.</li>
</ul>
<h3>Authors:</h3>
<ul>
<li><strong>FlightControl</strong>: Design &amp; Programming</li>
</ul>
<h2>Global(s)</h2>

View File

@ -84,20 +84,99 @@
<div id="content">
<h1>Module <code>Fsm</code></h1>
<p>This module contains the FSM class.</p>
<p>This module contains the FSM class and derived FSM_ classes.</p>
<p>This development is based on a state machine implementation made by Conroy Kyle.
The state machine can be found here: https://github.com/kyleconroy/lua-state-machine</p>
<p>I've taken the development and enhanced it to make the state machine hierarchical...
<p>I've taken the development and enhanced it (actually rewrote it) to make the state machine hierarchical...
It is a fantastic development, this module.</p>
<hr/>
<h1>1) <a href="Workflow.html##(FSM)">Workflow#FSM</a> class, extends <a href="Core.Base.html##(BASE)">Core.Base#BASE</a></h1>
<h1>1) <a href="Core.Fsm.html##(FSM)">Core.Fsm#FSM</a> class, extends <a href="Core.Base.html##(BASE)">Core.Base#BASE</a></h1>
<p>A Finite State Machine (FSM) defines the rules of transitioning between various States triggered by Events.</p>
<ul>
<li>A <strong>State</strong> defines a moment in the process.</li>
<li>An <strong>Event</strong> describes an action, that can be triggered both internally as externally in the FSM. An Event can be triggered Embedded or Delayed over time.</li>
</ul>
<p> <img src="../Presentations/MOOSE - FSM - 1. Concepts/Dia3.jpg" alt="Test Image"/></p>
<p>An FSM transitions in <strong>4 moments</strong> when an Event is being handled. <br/>
Each moment can be catched by handling methods defined by the mission designer, <br/>
that will be called by the FSM while executing the transition. <br/>
These methods define the flow of the FSM process; because in those methods the FSM Internal Events will be fired.</p>
<ul>
<li>To catch State moments, create methods starting with OnLeave or OnEnter concatenated with the State name.</li>
<li>To catch Event moments, create methods starting with OnBefore or OnAfter concatenated with the Event name.</li>
</ul>
<p><em>* The OnLeave and OnBefore transition methods may return false to cancel the transition.</em>*</p>
<p> <img src="../Presentations/MOOSE - FSM - 1. Concepts/Dia4.jpg" alt="Test Image"/></p>
<p>The FSM creates for each Event <strong>two Event trigger methods</strong>. <br/>
There are two modes how Events can be triggered, which is <strong>embedded</strong> and <strong>delayed</strong>:</p>
<ul>
<li>The <strong>FSM:Event()</strong> creates an Event that will be processed <strong>embedded</strong> or immediately.</li>
<li>The <strong>FSM:__Event( seconds )</strong> creates an Event that will be processed <strong>delayed</strong> over time, waiting x seconds.</li>
</ul>
<p> <img src="../Presentations/MOOSE - FSM - 1. Concepts/Dia5.jpg" alt="Test Image"/></p>
<h2>1.1) Define the FSM Rules</h2>
<p>The FSM can be defined by using 3 methods:</p>
<ul>
<li><a href="##(FSM).SetStartState">FSM.SetStartState</a>(): Define the <strong>Start State</strong> of the FSM. This is the State the FSM will have when nothing is processed yet.</li>
<li><a href="##(FSM).AddTransition">FSM.AddTransition</a>(): Adds a new possible Transition Rule to the FSM. A Transition will change the State of the FSM upon the defined triggered Event.</li>
<li><a href="##(FSM).AddProcess">FSM.AddProcess</a>(): Adds a new Sub-Process FSM to the FSM. A Sub-Process will start the Sub-Process of the FSM upon the defined triggered Event, with multiple possible States as a result.</li>
</ul>
<hr/>
<h1><strong>API CHANGE HISTORY</strong></h1>
<p>The underlying change log documents the API changes. Please read this carefully. The following notation is used:</p>
<ul>
<li><strong>Added</strong> parts are expressed in bold type face.</li>
<li><em>Removed</em> parts are expressed in italic type face.</li>
</ul>
<p>YYYY-MM-DD: CLASS:<strong>NewFunction</strong>( Params ) replaces CLASS:<em>OldFunction</em>( Params )
YYYY-MM-DD: CLASS:<strong>NewFunction( Params )</strong> added</p>
<p>Hereby the change log:</p>
<ul>
<li>2016-12-18: Released.</li>
</ul>
<hr/>
<h1><strong>AUTHORS and CONTRIBUTIONS</strong></h1>
<h3>Contributions:</h3>
<ul>
<li>None.</li>
</ul>
<h3>Authors:</h3>
<ul>
<li><strong>FlightControl</strong>: Design &amp; Programming</li>
</ul>
<h2>1.1) Add or remove objects from the FSM</h2>
<h2>Global(s)</h2>
<table class="function_list">

View File

@ -89,6 +89,7 @@
<h1>1) <a href="Functional.Spawn.html##(SPAWN)">Functional.Spawn#SPAWN</a> class, extends <a href="Core.Base.html##(BASE)">Core.Base#BASE</a></h1>
<p>The <a href="##(SPAWN)">#SPAWN</a> class allows to spawn dynamically new groups, based on pre-defined initialization settings, modifying the behaviour when groups are spawned.
For each group to be spawned, within the mission editor, a group has to be created with the "late activation flag" set. We call this group the <em>"Spawn Template"</em> of the SPAWN object.
A reference to this Spawn Template needs to be provided when constructing the SPAWN object, by indicating the name of the group within the mission editor in the constructor methods.</p>
@ -116,6 +117,7 @@ Groups will follow the following naming structure when spawned at run-time:</p>
</ul>
<h2>1.1) SPAWN construction methods</h2>
<p>Create a new SPAWN object with the <a href="##(SPAWN).New">SPAWN.New</a>() or the <a href="##(SPAWN).NewWithAlias">SPAWN.NewWithAlias</a>() methods:</p>
<ul>
@ -128,6 +130,7 @@ The initialization methods will modify this list of groups so that when a group
So in principle, the group list will contain all parameters and configurations after initialization, and when groups get actually spawned, this spawning can be done quickly and efficient.</p>
<h2>1.2) SPAWN initialization methods</h2>
<p>A spawn object will behave differently based on the usage of <strong>initialization</strong> methods, which all start with the <strong>Init</strong> prefix: </p>
<ul>
@ -142,6 +145,7 @@ So in principle, the group list will contain all parameters and configurations a
</ul>
<h2>1.3) SPAWN spawning methods</h2>
<p>Groups can be spawned at different times and methods:</p>
<ul>
@ -159,6 +163,7 @@ So in principle, the group list will contain all parameters and configurations a
You can use the <a href="GROUP.html">GROUP</a> object to do further actions with the DCSGroup.</p>
<h2>1.4) Retrieve alive GROUPs spawned by the SPAWN object</h2>
<p>The SPAWN class administers which GROUPS it has reserved (in stock) or has created during mission execution.
Every time a SPAWN object spawns a new GROUP object, a reference to the GROUP object is added to an internal table of GROUPS.
SPAWN provides methods to iterate through that internal GROUP object reference table:</p>
@ -173,6 +178,7 @@ SPAWN provides methods to iterate through that internal GROUP object reference t
The method <a href="##(SPAWN).GetGroupFromIndex">SPAWN.GetGroupFromIndex</a>() will return the GROUP object reference from the given Index, dead or alive...</p>
<h2>1.5) SPAWN object cleaning</h2>
<p>Sometimes, it will occur during a mission run-time, that ground or especially air objects get damaged, and will while being damged stop their activities, while remaining alive.
In such cases, the SPAWN object will just sit there and wait until that group gets destroyed, but most of the time it won't,
and it may occur that no new groups are or can be spawned as limits are reached.
@ -184,6 +190,7 @@ This models AI that has succesfully returned to their airbase, to restart their
Check the <a href="##(SPAWN).InitCleanUp">SPAWN.InitCleanUp</a>() for further info.</p>
<h2>1.6) Catch the <a href="Group.html">Group</a> spawn event in a callback function!</h2>
<p>When using the SpawnScheduled method, new <a href="Group.html">Group</a>s are created following the schedule timing parameters.
When a new <a href="Group.html">Group</a> is spawned, you maybe want to execute actions with that group spawned at the spawn event.
To SPAWN class supports this functionality through the <a href="##(SPAWN).OnSpawnGroup">SPAWN.OnSpawnGroup</a>( <em>*function( SpawnedGroup ) end *</em> ) method, which takes a function as a parameter that you can define locally.
@ -297,7 +304,7 @@ A coding example is provided at the description of the <a href="##(SPAWN).OnSpaw
<hr/>
<h1>AUTHORS and CONTRIBUTIONS</h1>
<h1><strong>AUTHORS and CONTRIBUTIONS</strong></h1>
<h3>Contributions:</h3>
@ -312,7 +319,6 @@ A coding example is provided at the description of the <a href="##(SPAWN).OnSpaw
</ul>
<h2>Global(s)</h2>
<table class="function_list">
<tr>
@ -2496,7 +2502,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
<p> When the first Spawn executes, all the Groups need to be made visible before start.</p>
<p> Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.</p>
</dd>
</dl>

View File

@ -255,7 +255,7 @@
<tr>
<td class="name" nowrap="nowrap"><a href="Fsm.html">Fsm</a></td>
<td class="summary">
<p>This module contains the FSM class.</p>
<p>This module contains the FSM class and derived FSM_ classes.</p>
</td>
</tr>
<tr>

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB