Switched for Event and State Transition handlers the parameter order

The parameters are now: From, Event, To
The old parameter order was: Event, From, To
This commit is contained in:
FlightControl 2016-12-20 09:24:19 +01:00
parent dc3ce7226e
commit cb993c4df5
71 changed files with 597 additions and 354 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

@ -3,7 +3,7 @@
-- 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.
--
-- ===
@ -271,7 +271,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
@ -661,8 +661,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

@ -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,6 +139,7 @@ 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" } )
-- Same, adding a process.