diff --git a/DCS_Folder_Sync.bat b/DCS_Folder_Sync.bat
index d950efe12..98d4fdc55 100644
--- a/DCS_Folder_Sync.bat
+++ b/DCS_Folder_Sync.bat
@@ -1,4 +1,4 @@
rem This script will pull the latest changes from the remote repository, and update the submodules accordingly.
-git pull
-git submodule update --init
+C:\Program Files (x86)\Git\bin\git pull
+C:\Program Files (x86)\Git\bin\git submodule update --init
diff --git a/Moose Development/Moose/AI/AI_Balancer.lua b/Moose Development/Moose/AI/AI_Balancer.lua
index 52adb5978..c866dd48b 100644
--- a/Moose Development/Moose/AI/AI_Balancer.lua
+++ b/Moose Development/Moose/AI/AI_Balancer.lua
@@ -3,17 +3,16 @@
-- even when there are hardly any players in the mission.**
--
-- 
---
---
+--
-- ===
--
--- # 1) @{AI.AI_Balancer#AI_BALANCER} class, extends @{Core.Fsm#FSM_SET}
+-- # 1) @{AI_Balancer#AI_BALANCER} class, extends @{Fsm#FSM_SET}
--
--- The @{AI.AI_Balancer#AI_BALANCER} class monitors and manages as many replacement AI groups as there are
+-- The @{AI_Balancer#AI_BALANCER} class monitors and manages as many replacement AI groups as there are
-- CLIENTS in a SET_CLIENT collection, which are not occupied by human players.
-- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.
--
--- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
+-- The parent class @{Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
-- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods.
-- An explanation about state and event transition methods can be found in the @{FSM} module documentation.
--
@@ -55,8 +54,8 @@
-- However, there are 2 additional options that you can use to customize the destroy behaviour.
-- When a human player joins a slot, you can configure to let the AI return to:
--
--- * @{#AI_BALANCER.ReturnToHomeAirbase}: Returns the AI to the **home** @{Wrapper.Airbase#AIRBASE}.
--- * @{#AI_BALANCER.ReturnToNearestAirbases}: Returns the AI to the **nearest friendly** @{Wrapper.Airbase#AIRBASE}.
+-- * @{#AI_BALANCER.ReturnToHomeAirbase}: Returns the AI to the **home** @{Airbase#AIRBASE}.
+-- * @{#AI_BALANCER.ReturnToNearestAirbases}: Returns the AI to the **nearest friendly** @{Airbase#AIRBASE}.
--
-- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return,
-- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed.
@@ -152,10 +151,10 @@ function AI_BALANCER:InitSpawnInterval( Earliest, Latest )
return self
end
---- Returns the AI to the nearest friendly @{Wrapper.Airbase#AIRBASE}.
+--- Returns the AI to the nearest friendly @{Airbase#AIRBASE}.
-- @param #AI_BALANCER self
--- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Wrapper.Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Wrapper.Airbase#AIRBASE}.
--- @param Core.Set#SET_AIRBASE ReturnAirbaseSet The SET of @{Core.Set#SET_AIRBASE}s to evaluate where to return to.
+-- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Airbase#AIRBASE}.
+-- @param Core.Set#SET_AIRBASE ReturnAirbaseSet The SET of @{Set#SET_AIRBASE}s to evaluate where to return to.
function AI_BALANCER:ReturnToNearestAirbases( ReturnTresholdRange, ReturnAirbaseSet )
self.ToNearestAirbase = true
@@ -163,9 +162,9 @@ function AI_BALANCER:ReturnToNearestAirbases( ReturnTresholdRange, ReturnAirbase
self.ReturnAirbaseSet = ReturnAirbaseSet
end
---- Returns the AI to the home @{Wrapper.Airbase#AIRBASE}.
+--- Returns the AI to the home @{Airbase#AIRBASE}.
-- @param #AI_BALANCER self
--- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Wrapper.Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Wrapper.Airbase#AIRBASE}.
+-- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Airbase#AIRBASE}.
function AI_BALANCER:ReturnToHomeAirbase( ReturnTresholdRange )
self.ToHomeAirbase = true
diff --git a/Moose Development/Moose/AI/AI_CAP.lua b/Moose Development/Moose/AI/AI_CAP.lua
index 94dab5dd7..297180962 100644
--- a/Moose Development/Moose/AI/AI_CAP.lua
+++ b/Moose Development/Moose/AI/AI_CAP.lua
@@ -2,10 +2,9 @@
--
-- 
--
---
-- ===
--
--- # 1) @{#AI_CAP_ZONE} class, extends @{AI.AI_CAP#AI_PATROL_ZONE}
+-- # 1) @{#AI_CAP_ZONE} class, extends @{AI_CAP#AI_PATROL_ZONE}
--
-- The @{#AI_CAP_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
@@ -71,7 +70,7 @@
-- that will define when the AI will engage with the detected airborne enemy targets.
-- The range can be beyond or smaller than the range of the Patrol Zone.
-- The range is applied at the position of the AI.
--- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range.
+-- Use the method @{AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range.
--
-- ## 1.4) Set the Zone of Engagement
--
@@ -79,7 +78,7 @@
--
-- An optional @{Zone} can be set,
-- that will define when the AI will engage with the detected airborne enemy targets.
--- Use the method @{AI.AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
+-- Use the method @{AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
--
-- ====
--
@@ -481,7 +480,7 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
if #AttackTasks == 0 then
self:E("No targets found -> Going back to Patrolling")
- self:__Accomplish( 1 )
+ self:__Abort( 1 )
self:__Route( 1 )
self:SetDetectionActivated()
else
diff --git a/Moose Development/Moose/AI/AI_CAS.lua b/Moose Development/Moose/AI/AI_CAS.lua
index adeaddfd3..812af56a8 100644
--- a/Moose Development/Moose/AI/AI_CAS.lua
+++ b/Moose Development/Moose/AI/AI_CAS.lua
@@ -1,13 +1,13 @@
---- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Provide Close Air Support to friendly ground troops.**
+--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** --
+-- **Provide Close Air Support to friendly ground troops.**
--
-- 
--
---
-- ===
--
--- # 1) @{#AI_CAS_ZONE} class, extends @{AI.AI_Patrol#AI_PATROL_ZONE}
+-- # 1) @{#AI_CAS_ZONE} class, extends @{AI_Patrol#AI_PATROL_ZONE}
--
--- @{#AI_CAS_ZONE} derives from the @{AI.AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour.
+-- @{#AI_CAS_ZONE} derives from the @{AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour.
--
-- The @{#AI_CAS_ZONE} class implements the core functions to provide Close Air Support in an Engage @{Zone} by an AIR @{Controllable} or @{Group}.
-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
@@ -148,7 +148,7 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
self.Accomplished = false
self:SetDetectionZone( self.EngageZone )
-
+
self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE.
--- OnBefore Transition Handler for Event Engage.
@@ -158,6 +158,12 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
+ -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
+ -- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+ -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
+ -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+ -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
+
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Engage.
@@ -167,6 +173,11 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
+ -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
+ -- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+ -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
+ -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+ -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
--- Synchronous Event Trigger for Event Engage.
-- @function [parent=#AI_CAS_ZONE] Engage
@@ -194,6 +205,8 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string Event The Event string.
-- @param #string To The To State string.
+ self:AddTransition( "Engaging", "Target", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE.
+
self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE.
--- OnBefore Transition Handler for Event Fired.
@@ -337,8 +350,9 @@ function AI_CAS_ZONE:onafterStart( Controllable, From, Event, To )
-- Call the parent Start event handler
self:GetParent(self).onafterStart( self, Controllable, From, Event, To )
- self:EventOnDead( self.OnDead )
+ self:HandleEvent( EVENTS.Dead, self.OnDead )
+ self:SetDetectionDeactivated() -- When not engaging, set the detection off.
end
--- @param Wrapper.Controllable#CONTROLLABLE AIControllable
@@ -361,15 +375,62 @@ function AI_CAS_ZONE:onbeforeEngage( Controllable, From, Event, To )
end
end
+--- @param #AI_CAS_ZONE self
+-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
+-- @param #string From The From State string.
+-- @param #string Event The Event string.
+-- @param #string To The To State string.
+function AI_CAS_ZONE:onafterTarget( Controllable, From, Event, To )
+ self:E("onafterTarget")
+
+ if Controllable:IsAlive() then
+
+ local AttackTasks = {}
+
+ for DetectedUnit, Detected in pairs( self.DetectedUnits ) do
+ local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
+ if DetectedUnit:IsAlive() then
+ if DetectedUnit:IsInZone( self.EngageZone ) then
+ if Detected == true then
+ self:E( {"Target: ", DetectedUnit } )
+ self.DetectedUnits[DetectedUnit] = false
+ local AttackTask = Controllable:EnRouteTaskEngageUnit( DetectedUnit, 1, true, self.EngageWeaponExpend, self.EngageAttackQty, self.EngageDirection, self.EngageAltitude, nil )
+ self.Controllable:PushTask( AttackTask, 1 )
+ end
+ end
+ else
+ self.DetectedUnits[DetectedUnit] = nil
+ end
+ end
+
+ self:__Target( -10 )
+
+ end
+end
+
+
--- @param #AI_CAS_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
+-- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
+-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+-- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
+-- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+-- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
+function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection )
+ self:E("onafterEngage")
+
+ self.EngageSpeed = EngageSpeed or 400
+ self.EngageAltitude = EngageAltitude or 2000
+ self.EngageWeaponExpend = EngageWeaponExpend
+ self.EngageAttackQty = EngageAttackQty
+ self.EngageDirection = EngageDirection
if Controllable:IsAlive() then
+
local EngageRoute = {}
@@ -384,7 +445,7 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
- ToEngageZoneSpeed,
+ self.EngageSpeed,
true
)
@@ -397,20 +458,15 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
local ToEngageZoneVec2 = self.EngageZone:GetRandomVec2()
self:T2( ToEngageZoneVec2 )
- -- Define Speed and Altitude.
- local ToEngageZoneAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude )
- local ToEngageZoneSpeed = self.PatrolMaxSpeed
- self:T2( ToEngageZoneSpeed )
-
-- Obtain a 3D @{Point} from the 2D point + altitude.
- local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, ToEngageZoneAltitude, ToEngageZoneVec2.y )
+ local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, self.EngageAltitude, ToEngageZoneVec2.y )
-- Create a route point of type air.
local ToEngageZoneRoutePoint = ToEngageZonePointVec3:RoutePointAir(
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
- ToEngageZoneSpeed,
+ self.EngageSpeed,
true
)
@@ -424,20 +480,15 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
local ToTargetVec2 = self.EngageZone:GetRandomVec2()
self:T2( ToTargetVec2 )
- --- Define Speed and Altitude.
- local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude )
- local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
- self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
-
--- Obtain a 3D @{Point} from the 2D point + altitude.
- local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
+ local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
--- Create a route point of type air.
local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir(
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
- ToTargetSpeed,
+ self.EngageSpeed,
true
)
@@ -447,24 +498,24 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
Controllable:OptionROEOpenFire()
- Controllable:OptionROTPassiveDefense()
+ Controllable:OptionROTVertical()
- local AttackTasks = {}
-
- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do
- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
- self:T( DetectedUnit )
- if DetectedUnit:IsAlive() then
- if DetectedUnit:IsInZone( self.EngageZone ) then
- self:E( {"Engaging ", DetectedUnit } )
- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit )
- end
- else
- self.DetectedUnits[DetectedUnit] = nil
- end
- end
-
- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
+-- local AttackTasks = {}
+--
+-- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do
+-- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
+-- self:T( DetectedUnit )
+-- if DetectedUnit:IsAlive() then
+-- if DetectedUnit:IsInZone( self.EngageZone ) then
+-- self:E( {"Engaging ", DetectedUnit } )
+-- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit )
+-- end
+-- else
+-- self.DetectedUnits[DetectedUnit] = nil
+-- end
+-- end
+--
+-- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
self.Controllable:WayPointInitialize( EngageRoute )
@@ -475,7 +526,11 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" )
--- NOW ROUTE THE GROUP!
- self.Controllable:WayPointExecute( 1, 2 )
+ self.Controllable:WayPointExecute( 1 )
+
+ self:SetDetectionInterval( 10 )
+ self:SetDetectionActivated()
+ self:__Target( -10 ) -- Start Targetting
end
end
@@ -501,7 +556,7 @@ end
-- @param #string To The To State string.
function AI_CAS_ZONE:onafterAccomplish( Controllable, From, Event, To )
self.Accomplished = true
- self:SetDetectionOff()
+ self:SetDetectionDeactivated()
end
--- @param #AI_CAS_ZONE self
diff --git a/Moose Development/Moose/AI/AI_Cargo.lua b/Moose Development/Moose/AI/AI_Cargo.lua
index 903181661..63c6e4117 100644
--- a/Moose Development/Moose/AI/AI_Cargo.lua
+++ b/Moose Development/Moose/AI/AI_Cargo.lua
@@ -1,4 +1,7 @@
---- Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground -- Management of logical cargo objects, that can be transported from and to transportation carriers.
+---Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Ground** --
+-- **Management of logical cargo objects, that can be transported from and to transportation carriers.**
+--
+-- 
--
-- ===
--
@@ -12,8 +15,8 @@
--
-- * AI_CARGO_GROUPED, represented by a Group of CARGO_UNITs.
--
--- 1) @{AI.AI_Cargo#AI_CARGO} class, extends @{Core.Fsm#FSM_PROCESS}
--- ==========================================================================
+-- # 1) @{#AI_CARGO} class, extends @{Fsm#FSM_PROCESS}
+--
-- The @{#AI_CARGO} class defines the core functions that defines a cargo object within MOOSE.
-- A cargo is a logical object defined that is available for transport, and has a life status within a simulation.
--
@@ -52,13 +55,13 @@
-- The state transition method needs to start with the name **OnEnter + the name of the state**.
-- These state transition methods need to provide a return value, which is specified at the function description.
--
--- 2) #AI_CARGO_UNIT class
--- ====================
+-- # 2) #AI_CARGO_UNIT class
+--
-- The AI_CARGO_UNIT class defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the AI_CARGO_UNIT objects to and from carriers.
--
--- 5) #AI_CARGO_GROUPED class
--- =======================
+-- # 5) #AI_CARGO_GROUPED class
+--
-- The AI_CARGO_GROUPED class defines a cargo that is represented by a group of UNIT objects within the simulator, and can be transported by a carrier.
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the AI_CARGO_UNIT objects to and from carriers.
--
@@ -90,14 +93,14 @@
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] UnBoard
-- @param #AI_CARGO self
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] __UnBoard
-- @param #AI_CARGO self
-- @param #number DelaySeconds The amount of seconds to delay the action.
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
-- Load
@@ -122,14 +125,14 @@
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] UnLoad
-- @param #AI_CARGO self
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] __UnLoad
-- @param #AI_CARGO self
-- @param #number DelaySeconds The amount of seconds to delay the action.
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
-- State Transition Functions
diff --git a/Moose Development/Moose/AI/AI_Patrol.lua b/Moose Development/Moose/AI/AI_Patrol.lua
index 43a101b01..58b6fc030 100644
--- a/Moose Development/Moose/AI/AI_Patrol.lua
+++ b/Moose Development/Moose/AI/AI_Patrol.lua
@@ -1,11 +1,11 @@
---- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Air Patrolling or Staging.**
+--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** --
+-- **Air Patrolling or Staging.**
--
-- 
--
---
-- ===
--
--- # 1) @{#AI_PATROL_ZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE}
+-- # 1) @{#AI_PATROL_ZONE} class, extends @{Fsm#FSM_CONTROLLABLE}
--
-- The @{#AI_PATROL_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}.
--
@@ -189,14 +189,13 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
-- defafult PatrolAltType to "RADIO" if not specified
self.PatrolAltType = PatrolAltType or "RADIO"
- self:SetDetectionOn()
-
+ self:SetDetectionInterval( 30 )
+
self.CheckStatus = true
self:ManageFuel( .2, 60 )
self:ManageDamage( 1 )
- self:SetDetectionInterval( 30 )
self.DetectedUnits = {} -- This table contains the targets detected during patrol.
@@ -450,7 +449,7 @@ end
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:SetDetectionOn()
self:F2()
-
+
self.DetectOn = true
end
@@ -460,7 +459,7 @@ end
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:SetDetectionOff()
self:F2()
-
+
self.DetectOn = false
end
@@ -479,8 +478,9 @@ end
function AI_PATROL_ZONE:SetDetectionActivated()
self:F2()
+ self:ClearDetectedUnits()
self.DetectActivated = true
- self:__Detect( self.DetectInterval )
+ self:__Detect( -self.DetectInterval )
end
--- Deactivate the detection. The AI will NOT detect for targets.
@@ -489,6 +489,7 @@ end
function AI_PATROL_ZONE:SetDetectionDeactivated()
self:F2()
+ self:ClearDetectedUnits()
self.DetectActivated = false
end
@@ -524,17 +525,23 @@ function AI_PATROL_ZONE:SetDetectionZone( DetectionZone )
end
end
---- Gets a list of @{Wrapper.Unit#UNIT}s that were detected by the AI.
+--- Gets a list of @{Unit#UNIT}s that were detected by the AI.
-- No filtering is applied, so, ANY detected UNIT can be in this list.
-- It is up to the mission designer to use the @{Unit} class and methods to filter the targets.
-- @param #AI_PATROL_ZONE self
--- @return #table The list of @{Wrapper.Unit#UNIT}s
+-- @return #table The list of @{Unit#UNIT}s
function AI_PATROL_ZONE:GetDetectedUnits()
self:F2()
return self.DetectedUnits
end
+--- Clears the list of @{Unit#UNIT}s that were detected by the AI.
+-- @param #AI_PATROL_ZONE self
+function AI_PATROL_ZONE:ClearDetectedUnits()
+ self:F2()
+ self.DetectedUnits = {}
+end
--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated.
@@ -584,10 +591,9 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
self:__Status( 60 ) -- Check status status every 30 seconds.
self:SetDetectionActivated()
- self:EventOnPilotDead( self.OnPilotDead )
- self:EventOnCrash( self.OnCrash )
- self:EventOnEjection( self.OnEjection )
-
+ self:HandleEvent( EVENTS.PilotDead, self.OnPilotDead )
+ self:HandleEvent( EVENTS.Crash, self.OnCrash )
+ self:HandleEvent( EVENTS.Ejection, self.OnEjection )
Controllable:OptionROEHoldFire()
Controllable:OptionROTVertical()
@@ -599,6 +605,8 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
self:__Route( 5 )
end
)
+
+ self:SetDetectionOn()
end
@@ -619,7 +627,7 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
local DetectedTargets = Controllable:GetDetectedTargets()
for TargetID, Target in pairs( DetectedTargets or {} ) do
local TargetObject = Target.object
- self:T( TargetObject )
+
if TargetObject and TargetObject:isExist() and TargetObject.id_ < 50000000 then
local TargetUnit = UNIT:Find( TargetObject )
@@ -628,18 +636,22 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
if self.DetectionZone then
if TargetUnit:IsInZone( self.DetectionZone ) then
self:T( {"Detected ", TargetUnit } )
- self.DetectedUnits[TargetUnit] = TargetUnit
+ if self.DetectedUnits[TargetUnit] == nil then
+ self.DetectedUnits[TargetUnit] = true
+ end
Detected = true
end
else
- self.DetectedUnits[TargetUnit] = TargetUnit
+ if self.DetectedUnits[TargetUnit] == nil then
+ self.DetectedUnits[TargetUnit] = true
+ end
Detected = true
end
end
end
-
- self:__Detect( self.DetectInterval )
+ self:__Detect( -self.DetectInterval )
+
if Detected == true then
self:__Detected( 1.5 )
end
@@ -874,4 +886,3 @@ function AI_PATROL_ZONE:OnPilotDead( EventData )
self:__PilotDead( 1, EventData )
end
end
-
diff --git a/Moose Development/Moose/Actions/Act_Account.lua b/Moose Development/Moose/Actions/Act_Account.lua
index 684d1742d..862079368 100644
--- a/Moose Development/Moose/Actions/Act_Account.lua
+++ b/Moose Development/Moose/Actions/Act_Account.lua
@@ -2,7 +2,7 @@
--
-- ===
--
--- # @{#ACT_ACCOUNT} FSM class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ACCOUNT} FSM class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ACCOUNT state machine:
--
@@ -117,7 +117,7 @@ do -- ACT_ACCOUNT
-- @param #string To
function ACT_ACCOUNT:onafterStart( ProcessUnit, From, Event, To )
- self:EventOnDead( self.onfuncEventDead )
+ self:HandleEvent( EVENTS.Dead, self.onfuncEventDead )
self:__Wait( 1 )
end
diff --git a/Moose Development/Moose/Actions/Act_Assign.lua b/Moose Development/Moose/Actions/Act_Assign.lua
index aa3162ffb..e78ca3b62 100644
--- a/Moose Development/Moose/Actions/Act_Assign.lua
+++ b/Moose Development/Moose/Actions/Act_Assign.lua
@@ -2,7 +2,7 @@
--
-- ===
--
--- # @{#ACT_ASSIGN} FSM template class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ASSIGN} FSM template class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ASSIGN state machine:
--
diff --git a/Moose Development/Moose/Actions/Act_Assist.lua b/Moose Development/Moose/Actions/Act_Assist.lua
index d10e29953..23c5fc056 100644
--- a/Moose Development/Moose/Actions/Act_Assist.lua
+++ b/Moose Development/Moose/Actions/Act_Assist.lua
@@ -2,7 +2,7 @@
--
-- ===
--
--- # @{#ACT_ASSIST} FSM class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ASSIST} FSM class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ASSIST state machine:
--
diff --git a/Moose Development/Moose/Actions/Act_Route.lua b/Moose Development/Moose/Actions/Act_Route.lua
index 1efef0ef8..53fa5d9b9 100644
--- a/Moose Development/Moose/Actions/Act_Route.lua
+++ b/Moose Development/Moose/Actions/Act_Route.lua
@@ -2,7 +2,7 @@
--
-- ===
--
--- # @{#ACT_ROUTE} FSM class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ROUTE} FSM class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ROUTE state machine:
--
diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua
index 6bb7aa043..2eb7f97e9 100644
--- a/Moose Development/Moose/Core/Base.lua
+++ b/Moose Development/Moose/Core/Base.lua
@@ -13,8 +13,8 @@
--
-- ## 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.
+-- Any class derived from BASE, must use the @{Base#BASE.New) constructor within the @{Base#BASE.Inherit) method.
+-- See an example at the @{Base#BASE.New} method how this is done.
--
-- ## 1.2) BASE Trace functionality
--
@@ -59,53 +59,50 @@
--
-- 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.
+-- ### 1.3.1 Subscribe / Unsubscribe to DCS Events
--
--- 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.
+-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
+-- So, when the DCS event occurs, the class will be notified of that event.
+-- There are two functions which you use to subscribe to or unsubscribe from an event.
--
--- Find below an example of the prototype how to write an event handling function:
+-- * @{#BASE.HandleEvent}(): Subscribe to a DCS Event.
+-- * @{#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
+--
+-- ### 1.3.2 Event Handling of DCS Events
+--
+-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
+-- when the DCS event occurs. The Event Handling method receives an @{Event#EVENTDATA} structure, which contains a lot of information
+-- about the event that occurred.
+--
+-- Find below an example of the prototype how to write an event handling function for two units:
--
--- 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
--- )
+-- local Tank1 = UNIT:FindByName( "Tank A" )
+-- local Tank2 = UNIT:FindByName( "Tank B" )
+--
+-- -- Here we subscribe to the Dead events. So, if one of these tanks dies, the Tank1 or Tank2 objects will be notified.
+-- Tank1:HandleEvent( EVENTS.Dead )
+-- Tank2:HandleEvent( EVENTS.Dead )
+--
+-- --- This function is an Event Handling function that will be called when Tank1 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank1:OnEventDead( EventData )
+--
+-- self:SmokeGreen()
+-- end
+--
+-- --- This function is an Event Handling function that will be called when Tank2 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank2:OnEventDead( EventData )
+--
+-- self:SmokeBlue()
+-- 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.
+--
+-- See the @{Event} module for more information about event handling.
--
-- ## 1.4) Class identification methods
--
@@ -181,6 +178,7 @@ local _ClassID = 0
BASE = {
ClassName = "BASE",
ClassID = 0,
+ _Private = {},
Events = {},
States = {}
}
@@ -287,369 +285,202 @@ function BASE:GetClassID()
return self.ClassID
end
---- Set a new listener for the class.
--- @param self
--- @param Dcs.DCSTypes#Event Event
--- @param #function EventFunction
--- @return #BASE
-function BASE:AddEvent( Event, EventFunction )
- self:F( Event )
+do -- Event Handling
- self.Events[#self.Events+1] = {}
- self.Events[#self.Events].Event = Event
- self.Events[#self.Events].EventFunction = EventFunction
- self.Events[#self.Events].EventEnabled = false
-
- return self
-end
-
---- Returns the event dispatcher
--- @param #BASE self
--- @return Core.Event#EVENT
-function BASE:Event()
-
- return _EVENTDISPATCHER
-end
-
---- Remove all subscribed events
--- @param #BASE self
--- @return #BASE
-function BASE:EventRemoveAll()
-
- _EVENTDISPATCHER:RemoveAll( self )
+ --- Returns the event dispatcher
+ -- @param #BASE self
+ -- @return Core.Event#EVENT
+ function BASE:EventDispatcher()
- return self
-end
-
---- 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
-function BASE:EventOnShot( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOT )
+ return _EVENTDISPATCHER
+ end
- return self
-end
-
---- 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
-function BASE:EventOnHit( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_HIT )
- return self
-end
-
---- 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
-function BASE:EventOnTakeOff( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_TAKEOFF )
+ --- Get the Class @{Event} processing Priority.
+ -- The Event processing Priority is a number from 1 to 10,
+ -- reflecting the order of the classes subscribed to the Event to be processed.
+ -- @param #BASE self
+ -- @return #number The @{Event} processing Priority.
+ function BASE:GetEventPriority()
+ return self._Private.EventPriority or 5
+ end
- return self
-end
-
---- 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
-function BASE:EventOnLand( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_LAND )
+ --- Set the Class @{Event} processing Priority.
+ -- The Event processing Priority is a number from 1 to 10,
+ -- reflecting the order of the classes subscribed to the Event to be processed.
+ -- @param #BASE self
+ -- @param #number EventPriority The @{Event} processing Priority.
+ -- @return self
+ function BASE:SetEventPriority( EventPriority )
+ self._Private.EventPriority = EventPriority
+ end
- return self
-end
-
---- 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
-function BASE:EventOnCrash( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_CRASH )
+ --- Remove all subscribed events
+ -- @param #BASE self
+ -- @return #BASE
+ function BASE:EventRemoveAll()
- return self
-end
-
---- 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
-function BASE:EventOnEjection( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_EJECTION )
+ self:EventDispatcher():RemoveAll( self )
+
+ return self
+ end
- return self
-end
-
-
---- 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
-function BASE:EventOnRefueling( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_REFUELING )
+ --- Subscribe to a DCS Event.
+ -- @param #BASE self
+ -- @param Core.Event#EVENTS Event
+ -- @param #function EventFunction (optional) The function to be called when the event occurs for the unit.
+ -- @return #BASE
+ function BASE:HandleEvent( Event, EventFunction )
- return self
-end
-
---- 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
-function BASE:EventOnDead( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_DEAD )
+ self:EventDispatcher():OnEventGeneric( EventFunction, self, Event )
+
+ return self
+ end
- return self
-end
-
---- 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
-function BASE:EventOnPilotDead( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PILOT_DEAD )
+ --- UnSubscribe to a DCS event.
+ -- @param #BASE self
+ -- @param Core.Event#EVENTS Event
+ -- @return #BASE
+ function BASE:UnHandleEvent( Event )
- return self
-end
-
---- 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
-function BASE:EventOnBaseCaptured( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_BASE_CAPTURED )
+ self:EventDispatcher():Remove( self, Event )
+
+ return self
+ end
- return self
-end
-
---- 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
-function BASE:EventOnMissionStart( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_MISSION_START )
+ -- Event handling function prototypes
- return self
+ --- Occurs whenever any unit in a mission fires a weapon. But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart.
+ -- @function [parent=#BASE] OnEventShot
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs whenever an object is hit by a weapon.
+ -- initiator : The unit object the fired the weapon
+ -- weapon: Weapon object that hit the target
+ -- target: The Object that was hit.
+ -- @function [parent=#BASE] OnEventHit
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft takes off from an airbase, farp, or ship.
+ -- initiator : The unit that tookoff
+ -- place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
+ -- @function [parent=#BASE] OnEventTakeoff
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft lands at an airbase, farp or ship
+ -- initiator : The unit that has landed
+ -- place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships
+ -- @function [parent=#BASE] OnEventLand
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any aircraft crashes into the ground and is completely destroyed.
+ -- initiator : The unit that has crashed
+ -- @function [parent=#BASE] OnEventCrash
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a pilot ejects from an aircraft
+ -- initiator : The unit that has ejected
+ -- @function [parent=#BASE] OnEventEjection
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft connects with a tanker and begins taking on fuel.
+ -- initiator : The unit that is receiving fuel.
+ -- @function [parent=#BASE] OnEventRefueling
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an object is completely destroyed.
+ -- initiator : The unit that is was destroyed.
+ -- @function [parent=#BASE] OnEvent
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when the pilot of an aircraft is killed. Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane.
+ -- initiator : The unit that the pilot has died in.
+ -- @function [parent=#BASE] OnEventPilotDead
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a ground unit captures either an airbase or a farp.
+ -- initiator : The unit that captured the base
+ -- place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
+ -- @function [parent=#BASE] OnEventBaseCaptured
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a mission starts
+ -- @function [parent=#BASE] OnEventMissionStart
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a mission ends
+ -- @function [parent=#BASE] OnEventMissionEnd
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft is finished taking fuel.
+ -- initiator : The unit that was receiving fuel.
+ -- @function [parent=#BASE] OnEventRefuelingStop
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any object is spawned into the mission.
+ -- initiator : The unit that was spawned
+ -- @function [parent=#BASE] OnEventBirth
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any system fails on a human controlled aircraft.
+ -- initiator : The unit that had the failure
+ -- @function [parent=#BASE] OnEventHumanFailure
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any aircraft starts its engines.
+ -- initiator : The unit that is starting its engines.
+ -- @function [parent=#BASE] OnEventEngineStartup
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any aircraft shuts down its engines.
+ -- initiator : The unit that is stopping its engines.
+ -- @function [parent=#BASE] OnEventEngineShutdown
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any player assumes direct control of a unit.
+ -- initiator : The unit that is being taken control of.
+ -- @function [parent=#BASE] OnEventPlayerEnterUnit
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any player relieves control of a unit to the AI.
+ -- initiator : The unit that the player left.
+ -- @function [parent=#BASE] OnEventPlayerLeaveUnit
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any unit begins firing a weapon that has a high rate of fire. Most common with aircraft cannons (GAU-8), autocannons, and machine guns.
+ -- initiator : The unit that is doing the shooing.
+ -- target: The unit that is being targeted.
+ -- @function [parent=#BASE] OnEventShootingStart
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any unit stops firing its weapon. Event will always correspond with a shooting start event.
+ -- initiator : The unit that was doing the shooing.
+ -- @function [parent=#BASE] OnEventShootingEnd
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
end
-
---- 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
-function BASE:EventOnPlayerMissionEnd( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_MISSION_END )
-
- return self
-end
-
---- 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
-function BASE:EventOnTookControl( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_TOOK_CONTROL )
-
- return self
-end
-
---- 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
-function BASE:EventOnRefuelingStop( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_REFUELING_STOP )
-
- return self
-end
-
---- 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
-function BASE:EventOnBirth( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_BIRTH )
-
- return self
-end
-
---- 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
-function BASE:EventOnHumanFailure( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_HUMAN_FAILURE )
-
- return self
-end
-
---- 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
-function BASE:EventOnEngineStartup( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_ENGINE_STARTUP )
-
- return self
-end
-
---- 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
-function BASE:EventOnEngineShutdown( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_ENGINE_SHUTDOWN )
-
- return self
-end
-
---- 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
-function BASE:EventOnPlayerEnterUnit( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_ENTER_UNIT )
-
- return self
-end
-
---- 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
-function BASE:EventOnPlayerLeaveUnit( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_LEAVE_UNIT )
-
- return self
-end
-
---- 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
-function BASE:EventOnPlayerComment( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_COMMENT )
-
- return self
-end
-
---- 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
-function BASE:EventOnShootingStart( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOOTING_START )
-
- return self
-end
-
---- 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
-function BASE:EventOnShootingEnd( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOOTING_END )
-
- return self
-end
-
-
-
-
-
-
-
---- Enable the event listeners for the class.
--- @param #BASE self
--- @return #BASE
-function BASE:EnableEvents()
- self:F( #self.Events )
-
- for EventID, Event in pairs( self.Events ) do
- Event.Self = self
- Event.EventEnabled = true
- end
- self.Events.Handler = world.addEventHandler( self )
-
- return self
-end
-
-
---- Disable the event listeners for the class.
--- @param #BASE self
--- @return #BASE
-function BASE:DisableEvents()
- self:F()
-
- world.removeEventHandler( self )
- for EventID, Event in pairs( self.Events ) do
- Event.Self = nil
- Event.EventEnabled = false
- end
-
- return self
-end
-
-
-local BaseEventCodes = {
- "S_EVENT_SHOT",
- "S_EVENT_HIT",
- "S_EVENT_TAKEOFF",
- "S_EVENT_LAND",
- "S_EVENT_CRASH",
- "S_EVENT_EJECTION",
- "S_EVENT_REFUELING",
- "S_EVENT_DEAD",
- "S_EVENT_PILOT_DEAD",
- "S_EVENT_BASE_CAPTURED",
- "S_EVENT_MISSION_START",
- "S_EVENT_MISSION_END",
- "S_EVENT_TOOK_CONTROL",
- "S_EVENT_REFUELING_STOP",
- "S_EVENT_BIRTH",
- "S_EVENT_HUMAN_FAILURE",
- "S_EVENT_ENGINE_STARTUP",
- "S_EVENT_ENGINE_SHUTDOWN",
- "S_EVENT_PLAYER_ENTER_UNIT",
- "S_EVENT_PLAYER_LEAVE_UNIT",
- "S_EVENT_PLAYER_COMMENT",
- "S_EVENT_SHOOTING_START",
- "S_EVENT_SHOOTING_END",
- "S_EVENT_MAX",
-}
---onEvent( {[1]="S_EVENT_BIRTH",[2]={["subPlace"]=5,["time"]=0,["initiator"]={["id_"]=16884480,},["place"]={["id_"]=5000040,},["id"]=15,["IniUnitName"]="US F-15C@RAMP-Air Support Mountains#001-01",},}
--- Event = {
--- id = enum world.event,
--- time = Time,
--- initiator = Unit,
--- target = Unit,
--- place = Unit,
--- subPlace = enum world.BirthPlace,
--- weapon = Weapon
--- }
--- Creation of a Birth Event.
-- @param #BASE self
diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua
index 37b76490c..8165bbf9d 100644
--- a/Moose Development/Moose/Core/Database.lua
+++ b/Moose Development/Moose/Core/Database.lua
@@ -2,7 +2,7 @@
--
-- ====
--
--- 1) @{Core.Database#DATABASE} class, extends @{Core.Base#BASE}
+-- 1) @{#DATABASE} class, extends @{Base#BASE}
-- ===================================================
-- Mission designers can use the DATABASE class to refer to:
--
@@ -83,15 +83,16 @@ function DATABASE:New()
-- Inherits from BASE
local self = BASE:Inherit( self, BASE:New() )
+
+ self:SetEventPriority( 1 )
- _EVENTDISPATCHER:OnBirth( self._EventOnBirth, self )
- _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
-
+ self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
+ self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
-- Follow alive players and clients
- _EVENTDISPATCHER:OnPlayerEnterUnit( self._EventOnPlayerEnterUnit, self )
- _EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventOnPlayerLeaveUnit, self )
+ self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit )
+ self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
self:_RegisterTemplates()
self:_RegisterGroupsAndUnits()
@@ -228,6 +229,7 @@ end
function DATABASE:AddGroup( GroupName )
if not self.GROUPS[GroupName] then
+ self:E( { "Add GROUP:", GroupName } )
self.GROUPS[GroupName] = GROUP:Register( GroupName )
end
@@ -569,6 +571,8 @@ function DATABASE:_EventOnPlayerEnterUnit( Event )
self:F2( { Event } )
if Event.IniUnit then
+ self:AddUnit( Event.IniDCSUnitName )
+ self:AddGroup( Event.IniDCSGroupName )
local PlayerName = Event.IniUnit:GetPlayerName()
if not self.PLAYERS[PlayerName] then
self:AddPlayer( Event.IniUnitName, PlayerName )
@@ -713,6 +717,8 @@ function DATABASE:_RegisterTemplates()
if (CoalitionName == 'red' or CoalitionName == 'blue') and type(coa_data) == 'table' then
--self.Units[coa_name] = {}
+
+ local CoalitionSide = coalition.side[string.upper(CoalitionName)]
----------------------------------------------
-- build nav points DB
@@ -736,6 +742,8 @@ function DATABASE:_RegisterTemplates()
for cntry_id, cntry_data in pairs(coa_data.country) do
local CountryName = string.upper(cntry_data.name)
+ local CountryID = cntry_data.id
+
--self.Units[coa_name][countryName] = {}
--self.Units[coa_name][countryName]["countryId"] = cntry_data.id
@@ -756,9 +764,9 @@ function DATABASE:_RegisterTemplates()
if GroupTemplate and GroupTemplate.units and type(GroupTemplate.units) == 'table' then --making sure again- this is a valid group
self:_RegisterTemplate(
GroupTemplate,
- coalition.side[string.upper(CoalitionName)],
+ CoalitionSide,
_DATABASECategory[string.lower(CategoryName)],
- country.id[string.upper(CountryName)]
+ CountryID
)
end --if GroupTemplate and GroupTemplate.units then
end --for group_num, GroupTemplate in pairs(obj_type_data.group) do
diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua
index cedee92e6..5a390985e 100644
--- a/Moose Development/Moose/Core/Event.lua
+++ b/Moose Development/Moose/Core/Event.lua
@@ -1,53 +1,193 @@
---- This module contains the EVENT class.
+--- This core module models the dispatching of DCS Events to subscribed MOOSE classes,
+-- following a given priority.
+--
+-- 
--
-- ===
--
--- Takes care of EVENT dispatching between DCS events and event handling functions defined in MOOSE classes.
+-- # 1) Event Handling Overview
+--
+-- 
+--
+-- Within a running mission, various DCS events occur. Units are dynamically created, crash, die, shoot stuff, get hit etc.
+-- This module provides a mechanism to dispatch those events occuring within your running mission, to the different objects orchestrating your mission.
+--
+-- 
+--
+-- Objects can subscribe to different events. The Event dispatcher will publish the received DCS events to the subscribed MOOSE objects, in a specified order.
+-- In this way, the subscribed MOOSE objects are kept in sync with your evolving running mission.
+--
+-- ## 1.1) Event Dispatching
+--
+-- 
+--
+-- The _EVENTDISPATCHER object is automatically created within MOOSE,
+-- and handles the dispatching of DCS Events occurring
+-- in the simulator to the subscribed objects
+-- in the correct processing order.
+--
+-- 
+--
+-- There are 5 levels of kind of objects that the _EVENTDISPATCHER services:
+--
+-- * _DATABASE object: The core of the MOOSE objects. Any object that is created, deleted or updated, is done in this database.
+-- * SET_ derived classes: Subsets of the _DATABASE object. These subsets are updated by the _EVENTDISPATCHER as the second priority.
+-- * UNIT objects: UNIT objects can subscribe to DCS events. Each DCS event will be directly published to teh subscribed UNIT object.
+-- * GROUP objects: GROUP objects can subscribe to DCS events. Each DCS event will be directly published to the subscribed GROUP object.
+-- * Any other object: Various other objects can subscribe to DCS events. Each DCS event triggered will be published to each subscribed object.
+--
+-- 
+--
+-- For most DCS events, the above order of updating will be followed.1
+--
+-- 
+--
+-- But for some DCS events, the publishing order is reversed. This is due to the fact that objects need to be **erased** instead of added.
+--
+-- ## 1.2) Event Handling
+--
+-- 
+--
+-- The actual event subscribing and handling is not facilitated through the _EVENTDISPATCHER, but it is done through the @{BASE} class, @{UNIT} class and @{GROUP} class.
+-- The _EVENTDISPATCHER is a component that is quietly working in the background of MOOSE.
+--
+-- 
+--
+-- 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.
+--
+-- ### 1.2.1 Subscribe / Unsubscribe to DCS Events
+--
+-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
+-- So, when the DCS event occurs, the class will be notified of that event.
+-- There are two functions which you use to subscribe to or unsubscribe from an event.
+--
+-- * @{Base#BASE.HandleEvent}(): Subscribe to a DCS Event.
+-- * @{Base#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
+--
+-- ### 1.3.2 Event Handling of DCS Events
+--
+-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
+-- when the DCS event occurs. The Event Handling method receives an @{Event#EVENTDATA} structure, which contains a lot of information
+-- about the event that occurred.
+--
+-- Find below an example of the prototype how to write an event handling function for two units:
+--
+-- local Tank1 = UNIT:FindByName( "Tank A" )
+-- local Tank2 = UNIT:FindByName( "Tank B" )
+--
+-- -- Here we subscribe to the Dead events. So, if one of these tanks dies, the Tank1 or Tank2 objects will be notified.
+-- Tank1:HandleEvent( EVENTS.Dead )
+-- Tank2:HandleEvent( EVENTS.Dead )
+--
+-- --- This function is an Event Handling function that will be called when Tank1 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank1:OnEventDead( EventData )
+--
+-- self:SmokeGreen()
+-- end
+--
+-- --- This function is an Event Handling function that will be called when Tank2 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank2:OnEventDead( EventData )
+--
+-- self:SmokeBlue()
+-- end
+--
+-- ### 1.3.3 Event Handling methods that are automatically called upon subscribed DCS events
+--
+-- 
+--
+-- The following list outlines which EVENTS item in the structure corresponds to which Event Handling method.
+-- Always ensure that your event handling methods align with the events being subscribed to, or nothing will be executed.
+--
+-- # 2) EVENTS type
+--
+-- The EVENTS structure contains names for all the different DCS events that objects can subscribe to using the
+-- @{Base#BASE.HandleEvent}() method.
+--
+-- # 3) EVENTDATA type
+--
+-- The EVENTDATA contains all the fields that are populated with event information before
+-- an Event Handler method is being called by the event dispatcher.
+-- The Event Handler received the EVENTDATA object as a parameter, and can be used to investigate further the different events.
+-- There are basically 4 main categories of information stored in the EVENTDATA structure:
+--
+-- * Initiator Unit data: Several fields documenting the initiator unit related to the event.
+-- * Target Unit data: Several fields documenting the target unit related to the event.
+-- * Weapon data: Certain events populate weapon information.
+-- * Place data: Certain events populate place information.
+--
+-- Find below an overview which events populate which information categories:
+--
+-- 
+--
+-- ====
+--
+-- # **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-02-07: Did a complete revision of the Event Handing API and underlying mechanisms.
--
-- ===
--
--- The above menus classes **are derived** from 2 main **abstract** classes defined within the MOOSE framework (so don't use these):
+-- # **AUTHORS and CONTRIBUTIONS**
--
--- ===
+-- ### Contributions:
--
--- ### Contributions: -
--- ### Authors: FlightControl : Design & Programming
+-- ### Authors:
--
+-- * [**FlightControl**](https://forums.eagle.ru/member.php?u=89536): Design & Programming & documentation.
+--
-- @module Event
--- The EVENT structure
-- @type EVENT
-- @field #EVENT.Events Events
+-- @extends Core.Base#BASE
EVENT = {
ClassName = "EVENT",
ClassID = 0,
}
-local _EVENTCODES = {
- "S_EVENT_SHOT",
- "S_EVENT_HIT",
- "S_EVENT_TAKEOFF",
- "S_EVENT_LAND",
- "S_EVENT_CRASH",
- "S_EVENT_EJECTION",
- "S_EVENT_REFUELING",
- "S_EVENT_DEAD",
- "S_EVENT_PILOT_DEAD",
- "S_EVENT_BASE_CAPTURED",
- "S_EVENT_MISSION_START",
- "S_EVENT_MISSION_END",
- "S_EVENT_TOOK_CONTROL",
- "S_EVENT_REFUELING_STOP",
- "S_EVENT_BIRTH",
- "S_EVENT_HUMAN_FAILURE",
- "S_EVENT_ENGINE_STARTUP",
- "S_EVENT_ENGINE_SHUTDOWN",
- "S_EVENT_PLAYER_ENTER_UNIT",
- "S_EVENT_PLAYER_LEAVE_UNIT",
- "S_EVENT_PLAYER_COMMENT",
- "S_EVENT_SHOOTING_START",
- "S_EVENT_SHOOTING_END",
- "S_EVENT_MAX",
+--- The different types of events supported by MOOSE.
+-- Use this structure to subscribe to events using the @{Base#BASE.HandleEvent}() method.
+-- @type EVENTS
+EVENTS = {
+ Shot = world.event.S_EVENT_SHOT,
+ Hit = world.event.S_EVENT_HIT,
+ Takeoff = world.event.S_EVENT_TAKEOFF,
+ Land = world.event.S_EVENT_LAND,
+ Crash = world.event.S_EVENT_CRASH,
+ Ejection = world.event.S_EVENT_EJECTION,
+ Refueling = world.event.S_EVENT_REFUELING,
+ Dead = world.event.S_EVENT_DEAD,
+ PilotDead = world.event.S_EVENT_PILOT_DEAD,
+ BaseCaptured = world.event.S_EVENT_BASE_CAPTURED,
+ MissionStart = world.event.S_EVENT_MISSION_START,
+ MissionEnd = world.event.S_EVENT_MISSION_END,
+ TookControl = world.event.S_EVENT_TOOK_CONTROL,
+ RefuelingStop = world.event.S_EVENT_REFUELING_STOP,
+ Birth = world.event.S_EVENT_BIRTH,
+ HumanFailure = world.event.S_EVENT_HUMAN_FAILURE,
+ EngineStartup = world.event.S_EVENT_ENGINE_STARTUP,
+ EngineShutdown = world.event.S_EVENT_ENGINE_SHUTDOWN,
+ PlayerEnterUnit = world.event.S_EVENT_PLAYER_ENTER_UNIT,
+ PlayerLeaveUnit = world.event.S_EVENT_PLAYER_LEAVE_UNIT,
+ PlayerComment = world.event.S_EVENT_PLAYER_COMMENT,
+ ShootingStart = world.event.S_EVENT_SHOOTING_START,
+ ShootingEnd = world.event.S_EVENT_SHOOTING_END,
}
--- The Event structure
@@ -72,6 +212,126 @@ local _EVENTCODES = {
-- @field WeaponName
-- @field WeaponTgtDCSUnit
+
+local _EVENTMETA = {
+ [world.event.S_EVENT_SHOT] = {
+ Order = 1,
+ Event = "OnEventShot",
+ Text = "S_EVENT_SHOT"
+ },
+ [world.event.S_EVENT_HIT] = {
+ Order = 1,
+ Event = "OnEventHit",
+ Text = "S_EVENT_HIT"
+ },
+ [world.event.S_EVENT_TAKEOFF] = {
+ Order = 1,
+ Event = "OnEventTakeOff",
+ Text = "S_EVENT_TAKEOFF"
+ },
+ [world.event.S_EVENT_LAND] = {
+ Order = 1,
+ Event = "OnEventLand",
+ Text = "S_EVENT_LAND"
+ },
+ [world.event.S_EVENT_CRASH] = {
+ Order = -1,
+ Event = "OnEventCrash",
+ Text = "S_EVENT_CRASH"
+ },
+ [world.event.S_EVENT_EJECTION] = {
+ Order = 1,
+ Event = "OnEventEjection",
+ Text = "S_EVENT_EJECTION"
+ },
+ [world.event.S_EVENT_REFUELING] = {
+ Order = 1,
+ Event = "OnEventRefueling",
+ Text = "S_EVENT_REFUELING"
+ },
+ [world.event.S_EVENT_DEAD] = {
+ Order = -1,
+ Event = "OnEventDead",
+ Text = "S_EVENT_DEAD"
+ },
+ [world.event.S_EVENT_PILOT_DEAD] = {
+ Order = 1,
+ Event = "OnEventPilotDead",
+ Text = "S_EVENT_PILOT_DEAD"
+ },
+ [world.event.S_EVENT_BASE_CAPTURED] = {
+ Order = 1,
+ Event = "OnEventBaseCaptured",
+ Text = "S_EVENT_BASE_CAPTURED"
+ },
+ [world.event.S_EVENT_MISSION_START] = {
+ Order = 1,
+ Event = "OnEventMissionStart",
+ Text = "S_EVENT_MISSION_START"
+ },
+ [world.event.S_EVENT_MISSION_END] = {
+ Order = 1,
+ Event = "OnEventMissionEnd",
+ Text = "S_EVENT_MISSION_END"
+ },
+ [world.event.S_EVENT_TOOK_CONTROL] = {
+ Order = 1,
+ Event = "OnEventTookControl",
+ Text = "S_EVENT_TOOK_CONTROL"
+ },
+ [world.event.S_EVENT_REFUELING_STOP] = {
+ Order = 1,
+ Event = "OnEventRefuelingStop",
+ Text = "S_EVENT_REFUELING_STOP"
+ },
+ [world.event.S_EVENT_BIRTH] = {
+ Order = 1,
+ Event = "OnEventBirth",
+ Text = "S_EVENT_BIRTH"
+ },
+ [world.event.S_EVENT_HUMAN_FAILURE] = {
+ Order = 1,
+ Event = "OnEventHumanFailure",
+ Text = "S_EVENT_HUMAN_FAILURE"
+ },
+ [world.event.S_EVENT_ENGINE_STARTUP] = {
+ Order = 1,
+ Event = "OnEventEngineStartup",
+ Text = "S_EVENT_ENGINE_STARTUP"
+ },
+ [world.event.S_EVENT_ENGINE_SHUTDOWN] = {
+ Order = 1,
+ Event = "OnEventEngineShutdown",
+ Text = "S_EVENT_ENGINE_SHUTDOWN"
+ },
+ [world.event.S_EVENT_PLAYER_ENTER_UNIT] = {
+ Order = 1,
+ Event = "OnEventPlayerEnterUnit",
+ Text = "S_EVENT_PLAYER_ENTER_UNIT"
+ },
+ [world.event.S_EVENT_PLAYER_LEAVE_UNIT] = {
+ Order = -1,
+ Event = "OnEventPlayerLeaveUnit",
+ Text = "S_EVENT_PLAYER_LEAVE_UNIT"
+ },
+ [world.event.S_EVENT_PLAYER_COMMENT] = {
+ Order = 1,
+ Event = "OnEventPlayerComment",
+ Text = "S_EVENT_PLAYER_COMMENT"
+ },
+ [world.event.S_EVENT_SHOOTING_START] = {
+ Order = 1,
+ Event = "OnEventShootingStart",
+ Text = "S_EVENT_SHOOTING_START"
+ },
+ [world.event.S_EVENT_SHOOTING_END] = {
+ Order = 1,
+ Event = "OnEventShootingEnd",
+ Text = "S_EVENT_SHOOTING_END"
+ },
+}
+
+
--- The Events structure
-- @type EVENT.Events
-- @field #number IniUnit
@@ -85,7 +345,7 @@ end
function EVENT:EventText( EventID )
- local EventText = _EVENTCODES[EventID]
+ local EventText = _EVENTMETA[EventID].Text
return EventText
end
@@ -97,18 +357,23 @@ end
-- @param Core.Base#BASE EventClass
-- @return #EVENT.Events
function EVENT:Init( EventID, EventClass )
- self:F3( { _EVENTCODES[EventID], EventClass } )
+ self:F3( { _EVENTMETA[EventID].Text, EventClass } )
if not self.Events[EventID] then
-- Create a WEAK table to ensure that the garbage collector is cleaning the event links when the object usage is cleaned.
self.Events[EventID] = setmetatable( {}, { __mode = "k" } )
-
end
+
+ -- Each event has a subtable of EventClasses, ordered by EventPriority.
+ local EventPriority = EventClass:GetEventPriority()
+ if not self.Events[EventID][EventPriority] then
+ self.Events[EventID][EventPriority] = {}
+ end
- if not self.Events[EventID][EventClass] then
- self.Events[EventID][EventClass] = setmetatable( {}, { __mode = "k" } )
+ if not self.Events[EventID][EventPriority][EventClass] then
+ self.Events[EventID][EventPriority][EventClass] = setmetatable( {}, { __mode = "k" } )
end
- return self.Events[EventID][EventClass]
+ return self.Events[EventID][EventPriority][EventClass]
end
--- Removes an Events entry
@@ -117,21 +382,37 @@ end
-- @param Dcs.DCSWorld#world.event EventID
-- @return #EVENT.Events
function EVENT:Remove( EventClass, EventID )
- self:F3( { EventClass, _EVENTCODES[EventID] } )
+ self:F3( { EventClass, _EVENTMETA[EventID].Text } )
local EventClass = EventClass
- self.Events[EventID][EventClass] = nil
+ local EventPriority = EventClass:GetEventPriority()
+ self.Events[EventID][EventPriority][EventClass] = nil
end
---- Clears all event subscriptions for a @{Core.Base#BASE} derived object.
+--- Removes an Events entry for a Unit
+-- @param #EVENT self
+-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
+-- @param Dcs.DCSWorld#world.event EventID
+-- @return #EVENT.Events
+function EVENT:RemoveForUnit( UnitName, EventClass, EventID )
+ self:F3( { EventClass, _EVENTMETA[EventID].Text } )
+
+ local EventClass = EventClass
+ local EventPriority = EventClass:GetEventPriority()
+ local Event = self.Events[EventID][EventPriority][EventClass]
+ Event.IniUnit[UnitName] = nil
+end
+
+--- Clears all event subscriptions for a @{Base#BASE} derived object.
-- @param #EVENT self
-- @param Core.Base#BASE EventObject
function EVENT:RemoveAll( EventObject )
self:F3( { EventObject:GetClassNameAndID() } )
local EventClass = EventObject:GetClassNameAndID()
+ local EventPriority = EventClass:GetEventPriority()
for EventID, EventData in pairs( self.Events ) do
- self.Events[EventID][EventClass] = nil
+ self.Events[EventID][EventPriority][EventClass] = nil
end
end
@@ -165,6 +446,7 @@ function EVENT:OnEventGeneric( EventFunction, EventClass, EventID )
local Event = self:Init( EventID, EventClass )
Event.EventFunction = EventFunction
Event.EventClass = EventClass
+
return self
end
@@ -650,7 +932,7 @@ do -- OnHit
self:Remove( EventClass, world.event.S_EVENT_HIT )
return self
- end
+ end
end
@@ -741,6 +1023,8 @@ function EVENT:onEvent( Event )
Event.IniDCSGroupName = ""
if Event.IniDCSGroup and Event.IniDCSGroup:isExist() then
Event.IniDCSGroupName = Event.IniDCSGroup:getName()
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+ self:E( { IniGroup = Event.IniGroup } )
end
end
if Event.target then
@@ -761,29 +1045,95 @@ function EVENT:onEvent( Event )
Event.WeaponName = Event.Weapon:getTypeName()
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
end
- self:E( { _EVENTCODES[Event.id], Event, Event.IniDCSUnitName, Event.TgtDCSUnitName } )
- -- Okay, we got the event from DCS. Now loop the self.Events[] table for the received Event.id, and for each EventData registered, check if a function needs to be called.
- for EventClass, EventData in pairs( self.Events[Event.id] ) do
- -- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT.
- if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then
- self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName } )
- local Result, Value = xpcall( function() return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) end, ErrorHandler )
- --EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event )
- else
- -- If the EventData is not bound to a specific unit, then call the EventClass EventFunction.
- -- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon.
- if Event.IniDCSUnit and not EventData.IniUnit then
- if EventClass == EventData.EventClass then
- self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID() } )
- local Result, Value = xpcall( function() return EventData.EventFunction( EventData.EventClass, Event ) end, ErrorHandler )
- --EventData.EventFunction( EventData.EventClass, Event )
+ local PriorityOrder = _EVENTMETA[Event.id].Order
+ local PriorityBegin = PriorityOrder == -1 and 5 or 1
+ local PriorityEnd = PriorityOrder == -1 and 1 or 5
+
+ self:E( { _EVENTMETA[Event.id].Text, Event, Event.IniDCSUnitName, Event.TgtDCSUnitName, PriorityOrder } )
+
+ for EventPriority = PriorityBegin, PriorityEnd, PriorityOrder do
+
+ if self.Events[Event.id][EventPriority] then
+
+ -- Okay, we got the event from DCS. Now loop the SORTED self.EventSorted[] table for the received Event.id, and for each EventData registered, check if a function needs to be called.
+ for EventClass, EventData in pairs( self.Events[Event.id][EventPriority] ) do
+
+ -- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT.
+ if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then
+
+ -- First test if a EventFunction is Set, otherwise search for the default function
+ if EventData.IniUnit[Event.IniDCSUnitName].EventFunction then
+
+ self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventClass, Event )
+ end, ErrorHandler )
+
+ else
+
+ -- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
+ local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
+ if EventFunction and type( EventFunction ) == "function" then
+
+ -- Now call the default event function.
+ self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventFunction( EventClass, Event )
+ end, ErrorHandler )
+ end
+
+ end
+
+ else
+
+ -- If the EventData is not bound to a specific unit, then call the EventClass EventFunction.
+ -- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon.
+ if Event.IniDCSUnit and not EventData.IniUnit then
+
+ if EventClass == EventData.EventClass then
+
+ -- First test if a EventFunction is Set, otherwise search for the default function
+ if EventData.EventFunction then
+
+ -- There is an EventFunction defined, so call the EventFunction.
+ self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventData.EventFunction( EventClass, Event )
+ end, ErrorHandler )
+ else
+
+ -- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
+ local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
+ if EventFunction and type( EventFunction ) == "function" then
+
+ -- Now call the default event function.
+ self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventFunction( EventClass, Event )
+ end, ErrorHandler )
+ end
+ end
+ end
+ end
end
end
end
end
else
- self:E( { _EVENTCODES[Event.id], Event } )
+ self:E( { _EVENTMETA[Event.id].Text, Event } )
end
end
diff --git a/Moose Development/Moose/Core/Fsm.lua b/Moose Development/Moose/Core/Fsm.lua
index acf7a73ce..b14634496 100644
--- a/Moose Development/Moose/Core/Fsm.lua
+++ b/Moose Development/Moose/Core/Fsm.lua
@@ -3,6 +3,8 @@
--
-- 
--
+-- ===
+--
-- A FSM can only be in one of a finite number of states.
-- The machine is in only one state at a time; the state it is in at any given time is called the **current state**.
-- It can change from one state to another when initiated by an **__internal__ or __external__ triggering event**, which is called a **transition**.
@@ -46,7 +48,7 @@
--
-- ===
--
--- # 1) @{Core.Fsm#FSM} class, extends @{Core.Base#BASE}
+-- # 1) @{#FSM} class, extends @{Base#BASE}
--
-- 
--
@@ -326,6 +328,7 @@ do -- FSM
self._Processes = {}
self._EndStates = {}
self._Scores = {}
+ self._EventSchedules = {}
self.CallScheduler = SCHEDULER:New( self )
@@ -526,9 +529,10 @@ do -- FSM
end
- function FSM:_call_handler(handler, params)
+ function FSM:_call_handler( handler, params, EventName )
if self[handler] then
self:T( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
local Value = self[handler]( self, unpack(params) )
return Value
end
@@ -552,10 +556,10 @@ do -- FSM
self:T( "FSM Transition:" .. self.current .. " --> " .. EventName .. " --> " .. to )
end
- if ( self:_call_handler("onbefore" .. EventName, params) == false )
- or ( self:_call_handler("OnBefore" .. EventName, params) == false )
- or ( self:_call_handler("onleave" .. from, params) == false )
- or ( self:_call_handler("OnLeave" .. from, params) == false ) then
+ if ( self:_call_handler("onbefore" .. EventName, params, EventName ) == false )
+ or ( self:_call_handler("OnBefore" .. EventName, params, EventName ) == false )
+ or ( self:_call_handler("onleave" .. from, params, EventName ) == false )
+ or ( self:_call_handler("OnLeave" .. from, params, EventName ) == false ) then
self:T( "Cancel Transition" )
return false
end
@@ -580,11 +584,11 @@ do -- FSM
local fsmparent, Event = self:_isendstate( to )
if fsmparent and Event then
self:F2( { "end state: ", fsmparent, Event } )
- self:_call_handler("onenter" .. to, params)
- self:_call_handler("OnEnter" .. to, params)
- self:_call_handler("onafter" .. EventName, params)
- self:_call_handler("OnAfter" .. EventName, params)
- self:_call_handler("onstatechange", params)
+ self:_call_handler("onenter" .. to, params, EventName )
+ self:_call_handler("OnEnter" .. to, params, EventName )
+ self:_call_handler("onafter" .. EventName, params, EventName )
+ self:_call_handler("OnAfter" .. EventName, params, EventName )
+ self:_call_handler("onstatechange", params, EventName )
fsmparent[Event]( fsmparent )
execute = false
end
@@ -592,14 +596,14 @@ do -- FSM
if execute then
-- only execute the call if the From state is not equal to the To state! Otherwise this function should never execute!
--if from ~= to then
- self:_call_handler("onenter" .. to, params)
- self:_call_handler("OnEnter" .. to, params)
+ self:_call_handler("onenter" .. to, params, EventName )
+ self:_call_handler("OnEnter" .. to, params, EventName )
--end
- self:_call_handler("onafter" .. EventName, params)
- self:_call_handler("OnAfter" .. EventName, params)
+ self:_call_handler("onafter" .. EventName, params, EventName )
+ self:_call_handler("OnAfter" .. EventName, params, EventName )
- self:_call_handler("onstatechange", params)
+ self:_call_handler("onstatechange", params, EventName )
end
else
self:T( "Cannot execute transition." )
@@ -612,7 +616,18 @@ do -- FSM
function FSM:_delayed_transition( EventName )
return function( self, DelaySeconds, ... )
self:T2( "Delayed Event: " .. EventName )
- local CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
+ local CallID = 0
+ if DelaySeconds < 0 then -- Only call the event ONCE!
+ DelaySeconds = math.abs( DelaySeconds )
+ if not self._EventSchedules[EventName] then
+ CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
+ self._EventSchedules[EventName] = CallID
+ else
+ -- reschedule
+ end
+ else
+ CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
+ end
self:T2( { CallID = CallID } )
end
end
@@ -732,7 +747,7 @@ do -- FSM_CONTROLLABLE
return self.Controllable
end
- function FSM_CONTROLLABLE:_call_handler( handler, params )
+ function FSM_CONTROLLABLE:_call_handler( handler, params, EventName )
local ErrorHandler = function( errmsg )
@@ -746,6 +761,7 @@ do -- FSM_CONTROLLABLE
if self[handler] then
self:F3( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
local Result, Value = xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler )
return Value
--return self[handler]( self, self.Controllable, unpack( params ) )
@@ -967,9 +983,10 @@ do -- FSM_TASK
return self
end
- function FSM_TASK:_call_handler( handler, params )
+ function FSM_TASK:_call_handler( handler, params, EventName )
if self[handler] then
self:T( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
return self[handler]( self, unpack( params ) )
end
end
@@ -1019,9 +1036,10 @@ do -- FSM_SET
return self.Controllable
end
- function FSM_SET:_call_handler( handler, params )
+ function FSM_SET:_call_handler( handler, params, EventName )
if self[handler] then
self:T( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
return self[handler]( self, self.Set, unpack( params ) )
end
end
diff --git a/Moose Development/Moose/Core/Menu.lua b/Moose Development/Moose/Core/Menu.lua
index 5d4ab402e..6defc55d5 100644
--- a/Moose Development/Moose/Core/Menu.lua
+++ b/Moose Development/Moose/Core/Menu.lua
@@ -1,7 +1,5 @@
--- This module contains the MENU classes.
--
--- There is a small note... When you see a class like MENU_COMMAND_COALITION with COMMAND in italic, it acutally represents it like this: `MENU_COMMAND_COALITION`.
---
-- ===
--
-- DCS Menus can be managed using the MENU classes.
@@ -15,17 +13,17 @@
--
-- ### To manage **main menus**, the classes begin with **MENU_**:
--
--- * @{Core.Menu#MENU_MISSION}: Manages main menus for whole mission file.
--- * @{Core.Menu#MENU_COALITION}: Manages main menus for whole coalition.
--- * @{Core.Menu#MENU_GROUP}: Manages main menus for GROUPs.
--- * @{Core.Menu#MENU_CLIENT}: Manages main menus for CLIENTs. This manages menus for units with the skill level "Client".
+-- * @{Menu#MENU_MISSION}: Manages main menus for whole mission file.
+-- * @{Menu#MENU_COALITION}: Manages main menus for whole coalition.
+-- * @{Menu#MENU_GROUP}: Manages main menus for GROUPs.
+-- * @{Menu#MENU_CLIENT}: Manages main menus for CLIENTs. This manages menus for units with the skill level "Client".
--
-- ### To manage **command menus**, which are menus that allow the player to issue **functions**, the classes begin with **MENU_COMMAND_**:
--
--- * @{Core.Menu#MENU_MISSION_COMMAND}: Manages command menus for whole mission file.
--- * @{Core.Menu#MENU_COALITION_COMMAND}: Manages command menus for whole coalition.
--- * @{Core.Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
--- * @{Core.Menu#MENU_CLIENT_COMMAND}: Manages command menus for CLIENTs. This manages menus for units with the skill level "Client".
+-- * @{Menu#MENU_MISSION_COMMAND}: Manages command menus for whole mission file.
+-- * @{Menu#MENU_COALITION_COMMAND}: Manages command menus for whole coalition.
+-- * @{Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
+-- * @{Menu#MENU_CLIENT_COMMAND}: Manages command menus for CLIENTs. This manages menus for units with the skill level "Client".
--
-- ===
--
@@ -37,11 +35,11 @@
-- These are simply abstract base classes defining a couple of fields that are used by the
-- derived MENU_ classes to manage menus.
--
--- 1.1) @{Core.Menu#MENU_BASE} class, extends @{Core.Base#BASE}
+-- 1.1) @{#MENU_BASE} class, extends @{Base#BASE}
-- --------------------------------------------------
-- The @{#MENU_BASE} class defines the main MENU class where other MENU classes are derived from.
--
--- 1.2) @{Core.Menu#MENU_COMMAND_BASE} class, extends @{Core.Base#BASE}
+-- 1.2) @{#MENU_COMMAND_BASE} class, extends @{Base#BASE}
-- ----------------------------------------------------------
-- The @{#MENU_COMMAND_BASE} class defines the main MENU class where other MENU COMMAND_ classes are derived from, in order to set commands.
--
@@ -53,15 +51,15 @@
-- ======================
-- The underlying classes manage the menus for a complete mission file.
--
--- 2.1) @{Menu#MENU_MISSION} class, extends @{Core.Menu#MENU_BASE}
+-- 2.1) @{#MENU_MISSION} class, extends @{Menu#MENU_BASE}
-- ---------------------------------------------------------
--- The @{Core.Menu#MENU_MISSION} class manages the main menus for a complete mission.
+-- The @{Menu#MENU_MISSION} class manages the main menus for a complete mission.
-- You can add menus with the @{#MENU_MISSION.New} method, which constructs a MENU_MISSION object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_MISSION.Remove}.
--
--- 2.2) @{Menu#MENU_MISSION_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 2.2) @{#MENU_MISSION_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- -------------------------------------------------------------------------
--- The @{Core.Menu#MENU_MISSION_COMMAND} class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_MISSION_COMMAND} class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_MISSION_COMMAND.New} method, which constructs a MENU_MISSION_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_MISSION_COMMAND.Remove}.
--
@@ -71,15 +69,15 @@
-- =========================
-- The underlying classes manage the menus for whole coalitions.
--
--- 3.1) @{Menu#MENU_COALITION} class, extends @{Core.Menu#MENU_BASE}
+-- 3.1) @{#MENU_COALITION} class, extends @{Menu#MENU_BASE}
-- ------------------------------------------------------------
--- The @{Core.Menu#MENU_COALITION} class manages the main menus for coalitions.
+-- The @{Menu#MENU_COALITION} class manages the main menus for coalitions.
-- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}.
--
--- 3.2) @{Menu#MENU_COALITION_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 3.2) @{Menu#MENU_COALITION_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- ----------------------------------------------------------------------------
--- The @{Core.Menu#MENU_COALITION_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_COALITION_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_COALITION_COMMAND.New} method, which constructs a MENU_COALITION_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION_COMMAND.Remove}.
--
@@ -89,15 +87,15 @@
-- =====================
-- The underlying classes manage the menus for groups. Note that groups can be inactive, alive or can be destroyed.
--
--- 4.1) @{Menu#MENU_GROUP} class, extends @{Core.Menu#MENU_BASE}
+-- 4.1) @{Menu#MENU_GROUP} class, extends @{Menu#MENU_BASE}
-- --------------------------------------------------------
--- The @{Core.Menu#MENU_GROUP} class manages the main menus for coalitions.
+-- The @{Menu#MENU_GROUP} class manages the main menus for coalitions.
-- You can add menus with the @{#MENU_GROUP.New} method, which constructs a MENU_GROUP object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP.Remove}.
--
--- 4.2) @{Menu#MENU_GROUP_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 4.2) @{Menu#MENU_GROUP_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- ------------------------------------------------------------------------
--- The @{Core.Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_GROUP_COMMAND.New} method, which constructs a MENU_GROUP_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP_COMMAND.Remove}.
--
@@ -107,15 +105,15 @@
-- ======================
-- The underlying classes manage the menus for units with skill level client or player.
--
--- 5.1) @{Menu#MENU_CLIENT} class, extends @{Core.Menu#MENU_BASE}
+-- 5.1) @{Menu#MENU_CLIENT} class, extends @{Menu#MENU_BASE}
-- ---------------------------------------------------------
--- The @{Core.Menu#MENU_CLIENT} class manages the main menus for coalitions.
+-- The @{Menu#MENU_CLIENT} class manages the main menus for coalitions.
-- You can add menus with the @{#MENU_CLIENT.New} method, which constructs a MENU_CLIENT object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_CLIENT.Remove}.
--
--- 5.2) @{Menu#MENU_CLIENT_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 5.2) @{Menu#MENU_CLIENT_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- -------------------------------------------------------------------------
--- The @{Core.Menu#MENU_CLIENT_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_CLIENT_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_CLIENT_COMMAND.New} method, which constructs a MENU_CLIENT_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_CLIENT_COMMAND.Remove}.
--
@@ -622,9 +620,8 @@ do -- MENU_CLIENT
-- @param #string MenuText The text for the menu.
-- @param #MENU_BASE ParentMenu The parent menu.
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
- -- @param CommandMenuArgument An argument for the function.
-- @return Menu#MENU_CLIENT_COMMAND self
- function MENU_CLIENT_COMMAND:New( MenuClient, MenuText, ParentMenu, CommandMenuFunction, ... )
+ function MENU_CLIENT_COMMAND:New( Client, MenuText, ParentMenu, CommandMenuFunction, ... )
-- Arrange meta tables
@@ -635,8 +632,8 @@ do -- MENU_CLIENT
local self = BASE:Inherit( self, MENU_COMMAND_BASE:New( MenuText, MenuParentPath, CommandMenuFunction, arg ) ) -- Menu#MENU_CLIENT_COMMAND
- self.MenuClient = MenuClient
- self.MenuClientGroupID = MenuClient:GetClientGroupID()
+ self.MenuClient = Client
+ self.MenuClientGroupID = Client:GetClientGroupID()
self.MenuParentPath = MenuParentPath
self.MenuText = MenuText
self.ParentMenu = ParentMenu
@@ -647,7 +644,7 @@ do -- MENU_CLIENT
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
- self:T( { MenuClient:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText, CommandMenuFunction, arg } )
+ self:T( { Client:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText, CommandMenuFunction, arg } )
local MenuPathID = table.concat(MenuParentPath) .. "/" .. MenuText
if MenuPath[MenuPathID] then
@@ -657,7 +654,9 @@ do -- MENU_CLIENT
self.MenuPath = missionCommands.addCommandForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath, self.MenuCallHandler, arg )
MenuPath[MenuPathID] = self.MenuPath
- ParentMenu.Menus[self.MenuPath] = self
+ if ParentMenu and ParentMenu.Menus then
+ ParentMenu.Menus[self.MenuPath] = self
+ end
return self
end
diff --git a/Moose Development/Moose/Core/Message.lua b/Moose Development/Moose/Core/Message.lua
index 15a627890..08ea61bdc 100644
--- a/Moose Development/Moose/Core/Message.lua
+++ b/Moose Development/Moose/Core/Message.lua
@@ -1,6 +1,6 @@
--- This module contains the MESSAGE class.
--
--- 1) @{Core.Message#MESSAGE} class, extends @{Core.Base#BASE}
+-- 1) @{Message#MESSAGE} class, extends @{Base#BASE}
-- =================================================
-- Message System to display Messages to Clients, Coalitions or All.
-- Messages are shown on the display panel for an amount of seconds, and will then disappear.
@@ -8,16 +8,16 @@
--
-- 1.1) MESSAGE construction methods
-- ---------------------------------
--- Messages are created with @{Core.Message#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet.
+-- Messages are created with @{Message#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet.
-- To send messages, you need to use the To functions.
--
-- 1.2) Send messages with MESSAGE To methods
-- ------------------------------------------
-- Messages are sent to:
--
--- * Clients with @{Core.Message#MESSAGE.ToClient}.
--- * Coalitions with @{Core.Message#MESSAGE.ToCoalition}.
--- * All Players with @{Core.Message#MESSAGE.ToAll}.
+-- * Clients with @{Message#MESSAGE.ToClient}.
+-- * Coalitions with @{Message#MESSAGE.ToCoalition}.
+-- * All Players with @{Message#MESSAGE.ToAll}.
--
-- @module Message
-- @author FlightControl
diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua
index 39801e785..e31653d0e 100644
--- a/Moose Development/Moose/Core/Point.lua
+++ b/Moose Development/Moose/Core/Point.lua
@@ -1,8 +1,8 @@
--- This module contains the POINT classes.
--
--- 1) @{Core.Point#POINT_VEC3} class, extends @{Core.Base#BASE}
+-- 1) @{Point#POINT_VEC3} class, extends @{Base#BASE}
-- ==================================================
--- The @{Core.Point#POINT_VEC3} class defines a 3D point in the simulator.
+-- The @{Point#POINT_VEC3} class defines a 3D point in the simulator.
--
-- **Important Note:** Most of the functions in this section were taken from MIST, and reworked to OO concepts.
-- In order to keep the credibility of the the author, I want to emphasize that the of the MIST framework was created by Grimes, who you can find on the Eagle Dynamics Forums.
@@ -11,20 +11,20 @@
-- ---------------------------
-- A new POINT_VEC3 instance can be created with:
--
--- * @{#POINT_VEC3.New}(): a 3D point.
--- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{Dcs.DCSTypes#Vec3}.
+-- * @{Point#POINT_VEC3.New}(): a 3D point.
+-- * @{Point#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
--
--
--- 2) @{Core.Point#POINT_VEC2} class, extends @{Core.Point#POINT_VEC3}
+-- 2) @{Point#POINT_VEC2} class, extends @{Point#POINT_VEC3}
-- =========================================================
--- The @{Core.Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
+-- The @{Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
--
-- 2.1) POINT_VEC2 constructor
-- ---------------------------
-- A new POINT_VEC2 instance can be created with:
--
--- * @{#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
--- * @{#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{Dcs.DCSTypes#Vec2}.
+-- * @{Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
+-- * @{Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
--
-- ===
--
@@ -672,10 +672,10 @@ function POINT_VEC2:DistanceFromPointVec2( PointVec2Reference )
return Distance
end
---- Calculate the distance from a reference @{Dcs.DCSTypes#Vec2}.
+--- Calculate the distance from a reference @{DCSTypes#Vec2}.
-- @param #POINT_VEC2 self
--- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{Dcs.DCSTypes#Vec2}.
--- @return Dcs.DCSTypes#Distance The distance from the reference @{Dcs.DCSTypes#Vec2} in meters.
+-- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{DCSTypes#Vec2}.
+-- @return Dcs.DCSTypes#Distance The distance from the reference @{DCSTypes#Vec2} in meters.
function POINT_VEC2:DistanceFromVec2( Vec2Reference )
self:F2( Vec2Reference )
diff --git a/Moose Development/Moose/Core/ScheduleDispatcher.lua b/Moose Development/Moose/Core/ScheduleDispatcher.lua
index 277fb7b8e..5abb966b5 100644
--- a/Moose Development/Moose/Core/ScheduleDispatcher.lua
+++ b/Moose Development/Moose/Core/ScheduleDispatcher.lua
@@ -22,7 +22,7 @@
--
-- The SCHEDULEDISPATCHER allows multiple scheduled functions to be planned and executed for one SCHEDULER object.
-- The SCHEDULER object therefore keeps a table of "CallID's", which are returned after each planning of a new scheduled function by the SCHEDULEDISPATCHER.
--- The SCHEDULER object plans new scheduled functions through the @{Core.Scheduler#SCHEDULER.Schedule}() method.
+-- The SCHEDULER object plans new scheduled functions through the @{Scheduler#SCHEDULER.Schedule}() method.
-- The Schedule() method returns the CallID that is the reference ID for each planned schedule.
--
-- ===
diff --git a/Moose Development/Moose/Core/Scheduler.lua b/Moose Development/Moose/Core/Scheduler.lua
index 2b68e54bd..1ade4a5de 100644
--- a/Moose Development/Moose/Core/Scheduler.lua
+++ b/Moose Development/Moose/Core/Scheduler.lua
@@ -1,28 +1,28 @@
--- This module contains the SCHEDULER class.
--
--- # 1) @{Core.Scheduler#SCHEDULER} class, extends @{Core.Base#BASE}
+-- # 1) @{Scheduler#SCHEDULER} class, extends @{Base#BASE}
--
--- The @{Core.Scheduler#SCHEDULER} class creates schedule.
+-- The @{Scheduler#SCHEDULER} class creates schedule.
--
-- ## 1.1) SCHEDULER constructor
--
-- The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters:
--
--- * @{Core.Scheduler#SCHEDULER.New}( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.
--- * @{Core.Scheduler#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
--- * @{Core.Scheduler#SCHEDULER.New}( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
--- * @{Core.Scheduler#SCHEDULER.New}( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
+-- * @{Scheduler#SCHEDULER.New}( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.
+-- * @{Scheduler#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
+-- * @{Scheduler#SCHEDULER.New}( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
+-- * @{Scheduler#SCHEDULER.New}( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
--
-- ## 1.2) SCHEDULER timer stopping and (re-)starting.
--
-- The SCHEDULER can be stopped and restarted with the following methods:
--
--- * @{Core.Scheduler#SCHEDULER.Start}(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.
--- * @{Core.Scheduler#SCHEDULER.Stop}(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.
+-- * @{Scheduler#SCHEDULER.Start}(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.
+-- * @{Scheduler#SCHEDULER.Stop}(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.
--
-- ## 1.3) Create a new schedule
--
--- With @{Core.Scheduler#SCHEDULER.Schedule}() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.
+-- With @{Scheduler#SCHEDULER.Schedule}() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.
--
-- ===
--
@@ -61,7 +61,7 @@ SCHEDULER = {
-- @param #number Repeat Specifies the interval in seconds when the scheduler will call the event function.
-- @param #number RandomizeFactor Specifies a randomization factor between 0 and 1 to randomize the Repeat.
-- @param #number Stop Specifies the amount of seconds when the scheduler will be stopped.
--- @return #SCHEDULER self
+-- @return #SCHEDULER self.
-- @return #number The ScheduleID of the planned schedule.
function SCHEDULER:New( SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop )
local self = BASE:Inherit( self, BASE:New() )
diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua
index f20832639..a069e6138 100644
--- a/Moose Development/Moose/Core/Set.lua
+++ b/Moose Development/Moose/Core/Set.lua
@@ -2,9 +2,9 @@
--
-- ===
--
--- 1) @{Core.Set#SET_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{Set#SET_BASE} class, extends @{Base#BASE}
-- ==============================================
--- The @{Core.Set#SET_BASE} class defines the core functions that define a collection of objects.
+-- The @{Set#SET_BASE} class defines the core functions that define a collection of objects.
-- A SET provides iterators to iterate the SET, but will **temporarily** yield the ForEach interator loop at defined **"intervals"** to the mail simulator loop.
-- In this way, large loops can be done while not blocking the simulator main processing loop.
-- The default **"yield interval"** is after 10 objects processed.
@@ -12,18 +12,18 @@
--
-- 1.1) Add or remove objects from the SET
-- ---------------------------------------
--- Some key core functions are @{Core.Set#SET_BASE.Add} and @{Core.Set#SET_BASE.Remove} to add or remove objects from the SET in your logic.
+-- Some key core functions are @{Set#SET_BASE.Add} and @{Set#SET_BASE.Remove} to add or remove objects from the SET in your logic.
--
-- 1.2) Define the SET iterator **"yield interval"** and the **"time interval"**
-- -----------------------------------------------------------------------------
--- Modify the iterator intervals with the @{Core.Set#SET_BASE.SetInteratorIntervals} method.
+-- Modify the iterator intervals with the @{Set#SET_BASE.SetInteratorIntervals} method.
-- You can set the **"yield interval"**, and the **"time interval"**. (See above).
--
-- ===
--
--- 2) @{Core.Set#SET_GROUP} class, extends @{Core.Set#SET_BASE}
+-- 2) @{Set#SET_GROUP} class, extends @{Set#SET_BASE}
-- ==================================================
--- Mission designers can use the @{Core.Set#SET_GROUP} class to build sets of groups belonging to certain:
+-- Mission designers can use the @{Set#SET_GROUP} class to build sets of groups belonging to certain:
--
-- * Coalitions
-- * Categories
@@ -38,7 +38,7 @@
--
-- 2.2) Add or Remove GROUP(s) from SET_GROUP:
-- -------------------------------------------
--- GROUPS can be added and removed using the @{Core.Set#SET_GROUP.AddGroupsByName} and @{Core.Set#SET_GROUP.RemoveGroupsByName} respectively.
+-- GROUPS can be added and removed using the @{Set#SET_GROUP.AddGroupsByName} and @{Set#SET_GROUP.RemoveGroupsByName} respectively.
-- These methods take a single GROUP name or an array of GROUP names to be added or removed from SET_GROUP.
--
-- 2.3) SET_GROUP filter criteria:
@@ -57,7 +57,7 @@
--
-- Planned filter criteria within development are (so these are not yet available):
--
--- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Core.Zone#ZONE}.
+-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Zone#ZONE}.
--
-- 2.4) SET_GROUP iterators:
-- -------------------------
@@ -72,9 +72,9 @@
--
-- ====
--
--- 3) @{Core.Set#SET_UNIT} class, extends @{Core.Set#SET_BASE}
+-- 3) @{Set#SET_UNIT} class, extends @{Set#SET_BASE}
-- ===================================================
--- Mission designers can use the @{Core.Set#SET_UNIT} class to build sets of units belonging to certain:
+-- Mission designers can use the @{Set#SET_UNIT} class to build sets of units belonging to certain:
--
-- * Coalitions
-- * Categories
@@ -90,7 +90,7 @@
--
-- 3.2) Add or Remove UNIT(s) from SET_UNIT:
-- -----------------------------------------
--- UNITs can be added and removed using the @{Core.Set#SET_UNIT.AddUnitsByName} and @{Core.Set#SET_UNIT.RemoveUnitsByName} respectively.
+-- UNITs can be added and removed using the @{Set#SET_UNIT.AddUnitsByName} and @{Set#SET_UNIT.RemoveUnitsByName} respectively.
-- These methods take a single UNIT name or an array of UNIT names to be added or removed from SET_UNIT.
--
-- 3.3) SET_UNIT filter criteria:
@@ -110,7 +110,7 @@
--
-- Planned filter criteria within development are (so these are not yet available):
--
--- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Core.Zone#ZONE}.
+-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Zone#ZONE}.
--
-- 3.4) SET_UNIT iterators:
-- ------------------------
@@ -130,9 +130,9 @@
--
-- ===
--
--- 4) @{Core.Set#SET_CLIENT} class, extends @{Core.Set#SET_BASE}
+-- 4) @{Set#SET_CLIENT} class, extends @{Set#SET_BASE}
-- ===================================================
--- Mission designers can use the @{Core.Set#SET_CLIENT} class to build sets of units belonging to certain:
+-- Mission designers can use the @{Set#SET_CLIENT} class to build sets of units belonging to certain:
--
-- * Coalitions
-- * Categories
@@ -148,7 +148,7 @@
--
-- 4.2) Add or Remove CLIENT(s) from SET_CLIENT:
-- -----------------------------------------
--- CLIENTs can be added and removed using the @{Core.Set#SET_CLIENT.AddClientsByName} and @{Core.Set#SET_CLIENT.RemoveClientsByName} respectively.
+-- CLIENTs can be added and removed using the @{Set#SET_CLIENT.AddClientsByName} and @{Set#SET_CLIENT.RemoveClientsByName} respectively.
-- These methods take a single CLIENT name or an array of CLIENT names to be added or removed from SET_CLIENT.
--
-- 4.3) SET_CLIENT filter criteria:
@@ -168,7 +168,7 @@
--
-- Planned filter criteria within development are (so these are not yet available):
--
--- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Core.Zone#ZONE}.
+-- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Zone#ZONE}.
--
-- 4.4) SET_CLIENT iterators:
-- ------------------------
@@ -180,9 +180,9 @@
--
-- ====
--
--- 5) @{Core.Set#SET_AIRBASE} class, extends @{Core.Set#SET_BASE}
+-- 5) @{Set#SET_AIRBASE} class, extends @{Set#SET_BASE}
-- ====================================================
--- Mission designers can use the @{Core.Set#SET_AIRBASE} class to build sets of airbases optionally belonging to certain:
+-- Mission designers can use the @{Set#SET_AIRBASE} class to build sets of airbases optionally belonging to certain:
--
-- * Coalitions
--
@@ -194,7 +194,7 @@
--
-- 5.2) Add or Remove AIRBASEs from SET_AIRBASE
-- --------------------------------------------
--- AIRBASEs can be added and removed using the @{Core.Set#SET_AIRBASE.AddAirbasesByName} and @{Core.Set#SET_AIRBASE.RemoveAirbasesByName} respectively.
+-- AIRBASEs can be added and removed using the @{Set#SET_AIRBASE.AddAirbasesByName} and @{Set#SET_AIRBASE.RemoveAirbasesByName} respectively.
-- These methods take a single AIRBASE name or an array of AIRBASE names to be added or removed from SET_AIRBASE.
--
-- 5.3) SET_AIRBASE filter criteria
@@ -264,10 +264,12 @@ function SET_BASE:New( Database )
self.CallScheduler = SCHEDULER:New( self )
+ self:SetEventPriority( 2 )
+
return self
end
---- Finds an @{Core.Base#BASE} object based on the object Name.
+--- Finds an @{Base#BASE} object based on the object Name.
-- @param #SET_BASE self
-- @param #string ObjectName
-- @return Core.Base#BASE The Object found.
@@ -287,7 +289,7 @@ function SET_BASE:GetSet()
return self.Set
end
---- Adds a @{Core.Base#BASE} object in the @{Core.Set#SET_BASE}, using a given ObjectName as the index.
+--- Adds a @{Base#BASE} object in the @{Set#SET_BASE}, using a given ObjectName as the index.
-- @param #SET_BASE self
-- @param #string ObjectName
-- @param Core.Base#BASE Object
@@ -313,7 +315,7 @@ function SET_BASE:Add( ObjectName, Object )
end
---- Adds a @{Core.Base#BASE} object in the @{Core.Set#SET_BASE}, using the Object Name as the index.
+--- Adds a @{Base#BASE} object in the @{Set#SET_BASE}, using the Object Name as the index.
-- @param #SET_BASE self
-- @param Wrapper.Object#OBJECT Object
-- @return Core.Base#BASE The added BASE Object.
@@ -328,7 +330,7 @@ end
---- Removes a @{Core.Base#BASE} object from the @{Core.Set#SET_BASE} and derived classes, based on the Object Name.
+--- Removes a @{Base#BASE} object from the @{Set#SET_BASE} and derived classes, based on the Object Name.
-- @param #SET_BASE self
-- @param #string ObjectName
function SET_BASE:Remove( ObjectName )
@@ -367,7 +369,7 @@ function SET_BASE:Remove( ObjectName )
end
---- Gets a @{Core.Base#BASE} object from the @{Core.Set#SET_BASE} and derived classes, based on the Object Name.
+--- Gets a @{Base#BASE} object from the @{Set#SET_BASE} and derived classes, based on the Object Name.
-- @param #SET_BASE self
-- @param #string ObjectName
-- @return Core.Base#BASE
@@ -382,7 +384,7 @@ function SET_BASE:Get( ObjectName )
end
---- Retrieves the amount of objects in the @{Core.Set#SET_BASE} and derived classes.
+--- Retrieves the amount of objects in the @{Set#SET_BASE} and derived classes.
-- @param #SET_BASE self
-- @return #number Count
function SET_BASE:Count()
@@ -451,13 +453,13 @@ function SET_BASE:_FilterStart()
end
end
- _EVENTDISPATCHER:OnBirth( self._EventOnBirth, self )
- _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
+ self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
+ self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
-- Follow alive players and clients
- _EVENTDISPATCHER:OnPlayerEnterUnit( self._EventOnPlayerEnterUnit, self )
- _EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventOnPlayerLeaveUnit, self )
+ self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit )
+ self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
return self
@@ -468,16 +470,16 @@ end
-- @return #SET_BASE self
function SET_BASE:FilterStop()
- _EVENTDISPATCHER:OnBirthRemove( self )
- _EVENTDISPATCHER:OnDeadRemove( self )
- _EVENTDISPATCHER:OnCrashRemove( self )
+ self:UnHandleEvent( EVENTS.Birth )
+ self:UnHandleEvent( EVENTS.Dead )
+ self:UnHandleEvent( EVENTS.Crash )
return self
end
---- Iterate the SET_BASE while identifying the nearest object from a @{Core.Point#POINT_VEC2}.
+--- Iterate the SET_BASE while identifying the nearest object from a @{Point#POINT_VEC2}.
-- @param #SET_BASE self
--- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest object in the set.
+-- @param Core.Point#POINT_VEC2 PointVec2 A @{Point#POINT_VEC2} object from where to evaluate the closest object in the set.
-- @return Core.Base#BASE The closest object.
function SET_BASE:FindNearestObjectFromPointVec2( PointVec2 )
self:F2( PointVec2 )
@@ -2224,10 +2226,10 @@ function SET_AIRBASE:ForEachAirbase( IteratorFunction, ... )
return self
end
---- Iterate the SET_AIRBASE while identifying the nearest @{Wrapper.Airbase#AIRBASE} from a @{Core.Point#POINT_VEC2}.
+--- Iterate the SET_AIRBASE while identifying the nearest @{Airbase#AIRBASE} from a @{Point#POINT_VEC2}.
-- @param #SET_AIRBASE self
--- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest @{Wrapper.Airbase#AIRBASE}.
--- @return Wrapper.Airbase#AIRBASE The closest @{Wrapper.Airbase#AIRBASE}.
+-- @param Core.Point#POINT_VEC2 PointVec2 A @{Point#POINT_VEC2} object from where to evaluate the closest @{Airbase#AIRBASE}.
+-- @return Wrapper.Airbase#AIRBASE The closest @{Airbase#AIRBASE}.
function SET_AIRBASE:FindNearestAirbaseFromPointVec2( PointVec2 )
self:F2( PointVec2 )
diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua
index d8aef9bdd..d096962aa 100644
--- a/Moose Development/Moose/Core/Zone.lua
+++ b/Moose Development/Moose/Core/Zone.lua
@@ -1,4 +1,4 @@
---- This module contains the ZONE classes, inherited from @{Core.Zone#ZONE_BASE}.
+--- This module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
-- There are essentially two core functions that zones accomodate:
--
-- * Test if an object is within the zone boundaries.
@@ -7,7 +7,7 @@
-- The object classes are using the zone classes to test the zone boundaries, which can take various forms:
--
-- * Test if completely within the zone.
--- * Test if partly within the zone (for @{Wrapper.Group#GROUP} objects).
+-- * Test if partly within the zone (for @{Group#GROUP} objects).
-- * Test if not in the zone.
-- * Distance to the nearest intersecting point of the zone.
-- * Distance to the center of the zone.
@@ -15,16 +15,16 @@
--
-- Each of these ZONE classes have a zone name, and specific parameters defining the zone type:
--
--- * @{Core.Zone#ZONE_BASE}: The ZONE_BASE class defining the base for all other zone classes.
--- * @{Core.Zone#ZONE_RADIUS}: The ZONE_RADIUS class defined by a zone name, a location and a radius.
--- * @{Core.Zone#ZONE}: The ZONE class, defined by the zone name as defined within the Mission Editor.
--- * @{Core.Zone#ZONE_UNIT}: The ZONE_UNIT class defines by a zone around a @{Wrapper.Unit#UNIT} with a radius.
--- * @{Core.Zone#ZONE_GROUP}: The ZONE_GROUP class defines by a zone around a @{Wrapper.Group#GROUP} with a radius.
--- * @{Core.Zone#ZONE_POLYGON}: The ZONE_POLYGON class defines by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+-- * @{Zone#ZONE_BASE}: The ZONE_BASE class defining the base for all other zone classes.
+-- * @{Zone#ZONE_RADIUS}: The ZONE_RADIUS class defined by a zone name, a location and a radius.
+-- * @{Zone#ZONE}: The ZONE class, defined by the zone name as defined within the Mission Editor.
+-- * @{Zone#ZONE_UNIT}: The ZONE_UNIT class defines by a zone around a @{Unit#UNIT} with a radius.
+-- * @{Zone#ZONE_GROUP}: The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius.
+-- * @{Zone#ZONE_POLYGON}: The ZONE_POLYGON class defines by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
--
-- ===
--
--- 1) @{Core.Zone#ZONE_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
-- ================================================
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
@@ -32,10 +32,10 @@
--
-- * @{#ZONE_BASE.GetName}(): Returns the name of the zone.
--
--- ### 1.2) Each zone implements two polymorphic functions defined in @{Core.Zone#ZONE_BASE}:
+-- ### 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
--
--- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Core.Point#POINT_VEC2} is within the zone.
--- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Core.Point#POINT_VEC3} is within the zone.
+-- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Point#POINT_VEC2} is within the zone.
+-- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Point#POINT_VEC3} is within the zone.
--
-- ### 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
--
@@ -45,8 +45,8 @@
--
-- ### 1.4) A zone manages Vectors:
--
--- * @{#ZONE_BASE.GetVec2}(): Returns the @{Dcs.DCSTypes#Vec2} coordinate of the zone.
--- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{Dcs.DCSTypes#Vec2} within the zone.
+-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} coordinate of the zone.
+-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{DCSTypes#Vec2} within the zone.
--
-- ### 1.5) A zone has a bounding square:
--
@@ -59,12 +59,12 @@
--
-- ===
--
--- 2) @{Core.Zone#ZONE_RADIUS} class, extends @{Core.Zone#ZONE_BASE}
+-- 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
-- =======================================================
-- The ZONE_RADIUS class defined by a zone name, a location and a radius.
-- This class implements the inherited functions from Core.Zone#ZONE_BASE taking into account the own zone format and properties.
--
--- ### 2.1) @{Core.Zone#ZONE_RADIUS} constructor:
+-- ### 2.1) @{Zone#ZONE_RADIUS} constructor:
--
-- * @{#ZONE_BASE.New}(): Constructor.
--
@@ -75,45 +75,45 @@
--
-- ### 2.3) Manage the location of the zone:
--
--- * @{#ZONE_BASE.SetVec2}(): Sets the @{Dcs.DCSTypes#Vec2} of the zone.
--- * @{#ZONE_BASE.GetVec2}(): Returns the @{Dcs.DCSTypes#Vec2} of the zone.
--- * @{#ZONE_BASE.GetVec3}(): Returns the @{Dcs.DCSTypes#Vec3} of the zone, taking an additional height parameter.
+-- * @{#ZONE_BASE.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
+-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
+-- * @{#ZONE_BASE.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
--
-- ===
--
--- 3) @{Core.Zone#ZONE} class, extends @{Core.Zone#ZONE_RADIUS}
+-- 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
-- ==========================================
-- The ZONE class, defined by the zone name as defined within the Mission Editor.
-- This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
--- 4) @{Core.Zone#ZONE_UNIT} class, extends @{Core.Zone#ZONE_RADIUS}
+-- 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
--- The ZONE_UNIT class defined by a zone around a @{Wrapper.Unit#UNIT} with a radius.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
--- 5) @{Core.Zone#ZONE_GROUP} class, extends @{Core.Zone#ZONE_RADIUS}
+-- 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
--- The ZONE_GROUP class defines by a zone around a @{Wrapper.Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
--- 6) @{Core.Zone#ZONE_POLYGON_BASE} class, extends @{Core.Zone#ZONE_BASE}
+-- 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
-- ========================================================
--- The ZONE_POLYGON_BASE class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_POLYGON_BASE class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
-- ===
--
--- 7) @{Core.Zone#ZONE_POLYGON} class, extends @{Core.Zone#ZONE_POLYGON_BASE}
+-- 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
-- ================================================================
--- The ZONE_POLYGON class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ====
--
@@ -204,7 +204,7 @@ function ZONE_BASE:IsPointVec3InZone( Vec3 )
return InZone
end
---- Returns the @{Dcs.DCSTypes#Vec2} coordinate of the zone.
+--- Returns the @{DCSTypes#Vec2} coordinate of the zone.
-- @param #ZONE_BASE self
-- @return #nil.
function ZONE_BASE:GetVec2()
@@ -212,7 +212,7 @@ function ZONE_BASE:GetVec2()
return nil
end
---- Define a random @{Dcs.DCSTypes#Vec2} within the zone.
+--- Define a random @{DCSTypes#Vec2} within the zone.
-- @param #ZONE_BASE self
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinates.
function ZONE_BASE:GetRandomVec2()
@@ -374,7 +374,7 @@ function ZONE_RADIUS:SetRadius( Radius )
return self.Radius
end
---- Returns the @{Dcs.DCSTypes#Vec2} of the zone.
+--- Returns the @{DCSTypes#Vec2} of the zone.
-- @param #ZONE_RADIUS self
-- @return Dcs.DCSTypes#Vec2 The location of the zone.
function ZONE_RADIUS:GetVec2()
@@ -385,7 +385,7 @@ function ZONE_RADIUS:GetVec2()
return self.Vec2
end
---- Sets the @{Dcs.DCSTypes#Vec2} of the zone.
+--- Sets the @{DCSTypes#Vec2} of the zone.
-- @param #ZONE_RADIUS self
-- @param Dcs.DCSTypes#Vec2 Vec2 The new location of the zone.
-- @return Dcs.DCSTypes#Vec2 The new location of the zone.
@@ -399,7 +399,7 @@ function ZONE_RADIUS:SetVec2( Vec2 )
return self.Vec2
end
---- Returns the @{Dcs.DCSTypes#Vec3} of the ZONE_RADIUS.
+--- Returns the @{DCSTypes#Vec3} of the ZONE_RADIUS.
-- @param #ZONE_RADIUS self
-- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
-- @return Dcs.DCSTypes#Vec3 The point of the zone.
@@ -501,7 +501,7 @@ function ZONE:New( ZoneName )
end
---- The ZONE_UNIT class defined by a zone around a @{Wrapper.Unit#UNIT} with a radius.
+--- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
-- @type ZONE_UNIT
-- @field Wrapper.Unit#UNIT ZoneUNIT
-- @extends Core.Zone#ZONE_RADIUS
@@ -526,9 +526,9 @@ function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius )
end
---- Returns the current location of the @{Wrapper.Unit#UNIT}.
+--- Returns the current location of the @{Unit#UNIT}.
-- @param #ZONE_UNIT self
--- @return Dcs.DCSTypes#Vec2 The location of the zone based on the @{Wrapper.Unit#UNIT}location.
+-- @return Dcs.DCSTypes#Vec2 The location of the zone based on the @{Unit#UNIT}location.
function ZONE_UNIT:GetVec2()
self:F( self.ZoneName )
@@ -567,7 +567,7 @@ function ZONE_UNIT:GetRandomVec2()
return RandomVec2
end
---- Returns the @{Dcs.DCSTypes#Vec3} of the ZONE_UNIT.
+--- Returns the @{DCSTypes#Vec3} of the ZONE_UNIT.
-- @param #ZONE_UNIT self
-- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
-- @return Dcs.DCSTypes#Vec3 The point of the zone.
@@ -593,7 +593,7 @@ ZONE_GROUP = {
ClassName="ZONE_GROUP",
}
---- Constructor to create a ZONE_GROUP instance, taking the zone name, a zone @{Wrapper.Group#GROUP} and a radius.
+--- Constructor to create a ZONE_GROUP instance, taking the zone name, a zone @{Group#GROUP} and a radius.
-- @param #ZONE_GROUP self
-- @param #string ZoneName Name of the zone.
-- @param Wrapper.Group#GROUP ZoneGROUP The @{Group} as the center of the zone.
@@ -644,9 +644,9 @@ end
-- Polygons
---- The ZONE_POLYGON_BASE class defined by an array of @{Dcs.DCSTypes#Vec2}, forming a polygon.
+--- The ZONE_POLYGON_BASE class defined by an array of @{DCSTypes#Vec2}, forming a polygon.
-- @type ZONE_POLYGON_BASE
--- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{Dcs.DCSTypes#Vec2}.
+-- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{DCSTypes#Vec2}.
-- @extends Core.Zone#ZONE_BASE
ZONE_POLYGON_BASE = {
ClassName="ZONE_POLYGON_BASE",
@@ -656,11 +656,11 @@ ZONE_POLYGON_BASE = {
-- @type ZONE_POLYGON_BASE.ListVec2
-- @list
---- Constructor to create a ZONE_POLYGON_BASE instance, taking the zone name and an array of @{Dcs.DCSTypes#Vec2}, forming a polygon.
--- The @{Wrapper.Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected.
+--- Constructor to create a ZONE_POLYGON_BASE instance, taking the zone name and an array of @{DCSTypes#Vec2}, forming a polygon.
+-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected.
-- @param #ZONE_POLYGON_BASE self
-- @param #string ZoneName Name of the zone.
--- @param #ZONE_POLYGON_BASE.ListVec2 PointsArray An array of @{Dcs.DCSTypes#Vec2}, forming a polygon..
+-- @param #ZONE_POLYGON_BASE.ListVec2 PointsArray An array of @{DCSTypes#Vec2}, forming a polygon..
-- @return #ZONE_POLYGON_BASE self
function ZONE_POLYGON_BASE:New( ZoneName, PointsArray )
local self = BASE:Inherit( self, ZONE_BASE:New( ZoneName ) )
@@ -757,7 +757,7 @@ function ZONE_POLYGON_BASE:IsPointVec2InZone( Vec2 )
return InPolygon
end
---- Define a random @{Dcs.DCSTypes#Vec2} within the zone.
+--- Define a random @{DCSTypes#Vec2} within the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinate.
function ZONE_POLYGON_BASE:GetRandomVec2()
@@ -809,15 +809,15 @@ end
---- The ZONE_POLYGON class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+--- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
-- @type ZONE_POLYGON
-- @extends Core.Zone#ZONE_POLYGON_BASE
ZONE_POLYGON = {
ClassName="ZONE_POLYGON",
}
---- Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the @{Wrapper.Group#GROUP} defined within the Mission Editor.
--- The @{Wrapper.Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
+--- Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the @{Group#GROUP} defined within the Mission Editor.
+-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
-- @param #ZONE_POLYGON self
-- @param #string ZoneName Name of the zone.
-- @param Wrapper.Group#GROUP ZoneGroup The GROUP waypoints as defined within the Mission Editor define the polygon shape.
diff --git a/Moose Development/Moose/Functional/AirbasePolice.lua b/Moose Development/Moose/Functional/AirbasePolice.lua
index 45af50d9f..1afb020ac 100644
--- a/Moose Development/Moose/Functional/AirbasePolice.lua
+++ b/Moose Development/Moose/Functional/AirbasePolice.lua
@@ -2,9 +2,9 @@
--
-- ===
--
--- 1) @{Functional.AirbasePolice#AIRBASEPOLICE_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{AirbasePolice#AIRBASEPOLICE_BASE} class, extends @{Base#BASE}
-- ==================================================================
--- The @{Functional.AirbasePolice#AIRBASEPOLICE_BASE} class provides the main methods to monitor CLIENT behaviour at airbases.
+-- The @{AirbasePolice#AIRBASEPOLICE_BASE} class provides the main methods to monitor CLIENT behaviour at airbases.
-- CLIENTS should not be allowed to:
--
-- * Don't taxi faster than 40 km/h.
@@ -12,7 +12,7 @@
-- * Avoid to hit other planes on the airbase.
-- * Obey ground control orders.
--
--- 2) @{Functional.AirbasePolice#AIRBASEPOLICE_CAUCASUS} class, extends @{Functional.AirbasePolice#AIRBASEPOLICE_BASE}
+-- 2) @{AirbasePolice#AIRBASEPOLICE_CAUCASUS} class, extends @{AirbasePolice#AIRBASEPOLICE_BASE}
-- =============================================================================================
-- All the airbases on the caucasus map can be monitored using this class.
-- If you want to monitor specific airbases, you need to use the @{#AIRBASEPOLICE_BASE.Monitor}() method, which takes a table or airbase names.
@@ -39,7 +39,7 @@
-- * TbilisiLochini
-- * Vaziani
--
--- 3) @{Functional.AirbasePolice#AIRBASEPOLICE_NEVADA} class, extends @{Functional.AirbasePolice#AIRBASEPOLICE_BASE}
+-- 3) @{AirbasePolice#AIRBASEPOLICE_NEVADA} class, extends @{AirbasePolice#AIRBASEPOLICE_BASE}
-- =============================================================================================
-- All the airbases on the NEVADA map can be monitored using this class.
-- If you want to monitor specific airbases, you need to use the @{#AIRBASEPOLICE_BASE.Monitor}() method, which takes a table or airbase names.
@@ -182,7 +182,8 @@ function AIRBASEPOLICE_BASE:_AirbaseMonitor()
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
else
MESSAGE:New( "Player " .. Client:GetPlayerName() .. " has been removed from the airbase, due to a speeding violation ...", 10, "Airbase Police" ):ToAll()
- Client:GetGroup():Destroy()
+ Client:Destroy()
+ trigger.action.setUserFlag( "AIRCRAFT_"..Client:GetID(), 100)
Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0 )
end
diff --git a/Moose Development/Moose/Functional/CleanUp.lua b/Moose Development/Moose/Functional/CleanUp.lua
index c9fb36b23..feb6a6d55 100644
--- a/Moose Development/Moose/Functional/CleanUp.lua
+++ b/Moose Development/Moose/Functional/CleanUp.lua
@@ -62,7 +62,7 @@ function CLEANUP:_DestroyGroup( GroupObject, CleanUpGroupName )
end
end
---- Destroys a @{Dcs.DCSWrapper.Unit#Unit} from the simulator, but checks first if it is still existing!
+--- Destroys a @{DCSWrapper.Unit#Unit} from the simulator, but checks first if it is still existing!
-- @param #CLEANUP self
-- @param Dcs.DCSWrapper.Unit#Unit CleanUpUnit The object to be destroyed.
-- @param #string CleanUpUnitName The Unit name ...
@@ -199,7 +199,7 @@ function CLEANUP:_EventHitCleanUp( Event )
end
end
---- Add the @{Dcs.DCSWrapper.Unit#Unit} to the CleanUpList for CleanUp.
+--- Add the @{DCSWrapper.Unit#Unit} to the CleanUpList for CleanUp.
function CLEANUP:_AddForCleanUp( CleanUpUnit, CleanUpUnitName )
self:F( { CleanUpUnit, CleanUpUnitName } )
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index bd5df0de6..e458e8cb5 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -2,14 +2,14 @@
--
-- ===
--
--- 1) @{Functional.Detection#DETECTION_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{Detection#DETECTION_BASE} class, extends @{Base#BASE}
-- ==========================================================
--- The @{Functional.Detection#DETECTION_BASE} class defines the core functions to administer detected objects.
--- The @{Functional.Detection#DETECTION_BASE} class will detect objects within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s).
+-- The @{Detection#DETECTION_BASE} class defines the core functions to administer detected objects.
+-- The @{Detection#DETECTION_BASE} class will detect objects within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s).
--
-- 1.1) DETECTION_BASE constructor
-- -------------------------------
--- Construct a new DETECTION_BASE instance using the @{Functional.Detection#DETECTION_BASE.New}() method.
+-- Construct a new DETECTION_BASE instance using the @{Detection#DETECTION_BASE.New}() method.
--
-- 1.2) DETECTION_BASE initialization
-- ----------------------------------
@@ -20,46 +20,46 @@
--
-- Use the following functions to report the objects it detected using the methods Visual, Optical, Radar, IRST, RWR, DLINK:
--
--- * @{Functional.Detection#DETECTION_BASE.InitDetectVisual}(): Detected using Visual.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectOptical}(): Detected using Optical.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectRadar}(): Detected using Radar.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectIRST}(): Detected using IRST.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectRWR}(): Detected using RWR.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectDLINK}(): Detected using DLINK.
+-- * @{Detection#DETECTION_BASE.InitDetectVisual}(): Detected using Visual.
+-- * @{Detection#DETECTION_BASE.InitDetectOptical}(): Detected using Optical.
+-- * @{Detection#DETECTION_BASE.InitDetectRadar}(): Detected using Radar.
+-- * @{Detection#DETECTION_BASE.InitDetectIRST}(): Detected using IRST.
+-- * @{Detection#DETECTION_BASE.InitDetectRWR}(): Detected using RWR.
+-- * @{Detection#DETECTION_BASE.InitDetectDLINK}(): Detected using DLINK.
--
-- 1.3) Obtain objects detected by DETECTION_BASE
-- ----------------------------------------------
--- DETECTION_BASE builds @{Set}s of objects detected. These @{Core.Set#SET_BASE}s can be retrieved using the method @{Functional.Detection#DETECTION_BASE.GetDetectedSets}().
--- The method will return a list (table) of @{Core.Set#SET_BASE} objects.
+-- DETECTION_BASE builds @{Set}s of objects detected. These @{Set#SET_BASE}s can be retrieved using the method @{Detection#DETECTION_BASE.GetDetectedSets}().
+-- The method will return a list (table) of @{Set#SET_BASE} objects.
--
-- ===
--
--- 2) @{Functional.Detection#DETECTION_AREAS} class, extends @{Functional.Detection#DETECTION_BASE}
+-- 2) @{Detection#DETECTION_AREAS} class, extends @{Detection#DETECTION_BASE}
-- ===============================================================================
--- The @{Functional.Detection#DETECTION_AREAS} class will detect units within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s),
--- and will build a list (table) of @{Core.Set#SET_UNIT}s containing the @{Wrapper.Unit#UNIT}s detected.
+-- The @{Detection#DETECTION_AREAS} class will detect units within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s),
+-- and will build a list (table) of @{Set#SET_UNIT}s containing the @{Unit#UNIT}s detected.
-- The class is group the detected units within zones given a DetectedZoneRange parameter.
-- A set with multiple detected zones will be created as there are groups of units detected.
--
-- 2.1) Retrieve the Detected Unit sets and Detected Zones
-- -------------------------------------------------------
--- The DetectedUnitSets methods are implemented in @{Functional.Detection#DECTECTION_BASE} and the DetectedZones methods is implemented in @{Functional.Detection#DETECTION_AREAS}.
+-- The DetectedUnitSets methods are implemented in @{Detection#DECTECTION_BASE} and the DetectedZones methods is implemented in @{Detection#DETECTION_AREAS}.
--
--- Retrieve the DetectedUnitSets with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSets}(). A table will be return of @{Core.Set#SET_UNIT}s.
--- To understand the amount of sets created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectedSetCount}().
--- If you want to obtain a specific set from the DetectedSets, use the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}() with a given index.
+-- Retrieve the DetectedUnitSets with the method @{Detection#DETECTION_BASE.GetDetectedSets}(). A table will be return of @{Set#SET_UNIT}s.
+-- To understand the amount of sets created, use the method @{Detection#DETECTION_BASE.GetDetectedSetCount}().
+-- If you want to obtain a specific set from the DetectedSets, use the method @{Detection#DETECTION_BASE.GetDetectedSet}() with a given index.
--
--- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}().
--- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}().
--- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
+-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Detection#DETECTION_BASE.GetDetectionZones}().
+-- To understand the amount of zones created, use the method @{Detection#DETECTION_BASE.GetDetectionZoneCount}().
+-- If you want to obtain a specific zone from the DetectedZones, use the method @{Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
--
-- 1.4) Flare or Smoke detected units
-- ----------------------------------
--- Use the methods @{Functional.Detection#DETECTION_AREAS.FlareDetectedUnits}() or @{Functional.Detection#DETECTION_AREAS.SmokeDetectedUnits}() to flare or smoke the detected units when a new detection has taken place.
+-- Use the methods @{Detection#DETECTION_AREAS.FlareDetectedUnits}() or @{Detection#DETECTION_AREAS.SmokeDetectedUnits}() to flare or smoke the detected units when a new detection has taken place.
--
-- 1.5) Flare or Smoke detected zones
-- ----------------------------------
--- Use the methods @{Functional.Detection#DETECTION_AREAS.FlareDetectedZones}() or @{Functional.Detection#DETECTION_AREAS.SmokeDetectedZones}() to flare or smoke the detected zones when a new detection has taken place.
+-- Use the methods @{Detection#DETECTION_AREAS.FlareDetectedZones}() or @{Detection#DETECTION_AREAS.SmokeDetectedZones}() to flare or smoke the detected zones when a new detection has taken place.
--
-- ===
--
@@ -245,7 +245,7 @@ function DETECTION_BASE:GetDetectedObject( ObjectName )
return nil
end
---- Get the detected @{Core.Set#SET_BASE}s.
+--- Get the detected @{Set#SET_BASE}s.
-- @param #DETECTION_BASE self
-- @return #DETECTION_BASE.DetectedSets DetectedSets
function DETECTION_BASE:GetDetectedSets()
@@ -308,12 +308,12 @@ function DETECTION_BASE:Schedule( DelayTime, RepeatInterval )
self.ScheduleDelayTime = DelayTime
self.ScheduleRepeatInterval = RepeatInterval
- self.DetectionScheduler = SCHEDULER:New(self, self._DetectionScheduler, { self, "Detection" }, DelayTime, RepeatInterval )
+ self.DetectionScheduler = SCHEDULER:New( self, self._DetectionScheduler, { self, "Detection" }, DelayTime, RepeatInterval )
return self
end
---- Form @{Set}s of detected @{Wrapper.Unit#UNIT}s in an array of @{Core.Set#SET_BASE}s.
+--- Form @{Set}s of detected @{Unit#UNIT}s in an array of @{Set#SET_BASE}s.
-- @param #DETECTION_BASE self
function DETECTION_BASE:_DetectionScheduler( SchedulerName )
self:F2( { SchedulerName } )
@@ -433,7 +433,7 @@ function DETECTION_AREAS:New( DetectionSetGroup, DetectionRange, DetectionZoneRa
self._SmokeDetectedZones = false
self._FlareDetectedZones = false
- self:Schedule( 0, 30 )
+ self:Schedule( 10, 10 )
return self
end
@@ -487,7 +487,7 @@ function DETECTION_AREAS:GetDetectedAreaCount()
return DetectedAreaCount
end
---- Get the @{Core.Set#SET_UNIT} of a detecttion area using a given numeric index.
+--- Get the @{Set#SET_UNIT} of a detecttion area using a given numeric index.
-- @param #DETECTION_AREAS self
-- @param #number Index
-- @return Core.Set#SET_UNIT DetectedSet
@@ -501,7 +501,7 @@ function DETECTION_AREAS:GetDetectedSet( Index )
return nil
end
---- Get the @{Core.Zone#ZONE_UNIT} of a detection area using a given numeric index.
+--- Get the @{Zone#ZONE_UNIT} of a detection area using a given numeric index.
-- @param #DETECTION_AREAS self
-- @param #number Index
-- @return Core.Zone#ZONE_UNIT DetectedZone
diff --git a/Moose Development/Moose/Functional/Escort.lua b/Moose Development/Moose/Functional/Escort.lua
index 96a28c453..247ede8b9 100644
--- a/Moose Development/Moose/Functional/Escort.lua
+++ b/Moose Development/Moose/Functional/Escort.lua
@@ -80,7 +80,7 @@
-- ============================
-- Create a new SPAWN object with the @{#ESCORT.New} method:
--
--- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Wrapper.Group#GROUP} for a @{Wrapper.Client#CLIENT}, with an optional briefing text.
+-- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Group#GROUP} for a @{Client#CLIENT}, with an optional briefing text.
--
-- ESCORT initialization methods.
-- ==============================
diff --git a/Moose Development/Moose/Functional/MissileTrainer.lua b/Moose Development/Moose/Functional/MissileTrainer.lua
index 0d4d3f32f..23bd215d2 100644
--- a/Moose Development/Moose/Functional/MissileTrainer.lua
+++ b/Moose Development/Moose/Functional/MissileTrainer.lua
@@ -2,7 +2,7 @@
--
-- ===
--
--- 1) @{Functional.MissileTrainer#MISSILETRAINER} class, extends @{Core.Base#BASE}
+-- 1) @{MissileTrainer#MISSILETRAINER} class, extends @{Base#BASE}
-- ===============================================================
-- The @{#MISSILETRAINER} class uses the DCS world messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft,
-- the class will destroy the missile within a certain range, to avoid damage to your aircraft.
diff --git a/Moose Development/Moose/Functional/Scoring.lua b/Moose Development/Moose/Functional/Scoring.lua
index 32e4a21f2..e2a6a5f46 100644
--- a/Moose Development/Moose/Functional/Scoring.lua
+++ b/Moose Development/Moose/Functional/Scoring.lua
@@ -51,9 +51,9 @@ function SCORING:New( GameName )
end
- _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnHit( self._EventOnHit, self )
+ self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Hit, self._EventOnHit )
--self.SchedulerId = routines.scheduleFunction( SCORING._FollowPlayersScheduled, { self }, 0, 5 )
self.SchedulerId = SCHEDULER:New( self, self._FollowPlayersScheduled, {}, 0, 5 )
diff --git a/Moose Development/Moose/Functional/Spawn.lua b/Moose Development/Moose/Functional/Spawn.lua
index 4db8a032f..48ceb1e74 100644
--- a/Moose Development/Moose/Functional/Spawn.lua
+++ b/Moose Development/Moose/Functional/Spawn.lua
@@ -1,6 +1,11 @@
---- This module contains the SPAWN class.
+--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**All** --
+-- **Spawn groups of units dynamically in your missions.**
+--
+-- 
--
--- # 1) @{Functional.Spawn#SPAWN} class, extends @{Core.Base#BASE}
+-- ===
+--
+-- # 1) @{#SPAWN} class, extends @{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.
@@ -42,7 +47,7 @@
-- * @{#SPAWN.InitLimit}(): Limits the amount of groups that can be alive at the same time and that can be dynamically spawned.
-- * @{#SPAWN.InitRandomizeRoute}(): Randomize the routes of spawned groups, and for air groups also optionally the height.
-- * @{#SPAWN.InitRandomizeTemplate}(): Randomize the group templates so that when a new group is spawned, a random group template is selected from one of the templates defined.
--- * @{#SPAWN.InitUncontrolled}(): Spawn plane groups uncontrolled.
+-- * @{#SPAWN.InitUnControlled}(): Spawn plane groups uncontrolled.
-- * @{#SPAWN.InitArray}(): Make groups visible before they are actually activated, and order these groups like a batallion in an array.
-- * @{#SPAWN.InitRepeat}(): Re-spawn groups when they land at the home base. Similar methods are @{#SPAWN.InitRepeatOnLanding} and @{#SPAWN.InitRepeatOnEngineShutDown}.
-- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Unit}s in the @{Group} that is spawned within a **radius band**, given an Outer and Inner radius.
@@ -112,6 +117,8 @@
--
-- Hereby the change log:
--
+-- 2017-02-04: SPAWN:InitUnControlled( **UnControlled** ) replaces SPAWN:InitUnControlled().
+--
-- 2017-01-24: SPAWN:**InitAIOnOff( AIOnOff )** added.
--
-- 2017-01-24: SPAWN:**InitAIOn()** added.
@@ -212,6 +219,7 @@ function SPAWN:New( SpawnTemplatePrefix )
self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false.
self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
self.AIOnOff = true -- The AI is on by default when spawning a group.
+ self.SpawnUnControlled = false
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@@ -250,6 +258,7 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false.
self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
self.AIOnOff = true -- The AI is on by default when spawning a group.
+ self.SpawnUnControlled = false
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@@ -646,6 +655,12 @@ function SPAWN:SpawnWithIndex( SpawnIndex )
self:T( 'SpawnTemplate.units['..UnitID..'].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units['..UnitID..'].y = ' .. SpawnTemplate.units[UnitID].y )
end
end
+
+ if SpawnTemplate.CategoryID == Group.Category.HELICOPTER or SpawnTemplate.CategoryID == Group.Category.AIRPLANE then
+ if SpawnTemplate.route.points[1].type == "TakeOffParking" then
+ SpawnTemplate.uncontrolled = self.SpawnUnControlled
+ end
+ end
end
_EVENTDISPATCHER:OnBirthForTemplate( SpawnTemplate, self._OnBirth, self )
@@ -734,7 +749,7 @@ end
--- Allows to place a CallFunction hook when a new group spawns.
-- The provided method will be called when a new group is spawned, including its given parameters.
--- The first parameter of the SpawnFunction is the @{Wrapper.Group#GROUP} that was spawned.
+-- The first parameter of the SpawnFunction is the @{Group#GROUP} that was spawned.
-- @param #SPAWN self
-- @param #function SpawnCallBackFunction The function to be called when a group spawns.
-- @param SpawnFunctionArguments A random amount of arguments to be provided to the function when the group spawns.
@@ -874,7 +889,7 @@ function SPAWN:SpawnFromStatic( HostStatic, SpawnIndex )
end
--- Will spawn a Group within a given @{Zone}.
--- The @{Zone} can be of any type derived from @{Core.Zone#ZONE_BASE}.
+-- The @{Zone} can be of any type derived from @{Zone#ZONE_BASE}.
-- Once the @{Group} is spawned within the zone, the @{Group} will continue on its route.
-- The **first waypoint** (where the group is spawned) is replaced with the zone location coordinates.
-- @param #SPAWN self
@@ -897,17 +912,20 @@ function SPAWN:SpawnInZone( Zone, RandomizeGroup, SpawnIndex )
return nil
end
---- (AIR) Will spawn a plane group in uncontrolled mode...
+--- (**AIR**) Will spawn a plane group in UnControlled or Controlled mode...
-- This will be similar to the uncontrolled flag setting in the ME.
+-- You can use UnControlled mode to simulate planes startup and ready for take-off but aren't moving (yet).
+-- ReSpawn the plane in Controlled mode, and the plane will move...
-- @param #SPAWN self
+-- @param #boolean UnControlled true if UnControlled, false if Controlled.
-- @return #SPAWN self
-function SPAWN:InitUnControlled()
- self:F( { self.SpawnTemplatePrefix } )
+function SPAWN:InitUnControlled( UnControlled )
+ self:F2( { self.SpawnTemplatePrefix, UnControlled } )
- self.SpawnUnControlled = true
+ self.SpawnUnControlled = UnControlled
for SpawnGroupID = 1, self.SpawnMaxGroups do
- self.SpawnGroups[SpawnGroupID].UnControlled = true
+ self.SpawnGroups[SpawnGroupID].UnControlled = UnControlled
end
return self
@@ -1227,9 +1245,6 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex )
SpawnTemplate.visible = false
end
- if SpawnTemplate.CategoryID == Group.Category.HELICOPTER or SpawnTemplate.CategoryID == Group.Category.AIRPLANE then
- SpawnTemplate.uncontrolled = false
- end
for UnitID = 1, #SpawnTemplate.units do
SpawnTemplate.units[UnitID].name = string.format( SpawnTemplate.name .. '-%02d', UnitID )
diff --git a/Moose Development/Moose/Tasking/CommandCenter.lua b/Moose Development/Moose/Tasking/CommandCenter.lua
index 1f1eb735d..967aa84b1 100644
--- a/Moose Development/Moose/Tasking/CommandCenter.lua
+++ b/Moose Development/Moose/Tasking/CommandCenter.lua
@@ -66,7 +66,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
self.Missions = {}
- self:EventOnBirth(
+ self:HandleEvent( EVENTS.Birth,
--- @param #COMMANDCENTER self
--- @param Core.Event#EVENTDATA EventData
function( self, EventData )
@@ -81,7 +81,8 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
local PlayerUnit = EventData.IniUnit
for MissionID, Mission in pairs( self:GetMissions() ) do
local Mission = Mission -- Tasking.Mission#MISSION
- Mission:JoinUnit( PlayerUnit )
+ local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled!
+ Mission:JoinUnit( PlayerUnit, PlayerGroup )
Mission:ReportDetails()
end
@@ -93,14 +94,15 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- - Set the correct menu.
-- - Assign the PlayerUnit to the Task if required.
-- - Send a message to the other players in the group that this player has joined.
- self:EventOnPlayerEnterUnit(
+ self:HandleEvent( EVENTS.PlayerEnterUnit,
--- @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 )
+ local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled!
+ Mission:JoinUnit( PlayerUnit, PlayerGroup )
Mission:ReportDetails()
end
end
@@ -109,12 +111,13 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task.
-- When there is no Unit left running the Task, the Task goes into Abort...
- self:EventOnPlayerLeaveUnit(
+ self:HandleEvent( EVENTS.PlayerLeaveUnit,
--- @param #TASK 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:AbortUnit( PlayerUnit )
end
end
@@ -123,7 +126,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task.
-- When there is no Unit left running the Task, the Task goes into Abort...
- self:EventOnCrash(
+ self:HandleEvent( EVENTS.Crash,
--- @param #TASK self
-- @param Core.Event#EVENTDATA EventData
function( self, EventData )
diff --git a/Moose Development/Moose/Tasking/DetectionManager.lua b/Moose Development/Moose/Tasking/DetectionManager.lua
index 0ecb7fc3a..b7bcc07b5 100644
--- a/Moose Development/Moose/Tasking/DetectionManager.lua
+++ b/Moose Development/Moose/Tasking/DetectionManager.lua
@@ -2,37 +2,37 @@
--
-- ===
--
--- 1) @{Tasking.DetectionManager#DETECTION_MANAGER} class, extends @{Core.Base#BASE}
+-- 1) @{DetectionManager#DETECTION_MANAGER} class, extends @{Base#BASE}
-- ====================================================================
--- The @{Tasking.DetectionManager#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
+-- The @{DetectionManager#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
-- Reportings can be done in several manners, and it is up to the derived classes if DETECTION_MANAGER to model the reporting behaviour.
--
-- 1.1) DETECTION_MANAGER constructor:
-- -----------------------------------
--- * @{Tasking.DetectionManager#DETECTION_MANAGER.New}(): Create a new DETECTION_MANAGER instance.
+-- * @{DetectionManager#DETECTION_MANAGER.New}(): Create a new DETECTION_MANAGER instance.
--
-- 1.2) DETECTION_MANAGER reporting:
-- ---------------------------------
--- Derived DETECTION_MANAGER classes will reports detected units using the method @{Tasking.DetectionManager#DETECTION_MANAGER.ReportDetected}(). This method implements polymorphic behaviour.
+-- Derived DETECTION_MANAGER classes will reports detected units using the method @{DetectionManager#DETECTION_MANAGER.ReportDetected}(). This method implements polymorphic behaviour.
--
--- The time interval in seconds of the reporting can be changed using the methods @{Tasking.DetectionManager#DETECTION_MANAGER.SetReportInterval}().
--- To control how long a reporting message is displayed, use @{Tasking.DetectionManager#DETECTION_MANAGER.SetReportDisplayTime}().
--- Derived classes need to implement the method @{Tasking.DetectionManager#DETECTION_MANAGER.GetReportDisplayTime}() to use the correct display time for displayed messages during a report.
+-- The time interval in seconds of the reporting can be changed using the methods @{DetectionManager#DETECTION_MANAGER.SetReportInterval}().
+-- To control how long a reporting message is displayed, use @{DetectionManager#DETECTION_MANAGER.SetReportDisplayTime}().
+-- Derived classes need to implement the method @{DetectionManager#DETECTION_MANAGER.GetReportDisplayTime}() to use the correct display time for displayed messages during a report.
--
--- Reporting can be started and stopped using the methods @{Tasking.DetectionManager#DETECTION_MANAGER.StartReporting}() and @{Tasking.DetectionManager#DETECTION_MANAGER.StopReporting}() respectively.
--- If an ad-hoc report is requested, use the method @{Tasking.DetectionManager#DETECTION_MANAGER#ReportNow}().
+-- Reporting can be started and stopped using the methods @{DetectionManager#DETECTION_MANAGER.StartReporting}() and @{DetectionManager#DETECTION_MANAGER.StopReporting}() respectively.
+-- If an ad-hoc report is requested, use the method @{DetectionManager#DETECTION_MANAGER#ReportNow}().
--
-- The default reporting interval is every 60 seconds. The reporting messages are displayed 15 seconds.
--
-- ===
--
--- 2) @{Tasking.DetectionManager#DETECTION_REPORTING} class, extends @{Tasking.DetectionManager#DETECTION_MANAGER}
+-- 2) @{DetectionManager#DETECTION_REPORTING} class, extends @{DetectionManager#DETECTION_MANAGER}
-- =========================================================================================
--- The @{Tasking.DetectionManager#DETECTION_REPORTING} class implements detected units reporting. Reporting can be controlled using the reporting methods available in the @{Tasking.DetectionManager#DETECTION_MANAGER} class.
+-- The @{DetectionManager#DETECTION_REPORTING} class implements detected units reporting. Reporting can be controlled using the reporting methods available in the @{DetectionManager#DETECTION_MANAGER} class.
--
-- 2.1) DETECTION_REPORTING constructor:
-- -------------------------------
--- The @{Tasking.DetectionManager#DETECTION_REPORTING.New}() method creates a new DETECTION_REPORTING instance.
+-- The @{DetectionManager#DETECTION_REPORTING.New}() method creates a new DETECTION_REPORTING instance.
--
-- ===
--
@@ -148,7 +148,7 @@ do -- DETECTION MANAGER
return self
end
- --- Report the detected @{Wrapper.Unit#UNIT}s detected within the @{Functional.Detection#DETECTION_BASE} object to the @{Set#SET_GROUP}s.
+ --- Report the detected @{Unit#UNIT}s detected within the @{Detection#DETECTION_BASE} object to the @{Set#SET_GROUP}s.
-- @param #DETECTION_MANAGER self
function DETECTION_MANAGER:_FacScheduler( SchedulerName )
self:F2( { SchedulerName } )
@@ -198,7 +198,7 @@ do -- DETECTION_REPORTING
--- Creates a string of the detected items in a @{Detection}.
-- @param #DETECTION_MANAGER self
- -- @param Set#SET_UNIT DetectedSet The detected Set created by the @{Functional.Detection#DETECTION_BASE} object.
+ -- @param Set#SET_UNIT DetectedSet The detected Set created by the @{Detection#DETECTION_BASE} object.
-- @return #DETECTION_MANAGER self
function DETECTION_REPORTING:GetDetectedItemsText( DetectedSet )
self:F2()
@@ -231,7 +231,7 @@ do -- DETECTION_REPORTING
--- Reports the detected items to the @{Set#SET_GROUP}.
-- @param #DETECTION_REPORTING self
-- @param Wrapper.Group#GROUP Group The @{Group} object to where the report needs to go.
- -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Functional.Detection#DETECTION_BASE} object.
+ -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Detection#DETECTION_BASE} object.
-- @return #boolean Return true if you want the reporting to continue... false will cancel the reporting loop.
function DETECTION_REPORTING:ProcessDetected( Group, Detection )
self:F2( Group )
@@ -392,7 +392,7 @@ do -- DETECTION_DISPATCHER
--- Assigns tasks in relation to the detected items to the @{Set#SET_GROUP}.
-- @param #DETECTION_DISPATCHER self
- -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Functional.Detection#DETECTION_AREAS} object.
+ -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Detection#DETECTION_AREAS} object.
-- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop.
function DETECTION_DISPATCHER:ProcessDetected( Detection )
self:F2()
diff --git a/Moose Development/Moose/Tasking/Mission.lua b/Moose Development/Moose/Tasking/Mission.lua
index 2566922a2..12fd65689 100644
--- a/Moose Development/Moose/Tasking/Mission.lua
+++ b/Moose Development/Moose/Tasking/Mission.lua
@@ -103,15 +103,16 @@ end
-- If the Unit is part of a Task in the Mission, true is returned.
-- @param #MISSION self
-- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player joining the Mission.
+-- @param Wrapper.Group#GROUP PlayerGroup The GROUP of the player joining the Mission.
-- @return #boolean true if Unit is part of a Task in the Mission.
-function MISSION:JoinUnit( PlayerUnit )
- self:F( { PlayerUnit = PlayerUnit } )
+function MISSION:JoinUnit( PlayerUnit, PlayerGroup )
+ self:F( { PlayerUnit = PlayerUnit, PlayerGroup = PlayerGroup } )
local PlayerUnitAdded = false
for TaskID, Task in pairs( self:GetTasks() ) do
local Task = Task -- Tasking.Task#TASK
- if Task:JoinUnit( PlayerUnit ) then
+ if Task:JoinUnit( PlayerUnit, PlayerGroup ) then
PlayerUnitAdded = true
end
end
diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua
index 7b23f21b0..63e846363 100644
--- a/Moose Development/Moose/Tasking/Task.lua
+++ b/Moose Development/Moose/Tasking/Task.lua
@@ -1,6 +1,6 @@
--- This module contains the TASK class.
--
--- 1) @{#TASK} class, extends @{Core.Base#BASE}
+-- 1) @{#TASK} class, extends @{Base#BASE}
-- ============================================
-- 1.1) The @{#TASK} class implements the methods for task orchestration within MOOSE.
-- ----------------------------------------------------------------------------------------
@@ -181,31 +181,6 @@ function TASK:New( Mission, SetGroupAssign, TaskName, TaskType )
self.TaskBriefing = "You are invited for the task: " .. self.TaskName .. "."
self.FsmTemplate = self.FsmTemplate or FSM_PROCESS:New()
-
- -- Handle the birth of new planes within the assigned set.
-
-
- -- Handle when a player crashes ...
- -- The Task is UnAssigned from the Unit.
- -- When there is no Unit left running the Task, and all of the Players crashed, the Task goes into Failed ...
--- self:EventOnCrash(
--- --- @param #TASK self
--- -- @param Core.Event#EVENTDATA EventData
--- function( self, EventData )
--- self:E( "In LeaveUnit" )
--- self:E( { "State", self:GetState() } )
--- if self:IsStateAssigned() then
--- local TaskUnit = EventData.IniUnit
--- local TaskGroup = EventData.IniUnit:GetGroup()
--- self:E( self.SetGroup:IsIncludeObject( TaskGroup ) )
--- if self.SetGroup:IsIncludeObject( TaskGroup ) then
--- self:UnAssignFromUnit( TaskUnit )
--- end
--- self:MessageToGroups( TaskUnit:GetPlayerName() .. " crashed!, and has aborted Task " .. self:GetName() )
--- end
--- end
--- )
---
Mission:AddTask( self )
@@ -234,14 +209,14 @@ end
-- If the Unit is part of the Task, true is returned.
-- @param #TASK self
-- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player joining the Mission.
+-- @param Wrapper.Group#GROUP PlayerGroup The GROUP of the player joining the Mission.
-- @return #boolean true if Unit is part of the Task.
-function TASK:JoinUnit( PlayerUnit )
- self:F( { PlayerUnit = PlayerUnit } )
+function TASK:JoinUnit( PlayerUnit, PlayerGroup )
+ self:F( { PlayerUnit = PlayerUnit, PlayerGroup = PlayerGroup } )
local PlayerUnitAdded = false
local PlayerGroups = self:GetGroups()
- local PlayerGroup = PlayerUnit:GetGroup()
-- Is the PlayerGroup part of the PlayerGroups?
if PlayerGroups:IsIncludeObject( PlayerGroup ) then
@@ -394,7 +369,6 @@ end
-- @return #boolean
function TASK:HasGroup( FindGroup )
- self:GetGroups():FilterOnce() -- Ensure that the filter is updated.
return self:GetGroups():IsIncludeObject( FindGroup )
end
diff --git a/Moose Development/Moose/Tasking/Task_A2G.lua b/Moose Development/Moose/Tasking/Task_A2G.lua
index bb9002d5b..3eee41d0d 100644
--- a/Moose Development/Moose/Tasking/Task_A2G.lua
+++ b/Moose Development/Moose/Tasking/Task_A2G.lua
@@ -1,14 +1,14 @@
--- (AI) (SP) (MP) Tasking for Air to Ground Processes.
--
--- 1) @{#TASK_A2G} class, extends @{Tasking.Task#TASK}
+-- 1) @{#TASK_A2G} class, extends @{Task#TASK}
-- =================================================
-- The @{#TASK_A2G} class defines a CAS or BAI task of a @{Set} of Target Units,
--- located at a Target Zone, based on the tasking capabilities defined in @{Tasking.Task#TASK}.
+-- located at a Target Zone, based on the tasking capabilities defined in @{Task#TASK}.
-- The TASK_A2G is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
--
-- * **None**: Start of the process
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_ASSIGN_ACCEPT} is started to accept the task.
--- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
+-- * **Assigned**: The SEAD task is assigned to a @{Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
--
diff --git a/Moose Development/Moose/Tasking/Task_Pickup.lua b/Moose Development/Moose/Tasking/Task_Pickup.lua
index a0c41eb02..9754ca417 100644
--- a/Moose Development/Moose/Tasking/Task_Pickup.lua
+++ b/Moose Development/Moose/Tasking/Task_Pickup.lua
@@ -1,14 +1,14 @@
--- This module contains the TASK_PICKUP classes.
--
--- 1) @{#TASK_PICKUP} class, extends @{Tasking.Task#TASK}
+-- 1) @{#TASK_PICKUP} class, extends @{Task#TASK}
-- ===================================================
-- The @{#TASK_PICKUP} class defines a pickup task of a @{Set} of @{CARGO} objects defined within the mission.
--- based on the tasking capabilities defined in @{Tasking.Task#TASK}.
+-- based on the tasking capabilities defined in @{Task#TASK}.
-- The TASK_PICKUP is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
--
-- * **None**: Start of the process
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_ASSIGN_ACCEPT} is started to accept the task.
--- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
+-- * **Assigned**: The SEAD task is assigned to a @{Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
--
diff --git a/Moose Development/Moose/Tasking/Task_SEAD.lua b/Moose Development/Moose/Tasking/Task_SEAD.lua
index fe68d5b97..cd40cd71e 100644
--- a/Moose Development/Moose/Tasking/Task_SEAD.lua
+++ b/Moose Development/Moose/Tasking/Task_SEAD.lua
@@ -1,14 +1,14 @@
--- This module contains the TASK_SEAD classes.
--
--- 1) @{#TASK_SEAD} class, extends @{Tasking.Task#TASK}
+-- 1) @{#TASK_SEAD} class, extends @{Task#TASK}
-- =================================================
-- The @{#TASK_SEAD} class defines a SEAD task for a @{Set} of Target Units, located at a Target Zone,
--- based on the tasking capabilities defined in @{Tasking.Task#TASK}.
+-- based on the tasking capabilities defined in @{Task#TASK}.
-- The TASK_SEAD is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
--
-- * **None**: Start of the process
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_ASSIGN_ACCEPT} is started to accept the task.
--- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
+-- * **Assigned**: The SEAD task is assigned to a @{Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
--
diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua
index 063bf33a8..a73189948 100644
--- a/Moose Development/Moose/Wrapper/Airbase.lua
+++ b/Moose Development/Moose/Wrapper/Airbase.lua
@@ -2,7 +2,7 @@
--
-- ===
--
--- 1) @{Wrapper.Airbase#AIRBASE} class, extends @{Wrapper.Positionable#POSITIONABLE}
+-- 1) @{Airbase#AIRBASE} class, extends @{Positionable#POSITIONABLE}
-- =================================================================
-- The @{AIRBASE} class is a wrapper class to handle the DCS Airbase objects:
--
@@ -33,7 +33,7 @@
-- ---------------------
-- The DCS Airbase APIs are used extensively within MOOSE. The AIRBASE class has for each DCS Airbase API a corresponding method.
-- To be able to distinguish easily in your code the difference between a AIRBASE API call and a DCS Airbase API call,
--- the first letter of the method is also capitalized. So, by example, the DCS Airbase method @{Dcs.DCSWrapper.Airbase#Airbase.getName}()
+-- the first letter of the method is also capitalized. So, by example, the DCS Airbase method @{DCSWrapper.Airbase#Airbase.getName}()
-- is implemented in the AIRBASE class as @{#AIRBASE.GetName}().
--
-- More functions will be added
diff --git a/Moose Development/Moose/Wrapper/Client.lua b/Moose Development/Moose/Wrapper/Client.lua
index e603afa20..4d08b3fea 100644
--- a/Moose Development/Moose/Wrapper/Client.lua
+++ b/Moose Development/Moose/Wrapper/Client.lua
@@ -1,10 +1,10 @@
--- This module contains the CLIENT class.
--
--- 1) @{Wrapper.Client#CLIENT} class, extends @{Wrapper.Unit#UNIT}
+-- 1) @{Client#CLIENT} class, extends @{Unit#UNIT}
-- ===============================================
-- Clients are those **Units** defined within the Mission Editor that have the skillset defined as __Client__ or __Player__.
-- Note that clients are NOT the same as Units, they are NOT necessarily alive.
--- The @{Wrapper.Client#CLIENT} class is a wrapper class to handle the DCS Unit objects that have the skillset defined as __Client__ or __Player__:
+-- The @{Client#CLIENT} class is a wrapper class to handle the DCS Unit objects that have the skillset defined as __Client__ or __Player__:
--
-- * Wraps the DCS Unit objects with skill level set to Player or Client.
-- * Support all DCS Unit APIs.
@@ -35,7 +35,6 @@
-- IMPORTANT: ONE SHOULD NEVER SANATIZE these CLIENT OBJECT REFERENCES! (make the CLIENT object references nil).
--
-- @module Client
--- @author FlightControl
--- The CLIENT class
-- @type CLIENT
@@ -226,7 +225,7 @@ end
--- Checks for a client alive event and calls a function on a continuous basis.
-- @param #CLIENT self
--- @param #function CallBack Function.
+-- @param #function CallBackFunction Create a function that will be called when a player joins the slot.
-- @return #CLIENT
function CLIENT:Alive( CallBackFunction, ... )
self:F()
@@ -399,8 +398,8 @@ function CLIENT:IsTransport()
return self.ClientTransport
end
---- Shows the @{AI.AI_Cargo#CARGO} contained within the CLIENT to the player as a message.
--- The @{AI.AI_Cargo#CARGO} is shown using the @{Core.Message#MESSAGE} distribution system.
+--- Shows the @{AI_Cargo#CARGO} contained within the CLIENT to the player as a message.
+-- The @{AI_Cargo#CARGO} is shown using the @{Message#MESSAGE} distribution system.
-- @param #CLIENT self
function CLIENT:ShowCargo()
self:F()
@@ -433,7 +432,7 @@ end
-- @param #string Message is the text describing the message.
-- @param #number MessageDuration is the duration in seconds that the Message should be displayed.
-- @param #string MessageCategory is the category of the message (the title).
--- @param #number MessageInterval is the interval in seconds between the display of the @{Core.Message#MESSAGE} when the CLIENT is in the air.
+-- @param #number MessageInterval is the interval in seconds between the display of the @{Message#MESSAGE} when the CLIENT is in the air.
-- @param #string MessageID is the identifier of the message when displayed with intervals.
function CLIENT:Message( Message, MessageDuration, MessageCategory, MessageInterval, MessageID )
self:F( { Message, MessageDuration, MessageCategory, MessageInterval } )
diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua
index bc5104782..0fe259cbf 100644
--- a/Moose Development/Moose/Wrapper/Controllable.lua
+++ b/Moose Development/Moose/Wrapper/Controllable.lua
@@ -1,8 +1,8 @@
--- This module contains the CONTROLLABLE class.
--
--- 1) @{Wrapper.Controllable#CONTROLLABLE} class, extends @{Wrapper.Positionable#POSITIONABLE}
+-- 1) @{Controllable#CONTROLLABLE} class, extends @{Positionable#POSITIONABLE}
-- ===========================================================
--- The @{Wrapper.Controllable#CONTROLLABLE} class is a wrapper class to handle the DCS Controllable objects:
+-- The @{Controllable#CONTROLLABLE} class is a wrapper class to handle the DCS Controllable objects:
--
-- * Support all DCS Controllable APIs.
-- * Enhance with Controllable specific APIs not in the DCS Controllable API set.
@@ -18,7 +18,7 @@
-- 1.2) CONTROLLABLE task methods
-- ------------------------------
-- Several controllable task methods are available that help you to prepare tasks.
--- These methods return a string consisting of the task description, which can then be given to either a @{Wrapper.Controllable#CONTROLLABLE.PushTask} or @{Wrapper.Controllable#SetTask} method to assign the task to the CONTROLLABLE.
+-- These methods return a string consisting of the task description, which can then be given to either a @{Controllable#CONTROLLABLE.PushTask} or @{Controllable#SetTask} method to assign the task to the CONTROLLABLE.
-- Tasks are specific for the category of the CONTROLLABLE, more specific, for AIR, GROUND or AIR and GROUND.
-- Each task description where applicable indicates for which controllable category the task is valid.
-- There are 2 main subdivisions of tasks: Assigned tasks and EnRoute tasks.
@@ -44,7 +44,7 @@
-- * @{#CONTROLLABLE.TaskHold}: (GROUND) Hold ground controllable from moving.
-- * @{#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the controllable.
-- * @{#CONTROLLABLE.TaskLand}: (AIR HELICOPTER) Landing at the ground. For helicopters only.
--- * @{#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the controllable at a @{Core.Zone#ZONE_RADIUS).
+-- * @{#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the controllable at a @{Zone#ZONE_RADIUS).
-- * @{#CONTROLLABLE.TaskOrbitCircle}: (AIR) Orbit at the current position of the first unit of the controllable at a specified alititude.
-- * @{#CONTROLLABLE.TaskOrbitCircleAtVec2}: (AIR) Orbit at a specified position at a specified alititude during a specified duration with a specified speed.
-- * @{#CONTROLLABLE.TaskRefueling}: (AIR) Refueling from the nearest tanker. No parameters.
@@ -344,7 +344,7 @@ end
--- Return a Combo Task taking an array of Tasks.
-- @param #CONTROLLABLE self
--- @param Dcs.DCSTasking.Task#TaskArray DCSTasks Array of @{Dcs.DCSTasking.Task#Task}
+-- @param Dcs.DCSTasking.Task#TaskArray DCSTasks Array of @{DCSTasking.Task#Task}
-- @return Dcs.DCSTasking.Task#Task
function CONTROLLABLE:TaskCombo( DCSTasks )
self:F2( { DCSTasks } )
@@ -829,7 +829,7 @@ function CONTROLLABLE:TaskLandAtVec2( Point, Duration )
return DCSTask
end
---- (AIR) Land the controllable at a @{Core.Zone#ZONE_RADIUS).
+--- (AIR) Land the controllable at a @{Zone#ZONE_RADIUS).
-- @param #CONTROLLABLE self
-- @param Core.Zone#ZONE Zone The zone where to land.
-- @param #number Duration The duration in seconds to stay on the ground.
@@ -1175,17 +1175,18 @@ end
--- (AIR) Attack the Unit.
-- @param #CONTROLLABLE self
--- @param Wrapper.Unit#UNIT AttackUnit The UNIT.
--- @param #number Priority All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
--- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
+-- @param Wrapper.Unit#UNIT EngageUnit The UNIT.
+-- @param #number Priority (optional) All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
+-- @param #boolean GroupAttack (optional) If true, all units in the group will attack the Unit when found.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- @param #number AttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
-- @param Dcs.DCSTypes#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
--- @param #boolean AttackQtyLimit (optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackControllable" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
+-- @param Dcs.DCSTypes#Distance Altitude (optional) Desired altitude to perform the unit engagement.
+-- @param #boolean Visible (optional) Unit must be visible.
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
-- @return Dcs.DCSTasking.Task#Task The DCS task structure.
-function CONTROLLABLE:EnRouteTaskEngageUnit( AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack )
- self:F2( { self.ControllableName, AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack } )
+function CONTROLLABLE:EnRouteTaskEngageUnit( EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack )
+ self:F2( { self.ControllableName, EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack } )
-- EngageUnit = {
-- id = 'EngageUnit',
@@ -1204,14 +1205,18 @@ function CONTROLLABLE:EnRouteTaskEngageUnit( AttackUnit, Priority, WeaponType, W
local DCSTask
DCSTask = { id = 'EngageUnit',
params = {
- unitId = AttackUnit:GetID(),
- weaponType = WeaponType,
- expend = WeaponExpend,
- attackQty = AttackQty,
+ unitId = EngageUnit:GetID(),
+ priority = Priority or 1,
+ groupAttack = GroupAttack or false,
+ visible = Visible or false,
+ expend = WeaponExpend or "Auto",
+ directionEnabled = Direction and true or false,
direction = Direction,
- attackQtyLimit = AttackQtyLimit,
+ altitudeEnabled = Altitude and true or false,
+ altitude = Altitude,
+ attackQtyLimit = AttackQty and true or false,
+ attackQty = AttackQty,
controllableAttack = ControllableAttack,
- priority = Priority,
},
},
@@ -1638,11 +1643,11 @@ function CONTROLLABLE:TaskRouteToZone( Zone, Randomize, Speed, Formation )
return nil
end
---- (AIR) Return the Controllable to an @{Wrapper.Airbase#AIRBASE}
+--- (AIR) Return the Controllable to an @{Airbase#AIRBASE}
-- A speed can be given in km/h.
-- A given formation can be given.
-- @param #CONTROLLABLE self
--- @param Wrapper.Airbase#AIRBASE ReturnAirbase The @{Wrapper.Airbase#AIRBASE} to return to.
+-- @param Wrapper.Airbase#AIRBASE ReturnAirbase The @{Airbase#AIRBASE} to return to.
-- @param #number Speed (optional) The speed.
-- @return #string The route
function CONTROLLABLE:RouteReturnToAirbase( ReturnAirbase, Speed )
@@ -1762,7 +1767,7 @@ function CONTROLLABLE:GetTaskRoute()
return routines.utils.deepCopy( _DATABASE.Templates.Controllables[self.ControllableName].Template.route.points )
end
---- Return the route of a controllable by using the @{Core.Database#DATABASE} class.
+--- Return the route of a controllable by using the @{Database#DATABASE} class.
-- @param #CONTROLLABLE self
-- @param #number Begin The route point from where the copy will start. The base route point is 0.
-- @param #number End The route point where the copy will end. The End point is the last point - the End point. The last point has base 0.
@@ -2187,7 +2192,7 @@ function CONTROLLABLE:OptionROTVertical()
end
--- Retrieve the controllable mission and allow to place function hooks within the mission waypoint plan.
--- Use the method @{Wrapper.Controllable#CONTROLLABLE:WayPointFunction} to define the hook functions for specific waypoints.
+-- Use the method @{Controllable#CONTROLLABLE:WayPointFunction} to define the hook functions for specific waypoints.
-- Use the method @{Controllable@CONTROLLABLE:WayPointExecute) to start the execution of the new mission plan.
-- Note that when WayPointInitialize is called, the Mission of the controllable is RESTARTED!
-- @param #CONTROLLABLE self
diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua
index 84a9d2912..5fcd0cdb2 100644
--- a/Moose Development/Moose/Wrapper/Group.lua
+++ b/Moose Development/Moose/Wrapper/Group.lua
@@ -1,8 +1,8 @@
--- This module contains the GROUP class.
--
--- 1) @{Wrapper.Group#GROUP} class, extends @{Wrapper.Controllable#CONTROLLABLE}
+-- 1) @{Group#GROUP} class, extends @{Controllable#CONTROLLABLE}
-- =============================================================
--- The @{Wrapper.Group#GROUP} class is a wrapper class to handle the DCS Group objects:
+-- The @{Group#GROUP} class is a wrapper class to handle the DCS Group objects:
--
-- * Support all DCS Group APIs.
-- * Enhance with Group specific APIs not in the DCS Group API set.
@@ -36,7 +36,7 @@
--
-- Group templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a group and assign it to another:
--
--- * @{Wrapper.Controllable#CONTROLLABLE.TaskMission}: (AIR + GROUND) Return a mission task from a mission template.
+-- * @{Controllable#CONTROLLABLE.TaskMission}: (AIR + GROUND) Return a mission task from a mission template.
--
-- ## 1.3) GROUP Command methods
--
@@ -55,7 +55,7 @@
-- * @{#GROUP.IsPartlyInZone}: Returns true if some units of the group are within a @{Zone}.
-- * @{#GROUP.IsNotInZone}: Returns true if none of the group units of the group are within a @{Zone}.
--
--- The zone can be of any @{Zone} class derived from @{Core.Zone#ZONE_BASE}. So, these methods are polymorphic to the zones tested on.
+-- The zone can be of any @{Zone} class derived from @{Zone#ZONE_BASE}. So, these methods are polymorphic to the zones tested on.
--
-- ## 1.6) GROUP AI methods
--
@@ -113,6 +113,8 @@ function GROUP:Register( GroupName )
local self = BASE:Inherit( self, CONTROLLABLE:New( GroupName ) )
self:F2( GroupName )
self.GroupName = GroupName
+
+ self:SetEventPriority( 4 )
return self
end
@@ -154,7 +156,7 @@ function GROUP:GetDCSObject()
return nil
end
---- Returns the @{Dcs.DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -295,7 +297,6 @@ function GROUP:GetUnit( UnitNumber )
if DCSGroup then
local UnitFound = UNIT:Find( DCSGroup:getUnit( UnitNumber ) )
- self:T3( UnitFound.UnitName )
self:T2( UnitFound )
return UnitFound
end
@@ -448,7 +449,7 @@ do -- Is Zone methods
--- Returns true if all units of the group are within a @{Zone}.
-- @param #GROUP self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the Group is completely within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
function GROUP:IsCompletelyInZone( Zone )
self:F2( { self.GroupName, Zone } )
@@ -467,7 +468,7 @@ end
--- Returns true if some units of the group are within a @{Zone}.
-- @param #GROUP self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the Group is completely within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
function GROUP:IsPartlyInZone( Zone )
self:F2( { self.GroupName, Zone } )
@@ -484,7 +485,7 @@ end
--- Returns true if none of the group units of the group are within a @{Zone}.
-- @param #GROUP self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the Group is completely within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
function GROUP:IsNotInZone( Zone )
self:F2( { self.GroupName, Zone } )
@@ -701,7 +702,7 @@ end
-- SPAWNING
--- Respawn the @{GROUP} using a (tweaked) template of the Group.
--- The template must be retrieved with the @{Wrapper.Group#GROUP.GetTemplate}() function.
+-- The template must be retrieved with the @{Group#GROUP.GetTemplate}() function.
-- The template contains all the definitions as declared within the mission file.
-- To understand templates, do the following:
--
@@ -803,7 +804,7 @@ function GROUP:GetTaskRoute()
return routines.utils.deepCopy( _DATABASE.Templates.Groups[self.GroupName].Template.route.points )
end
---- Return the route of a group by using the @{Core.Database#DATABASE} class.
+--- Return the route of a group by using the @{Database#DATABASE} class.
-- @param #GROUP self
-- @param #number Begin The route point from where the copy will start. The base route point is 0.
-- @param #number End The route point where the copy will end. The End point is the last point - the End point. The last point has base 0.
diff --git a/Moose Development/Moose/Wrapper/Identifiable.lua b/Moose Development/Moose/Wrapper/Identifiable.lua
index c11b5cee7..abfa0c607 100644
--- a/Moose Development/Moose/Wrapper/Identifiable.lua
+++ b/Moose Development/Moose/Wrapper/Identifiable.lua
@@ -1,6 +1,6 @@
--- This module contains the IDENTIFIABLE class.
--
--- 1) @{#IDENTIFIABLE} class, extends @{Wrapper.Object#OBJECT}
+-- 1) @{#IDENTIFIABLE} class, extends @{Object#OBJECT}
-- ===============================================================
-- The @{#IDENTIFIABLE} class is a wrapper class to handle the DCS Identifiable objects:
--
diff --git a/Moose Development/Moose/Wrapper/Object.lua b/Moose Development/Moose/Wrapper/Object.lua
index 14650e584..6641c80fb 100644
--- a/Moose Development/Moose/Wrapper/Object.lua
+++ b/Moose Development/Moose/Wrapper/Object.lua
@@ -1,8 +1,8 @@
--- This module contains the OBJECT class.
--
--- 1) @{Wrapper.Object#OBJECT} class, extends @{Core.Base#BASE}
+-- 1) @{Object#OBJECT} class, extends @{Base#BASE}
-- ===========================================================
--- The @{Wrapper.Object#OBJECT} class is a wrapper class to handle the DCS Object objects:
+-- The @{Object#OBJECT} class is a wrapper class to handle the DCS Object objects:
--
-- * Support all DCS Object APIs.
-- * Enhance with Object specific APIs not in the DCS Object API set.
@@ -12,13 +12,13 @@
-- ------------------------------
-- The OBJECT class provides the following functions to construct a OBJECT instance:
--
--- * @{Wrapper.Object#OBJECT.New}(): Create a OBJECT instance.
+-- * @{Object#OBJECT.New}(): Create a OBJECT instance.
--
-- 1.2) OBJECT methods:
-- --------------------------
-- The following methods can be used to identify an Object object:
--
--- * @{Wrapper.Object#OBJECT.GetID}(): Returns the ID of the Object object.
+-- * @{Object#OBJECT.GetID}(): Returns the ID of the Object object.
--
-- ===
--
diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua
index 7ce5f0d04..9be429b8f 100644
--- a/Moose Development/Moose/Wrapper/Positionable.lua
+++ b/Moose Development/Moose/Wrapper/Positionable.lua
@@ -1,8 +1,8 @@
--- This module contains the POSITIONABLE class.
--
--- 1) @{Wrapper.Positionable#POSITIONABLE} class, extends @{Wrapper.Identifiable#IDENTIFIABLE}
+-- 1) @{Positionable#POSITIONABLE} class, extends @{Identifiable#IDENTIFIABLE}
-- ===========================================================
--- The @{Wrapper.Positionable#POSITIONABLE} class is a wrapper class to handle the POSITIONABLE objects:
+-- The @{Positionable#POSITIONABLE} class is a wrapper class to handle the POSITIONABLE objects:
--
-- * Support all DCS APIs.
-- * Enhance with POSITIONABLE specific APIs not in the DCS API set.
@@ -12,14 +12,14 @@
-- ------------------------------
-- The POSITIONABLE class provides the following functions to construct a POSITIONABLE instance:
--
--- * @{Wrapper.Positionable#POSITIONABLE.New}(): Create a POSITIONABLE instance.
+-- * @{Positionable#POSITIONABLE.New}(): Create a POSITIONABLE instance.
--
-- 1.2) POSITIONABLE methods:
-- --------------------------
-- The following methods can be used to identify an measurable object:
--
--- * @{Wrapper.Positionable#POSITIONABLE.GetID}(): Returns the ID of the measurable object.
--- * @{Wrapper.Positionable#POSITIONABLE.GetName}(): Returns the name of the measurable object.
+-- * @{Positionable#POSITIONABLE.GetID}(): Returns the ID of the measurable object.
+-- * @{Positionable#POSITIONABLE.GetName}(): Returns the name of the measurable object.
--
-- ===
--
@@ -49,12 +49,12 @@ function POSITIONABLE:New( PositionableName )
return self
end
---- Returns the @{Dcs.DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
function POSITIONABLE:GetPositionVec3()
- self:E( self.PositionableName )
+ self:F2( self.PositionableName )
local DCSPositionable = self:GetDCSObject()
@@ -67,7 +67,7 @@ function POSITIONABLE:GetPositionVec3()
return nil
end
---- Returns the @{Dcs.DCSTypes#Vec2} vector indicating the point in 2D of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Vec2} vector indicating the point in 2D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Vec2 The 2D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -133,7 +133,7 @@ function POSITIONABLE:GetPointVec3()
end
---- Returns a random @{Dcs.DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
+--- Returns a random @{DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -157,7 +157,7 @@ function POSITIONABLE:GetRandomVec3( Radius )
return nil
end
---- Returns the @{Dcs.DCSTypes#Vec3} vector indicating the 3D vector of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Vec3} vector indicating the 3D vector of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
diff --git a/Moose Development/Moose/Wrapper/Static.lua b/Moose Development/Moose/Wrapper/Static.lua
index ca81d064e..efadcaf4d 100644
--- a/Moose Development/Moose/Wrapper/Static.lua
+++ b/Moose Development/Moose/Wrapper/Static.lua
@@ -1,10 +1,10 @@
--- This module contains the STATIC class.
--
--- 1) @{Wrapper.Static#STATIC} class, extends @{Wrapper.Positionable#POSITIONABLE}
+-- 1) @{Static#STATIC} class, extends @{Positionable#POSITIONABLE}
-- ===============================================================
-- Statics are **Static Units** defined within the Mission Editor.
-- Note that Statics are almost the same as Units, but they don't have a controller.
--- The @{Wrapper.Static#STATIC} class is a wrapper class to handle the DCS Static objects:
+-- The @{Static#STATIC} class is a wrapper class to handle the DCS Static objects:
--
-- * Wraps the DCS Static objects.
-- * Support all DCS Static APIs.
diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua
index 2b9d30b89..101174af0 100644
--- a/Moose Development/Moose/Wrapper/Unit.lua
+++ b/Moose Development/Moose/Wrapper/Unit.lua
@@ -1,6 +1,6 @@
--- This module contains the UNIT class.
--
--- 1) @{#UNIT} class, extends @{Wrapper.Controllable#CONTROLLABLE}
+-- 1) @{#UNIT} class, extends @{Controllable#CONTROLLABLE}
-- ===========================================================
-- The @{#UNIT} class is a wrapper class to handle the DCS Unit objects:
--
@@ -33,7 +33,7 @@
-- ------------------
-- The DCS Unit APIs are used extensively within MOOSE. The UNIT class has for each DCS Unit API a corresponding method.
-- To be able to distinguish easily in your code the difference between a UNIT API call and a DCS Unit API call,
--- the first letter of the method is also capitalized. So, by example, the DCS Unit method @{Dcs.DCSWrapper.Unit#Unit.getName}()
+-- the first letter of the method is also capitalized. So, by example, the DCS Unit method @{DCSWrapper.Unit#Unit.getName}()
-- is implemented in the UNIT class as @{#UNIT.GetName}().
--
-- 1.3) Smoke, Flare Units
@@ -60,7 +60,7 @@
-- The UNIT class contains methods to test the location or proximity against zones or other objects.
--
-- ### 1.6.1) Zones
--- To test whether the Unit is within a **zone**, use the @{#UNIT.IsInZone}() or the @{#UNIT.IsNotInZone}() methods. Any zone can be tested on, but the zone must be derived from @{Core.Zone#ZONE_BASE}.
+-- To test whether the Unit is within a **zone**, use the @{#UNIT.IsInZone}() or the @{#UNIT.IsNotInZone}() methods. Any zone can be tested on, but the zone must be derived from @{Zone#ZONE_BASE}.
--
-- ### 1.6.2) Units
-- Test if another DCS Unit is within a given radius of the current DCS Unit, use the @{#UNIT.OtherUnitInRadius}() method.
@@ -97,6 +97,8 @@ UNIT = {
function UNIT:Register( UnitName )
local self = BASE:Inherit( self, CONTROLLABLE:New( UnitName ) )
self.UnitName = UnitName
+
+ self:SetEventPriority( 3 )
return self
end
@@ -582,7 +584,7 @@ end
--- Returns true if the unit is within a @{Zone}.
-- @param #UNIT self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the unit is within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the unit is within the @{Zone#ZONE_BASE}
function UNIT:IsInZone( Zone )
self:F2( { self.UnitName, Zone } )
@@ -599,7 +601,7 @@ end
--- Returns true if the unit is not within a @{Zone}.
-- @param #UNIT self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the unit is not within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the unit is not within the @{Zone#ZONE_BASE}
function UNIT:IsNotInZone( Zone )
self:F2( { self.UnitName, Zone } )
@@ -836,3 +838,29 @@ function UNIT:InAir()
return nil
end
+do -- Event Handling
+
+ --- Subscribe to a DCS Event.
+ -- @param #UNIT self
+ -- @param Core.Event#EVENTS Event
+ -- @param #function EventFunction (optional) The function to be called when the event occurs for the unit.
+ -- @return #UNIT
+ function UNIT:HandleEvent( Event, EventFunction )
+
+ self:EventDispatcher():OnEventForUnit( self:GetName(), EventFunction, self, Event )
+
+ return self
+ end
+
+ --- UnSubscribe to a DCS event.
+ -- @param #UNIT self
+ -- @param Core.Event#EVENTS Event
+ -- @return #UNIT
+ function UNIT:UnHandleEvent( Event )
+
+ self:EventDispatcher():RemoveForUnit( self:GetName(), self, Event )
+
+ return self
+ end
+
+end
\ No newline at end of file
diff --git a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua
index 31a028f31..5d97e61ea 100644
--- a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua
+++ b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua
@@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
-env.info( 'Moose Generation Timestamp: 20170124_1109' )
+env.info( 'Moose Generation Timestamp: 20170207_2151' )
local base = _G
Include = {}
@@ -2805,8 +2805,8 @@ end
--
-- ## 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.
+-- Any class derived from BASE, must use the @{Base#BASE.New) constructor within the @{Base#BASE.Inherit) method.
+-- See an example at the @{Base#BASE.New} method how this is done.
--
-- ## 1.2) BASE Trace functionality
--
@@ -2851,53 +2851,50 @@ end
--
-- 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.
+-- ### 1.3.1 Subscribe / Unsubscribe to DCS Events
--
--- 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.
+-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
+-- So, when the DCS event occurs, the class will be notified of that event.
+-- There are two functions which you use to subscribe to or unsubscribe from an event.
--
--- Find below an example of the prototype how to write an event handling function:
+-- * @{#BASE.HandleEvent}(): Subscribe to a DCS Event.
+-- * @{#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
+--
+-- ### 1.3.2 Event Handling of DCS Events
+--
+-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
+-- when the DCS event occurs. The Event Handling method receives an @{Event#EVENTDATA} structure, which contains a lot of information
+-- about the event that occurred.
+--
+-- Find below an example of the prototype how to write an event handling function for two units:
--
--- 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
--- )
+-- local Tank1 = UNIT:FindByName( "Tank A" )
+-- local Tank2 = UNIT:FindByName( "Tank B" )
+--
+-- -- Here we subscribe to the Dead events. So, if one of these tanks dies, the Tank1 or Tank2 objects will be notified.
+-- Tank1:HandleEvent( EVENTS.Dead )
+-- Tank2:HandleEvent( EVENTS.Dead )
+--
+-- --- This function is an Event Handling function that will be called when Tank1 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank1:OnEventDead( EventData )
+--
+-- self:SmokeGreen()
+-- end
+--
+-- --- This function is an Event Handling function that will be called when Tank2 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank2:OnEventDead( EventData )
+--
+-- self:SmokeBlue()
+-- 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.
+--
+-- See the @{Event} module for more information about event handling.
--
-- ## 1.4) Class identification methods
--
@@ -2973,6 +2970,7 @@ local _ClassID = 0
BASE = {
ClassName = "BASE",
ClassID = 0,
+ _Private = {},
Events = {},
States = {}
}
@@ -3079,369 +3077,202 @@ function BASE:GetClassID()
return self.ClassID
end
---- Set a new listener for the class.
--- @param self
--- @param Dcs.DCSTypes#Event Event
--- @param #function EventFunction
--- @return #BASE
-function BASE:AddEvent( Event, EventFunction )
- self:F( Event )
+do -- Event Handling
- self.Events[#self.Events+1] = {}
- self.Events[#self.Events].Event = Event
- self.Events[#self.Events].EventFunction = EventFunction
- self.Events[#self.Events].EventEnabled = false
-
- return self
-end
-
---- Returns the event dispatcher
--- @param #BASE self
--- @return Core.Event#EVENT
-function BASE:Event()
-
- return _EVENTDISPATCHER
-end
-
---- Remove all subscribed events
--- @param #BASE self
--- @return #BASE
-function BASE:EventRemoveAll()
-
- _EVENTDISPATCHER:RemoveAll( self )
+ --- Returns the event dispatcher
+ -- @param #BASE self
+ -- @return Core.Event#EVENT
+ function BASE:EventDispatcher()
- return self
-end
-
---- 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
-function BASE:EventOnShot( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOT )
+ return _EVENTDISPATCHER
+ end
- return self
-end
-
---- 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
-function BASE:EventOnHit( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_HIT )
- return self
-end
-
---- 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
-function BASE:EventOnTakeOff( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_TAKEOFF )
+ --- Get the Class @{Event} processing Priority.
+ -- The Event processing Priority is a number from 1 to 10,
+ -- reflecting the order of the classes subscribed to the Event to be processed.
+ -- @param #BASE self
+ -- @return #number The @{Event} processing Priority.
+ function BASE:GetEventPriority()
+ return self._Private.EventPriority or 5
+ end
- return self
-end
-
---- 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
-function BASE:EventOnLand( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_LAND )
+ --- Set the Class @{Event} processing Priority.
+ -- The Event processing Priority is a number from 1 to 10,
+ -- reflecting the order of the classes subscribed to the Event to be processed.
+ -- @param #BASE self
+ -- @param #number EventPriority The @{Event} processing Priority.
+ -- @return self
+ function BASE:SetEventPriority( EventPriority )
+ self._Private.EventPriority = EventPriority
+ end
- return self
-end
-
---- 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
-function BASE:EventOnCrash( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_CRASH )
+ --- Remove all subscribed events
+ -- @param #BASE self
+ -- @return #BASE
+ function BASE:EventRemoveAll()
- return self
-end
-
---- 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
-function BASE:EventOnEjection( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_EJECTION )
+ self:EventDispatcher():RemoveAll( self )
+
+ return self
+ end
- return self
-end
-
-
---- 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
-function BASE:EventOnRefueling( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_REFUELING )
+ --- Subscribe to a DCS Event.
+ -- @param #BASE self
+ -- @param Core.Event#EVENTS Event
+ -- @param #function EventFunction (optional) The function to be called when the event occurs for the unit.
+ -- @return #BASE
+ function BASE:HandleEvent( Event, EventFunction )
- return self
-end
-
---- 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
-function BASE:EventOnDead( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_DEAD )
+ self:EventDispatcher():OnEventGeneric( EventFunction, self, Event )
+
+ return self
+ end
- return self
-end
-
---- 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
-function BASE:EventOnPilotDead( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PILOT_DEAD )
+ --- UnSubscribe to a DCS event.
+ -- @param #BASE self
+ -- @param Core.Event#EVENTS Event
+ -- @return #BASE
+ function BASE:UnHandleEvent( Event )
- return self
-end
-
---- 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
-function BASE:EventOnBaseCaptured( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_BASE_CAPTURED )
+ self:EventDispatcher():Remove( self, Event )
+
+ return self
+ end
- return self
-end
-
---- 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
-function BASE:EventOnMissionStart( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_MISSION_START )
+ -- Event handling function prototypes
- return self
+ --- Occurs whenever any unit in a mission fires a weapon. But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart.
+ -- @function [parent=#BASE] OnEventShot
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs whenever an object is hit by a weapon.
+ -- initiator : The unit object the fired the weapon
+ -- weapon: Weapon object that hit the target
+ -- target: The Object that was hit.
+ -- @function [parent=#BASE] OnEventHit
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft takes off from an airbase, farp, or ship.
+ -- initiator : The unit that tookoff
+ -- place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
+ -- @function [parent=#BASE] OnEventTakeoff
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft lands at an airbase, farp or ship
+ -- initiator : The unit that has landed
+ -- place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships
+ -- @function [parent=#BASE] OnEventLand
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any aircraft crashes into the ground and is completely destroyed.
+ -- initiator : The unit that has crashed
+ -- @function [parent=#BASE] OnEventCrash
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a pilot ejects from an aircraft
+ -- initiator : The unit that has ejected
+ -- @function [parent=#BASE] OnEventEjection
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft connects with a tanker and begins taking on fuel.
+ -- initiator : The unit that is receiving fuel.
+ -- @function [parent=#BASE] OnEventRefueling
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an object is completely destroyed.
+ -- initiator : The unit that is was destroyed.
+ -- @function [parent=#BASE] OnEvent
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when the pilot of an aircraft is killed. Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane.
+ -- initiator : The unit that the pilot has died in.
+ -- @function [parent=#BASE] OnEventPilotDead
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a ground unit captures either an airbase or a farp.
+ -- initiator : The unit that captured the base
+ -- place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
+ -- @function [parent=#BASE] OnEventBaseCaptured
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a mission starts
+ -- @function [parent=#BASE] OnEventMissionStart
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a mission ends
+ -- @function [parent=#BASE] OnEventMissionEnd
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft is finished taking fuel.
+ -- initiator : The unit that was receiving fuel.
+ -- @function [parent=#BASE] OnEventRefuelingStop
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any object is spawned into the mission.
+ -- initiator : The unit that was spawned
+ -- @function [parent=#BASE] OnEventBirth
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any system fails on a human controlled aircraft.
+ -- initiator : The unit that had the failure
+ -- @function [parent=#BASE] OnEventHumanFailure
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any aircraft starts its engines.
+ -- initiator : The unit that is starting its engines.
+ -- @function [parent=#BASE] OnEventEngineStartup
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any aircraft shuts down its engines.
+ -- initiator : The unit that is stopping its engines.
+ -- @function [parent=#BASE] OnEventEngineShutdown
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any player assumes direct control of a unit.
+ -- initiator : The unit that is being taken control of.
+ -- @function [parent=#BASE] OnEventPlayerEnterUnit
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any player relieves control of a unit to the AI.
+ -- initiator : The unit that the player left.
+ -- @function [parent=#BASE] OnEventPlayerLeaveUnit
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any unit begins firing a weapon that has a high rate of fire. Most common with aircraft cannons (GAU-8), autocannons, and machine guns.
+ -- initiator : The unit that is doing the shooing.
+ -- target: The unit that is being targeted.
+ -- @function [parent=#BASE] OnEventShootingStart
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any unit stops firing its weapon. Event will always correspond with a shooting start event.
+ -- initiator : The unit that was doing the shooing.
+ -- @function [parent=#BASE] OnEventShootingEnd
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
end
-
---- 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
-function BASE:EventOnPlayerMissionEnd( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_MISSION_END )
-
- return self
-end
-
---- 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
-function BASE:EventOnTookControl( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_TOOK_CONTROL )
-
- return self
-end
-
---- 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
-function BASE:EventOnRefuelingStop( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_REFUELING_STOP )
-
- return self
-end
-
---- 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
-function BASE:EventOnBirth( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_BIRTH )
-
- return self
-end
-
---- 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
-function BASE:EventOnHumanFailure( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_HUMAN_FAILURE )
-
- return self
-end
-
---- 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
-function BASE:EventOnEngineStartup( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_ENGINE_STARTUP )
-
- return self
-end
-
---- 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
-function BASE:EventOnEngineShutdown( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_ENGINE_SHUTDOWN )
-
- return self
-end
-
---- 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
-function BASE:EventOnPlayerEnterUnit( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_ENTER_UNIT )
-
- return self
-end
-
---- 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
-function BASE:EventOnPlayerLeaveUnit( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_LEAVE_UNIT )
-
- return self
-end
-
---- 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
-function BASE:EventOnPlayerComment( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_COMMENT )
-
- return self
-end
-
---- 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
-function BASE:EventOnShootingStart( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOOTING_START )
-
- return self
-end
-
---- 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
-function BASE:EventOnShootingEnd( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOOTING_END )
-
- return self
-end
-
-
-
-
-
-
-
---- Enable the event listeners for the class.
--- @param #BASE self
--- @return #BASE
-function BASE:EnableEvents()
- self:F( #self.Events )
-
- for EventID, Event in pairs( self.Events ) do
- Event.Self = self
- Event.EventEnabled = true
- end
- self.Events.Handler = world.addEventHandler( self )
-
- return self
-end
-
-
---- Disable the event listeners for the class.
--- @param #BASE self
--- @return #BASE
-function BASE:DisableEvents()
- self:F()
-
- world.removeEventHandler( self )
- for EventID, Event in pairs( self.Events ) do
- Event.Self = nil
- Event.EventEnabled = false
- end
-
- return self
-end
-
-
-local BaseEventCodes = {
- "S_EVENT_SHOT",
- "S_EVENT_HIT",
- "S_EVENT_TAKEOFF",
- "S_EVENT_LAND",
- "S_EVENT_CRASH",
- "S_EVENT_EJECTION",
- "S_EVENT_REFUELING",
- "S_EVENT_DEAD",
- "S_EVENT_PILOT_DEAD",
- "S_EVENT_BASE_CAPTURED",
- "S_EVENT_MISSION_START",
- "S_EVENT_MISSION_END",
- "S_EVENT_TOOK_CONTROL",
- "S_EVENT_REFUELING_STOP",
- "S_EVENT_BIRTH",
- "S_EVENT_HUMAN_FAILURE",
- "S_EVENT_ENGINE_STARTUP",
- "S_EVENT_ENGINE_SHUTDOWN",
- "S_EVENT_PLAYER_ENTER_UNIT",
- "S_EVENT_PLAYER_LEAVE_UNIT",
- "S_EVENT_PLAYER_COMMENT",
- "S_EVENT_SHOOTING_START",
- "S_EVENT_SHOOTING_END",
- "S_EVENT_MAX",
-}
---onEvent( {[1]="S_EVENT_BIRTH",[2]={["subPlace"]=5,["time"]=0,["initiator"]={["id_"]=16884480,},["place"]={["id_"]=5000040,},["id"]=15,["IniUnitName"]="US F-15C@RAMP-Air Support Mountains#001-01",},}
--- Event = {
--- id = enum world.event,
--- time = Time,
--- initiator = Unit,
--- target = Unit,
--- place = Unit,
--- subPlace = enum world.BirthPlace,
--- weapon = Weapon
--- }
--- Creation of a Birth Event.
-- @param #BASE self
@@ -3817,29 +3648,29 @@ end
--- This module contains the SCHEDULER class.
--
--- # 1) @{Core.Scheduler#SCHEDULER} class, extends @{Core.Base#BASE}
+-- # 1) @{Scheduler#SCHEDULER} class, extends @{Base#BASE}
--
--- The @{Core.Scheduler#SCHEDULER} class creates schedule.
+-- The @{Scheduler#SCHEDULER} class creates schedule.
--
-- ## 1.1) SCHEDULER constructor
--
-- The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters:
--
--- * @{Core.Scheduler#SCHEDULER.New}( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.
--- * @{Core.Scheduler#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
--- * @{Core.Scheduler#SCHEDULER.New}( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
--- * @{Core.Scheduler#SCHEDULER.New}( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
+-- * @{Scheduler#SCHEDULER.New}( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.
+-- * @{Scheduler#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
+-- * @{Scheduler#SCHEDULER.New}( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
+-- * @{Scheduler#SCHEDULER.New}( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
--
-- ## 1.2) SCHEDULER timer stopping and (re-)starting.
--
-- The SCHEDULER can be stopped and restarted with the following methods:
--
--- * @{Core.Scheduler#SCHEDULER.Start}(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.
--- * @{Core.Scheduler#SCHEDULER.Stop}(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.
+-- * @{Scheduler#SCHEDULER.Start}(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.
+-- * @{Scheduler#SCHEDULER.Stop}(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.
--
-- ## 1.3) Create a new schedule
--
--- With @{Core.Scheduler#SCHEDULER.Schedule}() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.
+-- With @{Scheduler#SCHEDULER.Schedule}() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.
--
-- ===
--
@@ -3878,7 +3709,7 @@ SCHEDULER = {
-- @param #number Repeat Specifies the interval in seconds when the scheduler will call the event function.
-- @param #number RandomizeFactor Specifies a randomization factor between 0 and 1 to randomize the Repeat.
-- @param #number Stop Specifies the amount of seconds when the scheduler will be stopped.
--- @return #SCHEDULER self
+-- @return #SCHEDULER self.
-- @return #number The ScheduleID of the planned schedule.
function SCHEDULER:New( SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop )
local self = BASE:Inherit( self, BASE:New() )
@@ -4002,7 +3833,7 @@ end
--
-- The SCHEDULEDISPATCHER allows multiple scheduled functions to be planned and executed for one SCHEDULER object.
-- The SCHEDULER object therefore keeps a table of "CallID's", which are returned after each planning of a new scheduled function by the SCHEDULEDISPATCHER.
--- The SCHEDULER object plans new scheduled functions through the @{Core.Scheduler#SCHEDULER.Schedule}() method.
+-- The SCHEDULER object plans new scheduled functions through the @{Scheduler#SCHEDULER.Schedule}() method.
-- The Schedule() method returns the CallID that is the reference ID for each planned schedule.
--
-- ===
@@ -4188,56 +4019,196 @@ end
---- This module contains the EVENT class.
+--- This core module models the dispatching of DCS Events to subscribed MOOSE classes,
+-- following a given priority.
+--
+-- 
--
-- ===
--
--- Takes care of EVENT dispatching between DCS events and event handling functions defined in MOOSE classes.
+-- # 1) Event Handling Overview
+--
+-- 
+--
+-- Within a running mission, various DCS events occur. Units are dynamically created, crash, die, shoot stuff, get hit etc.
+-- This module provides a mechanism to dispatch those events occuring within your running mission, to the different objects orchestrating your mission.
+--
+-- 
+--
+-- Objects can subscribe to different events. The Event dispatcher will publish the received DCS events to the subscribed MOOSE objects, in a specified order.
+-- In this way, the subscribed MOOSE objects are kept in sync with your evolving running mission.
+--
+-- ## 1.1) Event Dispatching
+--
+-- 
+--
+-- The _EVENTDISPATCHER object is automatically created within MOOSE,
+-- and handles the dispatching of DCS Events occurring
+-- in the simulator to the subscribed objects
+-- in the correct processing order.
+--
+-- 
+--
+-- There are 5 levels of kind of objects that the _EVENTDISPATCHER services:
+--
+-- * _DATABASE object: The core of the MOOSE objects. Any object that is created, deleted or updated, is done in this database.
+-- * SET_ derived classes: Subsets of the _DATABASE object. These subsets are updated by the _EVENTDISPATCHER as the second priority.
+-- * UNIT objects: UNIT objects can subscribe to DCS events. Each DCS event will be directly published to teh subscribed UNIT object.
+-- * GROUP objects: GROUP objects can subscribe to DCS events. Each DCS event will be directly published to the subscribed GROUP object.
+-- * Any other object: Various other objects can subscribe to DCS events. Each DCS event triggered will be published to each subscribed object.
+--
+-- 
+--
+-- For most DCS events, the above order of updating will be followed.1
+--
+-- 
+--
+-- But for some DCS events, the publishing order is reversed. This is due to the fact that objects need to be **erased** instead of added.
+--
+-- ## 1.2) Event Handling
+--
+-- 
+--
+-- The actual event subscribing and handling is not facilitated through the _EVENTDISPATCHER, but it is done through the @{BASE} class, @{UNIT} class and @{GROUP} class.
+-- The _EVENTDISPATCHER is a component that is quietly working in the background of MOOSE.
+--
+-- 
+--
+-- 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.
+--
+-- ### 1.2.1 Subscribe / Unsubscribe to DCS Events
+--
+-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
+-- So, when the DCS event occurs, the class will be notified of that event.
+-- There are two functions which you use to subscribe to or unsubscribe from an event.
+--
+-- * @{Base#BASE.HandleEvent}(): Subscribe to a DCS Event.
+-- * @{Base#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
+--
+-- ### 1.3.2 Event Handling of DCS Events
+--
+-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
+-- when the DCS event occurs. The Event Handling method receives an @{Event#EVENTDATA} structure, which contains a lot of information
+-- about the event that occurred.
+--
+-- Find below an example of the prototype how to write an event handling function for two units:
+--
+-- local Tank1 = UNIT:FindByName( "Tank A" )
+-- local Tank2 = UNIT:FindByName( "Tank B" )
+--
+-- -- Here we subscribe to the Dead events. So, if one of these tanks dies, the Tank1 or Tank2 objects will be notified.
+-- Tank1:HandleEvent( EVENTS.Dead )
+-- Tank2:HandleEvent( EVENTS.Dead )
+--
+-- --- This function is an Event Handling function that will be called when Tank1 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank1:OnEventDead( EventData )
+--
+-- self:SmokeGreen()
+-- end
+--
+-- --- This function is an Event Handling function that will be called when Tank2 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank2:OnEventDead( EventData )
+--
+-- self:SmokeBlue()
+-- end
+--
+-- ### 1.3.3 Event Handling methods that are automatically called upon subscribed DCS events
+--
+-- 
+--
+-- The following list outlines which EVENTS item in the structure corresponds to which Event Handling method.
+-- Always ensure that your event handling methods align with the events being subscribed to, or nothing will be executed.
+--
+-- # 2) EVENTS type
+--
+-- The EVENTS structure contains names for all the different DCS events that objects can subscribe to using the
+-- @{Base#BASE.HandleEvent}() method.
+--
+-- # 3) EVENTDATA type
+--
+-- The EVENTDATA contains all the fields that are populated with event information before
+-- an Event Handler method is being called by the event dispatcher.
+-- The Event Handler received the EVENTDATA object as a parameter, and can be used to investigate further the different events.
+-- There are basically 4 main categories of information stored in the EVENTDATA structure:
+--
+-- * Initiator Unit data: Several fields documenting the initiator unit related to the event.
+-- * Target Unit data: Several fields documenting the target unit related to the event.
+-- * Weapon data: Certain events populate weapon information.
+-- * Place data: Certain events populate place information.
+--
+-- Find below an overview which events populate which information categories:
+--
+-- 
+--
+-- ====
+--
+-- # **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-02-07: Did a complete revision of the Event Handing API and underlying mechanisms.
--
-- ===
--
--- The above menus classes **are derived** from 2 main **abstract** classes defined within the MOOSE framework (so don't use these):
+-- # **AUTHORS and CONTRIBUTIONS**
--
--- ===
+-- ### Contributions:
--
--- ### Contributions: -
--- ### Authors: FlightControl : Design & Programming
+-- ### Authors:
--
+-- * [**FlightControl**](https://forums.eagle.ru/member.php?u=89536): Design & Programming & documentation.
+--
-- @module Event
--- The EVENT structure
-- @type EVENT
-- @field #EVENT.Events Events
+-- @extends Core.Base#BASE
EVENT = {
ClassName = "EVENT",
ClassID = 0,
}
-local _EVENTCODES = {
- "S_EVENT_SHOT",
- "S_EVENT_HIT",
- "S_EVENT_TAKEOFF",
- "S_EVENT_LAND",
- "S_EVENT_CRASH",
- "S_EVENT_EJECTION",
- "S_EVENT_REFUELING",
- "S_EVENT_DEAD",
- "S_EVENT_PILOT_DEAD",
- "S_EVENT_BASE_CAPTURED",
- "S_EVENT_MISSION_START",
- "S_EVENT_MISSION_END",
- "S_EVENT_TOOK_CONTROL",
- "S_EVENT_REFUELING_STOP",
- "S_EVENT_BIRTH",
- "S_EVENT_HUMAN_FAILURE",
- "S_EVENT_ENGINE_STARTUP",
- "S_EVENT_ENGINE_SHUTDOWN",
- "S_EVENT_PLAYER_ENTER_UNIT",
- "S_EVENT_PLAYER_LEAVE_UNIT",
- "S_EVENT_PLAYER_COMMENT",
- "S_EVENT_SHOOTING_START",
- "S_EVENT_SHOOTING_END",
- "S_EVENT_MAX",
+--- The different types of events supported by MOOSE.
+-- Use this structure to subscribe to events using the @{Base#BASE.HandleEvent}() method.
+-- @type EVENTS
+EVENTS = {
+ Shot = world.event.S_EVENT_SHOT,
+ Hit = world.event.S_EVENT_HIT,
+ Takeoff = world.event.S_EVENT_TAKEOFF,
+ Land = world.event.S_EVENT_LAND,
+ Crash = world.event.S_EVENT_CRASH,
+ Ejection = world.event.S_EVENT_EJECTION,
+ Refueling = world.event.S_EVENT_REFUELING,
+ Dead = world.event.S_EVENT_DEAD,
+ PilotDead = world.event.S_EVENT_PILOT_DEAD,
+ BaseCaptured = world.event.S_EVENT_BASE_CAPTURED,
+ MissionStart = world.event.S_EVENT_MISSION_START,
+ MissionEnd = world.event.S_EVENT_MISSION_END,
+ TookControl = world.event.S_EVENT_TOOK_CONTROL,
+ RefuelingStop = world.event.S_EVENT_REFUELING_STOP,
+ Birth = world.event.S_EVENT_BIRTH,
+ HumanFailure = world.event.S_EVENT_HUMAN_FAILURE,
+ EngineStartup = world.event.S_EVENT_ENGINE_STARTUP,
+ EngineShutdown = world.event.S_EVENT_ENGINE_SHUTDOWN,
+ PlayerEnterUnit = world.event.S_EVENT_PLAYER_ENTER_UNIT,
+ PlayerLeaveUnit = world.event.S_EVENT_PLAYER_LEAVE_UNIT,
+ PlayerComment = world.event.S_EVENT_PLAYER_COMMENT,
+ ShootingStart = world.event.S_EVENT_SHOOTING_START,
+ ShootingEnd = world.event.S_EVENT_SHOOTING_END,
}
--- The Event structure
@@ -4262,6 +4233,126 @@ local _EVENTCODES = {
-- @field WeaponName
-- @field WeaponTgtDCSUnit
+
+local _EVENTMETA = {
+ [world.event.S_EVENT_SHOT] = {
+ Order = 1,
+ Event = "OnEventShot",
+ Text = "S_EVENT_SHOT"
+ },
+ [world.event.S_EVENT_HIT] = {
+ Order = 1,
+ Event = "OnEventHit",
+ Text = "S_EVENT_HIT"
+ },
+ [world.event.S_EVENT_TAKEOFF] = {
+ Order = 1,
+ Event = "OnEventTakeOff",
+ Text = "S_EVENT_TAKEOFF"
+ },
+ [world.event.S_EVENT_LAND] = {
+ Order = 1,
+ Event = "OnEventLand",
+ Text = "S_EVENT_LAND"
+ },
+ [world.event.S_EVENT_CRASH] = {
+ Order = -1,
+ Event = "OnEventCrash",
+ Text = "S_EVENT_CRASH"
+ },
+ [world.event.S_EVENT_EJECTION] = {
+ Order = 1,
+ Event = "OnEventEjection",
+ Text = "S_EVENT_EJECTION"
+ },
+ [world.event.S_EVENT_REFUELING] = {
+ Order = 1,
+ Event = "OnEventRefueling",
+ Text = "S_EVENT_REFUELING"
+ },
+ [world.event.S_EVENT_DEAD] = {
+ Order = -1,
+ Event = "OnEventDead",
+ Text = "S_EVENT_DEAD"
+ },
+ [world.event.S_EVENT_PILOT_DEAD] = {
+ Order = 1,
+ Event = "OnEventPilotDead",
+ Text = "S_EVENT_PILOT_DEAD"
+ },
+ [world.event.S_EVENT_BASE_CAPTURED] = {
+ Order = 1,
+ Event = "OnEventBaseCaptured",
+ Text = "S_EVENT_BASE_CAPTURED"
+ },
+ [world.event.S_EVENT_MISSION_START] = {
+ Order = 1,
+ Event = "OnEventMissionStart",
+ Text = "S_EVENT_MISSION_START"
+ },
+ [world.event.S_EVENT_MISSION_END] = {
+ Order = 1,
+ Event = "OnEventMissionEnd",
+ Text = "S_EVENT_MISSION_END"
+ },
+ [world.event.S_EVENT_TOOK_CONTROL] = {
+ Order = 1,
+ Event = "OnEventTookControl",
+ Text = "S_EVENT_TOOK_CONTROL"
+ },
+ [world.event.S_EVENT_REFUELING_STOP] = {
+ Order = 1,
+ Event = "OnEventRefuelingStop",
+ Text = "S_EVENT_REFUELING_STOP"
+ },
+ [world.event.S_EVENT_BIRTH] = {
+ Order = 1,
+ Event = "OnEventBirth",
+ Text = "S_EVENT_BIRTH"
+ },
+ [world.event.S_EVENT_HUMAN_FAILURE] = {
+ Order = 1,
+ Event = "OnEventHumanFailure",
+ Text = "S_EVENT_HUMAN_FAILURE"
+ },
+ [world.event.S_EVENT_ENGINE_STARTUP] = {
+ Order = 1,
+ Event = "OnEventEngineStartup",
+ Text = "S_EVENT_ENGINE_STARTUP"
+ },
+ [world.event.S_EVENT_ENGINE_SHUTDOWN] = {
+ Order = 1,
+ Event = "OnEventEngineShutdown",
+ Text = "S_EVENT_ENGINE_SHUTDOWN"
+ },
+ [world.event.S_EVENT_PLAYER_ENTER_UNIT] = {
+ Order = 1,
+ Event = "OnEventPlayerEnterUnit",
+ Text = "S_EVENT_PLAYER_ENTER_UNIT"
+ },
+ [world.event.S_EVENT_PLAYER_LEAVE_UNIT] = {
+ Order = -1,
+ Event = "OnEventPlayerLeaveUnit",
+ Text = "S_EVENT_PLAYER_LEAVE_UNIT"
+ },
+ [world.event.S_EVENT_PLAYER_COMMENT] = {
+ Order = 1,
+ Event = "OnEventPlayerComment",
+ Text = "S_EVENT_PLAYER_COMMENT"
+ },
+ [world.event.S_EVENT_SHOOTING_START] = {
+ Order = 1,
+ Event = "OnEventShootingStart",
+ Text = "S_EVENT_SHOOTING_START"
+ },
+ [world.event.S_EVENT_SHOOTING_END] = {
+ Order = 1,
+ Event = "OnEventShootingEnd",
+ Text = "S_EVENT_SHOOTING_END"
+ },
+}
+
+
--- The Events structure
-- @type EVENT.Events
-- @field #number IniUnit
@@ -4275,7 +4366,7 @@ end
function EVENT:EventText( EventID )
- local EventText = _EVENTCODES[EventID]
+ local EventText = _EVENTMETA[EventID].Text
return EventText
end
@@ -4287,18 +4378,23 @@ end
-- @param Core.Base#BASE EventClass
-- @return #EVENT.Events
function EVENT:Init( EventID, EventClass )
- self:F3( { _EVENTCODES[EventID], EventClass } )
+ self:F3( { _EVENTMETA[EventID].Text, EventClass } )
if not self.Events[EventID] then
-- Create a WEAK table to ensure that the garbage collector is cleaning the event links when the object usage is cleaned.
self.Events[EventID] = setmetatable( {}, { __mode = "k" } )
-
end
+
+ -- Each event has a subtable of EventClasses, ordered by EventPriority.
+ local EventPriority = EventClass:GetEventPriority()
+ if not self.Events[EventID][EventPriority] then
+ self.Events[EventID][EventPriority] = {}
+ end
- if not self.Events[EventID][EventClass] then
- self.Events[EventID][EventClass] = setmetatable( {}, { __mode = "k" } )
+ if not self.Events[EventID][EventPriority][EventClass] then
+ self.Events[EventID][EventPriority][EventClass] = setmetatable( {}, { __mode = "k" } )
end
- return self.Events[EventID][EventClass]
+ return self.Events[EventID][EventPriority][EventClass]
end
--- Removes an Events entry
@@ -4307,21 +4403,37 @@ end
-- @param Dcs.DCSWorld#world.event EventID
-- @return #EVENT.Events
function EVENT:Remove( EventClass, EventID )
- self:F3( { EventClass, _EVENTCODES[EventID] } )
+ self:F3( { EventClass, _EVENTMETA[EventID].Text } )
local EventClass = EventClass
- self.Events[EventID][EventClass] = nil
+ local EventPriority = EventClass:GetEventPriority()
+ self.Events[EventID][EventPriority][EventClass] = nil
end
---- Clears all event subscriptions for a @{Core.Base#BASE} derived object.
+--- Removes an Events entry for a Unit
+-- @param #EVENT self
+-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
+-- @param Dcs.DCSWorld#world.event EventID
+-- @return #EVENT.Events
+function EVENT:RemoveForUnit( UnitName, EventClass, EventID )
+ self:F3( { EventClass, _EVENTMETA[EventID].Text } )
+
+ local EventClass = EventClass
+ local EventPriority = EventClass:GetEventPriority()
+ local Event = self.Events[EventID][EventPriority][EventClass]
+ Event.IniUnit[UnitName] = nil
+end
+
+--- Clears all event subscriptions for a @{Base#BASE} derived object.
-- @param #EVENT self
-- @param Core.Base#BASE EventObject
function EVENT:RemoveAll( EventObject )
self:F3( { EventObject:GetClassNameAndID() } )
local EventClass = EventObject:GetClassNameAndID()
+ local EventPriority = EventClass:GetEventPriority()
for EventID, EventData in pairs( self.Events ) do
- self.Events[EventID][EventClass] = nil
+ self.Events[EventID][EventPriority][EventClass] = nil
end
end
@@ -4355,6 +4467,7 @@ function EVENT:OnEventGeneric( EventFunction, EventClass, EventID )
local Event = self:Init( EventID, EventClass )
Event.EventFunction = EventFunction
Event.EventClass = EventClass
+
return self
end
@@ -4840,7 +4953,7 @@ do -- OnHit
self:Remove( EventClass, world.event.S_EVENT_HIT )
return self
- end
+ end
end
@@ -4931,6 +5044,8 @@ function EVENT:onEvent( Event )
Event.IniDCSGroupName = ""
if Event.IniDCSGroup and Event.IniDCSGroup:isExist() then
Event.IniDCSGroupName = Event.IniDCSGroup:getName()
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+ self:E( { IniGroup = Event.IniGroup } )
end
end
if Event.target then
@@ -4951,36 +5066,100 @@ function EVENT:onEvent( Event )
Event.WeaponName = Event.Weapon:getTypeName()
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
end
- self:E( { _EVENTCODES[Event.id], Event, Event.IniDCSUnitName, Event.TgtDCSUnitName } )
- -- Okay, we got the event from DCS. Now loop the self.Events[] table for the received Event.id, and for each EventData registered, check if a function needs to be called.
- for EventClass, EventData in pairs( self.Events[Event.id] ) do
- -- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT.
- if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then
- self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName } )
- local Result, Value = xpcall( function() return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) end, ErrorHandler )
- --EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event )
- else
- -- If the EventData is not bound to a specific unit, then call the EventClass EventFunction.
- -- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon.
- if Event.IniDCSUnit and not EventData.IniUnit then
- if EventClass == EventData.EventClass then
- self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID() } )
- local Result, Value = xpcall( function() return EventData.EventFunction( EventData.EventClass, Event ) end, ErrorHandler )
- --EventData.EventFunction( EventData.EventClass, Event )
+ local PriorityOrder = _EVENTMETA[Event.id].Order
+ local PriorityBegin = PriorityOrder == -1 and 5 or 1
+ local PriorityEnd = PriorityOrder == -1 and 1 or 5
+
+ self:E( { _EVENTMETA[Event.id].Text, Event, Event.IniDCSUnitName, Event.TgtDCSUnitName, PriorityOrder } )
+
+ for EventPriority = PriorityBegin, PriorityEnd, PriorityOrder do
+
+ if self.Events[Event.id][EventPriority] then
+
+ -- Okay, we got the event from DCS. Now loop the SORTED self.EventSorted[] table for the received Event.id, and for each EventData registered, check if a function needs to be called.
+ for EventClass, EventData in pairs( self.Events[Event.id][EventPriority] ) do
+
+ -- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT.
+ if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then
+
+ -- First test if a EventFunction is Set, otherwise search for the default function
+ if EventData.IniUnit[Event.IniDCSUnitName].EventFunction then
+
+ self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventClass, Event )
+ end, ErrorHandler )
+
+ else
+
+ -- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
+ local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
+ if EventFunction and type( EventFunction ) == "function" then
+
+ -- Now call the default event function.
+ self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventFunction( EventClass, Event )
+ end, ErrorHandler )
+ end
+
+ end
+
+ else
+
+ -- If the EventData is not bound to a specific unit, then call the EventClass EventFunction.
+ -- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon.
+ if Event.IniDCSUnit and not EventData.IniUnit then
+
+ if EventClass == EventData.EventClass then
+
+ -- First test if a EventFunction is Set, otherwise search for the default function
+ if EventData.EventFunction then
+
+ -- There is an EventFunction defined, so call the EventFunction.
+ self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventData.EventFunction( EventClass, Event )
+ end, ErrorHandler )
+ else
+
+ -- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
+ local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
+ if EventFunction and type( EventFunction ) == "function" then
+
+ -- Now call the default event function.
+ self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventFunction( EventClass, Event )
+ end, ErrorHandler )
+ end
+ end
+ end
+ end
end
end
end
end
else
- self:E( { _EVENTCODES[Event.id], Event } )
+ self:E( { _EVENTMETA[Event.id].Text, Event } )
end
end
--- This module contains the MENU classes.
--
--- There is a small note... When you see a class like MENU_COMMAND_COALITION with COMMAND in italic, it acutally represents it like this: `MENU_COMMAND_COALITION`.
---
-- ===
--
-- DCS Menus can be managed using the MENU classes.
@@ -4994,17 +5173,17 @@ end
--
-- ### To manage **main menus**, the classes begin with **MENU_**:
--
--- * @{Core.Menu#MENU_MISSION}: Manages main menus for whole mission file.
--- * @{Core.Menu#MENU_COALITION}: Manages main menus for whole coalition.
--- * @{Core.Menu#MENU_GROUP}: Manages main menus for GROUPs.
--- * @{Core.Menu#MENU_CLIENT}: Manages main menus for CLIENTs. This manages menus for units with the skill level "Client".
+-- * @{Menu#MENU_MISSION}: Manages main menus for whole mission file.
+-- * @{Menu#MENU_COALITION}: Manages main menus for whole coalition.
+-- * @{Menu#MENU_GROUP}: Manages main menus for GROUPs.
+-- * @{Menu#MENU_CLIENT}: Manages main menus for CLIENTs. This manages menus for units with the skill level "Client".
--
-- ### To manage **command menus**, which are menus that allow the player to issue **functions**, the classes begin with **MENU_COMMAND_**:
--
--- * @{Core.Menu#MENU_MISSION_COMMAND}: Manages command menus for whole mission file.
--- * @{Core.Menu#MENU_COALITION_COMMAND}: Manages command menus for whole coalition.
--- * @{Core.Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
--- * @{Core.Menu#MENU_CLIENT_COMMAND}: Manages command menus for CLIENTs. This manages menus for units with the skill level "Client".
+-- * @{Menu#MENU_MISSION_COMMAND}: Manages command menus for whole mission file.
+-- * @{Menu#MENU_COALITION_COMMAND}: Manages command menus for whole coalition.
+-- * @{Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
+-- * @{Menu#MENU_CLIENT_COMMAND}: Manages command menus for CLIENTs. This manages menus for units with the skill level "Client".
--
-- ===
--
@@ -5016,11 +5195,11 @@ end
-- These are simply abstract base classes defining a couple of fields that are used by the
-- derived MENU_ classes to manage menus.
--
--- 1.1) @{Core.Menu#MENU_BASE} class, extends @{Core.Base#BASE}
+-- 1.1) @{#MENU_BASE} class, extends @{Base#BASE}
-- --------------------------------------------------
-- The @{#MENU_BASE} class defines the main MENU class where other MENU classes are derived from.
--
--- 1.2) @{Core.Menu#MENU_COMMAND_BASE} class, extends @{Core.Base#BASE}
+-- 1.2) @{#MENU_COMMAND_BASE} class, extends @{Base#BASE}
-- ----------------------------------------------------------
-- The @{#MENU_COMMAND_BASE} class defines the main MENU class where other MENU COMMAND_ classes are derived from, in order to set commands.
--
@@ -5032,15 +5211,15 @@ end
-- ======================
-- The underlying classes manage the menus for a complete mission file.
--
--- 2.1) @{Menu#MENU_MISSION} class, extends @{Core.Menu#MENU_BASE}
+-- 2.1) @{#MENU_MISSION} class, extends @{Menu#MENU_BASE}
-- ---------------------------------------------------------
--- The @{Core.Menu#MENU_MISSION} class manages the main menus for a complete mission.
+-- The @{Menu#MENU_MISSION} class manages the main menus for a complete mission.
-- You can add menus with the @{#MENU_MISSION.New} method, which constructs a MENU_MISSION object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_MISSION.Remove}.
--
--- 2.2) @{Menu#MENU_MISSION_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 2.2) @{#MENU_MISSION_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- -------------------------------------------------------------------------
--- The @{Core.Menu#MENU_MISSION_COMMAND} class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_MISSION_COMMAND} class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_MISSION_COMMAND.New} method, which constructs a MENU_MISSION_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_MISSION_COMMAND.Remove}.
--
@@ -5050,15 +5229,15 @@ end
-- =========================
-- The underlying classes manage the menus for whole coalitions.
--
--- 3.1) @{Menu#MENU_COALITION} class, extends @{Core.Menu#MENU_BASE}
+-- 3.1) @{#MENU_COALITION} class, extends @{Menu#MENU_BASE}
-- ------------------------------------------------------------
--- The @{Core.Menu#MENU_COALITION} class manages the main menus for coalitions.
+-- The @{Menu#MENU_COALITION} class manages the main menus for coalitions.
-- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}.
--
--- 3.2) @{Menu#MENU_COALITION_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 3.2) @{Menu#MENU_COALITION_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- ----------------------------------------------------------------------------
--- The @{Core.Menu#MENU_COALITION_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_COALITION_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_COALITION_COMMAND.New} method, which constructs a MENU_COALITION_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION_COMMAND.Remove}.
--
@@ -5068,15 +5247,15 @@ end
-- =====================
-- The underlying classes manage the menus for groups. Note that groups can be inactive, alive or can be destroyed.
--
--- 4.1) @{Menu#MENU_GROUP} class, extends @{Core.Menu#MENU_BASE}
+-- 4.1) @{Menu#MENU_GROUP} class, extends @{Menu#MENU_BASE}
-- --------------------------------------------------------
--- The @{Core.Menu#MENU_GROUP} class manages the main menus for coalitions.
+-- The @{Menu#MENU_GROUP} class manages the main menus for coalitions.
-- You can add menus with the @{#MENU_GROUP.New} method, which constructs a MENU_GROUP object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP.Remove}.
--
--- 4.2) @{Menu#MENU_GROUP_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 4.2) @{Menu#MENU_GROUP_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- ------------------------------------------------------------------------
--- The @{Core.Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_GROUP_COMMAND.New} method, which constructs a MENU_GROUP_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP_COMMAND.Remove}.
--
@@ -5086,15 +5265,15 @@ end
-- ======================
-- The underlying classes manage the menus for units with skill level client or player.
--
--- 5.1) @{Menu#MENU_CLIENT} class, extends @{Core.Menu#MENU_BASE}
+-- 5.1) @{Menu#MENU_CLIENT} class, extends @{Menu#MENU_BASE}
-- ---------------------------------------------------------
--- The @{Core.Menu#MENU_CLIENT} class manages the main menus for coalitions.
+-- The @{Menu#MENU_CLIENT} class manages the main menus for coalitions.
-- You can add menus with the @{#MENU_CLIENT.New} method, which constructs a MENU_CLIENT object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_CLIENT.Remove}.
--
--- 5.2) @{Menu#MENU_CLIENT_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 5.2) @{Menu#MENU_CLIENT_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- -------------------------------------------------------------------------
--- The @{Core.Menu#MENU_CLIENT_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_CLIENT_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_CLIENT_COMMAND.New} method, which constructs a MENU_CLIENT_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_CLIENT_COMMAND.Remove}.
--
@@ -5601,9 +5780,8 @@ do -- MENU_CLIENT
-- @param #string MenuText The text for the menu.
-- @param #MENU_BASE ParentMenu The parent menu.
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
- -- @param CommandMenuArgument An argument for the function.
-- @return Menu#MENU_CLIENT_COMMAND self
- function MENU_CLIENT_COMMAND:New( MenuClient, MenuText, ParentMenu, CommandMenuFunction, ... )
+ function MENU_CLIENT_COMMAND:New( Client, MenuText, ParentMenu, CommandMenuFunction, ... )
-- Arrange meta tables
@@ -5614,8 +5792,8 @@ do -- MENU_CLIENT
local self = BASE:Inherit( self, MENU_COMMAND_BASE:New( MenuText, MenuParentPath, CommandMenuFunction, arg ) ) -- Menu#MENU_CLIENT_COMMAND
- self.MenuClient = MenuClient
- self.MenuClientGroupID = MenuClient:GetClientGroupID()
+ self.MenuClient = Client
+ self.MenuClientGroupID = Client:GetClientGroupID()
self.MenuParentPath = MenuParentPath
self.MenuText = MenuText
self.ParentMenu = ParentMenu
@@ -5626,7 +5804,7 @@ do -- MENU_CLIENT
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
- self:T( { MenuClient:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText, CommandMenuFunction, arg } )
+ self:T( { Client:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText, CommandMenuFunction, arg } )
local MenuPathID = table.concat(MenuParentPath) .. "/" .. MenuText
if MenuPath[MenuPathID] then
@@ -5636,7 +5814,9 @@ do -- MENU_CLIENT
self.MenuPath = missionCommands.addCommandForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath, self.MenuCallHandler, arg )
MenuPath[MenuPathID] = self.MenuPath
- ParentMenu.Menus[self.MenuPath] = self
+ if ParentMenu and ParentMenu.Menus then
+ ParentMenu.Menus[self.MenuPath] = self
+ end
return self
end
@@ -5765,7 +5945,7 @@ do
end
end
- self:F( { MenuGroup:GetName(), MenuText, ParentMenu.MenuPath } )
+ --self:F( { MenuGroup:GetName(), MenuText, ParentMenu.MenuPath } )
return self
end
@@ -5844,7 +6024,7 @@ do
end
end
- self:F( { MenuGroup:GetName(), MenuText, ParentMenu.MenuPath } )
+ --self:F( { MenuGroup:GetName(), MenuText, ParentMenu.MenuPath } )
return self
end
@@ -5870,7 +6050,7 @@ do
end
---- This module contains the ZONE classes, inherited from @{Core.Zone#ZONE_BASE}.
+--- This module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
-- There are essentially two core functions that zones accomodate:
--
-- * Test if an object is within the zone boundaries.
@@ -5879,7 +6059,7 @@ end
-- The object classes are using the zone classes to test the zone boundaries, which can take various forms:
--
-- * Test if completely within the zone.
--- * Test if partly within the zone (for @{Wrapper.Group#GROUP} objects).
+-- * Test if partly within the zone (for @{Group#GROUP} objects).
-- * Test if not in the zone.
-- * Distance to the nearest intersecting point of the zone.
-- * Distance to the center of the zone.
@@ -5887,16 +6067,16 @@ end
--
-- Each of these ZONE classes have a zone name, and specific parameters defining the zone type:
--
--- * @{Core.Zone#ZONE_BASE}: The ZONE_BASE class defining the base for all other zone classes.
--- * @{Core.Zone#ZONE_RADIUS}: The ZONE_RADIUS class defined by a zone name, a location and a radius.
--- * @{Core.Zone#ZONE}: The ZONE class, defined by the zone name as defined within the Mission Editor.
--- * @{Core.Zone#ZONE_UNIT}: The ZONE_UNIT class defines by a zone around a @{Wrapper.Unit#UNIT} with a radius.
--- * @{Core.Zone#ZONE_GROUP}: The ZONE_GROUP class defines by a zone around a @{Wrapper.Group#GROUP} with a radius.
--- * @{Core.Zone#ZONE_POLYGON}: The ZONE_POLYGON class defines by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+-- * @{Zone#ZONE_BASE}: The ZONE_BASE class defining the base for all other zone classes.
+-- * @{Zone#ZONE_RADIUS}: The ZONE_RADIUS class defined by a zone name, a location and a radius.
+-- * @{Zone#ZONE}: The ZONE class, defined by the zone name as defined within the Mission Editor.
+-- * @{Zone#ZONE_UNIT}: The ZONE_UNIT class defines by a zone around a @{Unit#UNIT} with a radius.
+-- * @{Zone#ZONE_GROUP}: The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius.
+-- * @{Zone#ZONE_POLYGON}: The ZONE_POLYGON class defines by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
--
-- ===
--
--- 1) @{Core.Zone#ZONE_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
-- ================================================
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
@@ -5904,10 +6084,10 @@ end
--
-- * @{#ZONE_BASE.GetName}(): Returns the name of the zone.
--
--- ### 1.2) Each zone implements two polymorphic functions defined in @{Core.Zone#ZONE_BASE}:
+-- ### 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
--
--- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Core.Point#POINT_VEC2} is within the zone.
--- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Core.Point#POINT_VEC3} is within the zone.
+-- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Point#POINT_VEC2} is within the zone.
+-- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Point#POINT_VEC3} is within the zone.
--
-- ### 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
--
@@ -5917,8 +6097,8 @@ end
--
-- ### 1.4) A zone manages Vectors:
--
--- * @{#ZONE_BASE.GetVec2}(): Returns the @{Dcs.DCSTypes#Vec2} coordinate of the zone.
--- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{Dcs.DCSTypes#Vec2} within the zone.
+-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} coordinate of the zone.
+-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{DCSTypes#Vec2} within the zone.
--
-- ### 1.5) A zone has a bounding square:
--
@@ -5931,12 +6111,12 @@ end
--
-- ===
--
--- 2) @{Core.Zone#ZONE_RADIUS} class, extends @{Core.Zone#ZONE_BASE}
+-- 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
-- =======================================================
-- The ZONE_RADIUS class defined by a zone name, a location and a radius.
-- This class implements the inherited functions from Core.Zone#ZONE_BASE taking into account the own zone format and properties.
--
--- ### 2.1) @{Core.Zone#ZONE_RADIUS} constructor:
+-- ### 2.1) @{Zone#ZONE_RADIUS} constructor:
--
-- * @{#ZONE_BASE.New}(): Constructor.
--
@@ -5947,45 +6127,45 @@ end
--
-- ### 2.3) Manage the location of the zone:
--
--- * @{#ZONE_BASE.SetVec2}(): Sets the @{Dcs.DCSTypes#Vec2} of the zone.
--- * @{#ZONE_BASE.GetVec2}(): Returns the @{Dcs.DCSTypes#Vec2} of the zone.
--- * @{#ZONE_BASE.GetVec3}(): Returns the @{Dcs.DCSTypes#Vec3} of the zone, taking an additional height parameter.
+-- * @{#ZONE_BASE.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
+-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
+-- * @{#ZONE_BASE.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
--
-- ===
--
--- 3) @{Core.Zone#ZONE} class, extends @{Core.Zone#ZONE_RADIUS}
+-- 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
-- ==========================================
-- The ZONE class, defined by the zone name as defined within the Mission Editor.
-- This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
--- 4) @{Core.Zone#ZONE_UNIT} class, extends @{Core.Zone#ZONE_RADIUS}
+-- 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
--- The ZONE_UNIT class defined by a zone around a @{Wrapper.Unit#UNIT} with a radius.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
--- 5) @{Core.Zone#ZONE_GROUP} class, extends @{Core.Zone#ZONE_RADIUS}
+-- 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
--- The ZONE_GROUP class defines by a zone around a @{Wrapper.Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
--- 6) @{Core.Zone#ZONE_POLYGON_BASE} class, extends @{Core.Zone#ZONE_BASE}
+-- 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
-- ========================================================
--- The ZONE_POLYGON_BASE class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_POLYGON_BASE class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
-- ===
--
--- 7) @{Core.Zone#ZONE_POLYGON} class, extends @{Core.Zone#ZONE_POLYGON_BASE}
+-- 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
-- ================================================================
--- The ZONE_POLYGON class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ====
--
@@ -6076,7 +6256,7 @@ function ZONE_BASE:IsPointVec3InZone( Vec3 )
return InZone
end
---- Returns the @{Dcs.DCSTypes#Vec2} coordinate of the zone.
+--- Returns the @{DCSTypes#Vec2} coordinate of the zone.
-- @param #ZONE_BASE self
-- @return #nil.
function ZONE_BASE:GetVec2()
@@ -6084,7 +6264,7 @@ function ZONE_BASE:GetVec2()
return nil
end
---- Define a random @{Dcs.DCSTypes#Vec2} within the zone.
+--- Define a random @{DCSTypes#Vec2} within the zone.
-- @param #ZONE_BASE self
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinates.
function ZONE_BASE:GetRandomVec2()
@@ -6246,7 +6426,7 @@ function ZONE_RADIUS:SetRadius( Radius )
return self.Radius
end
---- Returns the @{Dcs.DCSTypes#Vec2} of the zone.
+--- Returns the @{DCSTypes#Vec2} of the zone.
-- @param #ZONE_RADIUS self
-- @return Dcs.DCSTypes#Vec2 The location of the zone.
function ZONE_RADIUS:GetVec2()
@@ -6257,7 +6437,7 @@ function ZONE_RADIUS:GetVec2()
return self.Vec2
end
---- Sets the @{Dcs.DCSTypes#Vec2} of the zone.
+--- Sets the @{DCSTypes#Vec2} of the zone.
-- @param #ZONE_RADIUS self
-- @param Dcs.DCSTypes#Vec2 Vec2 The new location of the zone.
-- @return Dcs.DCSTypes#Vec2 The new location of the zone.
@@ -6271,7 +6451,7 @@ function ZONE_RADIUS:SetVec2( Vec2 )
return self.Vec2
end
---- Returns the @{Dcs.DCSTypes#Vec3} of the ZONE_RADIUS.
+--- Returns the @{DCSTypes#Vec3} of the ZONE_RADIUS.
-- @param #ZONE_RADIUS self
-- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
-- @return Dcs.DCSTypes#Vec3 The point of the zone.
@@ -6321,16 +6501,20 @@ end
--- Returns a random location within the zone.
-- @param #ZONE_RADIUS self
+-- @param #number inner minimal distance from the center of the zone
+-- @param #number outer minimal distance from the outer edge of the zone
-- @return Dcs.DCSTypes#Vec2 The random location within the zone.
-function ZONE_RADIUS:GetRandomVec2()
- self:F( self.ZoneName )
+function ZONE_RADIUS:GetRandomVec2(inner, outer)
+ self:F( self.ZoneName, inner, outer )
local Point = {}
local Vec2 = self:GetVec2()
+ local _inner = inner or 0
+ local _outer = outer or self:GetRadius()
- local angle = math.random() * math.pi*2;
- Point.x = Vec2.x + math.cos( angle ) * math.random() * self:GetRadius();
- Point.y = Vec2.y + math.sin( angle ) * math.random() * self:GetRadius();
+ local angle = math.random() * math.pi * 2;
+ Point.x = Vec2.x + math.cos( angle ) * math.random(_inner, _outer);
+ Point.y = Vec2.y + math.sin( angle ) * math.random(_inner, _outer);
self:T( { Point } )
@@ -6369,7 +6553,7 @@ function ZONE:New( ZoneName )
end
---- The ZONE_UNIT class defined by a zone around a @{Wrapper.Unit#UNIT} with a radius.
+--- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
-- @type ZONE_UNIT
-- @field Wrapper.Unit#UNIT ZoneUNIT
-- @extends Core.Zone#ZONE_RADIUS
@@ -6394,9 +6578,9 @@ function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius )
end
---- Returns the current location of the @{Wrapper.Unit#UNIT}.
+--- Returns the current location of the @{Unit#UNIT}.
-- @param #ZONE_UNIT self
--- @return Dcs.DCSTypes#Vec2 The location of the zone based on the @{Wrapper.Unit#UNIT}location.
+-- @return Dcs.DCSTypes#Vec2 The location of the zone based on the @{Unit#UNIT}location.
function ZONE_UNIT:GetVec2()
self:F( self.ZoneName )
@@ -6435,7 +6619,7 @@ function ZONE_UNIT:GetRandomVec2()
return RandomVec2
end
---- Returns the @{Dcs.DCSTypes#Vec3} of the ZONE_UNIT.
+--- Returns the @{DCSTypes#Vec3} of the ZONE_UNIT.
-- @param #ZONE_UNIT self
-- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
-- @return Dcs.DCSTypes#Vec3 The point of the zone.
@@ -6461,7 +6645,7 @@ ZONE_GROUP = {
ClassName="ZONE_GROUP",
}
---- Constructor to create a ZONE_GROUP instance, taking the zone name, a zone @{Wrapper.Group#GROUP} and a radius.
+--- Constructor to create a ZONE_GROUP instance, taking the zone name, a zone @{Group#GROUP} and a radius.
-- @param #ZONE_GROUP self
-- @param #string ZoneName Name of the zone.
-- @param Wrapper.Group#GROUP ZoneGROUP The @{Group} as the center of the zone.
@@ -6512,9 +6696,9 @@ end
-- Polygons
---- The ZONE_POLYGON_BASE class defined by an array of @{Dcs.DCSTypes#Vec2}, forming a polygon.
+--- The ZONE_POLYGON_BASE class defined by an array of @{DCSTypes#Vec2}, forming a polygon.
-- @type ZONE_POLYGON_BASE
--- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{Dcs.DCSTypes#Vec2}.
+-- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{DCSTypes#Vec2}.
-- @extends Core.Zone#ZONE_BASE
ZONE_POLYGON_BASE = {
ClassName="ZONE_POLYGON_BASE",
@@ -6524,11 +6708,11 @@ ZONE_POLYGON_BASE = {
-- @type ZONE_POLYGON_BASE.ListVec2
-- @list
---- Constructor to create a ZONE_POLYGON_BASE instance, taking the zone name and an array of @{Dcs.DCSTypes#Vec2}, forming a polygon.
--- The @{Wrapper.Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected.
+--- Constructor to create a ZONE_POLYGON_BASE instance, taking the zone name and an array of @{DCSTypes#Vec2}, forming a polygon.
+-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected.
-- @param #ZONE_POLYGON_BASE self
-- @param #string ZoneName Name of the zone.
--- @param #ZONE_POLYGON_BASE.ListVec2 PointsArray An array of @{Dcs.DCSTypes#Vec2}, forming a polygon..
+-- @param #ZONE_POLYGON_BASE.ListVec2 PointsArray An array of @{DCSTypes#Vec2}, forming a polygon..
-- @return #ZONE_POLYGON_BASE self
function ZONE_POLYGON_BASE:New( ZoneName, PointsArray )
local self = BASE:Inherit( self, ZONE_BASE:New( ZoneName ) )
@@ -6625,7 +6809,7 @@ function ZONE_POLYGON_BASE:IsPointVec2InZone( Vec2 )
return InPolygon
end
---- Define a random @{Dcs.DCSTypes#Vec2} within the zone.
+--- Define a random @{DCSTypes#Vec2} within the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinate.
function ZONE_POLYGON_BASE:GetRandomVec2()
@@ -6677,15 +6861,15 @@ end
---- The ZONE_POLYGON class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+--- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
-- @type ZONE_POLYGON
-- @extends Core.Zone#ZONE_POLYGON_BASE
ZONE_POLYGON = {
ClassName="ZONE_POLYGON",
}
---- Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the @{Wrapper.Group#GROUP} defined within the Mission Editor.
--- The @{Wrapper.Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
+--- Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the @{Group#GROUP} defined within the Mission Editor.
+-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
-- @param #ZONE_POLYGON self
-- @param #string ZoneName Name of the zone.
-- @param Wrapper.Group#GROUP ZoneGroup The GROUP waypoints as defined within the Mission Editor define the polygon shape.
@@ -6704,7 +6888,7 @@ end
--
-- ====
--
--- 1) @{Core.Database#DATABASE} class, extends @{Core.Base#BASE}
+-- 1) @{#DATABASE} class, extends @{Base#BASE}
-- ===================================================
-- Mission designers can use the DATABASE class to refer to:
--
@@ -6785,15 +6969,16 @@ function DATABASE:New()
-- Inherits from BASE
local self = BASE:Inherit( self, BASE:New() )
+
+ self:SetEventPriority( 1 )
- _EVENTDISPATCHER:OnBirth( self._EventOnBirth, self )
- _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
-
+ self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
+ self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
-- Follow alive players and clients
- _EVENTDISPATCHER:OnPlayerEnterUnit( self._EventOnPlayerEnterUnit, self )
- _EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventOnPlayerLeaveUnit, self )
+ self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit )
+ self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
self:_RegisterTemplates()
self:_RegisterGroupsAndUnits()
@@ -6930,6 +7115,7 @@ end
function DATABASE:AddGroup( GroupName )
if not self.GROUPS[GroupName] then
+ self:E( { "Add GROUP:", GroupName } )
self.GROUPS[GroupName] = GROUP:Register( GroupName )
end
@@ -7271,6 +7457,8 @@ function DATABASE:_EventOnPlayerEnterUnit( Event )
self:F2( { Event } )
if Event.IniUnit then
+ self:AddUnit( Event.IniDCSUnitName )
+ self:AddGroup( Event.IniDCSGroupName )
local PlayerName = Event.IniUnit:GetPlayerName()
if not self.PLAYERS[PlayerName] then
self:AddPlayer( Event.IniUnitName, PlayerName )
@@ -7415,6 +7603,8 @@ function DATABASE:_RegisterTemplates()
if (CoalitionName == 'red' or CoalitionName == 'blue') and type(coa_data) == 'table' then
--self.Units[coa_name] = {}
+
+ local CoalitionSide = coalition.side[string.upper(CoalitionName)]
----------------------------------------------
-- build nav points DB
@@ -7438,6 +7628,8 @@ function DATABASE:_RegisterTemplates()
for cntry_id, cntry_data in pairs(coa_data.country) do
local CountryName = string.upper(cntry_data.name)
+ local CountryID = cntry_data.id
+
--self.Units[coa_name][countryName] = {}
--self.Units[coa_name][countryName]["countryId"] = cntry_data.id
@@ -7458,9 +7650,9 @@ function DATABASE:_RegisterTemplates()
if GroupTemplate and GroupTemplate.units and type(GroupTemplate.units) == 'table' then --making sure again- this is a valid group
self:_RegisterTemplate(
GroupTemplate,
- coalition.side[string.upper(CoalitionName)],
+ CoalitionSide,
_DATABASECategory[string.lower(CategoryName)],
- country.id[string.upper(CountryName)]
+ CountryID
)
end --if GroupTemplate and GroupTemplate.units then
end --for group_num, GroupTemplate in pairs(obj_type_data.group) do
@@ -7483,9 +7675,9 @@ end
--
-- ===
--
--- 1) @{Core.Set#SET_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{Set#SET_BASE} class, extends @{Base#BASE}
-- ==============================================
--- The @{Core.Set#SET_BASE} class defines the core functions that define a collection of objects.
+-- The @{Set#SET_BASE} class defines the core functions that define a collection of objects.
-- A SET provides iterators to iterate the SET, but will **temporarily** yield the ForEach interator loop at defined **"intervals"** to the mail simulator loop.
-- In this way, large loops can be done while not blocking the simulator main processing loop.
-- The default **"yield interval"** is after 10 objects processed.
@@ -7493,18 +7685,18 @@ end
--
-- 1.1) Add or remove objects from the SET
-- ---------------------------------------
--- Some key core functions are @{Core.Set#SET_BASE.Add} and @{Core.Set#SET_BASE.Remove} to add or remove objects from the SET in your logic.
+-- Some key core functions are @{Set#SET_BASE.Add} and @{Set#SET_BASE.Remove} to add or remove objects from the SET in your logic.
--
-- 1.2) Define the SET iterator **"yield interval"** and the **"time interval"**
-- -----------------------------------------------------------------------------
--- Modify the iterator intervals with the @{Core.Set#SET_BASE.SetInteratorIntervals} method.
+-- Modify the iterator intervals with the @{Set#SET_BASE.SetInteratorIntervals} method.
-- You can set the **"yield interval"**, and the **"time interval"**. (See above).
--
-- ===
--
--- 2) @{Core.Set#SET_GROUP} class, extends @{Core.Set#SET_BASE}
+-- 2) @{Set#SET_GROUP} class, extends @{Set#SET_BASE}
-- ==================================================
--- Mission designers can use the @{Core.Set#SET_GROUP} class to build sets of groups belonging to certain:
+-- Mission designers can use the @{Set#SET_GROUP} class to build sets of groups belonging to certain:
--
-- * Coalitions
-- * Categories
@@ -7519,7 +7711,7 @@ end
--
-- 2.2) Add or Remove GROUP(s) from SET_GROUP:
-- -------------------------------------------
--- GROUPS can be added and removed using the @{Core.Set#SET_GROUP.AddGroupsByName} and @{Core.Set#SET_GROUP.RemoveGroupsByName} respectively.
+-- GROUPS can be added and removed using the @{Set#SET_GROUP.AddGroupsByName} and @{Set#SET_GROUP.RemoveGroupsByName} respectively.
-- These methods take a single GROUP name or an array of GROUP names to be added or removed from SET_GROUP.
--
-- 2.3) SET_GROUP filter criteria:
@@ -7538,7 +7730,7 @@ end
--
-- Planned filter criteria within development are (so these are not yet available):
--
--- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Core.Zone#ZONE}.
+-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Zone#ZONE}.
--
-- 2.4) SET_GROUP iterators:
-- -------------------------
@@ -7553,9 +7745,9 @@ end
--
-- ====
--
--- 3) @{Core.Set#SET_UNIT} class, extends @{Core.Set#SET_BASE}
+-- 3) @{Set#SET_UNIT} class, extends @{Set#SET_BASE}
-- ===================================================
--- Mission designers can use the @{Core.Set#SET_UNIT} class to build sets of units belonging to certain:
+-- Mission designers can use the @{Set#SET_UNIT} class to build sets of units belonging to certain:
--
-- * Coalitions
-- * Categories
@@ -7571,7 +7763,7 @@ end
--
-- 3.2) Add or Remove UNIT(s) from SET_UNIT:
-- -----------------------------------------
--- UNITs can be added and removed using the @{Core.Set#SET_UNIT.AddUnitsByName} and @{Core.Set#SET_UNIT.RemoveUnitsByName} respectively.
+-- UNITs can be added and removed using the @{Set#SET_UNIT.AddUnitsByName} and @{Set#SET_UNIT.RemoveUnitsByName} respectively.
-- These methods take a single UNIT name or an array of UNIT names to be added or removed from SET_UNIT.
--
-- 3.3) SET_UNIT filter criteria:
@@ -7591,7 +7783,7 @@ end
--
-- Planned filter criteria within development are (so these are not yet available):
--
--- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Core.Zone#ZONE}.
+-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Zone#ZONE}.
--
-- 3.4) SET_UNIT iterators:
-- ------------------------
@@ -7611,9 +7803,9 @@ end
--
-- ===
--
--- 4) @{Core.Set#SET_CLIENT} class, extends @{Core.Set#SET_BASE}
+-- 4) @{Set#SET_CLIENT} class, extends @{Set#SET_BASE}
-- ===================================================
--- Mission designers can use the @{Core.Set#SET_CLIENT} class to build sets of units belonging to certain:
+-- Mission designers can use the @{Set#SET_CLIENT} class to build sets of units belonging to certain:
--
-- * Coalitions
-- * Categories
@@ -7629,7 +7821,7 @@ end
--
-- 4.2) Add or Remove CLIENT(s) from SET_CLIENT:
-- -----------------------------------------
--- CLIENTs can be added and removed using the @{Core.Set#SET_CLIENT.AddClientsByName} and @{Core.Set#SET_CLIENT.RemoveClientsByName} respectively.
+-- CLIENTs can be added and removed using the @{Set#SET_CLIENT.AddClientsByName} and @{Set#SET_CLIENT.RemoveClientsByName} respectively.
-- These methods take a single CLIENT name or an array of CLIENT names to be added or removed from SET_CLIENT.
--
-- 4.3) SET_CLIENT filter criteria:
@@ -7649,7 +7841,7 @@ end
--
-- Planned filter criteria within development are (so these are not yet available):
--
--- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Core.Zone#ZONE}.
+-- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Zone#ZONE}.
--
-- 4.4) SET_CLIENT iterators:
-- ------------------------
@@ -7661,9 +7853,9 @@ end
--
-- ====
--
--- 5) @{Core.Set#SET_AIRBASE} class, extends @{Core.Set#SET_BASE}
+-- 5) @{Set#SET_AIRBASE} class, extends @{Set#SET_BASE}
-- ====================================================
--- Mission designers can use the @{Core.Set#SET_AIRBASE} class to build sets of airbases optionally belonging to certain:
+-- Mission designers can use the @{Set#SET_AIRBASE} class to build sets of airbases optionally belonging to certain:
--
-- * Coalitions
--
@@ -7675,7 +7867,7 @@ end
--
-- 5.2) Add or Remove AIRBASEs from SET_AIRBASE
-- --------------------------------------------
--- AIRBASEs can be added and removed using the @{Core.Set#SET_AIRBASE.AddAirbasesByName} and @{Core.Set#SET_AIRBASE.RemoveAirbasesByName} respectively.
+-- AIRBASEs can be added and removed using the @{Set#SET_AIRBASE.AddAirbasesByName} and @{Set#SET_AIRBASE.RemoveAirbasesByName} respectively.
-- These methods take a single AIRBASE name or an array of AIRBASE names to be added or removed from SET_AIRBASE.
--
-- 5.3) SET_AIRBASE filter criteria
@@ -7745,10 +7937,12 @@ function SET_BASE:New( Database )
self.CallScheduler = SCHEDULER:New( self )
+ self:SetEventPriority( 2 )
+
return self
end
---- Finds an @{Core.Base#BASE} object based on the object Name.
+--- Finds an @{Base#BASE} object based on the object Name.
-- @param #SET_BASE self
-- @param #string ObjectName
-- @return Core.Base#BASE The Object found.
@@ -7768,7 +7962,7 @@ function SET_BASE:GetSet()
return self.Set
end
---- Adds a @{Core.Base#BASE} object in the @{Core.Set#SET_BASE}, using a given ObjectName as the index.
+--- Adds a @{Base#BASE} object in the @{Set#SET_BASE}, using a given ObjectName as the index.
-- @param #SET_BASE self
-- @param #string ObjectName
-- @param Core.Base#BASE Object
@@ -7794,7 +7988,7 @@ function SET_BASE:Add( ObjectName, Object )
end
---- Adds a @{Core.Base#BASE} object in the @{Core.Set#SET_BASE}, using the Object Name as the index.
+--- Adds a @{Base#BASE} object in the @{Set#SET_BASE}, using the Object Name as the index.
-- @param #SET_BASE self
-- @param Wrapper.Object#OBJECT Object
-- @return Core.Base#BASE The added BASE Object.
@@ -7809,7 +8003,7 @@ end
---- Removes a @{Core.Base#BASE} object from the @{Core.Set#SET_BASE} and derived classes, based on the Object Name.
+--- Removes a @{Base#BASE} object from the @{Set#SET_BASE} and derived classes, based on the Object Name.
-- @param #SET_BASE self
-- @param #string ObjectName
function SET_BASE:Remove( ObjectName )
@@ -7848,7 +8042,7 @@ function SET_BASE:Remove( ObjectName )
end
---- Gets a @{Core.Base#BASE} object from the @{Core.Set#SET_BASE} and derived classes, based on the Object Name.
+--- Gets a @{Base#BASE} object from the @{Set#SET_BASE} and derived classes, based on the Object Name.
-- @param #SET_BASE self
-- @param #string ObjectName
-- @return Core.Base#BASE
@@ -7863,7 +8057,7 @@ function SET_BASE:Get( ObjectName )
end
---- Retrieves the amount of objects in the @{Core.Set#SET_BASE} and derived classes.
+--- Retrieves the amount of objects in the @{Set#SET_BASE} and derived classes.
-- @param #SET_BASE self
-- @return #number Count
function SET_BASE:Count()
@@ -7932,13 +8126,13 @@ function SET_BASE:_FilterStart()
end
end
- _EVENTDISPATCHER:OnBirth( self._EventOnBirth, self )
- _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
+ self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
+ self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
-- Follow alive players and clients
- _EVENTDISPATCHER:OnPlayerEnterUnit( self._EventOnPlayerEnterUnit, self )
- _EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventOnPlayerLeaveUnit, self )
+ self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit )
+ self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
return self
@@ -7949,16 +8143,16 @@ end
-- @return #SET_BASE self
function SET_BASE:FilterStop()
- _EVENTDISPATCHER:OnBirthRemove( self )
- _EVENTDISPATCHER:OnDeadRemove( self )
- _EVENTDISPATCHER:OnCrashRemove( self )
+ self:UnHandleEvent( EVENTS.Birth )
+ self:UnHandleEvent( EVENTS.Dead )
+ self:UnHandleEvent( EVENTS.Crash )
return self
end
---- Iterate the SET_BASE while identifying the nearest object from a @{Core.Point#POINT_VEC2}.
+--- Iterate the SET_BASE while identifying the nearest object from a @{Point#POINT_VEC2}.
-- @param #SET_BASE self
--- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest object in the set.
+-- @param Core.Point#POINT_VEC2 PointVec2 A @{Point#POINT_VEC2} object from where to evaluate the closest object in the set.
-- @return Core.Base#BASE The closest object.
function SET_BASE:FindNearestObjectFromPointVec2( PointVec2 )
self:F2( PointVec2 )
@@ -9705,10 +9899,10 @@ function SET_AIRBASE:ForEachAirbase( IteratorFunction, ... )
return self
end
---- Iterate the SET_AIRBASE while identifying the nearest @{Wrapper.Airbase#AIRBASE} from a @{Core.Point#POINT_VEC2}.
+--- Iterate the SET_AIRBASE while identifying the nearest @{Airbase#AIRBASE} from a @{Point#POINT_VEC2}.
-- @param #SET_AIRBASE self
--- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest @{Wrapper.Airbase#AIRBASE}.
--- @return Wrapper.Airbase#AIRBASE The closest @{Wrapper.Airbase#AIRBASE}.
+-- @param Core.Point#POINT_VEC2 PointVec2 A @{Point#POINT_VEC2} object from where to evaluate the closest @{Airbase#AIRBASE}.
+-- @return Wrapper.Airbase#AIRBASE The closest @{Airbase#AIRBASE}.
function SET_AIRBASE:FindNearestAirbaseFromPointVec2( PointVec2 )
self:F2( PointVec2 )
@@ -9762,9 +9956,9 @@ function SET_AIRBASE:IsIncludeObject( MAirbase )
end
--- This module contains the POINT classes.
--
--- 1) @{Core.Point#POINT_VEC3} class, extends @{Core.Base#BASE}
+-- 1) @{Point#POINT_VEC3} class, extends @{Base#BASE}
-- ==================================================
--- The @{Core.Point#POINT_VEC3} class defines a 3D point in the simulator.
+-- The @{Point#POINT_VEC3} class defines a 3D point in the simulator.
--
-- **Important Note:** Most of the functions in this section were taken from MIST, and reworked to OO concepts.
-- In order to keep the credibility of the the author, I want to emphasize that the of the MIST framework was created by Grimes, who you can find on the Eagle Dynamics Forums.
@@ -9773,20 +9967,20 @@ end
-- ---------------------------
-- A new POINT_VEC3 instance can be created with:
--
--- * @{#POINT_VEC3.New}(): a 3D point.
--- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{Dcs.DCSTypes#Vec3}.
+-- * @{Point#POINT_VEC3.New}(): a 3D point.
+-- * @{Point#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
--
--
--- 2) @{Core.Point#POINT_VEC2} class, extends @{Core.Point#POINT_VEC3}
+-- 2) @{Point#POINT_VEC2} class, extends @{Point#POINT_VEC3}
-- =========================================================
--- The @{Core.Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
+-- The @{Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
--
-- 2.1) POINT_VEC2 constructor
-- ---------------------------
-- A new POINT_VEC2 instance can be created with:
--
--- * @{#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
--- * @{#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{Dcs.DCSTypes#Vec2}.
+-- * @{Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
+-- * @{Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
--
-- ===
--
@@ -10434,10 +10628,10 @@ function POINT_VEC2:DistanceFromPointVec2( PointVec2Reference )
return Distance
end
---- Calculate the distance from a reference @{Dcs.DCSTypes#Vec2}.
+--- Calculate the distance from a reference @{DCSTypes#Vec2}.
-- @param #POINT_VEC2 self
--- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{Dcs.DCSTypes#Vec2}.
--- @return Dcs.DCSTypes#Distance The distance from the reference @{Dcs.DCSTypes#Vec2} in meters.
+-- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{DCSTypes#Vec2}.
+-- @return Dcs.DCSTypes#Distance The distance from the reference @{DCSTypes#Vec2} in meters.
function POINT_VEC2:DistanceFromVec2( Vec2Reference )
self:F2( Vec2Reference )
@@ -10475,7 +10669,7 @@ end
--- This module contains the MESSAGE class.
--
--- 1) @{Core.Message#MESSAGE} class, extends @{Core.Base#BASE}
+-- 1) @{Message#MESSAGE} class, extends @{Base#BASE}
-- =================================================
-- Message System to display Messages to Clients, Coalitions or All.
-- Messages are shown on the display panel for an amount of seconds, and will then disappear.
@@ -10483,16 +10677,16 @@ end
--
-- 1.1) MESSAGE construction methods
-- ---------------------------------
--- Messages are created with @{Core.Message#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet.
+-- Messages are created with @{Message#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet.
-- To send messages, you need to use the To functions.
--
-- 1.2) Send messages with MESSAGE To methods
-- ------------------------------------------
-- Messages are sent to:
--
--- * Clients with @{Core.Message#MESSAGE.ToClient}.
--- * Coalitions with @{Core.Message#MESSAGE.ToCoalition}.
--- * All Players with @{Core.Message#MESSAGE.ToAll}.
+-- * Clients with @{Message#MESSAGE.ToClient}.
+-- * Coalitions with @{Message#MESSAGE.ToCoalition}.
+-- * All Players with @{Message#MESSAGE.ToAll}.
--
-- @module Message
-- @author FlightControl
@@ -10758,6 +10952,8 @@ end
--
-- 
--
+-- ===
+--
-- A FSM can only be in one of a finite number of states.
-- The machine is in only one state at a time; the state it is in at any given time is called the **current state**.
-- It can change from one state to another when initiated by an **__internal__ or __external__ triggering event**, which is called a **transition**.
@@ -10801,7 +10997,7 @@ end
--
-- ===
--
--- # 1) @{Core.Fsm#FSM} class, extends @{Core.Base#BASE}
+-- # 1) @{#FSM} class, extends @{Base#BASE}
--
-- 
--
@@ -11081,6 +11277,7 @@ do -- FSM
self._Processes = {}
self._EndStates = {}
self._Scores = {}
+ self._EventSchedules = {}
self.CallScheduler = SCHEDULER:New( self )
@@ -11281,9 +11478,10 @@ do -- FSM
end
- function FSM:_call_handler(handler, params)
+ function FSM:_call_handler( handler, params, EventName )
if self[handler] then
self:T( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
local Value = self[handler]( self, unpack(params) )
return Value
end
@@ -11307,10 +11505,10 @@ do -- FSM
self:T( "FSM Transition:" .. self.current .. " --> " .. EventName .. " --> " .. to )
end
- if ( self:_call_handler("onbefore" .. EventName, params) == false )
- or ( self:_call_handler("OnBefore" .. EventName, params) == false )
- or ( self:_call_handler("onleave" .. from, params) == false )
- or ( self:_call_handler("OnLeave" .. from, params) == false ) then
+ if ( self:_call_handler("onbefore" .. EventName, params, EventName ) == false )
+ or ( self:_call_handler("OnBefore" .. EventName, params, EventName ) == false )
+ or ( self:_call_handler("onleave" .. from, params, EventName ) == false )
+ or ( self:_call_handler("OnLeave" .. from, params, EventName ) == false ) then
self:T( "Cancel Transition" )
return false
end
@@ -11335,11 +11533,11 @@ do -- FSM
local fsmparent, Event = self:_isendstate( to )
if fsmparent and Event then
self:F2( { "end state: ", fsmparent, Event } )
- self:_call_handler("onenter" .. to, params)
- self:_call_handler("OnEnter" .. to, params)
- self:_call_handler("onafter" .. EventName, params)
- self:_call_handler("OnAfter" .. EventName, params)
- self:_call_handler("onstatechange", params)
+ self:_call_handler("onenter" .. to, params, EventName )
+ self:_call_handler("OnEnter" .. to, params, EventName )
+ self:_call_handler("onafter" .. EventName, params, EventName )
+ self:_call_handler("OnAfter" .. EventName, params, EventName )
+ self:_call_handler("onstatechange", params, EventName )
fsmparent[Event]( fsmparent )
execute = false
end
@@ -11347,14 +11545,14 @@ do -- FSM
if execute then
-- only execute the call if the From state is not equal to the To state! Otherwise this function should never execute!
--if from ~= to then
- self:_call_handler("onenter" .. to, params)
- self:_call_handler("OnEnter" .. to, params)
+ self:_call_handler("onenter" .. to, params, EventName )
+ self:_call_handler("OnEnter" .. to, params, EventName )
--end
- self:_call_handler("onafter" .. EventName, params)
- self:_call_handler("OnAfter" .. EventName, params)
+ self:_call_handler("onafter" .. EventName, params, EventName )
+ self:_call_handler("OnAfter" .. EventName, params, EventName )
- self:_call_handler("onstatechange", params)
+ self:_call_handler("onstatechange", params, EventName )
end
else
self:T( "Cannot execute transition." )
@@ -11367,7 +11565,18 @@ do -- FSM
function FSM:_delayed_transition( EventName )
return function( self, DelaySeconds, ... )
self:T2( "Delayed Event: " .. EventName )
- local CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
+ local CallID = 0
+ if DelaySeconds < 0 then -- Only call the event ONCE!
+ DelaySeconds = math.abs( DelaySeconds )
+ if not self._EventSchedules[EventName] then
+ CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
+ self._EventSchedules[EventName] = CallID
+ else
+ -- reschedule
+ end
+ else
+ CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
+ end
self:T2( { CallID = CallID } )
end
end
@@ -11487,7 +11696,7 @@ do -- FSM_CONTROLLABLE
return self.Controllable
end
- function FSM_CONTROLLABLE:_call_handler( handler, params )
+ function FSM_CONTROLLABLE:_call_handler( handler, params, EventName )
local ErrorHandler = function( errmsg )
@@ -11501,6 +11710,7 @@ do -- FSM_CONTROLLABLE
if self[handler] then
self:F3( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
local Result, Value = xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler )
return Value
--return self[handler]( self, self.Controllable, unpack( params ) )
@@ -11722,9 +11932,10 @@ do -- FSM_TASK
return self
end
- function FSM_TASK:_call_handler( handler, params )
+ function FSM_TASK:_call_handler( handler, params, EventName )
if self[handler] then
self:T( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
return self[handler]( self, unpack( params ) )
end
end
@@ -11774,9 +11985,10 @@ do -- FSM_SET
return self.Controllable
end
- function FSM_SET:_call_handler( handler, params )
+ function FSM_SET:_call_handler( handler, params, EventName )
if self[handler] then
self:T( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
return self[handler]( self, self.Set, unpack( params ) )
end
end
@@ -11785,9 +11997,9 @@ end -- FSM_SET
--- This module contains the OBJECT class.
--
--- 1) @{Wrapper.Object#OBJECT} class, extends @{Core.Base#BASE}
+-- 1) @{Object#OBJECT} class, extends @{Base#BASE}
-- ===========================================================
--- The @{Wrapper.Object#OBJECT} class is a wrapper class to handle the DCS Object objects:
+-- The @{Object#OBJECT} class is a wrapper class to handle the DCS Object objects:
--
-- * Support all DCS Object APIs.
-- * Enhance with Object specific APIs not in the DCS Object API set.
@@ -11797,13 +12009,13 @@ end -- FSM_SET
-- ------------------------------
-- The OBJECT class provides the following functions to construct a OBJECT instance:
--
--- * @{Wrapper.Object#OBJECT.New}(): Create a OBJECT instance.
+-- * @{Object#OBJECT.New}(): Create a OBJECT instance.
--
-- 1.2) OBJECT methods:
-- --------------------------
-- The following methods can be used to identify an Object object:
--
--- * @{Wrapper.Object#OBJECT.GetID}(): Returns the ID of the Object object.
+-- * @{Object#OBJECT.GetID}(): Returns the ID of the Object object.
--
-- ===
--
@@ -11873,7 +12085,7 @@ end
--- This module contains the IDENTIFIABLE class.
--
--- 1) @{#IDENTIFIABLE} class, extends @{Wrapper.Object#OBJECT}
+-- 1) @{#IDENTIFIABLE} class, extends @{Object#OBJECT}
-- ===============================================================
-- The @{#IDENTIFIABLE} class is a wrapper class to handle the DCS Identifiable objects:
--
@@ -12099,9 +12311,9 @@ end
--- This module contains the POSITIONABLE class.
--
--- 1) @{Wrapper.Positionable#POSITIONABLE} class, extends @{Wrapper.Identifiable#IDENTIFIABLE}
+-- 1) @{Positionable#POSITIONABLE} class, extends @{Identifiable#IDENTIFIABLE}
-- ===========================================================
--- The @{Wrapper.Positionable#POSITIONABLE} class is a wrapper class to handle the POSITIONABLE objects:
+-- The @{Positionable#POSITIONABLE} class is a wrapper class to handle the POSITIONABLE objects:
--
-- * Support all DCS APIs.
-- * Enhance with POSITIONABLE specific APIs not in the DCS API set.
@@ -12111,14 +12323,14 @@ end
-- ------------------------------
-- The POSITIONABLE class provides the following functions to construct a POSITIONABLE instance:
--
--- * @{Wrapper.Positionable#POSITIONABLE.New}(): Create a POSITIONABLE instance.
+-- * @{Positionable#POSITIONABLE.New}(): Create a POSITIONABLE instance.
--
-- 1.2) POSITIONABLE methods:
-- --------------------------
-- The following methods can be used to identify an measurable object:
--
--- * @{Wrapper.Positionable#POSITIONABLE.GetID}(): Returns the ID of the measurable object.
--- * @{Wrapper.Positionable#POSITIONABLE.GetName}(): Returns the name of the measurable object.
+-- * @{Positionable#POSITIONABLE.GetID}(): Returns the ID of the measurable object.
+-- * @{Positionable#POSITIONABLE.GetName}(): Returns the name of the measurable object.
--
-- ===
--
@@ -12148,12 +12360,12 @@ function POSITIONABLE:New( PositionableName )
return self
end
---- Returns the @{Dcs.DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
function POSITIONABLE:GetPositionVec3()
- self:E( self.PositionableName )
+ self:F2( self.PositionableName )
local DCSPositionable = self:GetDCSObject()
@@ -12166,7 +12378,7 @@ function POSITIONABLE:GetPositionVec3()
return nil
end
---- Returns the @{Dcs.DCSTypes#Vec2} vector indicating the point in 2D of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Vec2} vector indicating the point in 2D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Vec2 The 2D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -12232,7 +12444,7 @@ function POSITIONABLE:GetPointVec3()
end
---- Returns a random @{Dcs.DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
+--- Returns a random @{DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -12256,7 +12468,7 @@ function POSITIONABLE:GetRandomVec3( Radius )
return nil
end
---- Returns the @{Dcs.DCSTypes#Vec3} vector indicating the 3D vector of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Vec3} vector indicating the 3D vector of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -12537,9 +12749,9 @@ end
--- This module contains the CONTROLLABLE class.
--
--- 1) @{Wrapper.Controllable#CONTROLLABLE} class, extends @{Wrapper.Positionable#POSITIONABLE}
+-- 1) @{Controllable#CONTROLLABLE} class, extends @{Positionable#POSITIONABLE}
-- ===========================================================
--- The @{Wrapper.Controllable#CONTROLLABLE} class is a wrapper class to handle the DCS Controllable objects:
+-- The @{Controllable#CONTROLLABLE} class is a wrapper class to handle the DCS Controllable objects:
--
-- * Support all DCS Controllable APIs.
-- * Enhance with Controllable specific APIs not in the DCS Controllable API set.
@@ -12555,7 +12767,7 @@ end
-- 1.2) CONTROLLABLE task methods
-- ------------------------------
-- Several controllable task methods are available that help you to prepare tasks.
--- These methods return a string consisting of the task description, which can then be given to either a @{Wrapper.Controllable#CONTROLLABLE.PushTask} or @{Wrapper.Controllable#SetTask} method to assign the task to the CONTROLLABLE.
+-- These methods return a string consisting of the task description, which can then be given to either a @{Controllable#CONTROLLABLE.PushTask} or @{Controllable#SetTask} method to assign the task to the CONTROLLABLE.
-- Tasks are specific for the category of the CONTROLLABLE, more specific, for AIR, GROUND or AIR and GROUND.
-- Each task description where applicable indicates for which controllable category the task is valid.
-- There are 2 main subdivisions of tasks: Assigned tasks and EnRoute tasks.
@@ -12581,7 +12793,7 @@ end
-- * @{#CONTROLLABLE.TaskHold}: (GROUND) Hold ground controllable from moving.
-- * @{#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the controllable.
-- * @{#CONTROLLABLE.TaskLand}: (AIR HELICOPTER) Landing at the ground. For helicopters only.
--- * @{#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the controllable at a @{Core.Zone#ZONE_RADIUS).
+-- * @{#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the controllable at a @{Zone#ZONE_RADIUS).
-- * @{#CONTROLLABLE.TaskOrbitCircle}: (AIR) Orbit at the current position of the first unit of the controllable at a specified alititude.
-- * @{#CONTROLLABLE.TaskOrbitCircleAtVec2}: (AIR) Orbit at a specified position at a specified alititude during a specified duration with a specified speed.
-- * @{#CONTROLLABLE.TaskRefueling}: (AIR) Refueling from the nearest tanker. No parameters.
@@ -12881,7 +13093,7 @@ end
--- Return a Combo Task taking an array of Tasks.
-- @param #CONTROLLABLE self
--- @param Dcs.DCSTasking.Task#TaskArray DCSTasks Array of @{Dcs.DCSTasking.Task#Task}
+-- @param Dcs.DCSTasking.Task#TaskArray DCSTasks Array of @{DCSTasking.Task#Task}
-- @return Dcs.DCSTasking.Task#Task
function CONTROLLABLE:TaskCombo( DCSTasks )
self:F2( { DCSTasks } )
@@ -13366,7 +13578,7 @@ function CONTROLLABLE:TaskLandAtVec2( Point, Duration )
return DCSTask
end
---- (AIR) Land the controllable at a @{Core.Zone#ZONE_RADIUS).
+--- (AIR) Land the controllable at a @{Zone#ZONE_RADIUS).
-- @param #CONTROLLABLE self
-- @param Core.Zone#ZONE Zone The zone where to land.
-- @param #number Duration The duration in seconds to stay on the ground.
@@ -13712,17 +13924,18 @@ end
--- (AIR) Attack the Unit.
-- @param #CONTROLLABLE self
--- @param Wrapper.Unit#UNIT AttackUnit The UNIT.
--- @param #number Priority All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
--- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
+-- @param Wrapper.Unit#UNIT EngageUnit The UNIT.
+-- @param #number Priority (optional) All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
+-- @param #boolean GroupAttack (optional) If true, all units in the group will attack the Unit when found.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- @param #number AttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
-- @param Dcs.DCSTypes#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
--- @param #boolean AttackQtyLimit (optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackControllable" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
+-- @param Dcs.DCSTypes#Distance Altitude (optional) Desired altitude to perform the unit engagement.
+-- @param #boolean Visible (optional) Unit must be visible.
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
-- @return Dcs.DCSTasking.Task#Task The DCS task structure.
-function CONTROLLABLE:EnRouteTaskEngageUnit( AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack )
- self:F2( { self.ControllableName, AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack } )
+function CONTROLLABLE:EnRouteTaskEngageUnit( EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack )
+ self:F2( { self.ControllableName, EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack } )
-- EngageUnit = {
-- id = 'EngageUnit',
@@ -13741,14 +13954,18 @@ function CONTROLLABLE:EnRouteTaskEngageUnit( AttackUnit, Priority, WeaponType, W
local DCSTask
DCSTask = { id = 'EngageUnit',
params = {
- unitId = AttackUnit:GetID(),
- weaponType = WeaponType,
- expend = WeaponExpend,
- attackQty = AttackQty,
+ unitId = EngageUnit:GetID(),
+ priority = Priority or 1,
+ groupAttack = GroupAttack or false,
+ visible = Visible or false,
+ expend = WeaponExpend or "Auto",
+ directionEnabled = Direction and true or false,
direction = Direction,
- attackQtyLimit = AttackQtyLimit,
+ altitudeEnabled = Altitude and true or false,
+ altitude = Altitude,
+ attackQtyLimit = AttackQty and true or false,
+ attackQty = AttackQty,
controllableAttack = ControllableAttack,
- priority = Priority,
},
},
@@ -14175,11 +14392,11 @@ function CONTROLLABLE:TaskRouteToZone( Zone, Randomize, Speed, Formation )
return nil
end
---- (AIR) Return the Controllable to an @{Wrapper.Airbase#AIRBASE}
+--- (AIR) Return the Controllable to an @{Airbase#AIRBASE}
-- A speed can be given in km/h.
-- A given formation can be given.
-- @param #CONTROLLABLE self
--- @param Wrapper.Airbase#AIRBASE ReturnAirbase The @{Wrapper.Airbase#AIRBASE} to return to.
+-- @param Wrapper.Airbase#AIRBASE ReturnAirbase The @{Airbase#AIRBASE} to return to.
-- @param #number Speed (optional) The speed.
-- @return #string The route
function CONTROLLABLE:RouteReturnToAirbase( ReturnAirbase, Speed )
@@ -14299,7 +14516,7 @@ function CONTROLLABLE:GetTaskRoute()
return routines.utils.deepCopy( _DATABASE.Templates.Controllables[self.ControllableName].Template.route.points )
end
---- Return the route of a controllable by using the @{Core.Database#DATABASE} class.
+--- Return the route of a controllable by using the @{Database#DATABASE} class.
-- @param #CONTROLLABLE self
-- @param #number Begin The route point from where the copy will start. The base route point is 0.
-- @param #number End The route point where the copy will end. The End point is the last point - the End point. The last point has base 0.
@@ -14724,7 +14941,7 @@ function CONTROLLABLE:OptionROTVertical()
end
--- Retrieve the controllable mission and allow to place function hooks within the mission waypoint plan.
--- Use the method @{Wrapper.Controllable#CONTROLLABLE:WayPointFunction} to define the hook functions for specific waypoints.
+-- Use the method @{Controllable#CONTROLLABLE:WayPointFunction} to define the hook functions for specific waypoints.
-- Use the method @{Controllable@CONTROLLABLE:WayPointExecute) to start the execution of the new mission plan.
-- Note that when WayPointInitialize is called, the Mission of the controllable is RESTARTED!
-- @param #CONTROLLABLE self
@@ -14824,9 +15041,9 @@ end
-- Message APIs--- This module contains the GROUP class.
--
--- 1) @{Wrapper.Group#GROUP} class, extends @{Wrapper.Controllable#CONTROLLABLE}
+-- 1) @{Group#GROUP} class, extends @{Controllable#CONTROLLABLE}
-- =============================================================
--- The @{Wrapper.Group#GROUP} class is a wrapper class to handle the DCS Group objects:
+-- The @{Group#GROUP} class is a wrapper class to handle the DCS Group objects:
--
-- * Support all DCS Group APIs.
-- * Enhance with Group specific APIs not in the DCS Group API set.
@@ -14860,7 +15077,7 @@ end
--
-- Group templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a group and assign it to another:
--
--- * @{Wrapper.Controllable#CONTROLLABLE.TaskMission}: (AIR + GROUND) Return a mission task from a mission template.
+-- * @{Controllable#CONTROLLABLE.TaskMission}: (AIR + GROUND) Return a mission task from a mission template.
--
-- ## 1.3) GROUP Command methods
--
@@ -14879,7 +15096,7 @@ end
-- * @{#GROUP.IsPartlyInZone}: Returns true if some units of the group are within a @{Zone}.
-- * @{#GROUP.IsNotInZone}: Returns true if none of the group units of the group are within a @{Zone}.
--
--- The zone can be of any @{Zone} class derived from @{Core.Zone#ZONE_BASE}. So, these methods are polymorphic to the zones tested on.
+-- The zone can be of any @{Zone} class derived from @{Zone#ZONE_BASE}. So, these methods are polymorphic to the zones tested on.
--
-- ## 1.6) GROUP AI methods
--
@@ -14937,6 +15154,8 @@ function GROUP:Register( GroupName )
local self = BASE:Inherit( self, CONTROLLABLE:New( GroupName ) )
self:F2( GroupName )
self.GroupName = GroupName
+
+ self:SetEventPriority( 4 )
return self
end
@@ -14978,7 +15197,7 @@ function GROUP:GetDCSObject()
return nil
end
---- Returns the @{Dcs.DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -15119,7 +15338,6 @@ function GROUP:GetUnit( UnitNumber )
if DCSGroup then
local UnitFound = UNIT:Find( DCSGroup:getUnit( UnitNumber ) )
- self:T3( UnitFound.UnitName )
self:T2( UnitFound )
return UnitFound
end
@@ -15272,7 +15490,7 @@ do -- Is Zone methods
--- Returns true if all units of the group are within a @{Zone}.
-- @param #GROUP self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the Group is completely within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
function GROUP:IsCompletelyInZone( Zone )
self:F2( { self.GroupName, Zone } )
@@ -15291,7 +15509,7 @@ end
--- Returns true if some units of the group are within a @{Zone}.
-- @param #GROUP self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the Group is completely within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
function GROUP:IsPartlyInZone( Zone )
self:F2( { self.GroupName, Zone } )
@@ -15308,7 +15526,7 @@ end
--- Returns true if none of the group units of the group are within a @{Zone}.
-- @param #GROUP self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the Group is completely within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
function GROUP:IsNotInZone( Zone )
self:F2( { self.GroupName, Zone } )
@@ -15525,7 +15743,7 @@ end
-- SPAWNING
--- Respawn the @{GROUP} using a (tweaked) template of the Group.
--- The template must be retrieved with the @{Wrapper.Group#GROUP.GetTemplate}() function.
+-- The template must be retrieved with the @{Group#GROUP.GetTemplate}() function.
-- The template contains all the definitions as declared within the mission file.
-- To understand templates, do the following:
--
@@ -15627,7 +15845,7 @@ function GROUP:GetTaskRoute()
return routines.utils.deepCopy( _DATABASE.Templates.Groups[self.GroupName].Template.route.points )
end
---- Return the route of a group by using the @{Core.Database#DATABASE} class.
+--- Return the route of a group by using the @{Database#DATABASE} class.
-- @param #GROUP self
-- @param #number Begin The route point from where the copy will start. The base route point is 0.
-- @param #number End The route point where the copy will end. The End point is the last point - the End point. The last point has base 0.
@@ -15724,7 +15942,7 @@ end
--- This module contains the UNIT class.
--
--- 1) @{#UNIT} class, extends @{Wrapper.Controllable#CONTROLLABLE}
+-- 1) @{#UNIT} class, extends @{Controllable#CONTROLLABLE}
-- ===========================================================
-- The @{#UNIT} class is a wrapper class to handle the DCS Unit objects:
--
@@ -15757,7 +15975,7 @@ end
-- ------------------
-- The DCS Unit APIs are used extensively within MOOSE. The UNIT class has for each DCS Unit API a corresponding method.
-- To be able to distinguish easily in your code the difference between a UNIT API call and a DCS Unit API call,
--- the first letter of the method is also capitalized. So, by example, the DCS Unit method @{Dcs.DCSWrapper.Unit#Unit.getName}()
+-- the first letter of the method is also capitalized. So, by example, the DCS Unit method @{DCSWrapper.Unit#Unit.getName}()
-- is implemented in the UNIT class as @{#UNIT.GetName}().
--
-- 1.3) Smoke, Flare Units
@@ -15784,7 +16002,7 @@ end
-- The UNIT class contains methods to test the location or proximity against zones or other objects.
--
-- ### 1.6.1) Zones
--- To test whether the Unit is within a **zone**, use the @{#UNIT.IsInZone}() or the @{#UNIT.IsNotInZone}() methods. Any zone can be tested on, but the zone must be derived from @{Core.Zone#ZONE_BASE}.
+-- To test whether the Unit is within a **zone**, use the @{#UNIT.IsInZone}() or the @{#UNIT.IsNotInZone}() methods. Any zone can be tested on, but the zone must be derived from @{Zone#ZONE_BASE}.
--
-- ### 1.6.2) Units
-- Test if another DCS Unit is within a given radius of the current DCS Unit, use the @{#UNIT.OtherUnitInRadius}() method.
@@ -15821,6 +16039,8 @@ UNIT = {
function UNIT:Register( UnitName )
local self = BASE:Inherit( self, CONTROLLABLE:New( UnitName ) )
self.UnitName = UnitName
+
+ self:SetEventPriority( 3 )
return self
end
@@ -16306,7 +16526,7 @@ end
--- Returns true if the unit is within a @{Zone}.
-- @param #UNIT self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the unit is within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the unit is within the @{Zone#ZONE_BASE}
function UNIT:IsInZone( Zone )
self:F2( { self.UnitName, Zone } )
@@ -16323,7 +16543,7 @@ end
--- Returns true if the unit is not within a @{Zone}.
-- @param #UNIT self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the unit is not within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the unit is not within the @{Zone#ZONE_BASE}
function UNIT:IsNotInZone( Zone )
self:F2( { self.UnitName, Zone } )
@@ -16560,13 +16780,38 @@ function UNIT:InAir()
return nil
end
---- This module contains the CLIENT class.
+do -- Event Handling
+
+ --- Subscribe to a DCS Event.
+ -- @param #UNIT self
+ -- @param Core.Event#EVENTS Event
+ -- @param #function EventFunction (optional) The function to be called when the event occurs for the unit.
+ -- @return #UNIT
+ function UNIT:HandleEvent( Event, EventFunction )
+
+ self:EventDispatcher():OnEventForUnit( self:GetName(), EventFunction, self, Event )
+
+ return self
+ end
+
+ --- UnSubscribe to a DCS event.
+ -- @param #UNIT self
+ -- @param Core.Event#EVENTS Event
+ -- @return #UNIT
+ function UNIT:UnHandleEvent( Event )
+
+ self:EventDispatcher():RemoveForUnit( self:GetName(), self, Event )
+
+ return self
+ end
+
+end--- This module contains the CLIENT class.
--
--- 1) @{Wrapper.Client#CLIENT} class, extends @{Wrapper.Unit#UNIT}
+-- 1) @{Client#CLIENT} class, extends @{Unit#UNIT}
-- ===============================================
-- Clients are those **Units** defined within the Mission Editor that have the skillset defined as __Client__ or __Player__.
-- Note that clients are NOT the same as Units, they are NOT necessarily alive.
--- The @{Wrapper.Client#CLIENT} class is a wrapper class to handle the DCS Unit objects that have the skillset defined as __Client__ or __Player__:
+-- The @{Client#CLIENT} class is a wrapper class to handle the DCS Unit objects that have the skillset defined as __Client__ or __Player__:
--
-- * Wraps the DCS Unit objects with skill level set to Player or Client.
-- * Support all DCS Unit APIs.
@@ -16597,7 +16842,6 @@ end
-- IMPORTANT: ONE SHOULD NEVER SANATIZE these CLIENT OBJECT REFERENCES! (make the CLIENT object references nil).
--
-- @module Client
--- @author FlightControl
--- The CLIENT class
-- @type CLIENT
@@ -16788,7 +17032,7 @@ end
--- Checks for a client alive event and calls a function on a continuous basis.
-- @param #CLIENT self
--- @param #function CallBack Function.
+-- @param #function CallBackFunction Create a function that will be called when a player joins the slot.
-- @return #CLIENT
function CLIENT:Alive( CallBackFunction, ... )
self:F()
@@ -16961,8 +17205,8 @@ function CLIENT:IsTransport()
return self.ClientTransport
end
---- Shows the @{AI.AI_Cargo#CARGO} contained within the CLIENT to the player as a message.
--- The @{AI.AI_Cargo#CARGO} is shown using the @{Core.Message#MESSAGE} distribution system.
+--- Shows the @{AI_Cargo#CARGO} contained within the CLIENT to the player as a message.
+-- The @{AI_Cargo#CARGO} is shown using the @{Message#MESSAGE} distribution system.
-- @param #CLIENT self
function CLIENT:ShowCargo()
self:F()
@@ -16995,7 +17239,7 @@ end
-- @param #string Message is the text describing the message.
-- @param #number MessageDuration is the duration in seconds that the Message should be displayed.
-- @param #string MessageCategory is the category of the message (the title).
--- @param #number MessageInterval is the interval in seconds between the display of the @{Core.Message#MESSAGE} when the CLIENT is in the air.
+-- @param #number MessageInterval is the interval in seconds between the display of the @{Message#MESSAGE} when the CLIENT is in the air.
-- @param #string MessageID is the identifier of the message when displayed with intervals.
function CLIENT:Message( Message, MessageDuration, MessageCategory, MessageInterval, MessageID )
self:F( { Message, MessageDuration, MessageCategory, MessageInterval } )
@@ -17036,11 +17280,11 @@ function CLIENT:Message( Message, MessageDuration, MessageCategory, MessageInter
end
--- This module contains the STATIC class.
--
--- 1) @{Wrapper.Static#STATIC} class, extends @{Wrapper.Positionable#POSITIONABLE}
+-- 1) @{Static#STATIC} class, extends @{Positionable#POSITIONABLE}
-- ===============================================================
-- Statics are **Static Units** defined within the Mission Editor.
-- Note that Statics are almost the same as Units, but they don't have a controller.
--- The @{Wrapper.Static#STATIC} class is a wrapper class to handle the DCS Static objects:
+-- The @{Static#STATIC} class is a wrapper class to handle the DCS Static objects:
--
-- * Wraps the DCS Static objects.
-- * Support all DCS Static APIs.
@@ -17119,7 +17363,7 @@ end
--
-- ===
--
--- 1) @{Wrapper.Airbase#AIRBASE} class, extends @{Wrapper.Positionable#POSITIONABLE}
+-- 1) @{Airbase#AIRBASE} class, extends @{Positionable#POSITIONABLE}
-- =================================================================
-- The @{AIRBASE} class is a wrapper class to handle the DCS Airbase objects:
--
@@ -17150,7 +17394,7 @@ end
-- ---------------------
-- The DCS Airbase APIs are used extensively within MOOSE. The AIRBASE class has for each DCS Airbase API a corresponding method.
-- To be able to distinguish easily in your code the difference between a AIRBASE API call and a DCS Airbase API call,
--- the first letter of the method is also capitalized. So, by example, the DCS Airbase method @{Dcs.DCSWrapper.Airbase#Airbase.getName}()
+-- the first letter of the method is also capitalized. So, by example, the DCS Airbase method @{DCSWrapper.Airbase#Airbase.getName}()
-- is implemented in the AIRBASE class as @{#AIRBASE.GetName}().
--
-- More functions will be added
@@ -17277,9 +17521,9 @@ function SCORING:New( GameName )
end
- _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnHit( self._EventOnHit, self )
+ self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Hit, self._EventOnHit )
--self.SchedulerId = routines.scheduleFunction( SCORING._FollowPlayersScheduled, { self }, 0, 5 )
self.SchedulerId = SCHEDULER:New( self, self._FollowPlayersScheduled, {}, 0, 5 )
@@ -18116,7 +18360,7 @@ function CLEANUP:_DestroyGroup( GroupObject, CleanUpGroupName )
end
end
---- Destroys a @{Dcs.DCSWrapper.Unit#Unit} from the simulator, but checks first if it is still existing!
+--- Destroys a @{DCSWrapper.Unit#Unit} from the simulator, but checks first if it is still existing!
-- @param #CLEANUP self
-- @param Dcs.DCSWrapper.Unit#Unit CleanUpUnit The object to be destroyed.
-- @param #string CleanUpUnitName The Unit name ...
@@ -18253,7 +18497,7 @@ function CLEANUP:_EventHitCleanUp( Event )
end
end
---- Add the @{Dcs.DCSWrapper.Unit#Unit} to the CleanUpList for CleanUp.
+--- Add the @{DCSWrapper.Unit#Unit} to the CleanUpList for CleanUp.
function CLEANUP:_AddForCleanUp( CleanUpUnit, CleanUpUnitName )
self:F( { CleanUpUnit, CleanUpUnitName } )
@@ -18372,9 +18616,14 @@ function CLEANUP:_CleanUpScheduler()
return true
end
---- This module contains the SPAWN class.
+--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**All** --
+-- **Spawn groups of units dynamically in your missions.**
+--
+-- 
--
--- # 1) @{Functional.Spawn#SPAWN} class, extends @{Core.Base#BASE}
+-- ===
+--
+-- # 1) @{#SPAWN} class, extends @{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.
@@ -18416,7 +18665,7 @@ end
-- * @{#SPAWN.InitLimit}(): Limits the amount of groups that can be alive at the same time and that can be dynamically spawned.
-- * @{#SPAWN.InitRandomizeRoute}(): Randomize the routes of spawned groups, and for air groups also optionally the height.
-- * @{#SPAWN.InitRandomizeTemplate}(): Randomize the group templates so that when a new group is spawned, a random group template is selected from one of the templates defined.
--- * @{#SPAWN.InitUncontrolled}(): Spawn plane groups uncontrolled.
+-- * @{#SPAWN.InitUnControlled}(): Spawn plane groups uncontrolled.
-- * @{#SPAWN.InitArray}(): Make groups visible before they are actually activated, and order these groups like a batallion in an array.
-- * @{#SPAWN.InitRepeat}(): Re-spawn groups when they land at the home base. Similar methods are @{#SPAWN.InitRepeatOnLanding} and @{#SPAWN.InitRepeatOnEngineShutDown}.
-- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Unit}s in the @{Group} that is spawned within a **radius band**, given an Outer and Inner radius.
@@ -18486,6 +18735,8 @@ end
--
-- Hereby the change log:
--
+-- 2017-02-04: SPAWN:InitUnControlled( **UnControlled** ) replaces SPAWN:InitUnControlled().
+--
-- 2017-01-24: SPAWN:**InitAIOnOff( AIOnOff )** added.
--
-- 2017-01-24: SPAWN:**InitAIOn()** added.
@@ -18586,6 +18837,7 @@ function SPAWN:New( SpawnTemplatePrefix )
self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false.
self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
self.AIOnOff = true -- The AI is on by default when spawning a group.
+ self.SpawnUnControlled = false
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@@ -18624,6 +18876,7 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false.
self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
self.AIOnOff = true -- The AI is on by default when spawning a group.
+ self.SpawnUnControlled = false
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@@ -19020,6 +19273,12 @@ function SPAWN:SpawnWithIndex( SpawnIndex )
self:T( 'SpawnTemplate.units['..UnitID..'].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units['..UnitID..'].y = ' .. SpawnTemplate.units[UnitID].y )
end
end
+
+ if SpawnTemplate.CategoryID == Group.Category.HELICOPTER or SpawnTemplate.CategoryID == Group.Category.AIRPLANE then
+ if SpawnTemplate.route.points[1].type == "TakeOffParking" then
+ SpawnTemplate.uncontrolled = self.SpawnUnControlled
+ end
+ end
end
_EVENTDISPATCHER:OnBirthForTemplate( SpawnTemplate, self._OnBirth, self )
@@ -19108,7 +19367,7 @@ end
--- Allows to place a CallFunction hook when a new group spawns.
-- The provided method will be called when a new group is spawned, including its given parameters.
--- The first parameter of the SpawnFunction is the @{Wrapper.Group#GROUP} that was spawned.
+-- The first parameter of the SpawnFunction is the @{Group#GROUP} that was spawned.
-- @param #SPAWN self
-- @param #function SpawnCallBackFunction The function to be called when a group spawns.
-- @param SpawnFunctionArguments A random amount of arguments to be provided to the function when the group spawns.
@@ -19248,7 +19507,7 @@ function SPAWN:SpawnFromStatic( HostStatic, SpawnIndex )
end
--- Will spawn a Group within a given @{Zone}.
--- The @{Zone} can be of any type derived from @{Core.Zone#ZONE_BASE}.
+-- The @{Zone} can be of any type derived from @{Zone#ZONE_BASE}.
-- Once the @{Group} is spawned within the zone, the @{Group} will continue on its route.
-- The **first waypoint** (where the group is spawned) is replaced with the zone location coordinates.
-- @param #SPAWN self
@@ -19271,17 +19530,20 @@ function SPAWN:SpawnInZone( Zone, RandomizeGroup, SpawnIndex )
return nil
end
---- (AIR) Will spawn a plane group in uncontrolled mode...
+--- (**AIR**) Will spawn a plane group in UnControlled or Controlled mode...
-- This will be similar to the uncontrolled flag setting in the ME.
+-- You can use UnControlled mode to simulate planes startup and ready for take-off but aren't moving (yet).
+-- ReSpawn the plane in Controlled mode, and the plane will move...
-- @param #SPAWN self
+-- @param #boolean UnControlled true if UnControlled, false if Controlled.
-- @return #SPAWN self
-function SPAWN:InitUnControlled()
- self:F( { self.SpawnTemplatePrefix } )
+function SPAWN:InitUnControlled( UnControlled )
+ self:F2( { self.SpawnTemplatePrefix, UnControlled } )
- self.SpawnUnControlled = true
+ self.SpawnUnControlled = UnControlled
for SpawnGroupID = 1, self.SpawnMaxGroups do
- self.SpawnGroups[SpawnGroupID].UnControlled = true
+ self.SpawnGroups[SpawnGroupID].UnControlled = UnControlled
end
return self
@@ -19601,9 +19863,6 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex )
SpawnTemplate.visible = false
end
- if SpawnTemplate.CategoryID == Group.Category.HELICOPTER or SpawnTemplate.CategoryID == Group.Category.AIRPLANE then
- SpawnTemplate.uncontrolled = false
- end
for UnitID = 1, #SpawnTemplate.units do
SpawnTemplate.units[UnitID].name = string.format( SpawnTemplate.name .. '-%02d', UnitID )
@@ -20308,7 +20567,7 @@ end
-- ============================
-- Create a new SPAWN object with the @{#ESCORT.New} method:
--
--- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Wrapper.Group#GROUP} for a @{Wrapper.Client#CLIENT}, with an optional briefing text.
+-- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Group#GROUP} for a @{Client#CLIENT}, with an optional briefing text.
--
-- ESCORT initialization methods.
-- ==============================
@@ -21511,7 +21770,7 @@ end
--
-- ===
--
--- 1) @{Functional.MissileTrainer#MISSILETRAINER} class, extends @{Core.Base#BASE}
+-- 1) @{MissileTrainer#MISSILETRAINER} class, extends @{Base#BASE}
-- ===============================================================
-- The @{#MISSILETRAINER} class uses the DCS world messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft,
-- the class will destroy the missile within a certain range, to avoid damage to your aircraft.
@@ -22218,9 +22477,9 @@ end
--
-- ===
--
--- 1) @{Functional.AirbasePolice#AIRBASEPOLICE_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{AirbasePolice#AIRBASEPOLICE_BASE} class, extends @{Base#BASE}
-- ==================================================================
--- The @{Functional.AirbasePolice#AIRBASEPOLICE_BASE} class provides the main methods to monitor CLIENT behaviour at airbases.
+-- The @{AirbasePolice#AIRBASEPOLICE_BASE} class provides the main methods to monitor CLIENT behaviour at airbases.
-- CLIENTS should not be allowed to:
--
-- * Don't taxi faster than 40 km/h.
@@ -22228,7 +22487,7 @@ end
-- * Avoid to hit other planes on the airbase.
-- * Obey ground control orders.
--
--- 2) @{Functional.AirbasePolice#AIRBASEPOLICE_CAUCASUS} class, extends @{Functional.AirbasePolice#AIRBASEPOLICE_BASE}
+-- 2) @{AirbasePolice#AIRBASEPOLICE_CAUCASUS} class, extends @{AirbasePolice#AIRBASEPOLICE_BASE}
-- =============================================================================================
-- All the airbases on the caucasus map can be monitored using this class.
-- If you want to monitor specific airbases, you need to use the @{#AIRBASEPOLICE_BASE.Monitor}() method, which takes a table or airbase names.
@@ -22255,7 +22514,7 @@ end
-- * TbilisiLochini
-- * Vaziani
--
--- 3) @{Functional.AirbasePolice#AIRBASEPOLICE_NEVADA} class, extends @{Functional.AirbasePolice#AIRBASEPOLICE_BASE}
+-- 3) @{AirbasePolice#AIRBASEPOLICE_NEVADA} class, extends @{AirbasePolice#AIRBASEPOLICE_BASE}
-- =============================================================================================
-- All the airbases on the NEVADA map can be monitored using this class.
-- If you want to monitor specific airbases, you need to use the @{#AIRBASEPOLICE_BASE.Monitor}() method, which takes a table or airbase names.
@@ -22398,7 +22657,8 @@ function AIRBASEPOLICE_BASE:_AirbaseMonitor()
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
else
MESSAGE:New( "Player " .. Client:GetPlayerName() .. " has been removed from the airbase, due to a speeding violation ...", 10, "Airbase Police" ):ToAll()
- Client:GetGroup():Destroy()
+ Client:Destroy()
+ trigger.action.setUserFlag( "AIRCRAFT_"..Client:GetID(), 100)
Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0 )
end
@@ -23413,14 +23673,14 @@ end
--
-- ===
--
--- 1) @{Functional.Detection#DETECTION_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{Detection#DETECTION_BASE} class, extends @{Base#BASE}
-- ==========================================================
--- The @{Functional.Detection#DETECTION_BASE} class defines the core functions to administer detected objects.
--- The @{Functional.Detection#DETECTION_BASE} class will detect objects within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s).
+-- The @{Detection#DETECTION_BASE} class defines the core functions to administer detected objects.
+-- The @{Detection#DETECTION_BASE} class will detect objects within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s).
--
-- 1.1) DETECTION_BASE constructor
-- -------------------------------
--- Construct a new DETECTION_BASE instance using the @{Functional.Detection#DETECTION_BASE.New}() method.
+-- Construct a new DETECTION_BASE instance using the @{Detection#DETECTION_BASE.New}() method.
--
-- 1.2) DETECTION_BASE initialization
-- ----------------------------------
@@ -23431,46 +23691,46 @@ end
--
-- Use the following functions to report the objects it detected using the methods Visual, Optical, Radar, IRST, RWR, DLINK:
--
--- * @{Functional.Detection#DETECTION_BASE.InitDetectVisual}(): Detected using Visual.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectOptical}(): Detected using Optical.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectRadar}(): Detected using Radar.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectIRST}(): Detected using IRST.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectRWR}(): Detected using RWR.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectDLINK}(): Detected using DLINK.
+-- * @{Detection#DETECTION_BASE.InitDetectVisual}(): Detected using Visual.
+-- * @{Detection#DETECTION_BASE.InitDetectOptical}(): Detected using Optical.
+-- * @{Detection#DETECTION_BASE.InitDetectRadar}(): Detected using Radar.
+-- * @{Detection#DETECTION_BASE.InitDetectIRST}(): Detected using IRST.
+-- * @{Detection#DETECTION_BASE.InitDetectRWR}(): Detected using RWR.
+-- * @{Detection#DETECTION_BASE.InitDetectDLINK}(): Detected using DLINK.
--
-- 1.3) Obtain objects detected by DETECTION_BASE
-- ----------------------------------------------
--- DETECTION_BASE builds @{Set}s of objects detected. These @{Core.Set#SET_BASE}s can be retrieved using the method @{Functional.Detection#DETECTION_BASE.GetDetectedSets}().
--- The method will return a list (table) of @{Core.Set#SET_BASE} objects.
+-- DETECTION_BASE builds @{Set}s of objects detected. These @{Set#SET_BASE}s can be retrieved using the method @{Detection#DETECTION_BASE.GetDetectedSets}().
+-- The method will return a list (table) of @{Set#SET_BASE} objects.
--
-- ===
--
--- 2) @{Functional.Detection#DETECTION_AREAS} class, extends @{Functional.Detection#DETECTION_BASE}
+-- 2) @{Detection#DETECTION_AREAS} class, extends @{Detection#DETECTION_BASE}
-- ===============================================================================
--- The @{Functional.Detection#DETECTION_AREAS} class will detect units within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s),
--- and will build a list (table) of @{Core.Set#SET_UNIT}s containing the @{Wrapper.Unit#UNIT}s detected.
+-- The @{Detection#DETECTION_AREAS} class will detect units within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s),
+-- and will build a list (table) of @{Set#SET_UNIT}s containing the @{Unit#UNIT}s detected.
-- The class is group the detected units within zones given a DetectedZoneRange parameter.
-- A set with multiple detected zones will be created as there are groups of units detected.
--
-- 2.1) Retrieve the Detected Unit sets and Detected Zones
-- -------------------------------------------------------
--- The DetectedUnitSets methods are implemented in @{Functional.Detection#DECTECTION_BASE} and the DetectedZones methods is implemented in @{Functional.Detection#DETECTION_AREAS}.
+-- The DetectedUnitSets methods are implemented in @{Detection#DECTECTION_BASE} and the DetectedZones methods is implemented in @{Detection#DETECTION_AREAS}.
--
--- Retrieve the DetectedUnitSets with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSets}(). A table will be return of @{Core.Set#SET_UNIT}s.
--- To understand the amount of sets created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectedSetCount}().
--- If you want to obtain a specific set from the DetectedSets, use the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}() with a given index.
+-- Retrieve the DetectedUnitSets with the method @{Detection#DETECTION_BASE.GetDetectedSets}(). A table will be return of @{Set#SET_UNIT}s.
+-- To understand the amount of sets created, use the method @{Detection#DETECTION_BASE.GetDetectedSetCount}().
+-- If you want to obtain a specific set from the DetectedSets, use the method @{Detection#DETECTION_BASE.GetDetectedSet}() with a given index.
--
--- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}().
--- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}().
--- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
+-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Detection#DETECTION_BASE.GetDetectionZones}().
+-- To understand the amount of zones created, use the method @{Detection#DETECTION_BASE.GetDetectionZoneCount}().
+-- If you want to obtain a specific zone from the DetectedZones, use the method @{Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
--
-- 1.4) Flare or Smoke detected units
-- ----------------------------------
--- Use the methods @{Functional.Detection#DETECTION_AREAS.FlareDetectedUnits}() or @{Functional.Detection#DETECTION_AREAS.SmokeDetectedUnits}() to flare or smoke the detected units when a new detection has taken place.
+-- Use the methods @{Detection#DETECTION_AREAS.FlareDetectedUnits}() or @{Detection#DETECTION_AREAS.SmokeDetectedUnits}() to flare or smoke the detected units when a new detection has taken place.
--
-- 1.5) Flare or Smoke detected zones
-- ----------------------------------
--- Use the methods @{Functional.Detection#DETECTION_AREAS.FlareDetectedZones}() or @{Functional.Detection#DETECTION_AREAS.SmokeDetectedZones}() to flare or smoke the detected zones when a new detection has taken place.
+-- Use the methods @{Detection#DETECTION_AREAS.FlareDetectedZones}() or @{Detection#DETECTION_AREAS.SmokeDetectedZones}() to flare or smoke the detected zones when a new detection has taken place.
--
-- ===
--
@@ -23656,7 +23916,7 @@ function DETECTION_BASE:GetDetectedObject( ObjectName )
return nil
end
---- Get the detected @{Core.Set#SET_BASE}s.
+--- Get the detected @{Set#SET_BASE}s.
-- @param #DETECTION_BASE self
-- @return #DETECTION_BASE.DetectedSets DetectedSets
function DETECTION_BASE:GetDetectedSets()
@@ -23719,12 +23979,12 @@ function DETECTION_BASE:Schedule( DelayTime, RepeatInterval )
self.ScheduleDelayTime = DelayTime
self.ScheduleRepeatInterval = RepeatInterval
- self.DetectionScheduler = SCHEDULER:New(self, self._DetectionScheduler, { self, "Detection" }, DelayTime, RepeatInterval )
+ self.DetectionScheduler = SCHEDULER:New( self, self._DetectionScheduler, { self, "Detection" }, DelayTime, RepeatInterval )
return self
end
---- Form @{Set}s of detected @{Wrapper.Unit#UNIT}s in an array of @{Core.Set#SET_BASE}s.
+--- Form @{Set}s of detected @{Unit#UNIT}s in an array of @{Set#SET_BASE}s.
-- @param #DETECTION_BASE self
function DETECTION_BASE:_DetectionScheduler( SchedulerName )
self:F2( { SchedulerName } )
@@ -23844,7 +24104,7 @@ function DETECTION_AREAS:New( DetectionSetGroup, DetectionRange, DetectionZoneRa
self._SmokeDetectedZones = false
self._FlareDetectedZones = false
- self:Schedule( 0, 30 )
+ self:Schedule( 10, 10 )
return self
end
@@ -23898,7 +24158,7 @@ function DETECTION_AREAS:GetDetectedAreaCount()
return DetectedAreaCount
end
---- Get the @{Core.Set#SET_UNIT} of a detecttion area using a given numeric index.
+--- Get the @{Set#SET_UNIT} of a detecttion area using a given numeric index.
-- @param #DETECTION_AREAS self
-- @param #number Index
-- @return Core.Set#SET_UNIT DetectedSet
@@ -23912,7 +24172,7 @@ function DETECTION_AREAS:GetDetectedSet( Index )
return nil
end
---- Get the @{Core.Zone#ZONE_UNIT} of a detection area using a given numeric index.
+--- Get the @{Zone#ZONE_UNIT} of a detection area using a given numeric index.
-- @param #DETECTION_AREAS self
-- @param #number Index
-- @return Core.Zone#ZONE_UNIT DetectedZone
@@ -24399,17 +24659,16 @@ end
-- even when there are hardly any players in the mission.**
--
-- 
---
---
+--
-- ===
--
--- # 1) @{AI.AI_Balancer#AI_BALANCER} class, extends @{Core.Fsm#FSM_SET}
+-- # 1) @{AI_Balancer#AI_BALANCER} class, extends @{Fsm#FSM_SET}
--
--- The @{AI.AI_Balancer#AI_BALANCER} class monitors and manages as many replacement AI groups as there are
+-- The @{AI_Balancer#AI_BALANCER} class monitors and manages as many replacement AI groups as there are
-- CLIENTS in a SET_CLIENT collection, which are not occupied by human players.
-- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.
--
--- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
+-- The parent class @{Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
-- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods.
-- An explanation about state and event transition methods can be found in the @{FSM} module documentation.
--
@@ -24451,8 +24710,8 @@ end
-- However, there are 2 additional options that you can use to customize the destroy behaviour.
-- When a human player joins a slot, you can configure to let the AI return to:
--
--- * @{#AI_BALANCER.ReturnToHomeAirbase}: Returns the AI to the **home** @{Wrapper.Airbase#AIRBASE}.
--- * @{#AI_BALANCER.ReturnToNearestAirbases}: Returns the AI to the **nearest friendly** @{Wrapper.Airbase#AIRBASE}.
+-- * @{#AI_BALANCER.ReturnToHomeAirbase}: Returns the AI to the **home** @{Airbase#AIRBASE}.
+-- * @{#AI_BALANCER.ReturnToNearestAirbases}: Returns the AI to the **nearest friendly** @{Airbase#AIRBASE}.
--
-- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return,
-- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed.
@@ -24548,10 +24807,10 @@ function AI_BALANCER:InitSpawnInterval( Earliest, Latest )
return self
end
---- Returns the AI to the nearest friendly @{Wrapper.Airbase#AIRBASE}.
+--- Returns the AI to the nearest friendly @{Airbase#AIRBASE}.
-- @param #AI_BALANCER self
--- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Wrapper.Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Wrapper.Airbase#AIRBASE}.
--- @param Core.Set#SET_AIRBASE ReturnAirbaseSet The SET of @{Core.Set#SET_AIRBASE}s to evaluate where to return to.
+-- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Airbase#AIRBASE}.
+-- @param Core.Set#SET_AIRBASE ReturnAirbaseSet The SET of @{Set#SET_AIRBASE}s to evaluate where to return to.
function AI_BALANCER:ReturnToNearestAirbases( ReturnTresholdRange, ReturnAirbaseSet )
self.ToNearestAirbase = true
@@ -24559,9 +24818,9 @@ function AI_BALANCER:ReturnToNearestAirbases( ReturnTresholdRange, ReturnAirbase
self.ReturnAirbaseSet = ReturnAirbaseSet
end
---- Returns the AI to the home @{Wrapper.Airbase#AIRBASE}.
+--- Returns the AI to the home @{Airbase#AIRBASE}.
-- @param #AI_BALANCER self
--- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Wrapper.Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Wrapper.Airbase#AIRBASE}.
+-- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Airbase#AIRBASE}.
function AI_BALANCER:ReturnToHomeAirbase( ReturnTresholdRange )
self.ToHomeAirbase = true
@@ -24698,14 +24957,14 @@ end
---- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Air Patrolling or Staging.**
+--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** --
+-- **Air Patrolling or Staging.**
--
-- 
--
---
-- ===
--
--- # 1) @{#AI_PATROL_ZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE}
+-- # 1) @{#AI_PATROL_ZONE} class, extends @{Fsm#FSM_CONTROLLABLE}
--
-- The @{#AI_PATROL_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}.
--
@@ -24867,13 +25126,14 @@ AI_PATROL_ZONE = {
-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h.
-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h.
+-- @param Dcs.DCSTypes#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
-- @return #AI_PATROL_ZONE self
-- @usage
-- -- Define a new AI_PATROL_ZONE Object. This PatrolArea will patrol an AIControllable within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h.
-- PatrolZone = ZONE:New( 'PatrolZone' )
-- PatrolSpawn = SPAWN:New( 'Patrol Group' )
-- PatrolArea = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 600, 900 )
-function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed )
+function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
-- Inherits from BASE
local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- #AI_PATROL_ZONE
@@ -24885,14 +25145,16 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
self.PatrolMinSpeed = PatrolMinSpeed
self.PatrolMaxSpeed = PatrolMaxSpeed
- self:SetDetectionOn()
-
+ -- defafult PatrolAltType to "RADIO" if not specified
+ self.PatrolAltType = PatrolAltType or "RADIO"
+
+ self:SetDetectionInterval( 30 )
+
self.CheckStatus = true
self:ManageFuel( .2, 60 )
self:ManageDamage( 1 )
- self:SetDetectionInterval( 30 )
self.DetectedUnits = {} -- This table contains the targets detected during patrol.
@@ -25146,7 +25408,7 @@ end
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:SetDetectionOn()
self:F2()
-
+
self.DetectOn = true
end
@@ -25156,7 +25418,7 @@ end
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:SetDetectionOff()
self:F2()
-
+
self.DetectOn = false
end
@@ -25175,8 +25437,9 @@ end
function AI_PATROL_ZONE:SetDetectionActivated()
self:F2()
+ self:ClearDetectedUnits()
self.DetectActivated = true
- self:__Detect( self.DetectInterval )
+ self:__Detect( -self.DetectInterval )
end
--- Deactivate the detection. The AI will NOT detect for targets.
@@ -25185,6 +25448,7 @@ end
function AI_PATROL_ZONE:SetDetectionDeactivated()
self:F2()
+ self:ClearDetectedUnits()
self.DetectActivated = false
end
@@ -25220,17 +25484,23 @@ function AI_PATROL_ZONE:SetDetectionZone( DetectionZone )
end
end
---- Gets a list of @{Wrapper.Unit#UNIT}s that were detected by the AI.
+--- Gets a list of @{Unit#UNIT}s that were detected by the AI.
-- No filtering is applied, so, ANY detected UNIT can be in this list.
-- It is up to the mission designer to use the @{Unit} class and methods to filter the targets.
-- @param #AI_PATROL_ZONE self
--- @return #table The list of @{Wrapper.Unit#UNIT}s
+-- @return #table The list of @{Unit#UNIT}s
function AI_PATROL_ZONE:GetDetectedUnits()
self:F2()
return self.DetectedUnits
end
+--- Clears the list of @{Unit#UNIT}s that were detected by the AI.
+-- @param #AI_PATROL_ZONE self
+function AI_PATROL_ZONE:ClearDetectedUnits()
+ self:F2()
+ self.DetectedUnits = {}
+end
--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated.
@@ -25280,10 +25550,9 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
self:__Status( 60 ) -- Check status status every 30 seconds.
self:SetDetectionActivated()
- self:EventOnPilotDead( self.OnPilotDead )
- self:EventOnCrash( self.OnCrash )
- self:EventOnEjection( self.OnEjection )
-
+ self:HandleEvent( EVENTS.PilotDead, self.OnPilotDead )
+ self:HandleEvent( EVENTS.Crash, self.OnCrash )
+ self:HandleEvent( EVENTS.Ejection, self.OnEjection )
Controllable:OptionROEHoldFire()
Controllable:OptionROTVertical()
@@ -25295,6 +25564,8 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
self:__Route( 5 )
end
)
+
+ self:SetDetectionOn()
end
@@ -25315,7 +25586,7 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
local DetectedTargets = Controllable:GetDetectedTargets()
for TargetID, Target in pairs( DetectedTargets or {} ) do
local TargetObject = Target.object
- self:T( TargetObject )
+
if TargetObject and TargetObject:isExist() and TargetObject.id_ < 50000000 then
local TargetUnit = UNIT:Find( TargetObject )
@@ -25324,18 +25595,22 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
if self.DetectionZone then
if TargetUnit:IsInZone( self.DetectionZone ) then
self:T( {"Detected ", TargetUnit } )
- self.DetectedUnits[TargetUnit] = TargetUnit
+ if self.DetectedUnits[TargetUnit] == nil then
+ self.DetectedUnits[TargetUnit] = true
+ end
Detected = true
end
else
- self.DetectedUnits[TargetUnit] = TargetUnit
+ if self.DetectedUnits[TargetUnit] == nil then
+ self.DetectedUnits[TargetUnit] = true
+ end
Detected = true
end
end
end
-
- self:__Detect( self.DetectInterval )
+ self:__Detect( -self.DetectInterval )
+
if Detected == true then
self:__Detected( 1.5 )
end
@@ -25390,7 +25665,7 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
local CurrentRoutePoint = CurrentPointVec3:RoutePointAir(
- POINT_VEC3.RoutePointAltType.BARO,
+ self.PatrolAltType,
POINT_VEC3.RoutePointType.TakeOffParking,
POINT_VEC3.RoutePointAction.FromParkingArea,
ToPatrolZoneSpeed,
@@ -25405,7 +25680,7 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
local CurrentRoutePoint = CurrentPointVec3:RoutePointAir(
- POINT_VEC3.RoutePointAltType.BARO,
+ self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
ToPatrolZoneSpeed,
@@ -25431,7 +25706,7 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
--- Create a route point of type air.
local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir(
- POINT_VEC3.RoutePointAltType.BARO,
+ self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
ToTargetSpeed,
@@ -25519,7 +25794,7 @@ function AI_PATROL_ZONE:onafterRTB()
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
local ToPatrolZoneSpeed = self.PatrolMaxSpeed
local CurrentRoutePoint = CurrentPointVec3:RoutePointAir(
- POINT_VEC3.RoutePointAltType.BARO,
+ self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
ToPatrolZoneSpeed,
@@ -25570,17 +25845,16 @@ function AI_PATROL_ZONE:OnPilotDead( EventData )
self:__PilotDead( 1, EventData )
end
end
-
---- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Provide Close Air Support to friendly ground troops.**
+--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** --
+-- **Provide Close Air Support to friendly ground troops.**
--
-- 
--
---
-- ===
--
--- # 1) @{#AI_CAS_ZONE} class, extends @{AI.AI_Patrol#AI_PATROL_ZONE}
+-- # 1) @{#AI_CAS_ZONE} class, extends @{AI_Patrol#AI_PATROL_ZONE}
--
--- @{#AI_CAS_ZONE} derives from the @{AI.AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour.
+-- @{#AI_CAS_ZONE} derives from the @{AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour.
--
-- The @{#AI_CAS_ZONE} class implements the core functions to provide Close Air Support in an Engage @{Zone} by an AIR @{Controllable} or @{Group}.
-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
@@ -25709,18 +25983,19 @@ AI_CAS_ZONE = {
-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h.
-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h.
+-- @param Dcs.DCSTypes#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
-- @param Core.Zone#ZONE EngageZone
-- @return #AI_CAS_ZONE self
-function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone )
+function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone, PatrolAltType )
-- Inherits from BASE
- local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) ) -- #AI_CAS_ZONE
+ local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) ) -- #AI_CAS_ZONE
self.EngageZone = EngageZone
self.Accomplished = false
self:SetDetectionZone( self.EngageZone )
-
+
self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE.
--- OnBefore Transition Handler for Event Engage.
@@ -25730,6 +26005,12 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
+ -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
+ -- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+ -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
+ -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+ -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
+
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Engage.
@@ -25739,6 +26020,11 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
+ -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
+ -- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+ -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
+ -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+ -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
--- Synchronous Event Trigger for Event Engage.
-- @function [parent=#AI_CAS_ZONE] Engage
@@ -25766,6 +26052,8 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string Event The Event string.
-- @param #string To The To State string.
+ self:AddTransition( "Engaging", "Target", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE.
+
self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE.
--- OnBefore Transition Handler for Event Fired.
@@ -25909,8 +26197,9 @@ function AI_CAS_ZONE:onafterStart( Controllable, From, Event, To )
-- Call the parent Start event handler
self:GetParent(self).onafterStart( self, Controllable, From, Event, To )
- self:EventOnDead( self.OnDead )
+ self:HandleEvent( EVENTS.Dead, self.OnDead )
+ self:SetDetectionDeactivated() -- When not engaging, set the detection off.
end
--- @param Wrapper.Controllable#CONTROLLABLE AIControllable
@@ -25933,15 +26222,62 @@ function AI_CAS_ZONE:onbeforeEngage( Controllable, From, Event, To )
end
end
+--- @param #AI_CAS_ZONE self
+-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
+-- @param #string From The From State string.
+-- @param #string Event The Event string.
+-- @param #string To The To State string.
+function AI_CAS_ZONE:onafterTarget( Controllable, From, Event, To )
+ self:E("onafterTarget")
+
+ if Controllable:IsAlive() then
+
+ local AttackTasks = {}
+
+ for DetectedUnit, Detected in pairs( self.DetectedUnits ) do
+ local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
+ if DetectedUnit:IsAlive() then
+ if DetectedUnit:IsInZone( self.EngageZone ) then
+ if Detected == true then
+ self:E( {"Target: ", DetectedUnit } )
+ self.DetectedUnits[DetectedUnit] = false
+ local AttackTask = Controllable:EnRouteTaskEngageUnit( DetectedUnit, 1, true, self.EngageWeaponExpend, self.EngageAttackQty, self.EngageDirection, self.EngageAltitude, nil )
+ self.Controllable:PushTask( AttackTask, 1 )
+ end
+ end
+ else
+ self.DetectedUnits[DetectedUnit] = nil
+ end
+ end
+
+ self:__Target( -10 )
+
+ end
+end
+
+
--- @param #AI_CAS_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
+-- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
+-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+-- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
+-- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+-- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
+function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection )
+ self:E("onafterEngage")
+
+ self.EngageSpeed = EngageSpeed or 400
+ self.EngageAltitude = EngageAltitude or 2000
+ self.EngageWeaponExpend = EngageWeaponExpend
+ self.EngageAttackQty = EngageAttackQty
+ self.EngageDirection = EngageDirection
if Controllable:IsAlive() then
+
local EngageRoute = {}
@@ -25953,10 +26289,10 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
local ToEngageZoneSpeed = self.PatrolMaxSpeed
local CurrentRoutePoint = CurrentPointVec3:RoutePointAir(
- POINT_VEC3.RoutePointAltType.BARO,
+ self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
- ToEngageZoneSpeed,
+ self.EngageSpeed,
true
)
@@ -25969,20 +26305,15 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
local ToEngageZoneVec2 = self.EngageZone:GetRandomVec2()
self:T2( ToEngageZoneVec2 )
- -- Define Speed and Altitude.
- local ToEngageZoneAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude )
- local ToEngageZoneSpeed = self.PatrolMaxSpeed
- self:T2( ToEngageZoneSpeed )
-
-- Obtain a 3D @{Point} from the 2D point + altitude.
- local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, ToEngageZoneAltitude, ToEngageZoneVec2.y )
+ local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, self.EngageAltitude, ToEngageZoneVec2.y )
-- Create a route point of type air.
local ToEngageZoneRoutePoint = ToEngageZonePointVec3:RoutePointAir(
- POINT_VEC3.RoutePointAltType.BARO,
+ self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
- ToEngageZoneSpeed,
+ self.EngageSpeed,
true
)
@@ -25996,20 +26327,15 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
local ToTargetVec2 = self.EngageZone:GetRandomVec2()
self:T2( ToTargetVec2 )
- --- Define Speed and Altitude.
- local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude )
- local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
- self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
-
--- Obtain a 3D @{Point} from the 2D point + altitude.
- local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
+ local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
--- Create a route point of type air.
local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir(
- POINT_VEC3.RoutePointAltType.BARO,
+ self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
- ToTargetSpeed,
+ self.EngageSpeed,
true
)
@@ -26019,24 +26345,24 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
Controllable:OptionROEOpenFire()
- Controllable:OptionROTPassiveDefense()
+ Controllable:OptionROTVertical()
- local AttackTasks = {}
-
- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do
- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
- self:T( DetectedUnit )
- if DetectedUnit:IsAlive() then
- if DetectedUnit:IsInZone( self.EngageZone ) then
- self:E( {"Engaging ", DetectedUnit } )
- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit )
- end
- else
- self.DetectedUnits[DetectedUnit] = nil
- end
- end
-
- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
+-- local AttackTasks = {}
+--
+-- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do
+-- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
+-- self:T( DetectedUnit )
+-- if DetectedUnit:IsAlive() then
+-- if DetectedUnit:IsInZone( self.EngageZone ) then
+-- self:E( {"Engaging ", DetectedUnit } )
+-- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit )
+-- end
+-- else
+-- self.DetectedUnits[DetectedUnit] = nil
+-- end
+-- end
+--
+-- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
self.Controllable:WayPointInitialize( EngageRoute )
@@ -26047,7 +26373,11 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" )
--- NOW ROUTE THE GROUP!
- self.Controllable:WayPointExecute( 1, 2 )
+ self.Controllable:WayPointExecute( 1 )
+
+ self:SetDetectionInterval( 10 )
+ self:SetDetectionActivated()
+ self:__Target( -10 ) -- Start Targetting
end
end
@@ -26073,7 +26403,7 @@ end
-- @param #string To The To State string.
function AI_CAS_ZONE:onafterAccomplish( Controllable, From, Event, To )
self.Accomplished = true
- self:SetDetectionOff()
+ self:SetDetectionDeactivated()
end
--- @param #AI_CAS_ZONE self
@@ -26091,10 +26421,9 @@ end
--
-- 
--
---
-- ===
--
--- # 1) @{#AI_CAP_ZONE} class, extends @{AI.AI_CAP#AI_PATROL_ZONE}
+-- # 1) @{#AI_CAP_ZONE} class, extends @{AI_CAP#AI_PATROL_ZONE}
--
-- The @{#AI_CAP_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
@@ -26160,7 +26489,7 @@ end
-- that will define when the AI will engage with the detected airborne enemy targets.
-- The range can be beyond or smaller than the range of the Patrol Zone.
-- The range is applied at the position of the AI.
--- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range.
+-- Use the method @{AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range.
--
-- ## 1.4) Set the Zone of Engagement
--
@@ -26168,7 +26497,7 @@ end
--
-- An optional @{Zone} can be set,
-- that will define when the AI will engage with the detected airborne enemy targets.
--- Use the method @{AI.AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
+-- Use the method @{AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
--
-- ====
--
@@ -26220,11 +26549,12 @@ AI_CAP_ZONE = {
-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h.
-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h.
+-- @param Dcs.DCSTypes#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
-- @return #AI_CAP_ZONE self
-function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed )
+function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
-- Inherits from BASE
- local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) ) -- #AI_CAP_ZONE
+ local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) ) -- #AI_CAP_ZONE
self.Accomplished = false
self.Engaging = false
@@ -26501,7 +26831,7 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
local ToEngageZoneSpeed = self.PatrolMaxSpeed
local CurrentRoutePoint = CurrentPointVec3:RoutePointAir(
- POINT_VEC3.RoutePointAltType.BARO,
+ self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
ToEngageZoneSpeed,
@@ -26525,7 +26855,7 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
--- Create a route point of type air.
local ToPatrolRoutePoint = ToTargetPointVec3:RoutePointAir(
- POINT_VEC3.RoutePointAltType.BARO,
+ self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
ToTargetSpeed,
@@ -26569,7 +26899,7 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
if #AttackTasks == 0 then
self:E("No targets found -> Going back to Patrolling")
- self:__Accomplish( 1 )
+ self:__Abort( 1 )
self:__Route( 1 )
self:SetDetectionActivated()
else
@@ -26615,7 +26945,10 @@ function AI_CAP_ZONE:onafterAccomplish( Controllable, From, Event, To )
end
---- Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground -- Management of logical cargo objects, that can be transported from and to transportation carriers.
+---Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Ground** --
+-- **Management of logical cargo objects, that can be transported from and to transportation carriers.**
+--
+-- 
--
-- ===
--
@@ -26629,8 +26962,8 @@ end
--
-- * AI_CARGO_GROUPED, represented by a Group of CARGO_UNITs.
--
--- 1) @{AI.AI_Cargo#AI_CARGO} class, extends @{Core.Fsm#FSM_PROCESS}
--- ==========================================================================
+-- # 1) @{#AI_CARGO} class, extends @{Fsm#FSM_PROCESS}
+--
-- The @{#AI_CARGO} class defines the core functions that defines a cargo object within MOOSE.
-- A cargo is a logical object defined that is available for transport, and has a life status within a simulation.
--
@@ -26669,13 +27002,13 @@ end
-- The state transition method needs to start with the name **OnEnter + the name of the state**.
-- These state transition methods need to provide a return value, which is specified at the function description.
--
--- 2) #AI_CARGO_UNIT class
--- ====================
+-- # 2) #AI_CARGO_UNIT class
+--
-- The AI_CARGO_UNIT class defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the AI_CARGO_UNIT objects to and from carriers.
--
--- 5) #AI_CARGO_GROUPED class
--- =======================
+-- # 5) #AI_CARGO_GROUPED class
+--
-- The AI_CARGO_GROUPED class defines a cargo that is represented by a group of UNIT objects within the simulator, and can be transported by a carrier.
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the AI_CARGO_UNIT objects to and from carriers.
--
@@ -26707,14 +27040,14 @@ end
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] UnBoard
-- @param #AI_CARGO self
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] __UnBoard
-- @param #AI_CARGO self
-- @param #number DelaySeconds The amount of seconds to delay the action.
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
-- Load
@@ -26739,14 +27072,14 @@ end
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] UnLoad
-- @param #AI_CARGO self
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] __UnLoad
-- @param #AI_CARGO self
-- @param #number DelaySeconds The amount of seconds to delay the action.
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
-- State Transition Functions
@@ -27644,7 +27977,7 @@ end -- AI_CARGO_GROUPED
--
-- ===
--
--- # @{#ACT_ASSIGN} FSM template class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ASSIGN} FSM template class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ASSIGN state machine:
--
@@ -27937,7 +28270,7 @@ end -- ACT_ASSIGN_MENU_ACCEPT
--
-- ===
--
--- # @{#ACT_ROUTE} FSM class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ROUTE} FSM class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ROUTE state machine:
--
@@ -28189,7 +28522,7 @@ end -- ACT_ROUTE_ZONE
--
-- ===
--
--- # @{#ACT_ACCOUNT} FSM class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ACCOUNT} FSM class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ACCOUNT state machine:
--
@@ -28304,7 +28637,7 @@ do -- ACT_ACCOUNT
-- @param #string To
function ACT_ACCOUNT:onafterStart( ProcessUnit, From, Event, To )
- self:EventOnDead( self.onfuncEventDead )
+ self:HandleEvent( EVENTS.Dead, self.onfuncEventDead )
self:__Wait( 1 )
end
@@ -28455,7 +28788,7 @@ end -- ACT_ACCOUNT DEADS
--
-- ===
--
--- # @{#ACT_ASSIST} FSM class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ASSIST} FSM class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ASSIST state machine:
--
@@ -28724,7 +29057,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
self.Missions = {}
- self:EventOnBirth(
+ self:HandleEvent( EVENTS.Birth,
--- @param #COMMANDCENTER self
--- @param Core.Event#EVENTDATA EventData
function( self, EventData )
@@ -28739,7 +29072,8 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
local PlayerUnit = EventData.IniUnit
for MissionID, Mission in pairs( self:GetMissions() ) do
local Mission = Mission -- Tasking.Mission#MISSION
- Mission:JoinUnit( PlayerUnit )
+ local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled!
+ Mission:JoinUnit( PlayerUnit, PlayerGroup )
Mission:ReportDetails()
end
@@ -28751,14 +29085,15 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- - Set the correct menu.
-- - Assign the PlayerUnit to the Task if required.
-- - Send a message to the other players in the group that this player has joined.
- self:EventOnPlayerEnterUnit(
+ self:HandleEvent( EVENTS.PlayerEnterUnit,
--- @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 )
+ local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled!
+ Mission:JoinUnit( PlayerUnit, PlayerGroup )
Mission:ReportDetails()
end
end
@@ -28767,12 +29102,13 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task.
-- When there is no Unit left running the Task, the Task goes into Abort...
- self:EventOnPlayerLeaveUnit(
+ self:HandleEvent( EVENTS.PlayerLeaveUnit,
--- @param #TASK 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:AbortUnit( PlayerUnit )
end
end
@@ -28781,7 +29117,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task.
-- When there is no Unit left running the Task, the Task goes into Abort...
- self:EventOnCrash(
+ self:HandleEvent( EVENTS.Crash,
--- @param #TASK self
-- @param Core.Event#EVENTDATA EventData
function( self, EventData )
@@ -29040,15 +29376,16 @@ end
-- If the Unit is part of a Task in the Mission, true is returned.
-- @param #MISSION self
-- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player joining the Mission.
+-- @param Wrapper.Group#GROUP PlayerGroup The GROUP of the player joining the Mission.
-- @return #boolean true if Unit is part of a Task in the Mission.
-function MISSION:JoinUnit( PlayerUnit )
- self:F( { PlayerUnit = PlayerUnit } )
+function MISSION:JoinUnit( PlayerUnit, PlayerGroup )
+ self:F( { PlayerUnit = PlayerUnit, PlayerGroup = PlayerGroup } )
local PlayerUnitAdded = false
for TaskID, Task in pairs( self:GetTasks() ) do
local Task = Task -- Tasking.Task#TASK
- if Task:JoinUnit( PlayerUnit ) then
+ if Task:JoinUnit( PlayerUnit, PlayerGroup ) then
PlayerUnitAdded = true
end
end
@@ -29891,7 +30228,7 @@ end
--- This module contains the TASK class.
--
--- 1) @{#TASK} class, extends @{Core.Base#BASE}
+-- 1) @{#TASK} class, extends @{Base#BASE}
-- ============================================
-- 1.1) The @{#TASK} class implements the methods for task orchestration within MOOSE.
-- ----------------------------------------------------------------------------------------
@@ -30072,31 +30409,6 @@ function TASK:New( Mission, SetGroupAssign, TaskName, TaskType )
self.TaskBriefing = "You are invited for the task: " .. self.TaskName .. "."
self.FsmTemplate = self.FsmTemplate or FSM_PROCESS:New()
-
- -- Handle the birth of new planes within the assigned set.
-
-
- -- Handle when a player crashes ...
- -- The Task is UnAssigned from the Unit.
- -- When there is no Unit left running the Task, and all of the Players crashed, the Task goes into Failed ...
--- self:EventOnCrash(
--- --- @param #TASK self
--- -- @param Core.Event#EVENTDATA EventData
--- function( self, EventData )
--- self:E( "In LeaveUnit" )
--- self:E( { "State", self:GetState() } )
--- if self:IsStateAssigned() then
--- local TaskUnit = EventData.IniUnit
--- local TaskGroup = EventData.IniUnit:GetGroup()
--- self:E( self.SetGroup:IsIncludeObject( TaskGroup ) )
--- if self.SetGroup:IsIncludeObject( TaskGroup ) then
--- self:UnAssignFromUnit( TaskUnit )
--- end
--- self:MessageToGroups( TaskUnit:GetPlayerName() .. " crashed!, and has aborted Task " .. self:GetName() )
--- end
--- end
--- )
---
Mission:AddTask( self )
@@ -30125,14 +30437,14 @@ end
-- If the Unit is part of the Task, true is returned.
-- @param #TASK self
-- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player joining the Mission.
+-- @param Wrapper.Group#GROUP PlayerGroup The GROUP of the player joining the Mission.
-- @return #boolean true if Unit is part of the Task.
-function TASK:JoinUnit( PlayerUnit )
- self:F( { PlayerUnit = PlayerUnit } )
+function TASK:JoinUnit( PlayerUnit, PlayerGroup )
+ self:F( { PlayerUnit = PlayerUnit, PlayerGroup = PlayerGroup } )
local PlayerUnitAdded = false
local PlayerGroups = self:GetGroups()
- local PlayerGroup = PlayerUnit:GetGroup()
-- Is the PlayerGroup part of the PlayerGroups?
if PlayerGroups:IsIncludeObject( PlayerGroup ) then
@@ -30285,7 +30597,6 @@ end
-- @return #boolean
function TASK:HasGroup( FindGroup )
- self:GetGroups():FilterOnce() -- Ensure that the filter is updated.
return self:GetGroups():IsIncludeObject( FindGroup )
end
@@ -30911,41 +31222,41 @@ end
end -- Reporting
--- This module contains the DETECTION_MANAGER class and derived classes.
+--- This module contains the DETECTION_MANAGER class and derived classes.
--
-- ===
--
--- 1) @{Tasking.DetectionManager#DETECTION_MANAGER} class, extends @{Core.Base#BASE}
+-- 1) @{DetectionManager#DETECTION_MANAGER} class, extends @{Base#BASE}
-- ====================================================================
--- The @{Tasking.DetectionManager#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
+-- The @{DetectionManager#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
-- Reportings can be done in several manners, and it is up to the derived classes if DETECTION_MANAGER to model the reporting behaviour.
--
-- 1.1) DETECTION_MANAGER constructor:
-- -----------------------------------
--- * @{Tasking.DetectionManager#DETECTION_MANAGER.New}(): Create a new DETECTION_MANAGER instance.
+-- * @{DetectionManager#DETECTION_MANAGER.New}(): Create a new DETECTION_MANAGER instance.
--
-- 1.2) DETECTION_MANAGER reporting:
-- ---------------------------------
--- Derived DETECTION_MANAGER classes will reports detected units using the method @{Tasking.DetectionManager#DETECTION_MANAGER.ReportDetected}(). This method implements polymorphic behaviour.
+-- Derived DETECTION_MANAGER classes will reports detected units using the method @{DetectionManager#DETECTION_MANAGER.ReportDetected}(). This method implements polymorphic behaviour.
--
--- The time interval in seconds of the reporting can be changed using the methods @{Tasking.DetectionManager#DETECTION_MANAGER.SetReportInterval}().
--- To control how long a reporting message is displayed, use @{Tasking.DetectionManager#DETECTION_MANAGER.SetReportDisplayTime}().
--- Derived classes need to implement the method @{Tasking.DetectionManager#DETECTION_MANAGER.GetReportDisplayTime}() to use the correct display time for displayed messages during a report.
+-- The time interval in seconds of the reporting can be changed using the methods @{DetectionManager#DETECTION_MANAGER.SetReportInterval}().
+-- To control how long a reporting message is displayed, use @{DetectionManager#DETECTION_MANAGER.SetReportDisplayTime}().
+-- Derived classes need to implement the method @{DetectionManager#DETECTION_MANAGER.GetReportDisplayTime}() to use the correct display time for displayed messages during a report.
--
--- Reporting can be started and stopped using the methods @{Tasking.DetectionManager#DETECTION_MANAGER.StartReporting}() and @{Tasking.DetectionManager#DETECTION_MANAGER.StopReporting}() respectively.
--- If an ad-hoc report is requested, use the method @{Tasking.DetectionManager#DETECTION_MANAGER#ReportNow}().
+-- Reporting can be started and stopped using the methods @{DetectionManager#DETECTION_MANAGER.StartReporting}() and @{DetectionManager#DETECTION_MANAGER.StopReporting}() respectively.
+-- If an ad-hoc report is requested, use the method @{DetectionManager#DETECTION_MANAGER#ReportNow}().
--
-- The default reporting interval is every 60 seconds. The reporting messages are displayed 15 seconds.
--
-- ===
--
--- 2) @{Tasking.DetectionManager#DETECTION_REPORTING} class, extends @{Tasking.DetectionManager#DETECTION_MANAGER}
+-- 2) @{DetectionManager#DETECTION_REPORTING} class, extends @{DetectionManager#DETECTION_MANAGER}
-- =========================================================================================
--- The @{Tasking.DetectionManager#DETECTION_REPORTING} class implements detected units reporting. Reporting can be controlled using the reporting methods available in the @{Tasking.DetectionManager#DETECTION_MANAGER} class.
+-- The @{DetectionManager#DETECTION_REPORTING} class implements detected units reporting. Reporting can be controlled using the reporting methods available in the @{DetectionManager#DETECTION_MANAGER} class.
--
-- 2.1) DETECTION_REPORTING constructor:
-- -------------------------------
--- The @{Tasking.DetectionManager#DETECTION_REPORTING.New}() method creates a new DETECTION_REPORTING instance.
+-- The @{DetectionManager#DETECTION_REPORTING.New}() method creates a new DETECTION_REPORTING instance.
--
-- ===
--
@@ -31061,7 +31372,7 @@ do -- DETECTION MANAGER
return self
end
- --- Report the detected @{Wrapper.Unit#UNIT}s detected within the @{Functional.Detection#DETECTION_BASE} object to the @{Set#SET_GROUP}s.
+ --- Report the detected @{Unit#UNIT}s detected within the @{Detection#DETECTION_BASE} object to the @{Set#SET_GROUP}s.
-- @param #DETECTION_MANAGER self
function DETECTION_MANAGER:_FacScheduler( SchedulerName )
self:F2( { SchedulerName } )
@@ -31111,7 +31422,7 @@ do -- DETECTION_REPORTING
--- Creates a string of the detected items in a @{Detection}.
-- @param #DETECTION_MANAGER self
- -- @param Set#SET_UNIT DetectedSet The detected Set created by the @{Functional.Detection#DETECTION_BASE} object.
+ -- @param Set#SET_UNIT DetectedSet The detected Set created by the @{Detection#DETECTION_BASE} object.
-- @return #DETECTION_MANAGER self
function DETECTION_REPORTING:GetDetectedItemsText( DetectedSet )
self:F2()
@@ -31144,7 +31455,7 @@ do -- DETECTION_REPORTING
--- Reports the detected items to the @{Set#SET_GROUP}.
-- @param #DETECTION_REPORTING self
-- @param Wrapper.Group#GROUP Group The @{Group} object to where the report needs to go.
- -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Functional.Detection#DETECTION_BASE} object.
+ -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Detection#DETECTION_BASE} object.
-- @return #boolean Return true if you want the reporting to continue... false will cancel the reporting loop.
function DETECTION_REPORTING:ProcessDetected( Group, Detection )
self:F2( Group )
@@ -31305,7 +31616,7 @@ do -- DETECTION_DISPATCHER
--- Assigns tasks in relation to the detected items to the @{Set#SET_GROUP}.
-- @param #DETECTION_DISPATCHER self
- -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Functional.Detection#DETECTION_AREAS} object.
+ -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Detection#DETECTION_AREAS} object.
-- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop.
function DETECTION_DISPATCHER:ProcessDetected( Detection )
self:F2()
@@ -31420,15 +31731,15 @@ do -- DETECTION_DISPATCHER
end--- This module contains the TASK_SEAD classes.
--
--- 1) @{#TASK_SEAD} class, extends @{Tasking.Task#TASK}
+-- 1) @{#TASK_SEAD} class, extends @{Task#TASK}
-- =================================================
-- The @{#TASK_SEAD} class defines a SEAD task for a @{Set} of Target Units, located at a Target Zone,
--- based on the tasking capabilities defined in @{Tasking.Task#TASK}.
+-- based on the tasking capabilities defined in @{Task#TASK}.
-- The TASK_SEAD is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
--
-- * **None**: Start of the process
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_ASSIGN_ACCEPT} is started to accept the task.
--- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
+-- * **Assigned**: The SEAD task is assigned to a @{Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
--
@@ -31498,15 +31809,15 @@ do -- TASK_SEAD
end
--- (AI) (SP) (MP) Tasking for Air to Ground Processes.
--
--- 1) @{#TASK_A2G} class, extends @{Tasking.Task#TASK}
+-- 1) @{#TASK_A2G} class, extends @{Task#TASK}
-- =================================================
-- The @{#TASK_A2G} class defines a CAS or BAI task of a @{Set} of Target Units,
--- located at a Target Zone, based on the tasking capabilities defined in @{Tasking.Task#TASK}.
+-- located at a Target Zone, based on the tasking capabilities defined in @{Task#TASK}.
-- The TASK_A2G is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
--
-- * **None**: Start of the process
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_ASSIGN_ACCEPT} is started to accept the task.
--- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
+-- * **Assigned**: The SEAD task is assigned to a @{Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
--
diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua
index b55fff7e4..5d97e61ea 100644
--- a/Moose Mission Setup/Moose.lua
+++ b/Moose Mission Setup/Moose.lua
@@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
-env.info( 'Moose Generation Timestamp: "20170202_2257"' )
+env.info( 'Moose Generation Timestamp: 20170207_2151' )
local base = _G
Include = {}
@@ -2805,8 +2805,8 @@ end
--
-- ## 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.
+-- Any class derived from BASE, must use the @{Base#BASE.New) constructor within the @{Base#BASE.Inherit) method.
+-- See an example at the @{Base#BASE.New} method how this is done.
--
-- ## 1.2) BASE Trace functionality
--
@@ -2851,53 +2851,50 @@ end
--
-- 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.
+-- ### 1.3.1 Subscribe / Unsubscribe to DCS Events
--
--- 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.
+-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
+-- So, when the DCS event occurs, the class will be notified of that event.
+-- There are two functions which you use to subscribe to or unsubscribe from an event.
--
--- Find below an example of the prototype how to write an event handling function:
+-- * @{#BASE.HandleEvent}(): Subscribe to a DCS Event.
+-- * @{#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
+--
+-- ### 1.3.2 Event Handling of DCS Events
+--
+-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
+-- when the DCS event occurs. The Event Handling method receives an @{Event#EVENTDATA} structure, which contains a lot of information
+-- about the event that occurred.
+--
+-- Find below an example of the prototype how to write an event handling function for two units:
--
--- 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
--- )
+-- local Tank1 = UNIT:FindByName( "Tank A" )
+-- local Tank2 = UNIT:FindByName( "Tank B" )
+--
+-- -- Here we subscribe to the Dead events. So, if one of these tanks dies, the Tank1 or Tank2 objects will be notified.
+-- Tank1:HandleEvent( EVENTS.Dead )
+-- Tank2:HandleEvent( EVENTS.Dead )
+--
+-- --- This function is an Event Handling function that will be called when Tank1 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank1:OnEventDead( EventData )
+--
+-- self:SmokeGreen()
+-- end
+--
+-- --- This function is an Event Handling function that will be called when Tank2 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank2:OnEventDead( EventData )
+--
+-- self:SmokeBlue()
+-- 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.
+--
+-- See the @{Event} module for more information about event handling.
--
-- ## 1.4) Class identification methods
--
@@ -2973,6 +2970,7 @@ local _ClassID = 0
BASE = {
ClassName = "BASE",
ClassID = 0,
+ _Private = {},
Events = {},
States = {}
}
@@ -3079,369 +3077,202 @@ function BASE:GetClassID()
return self.ClassID
end
---- Set a new listener for the class.
--- @param self
--- @param Dcs.DCSTypes#Event Event
--- @param #function EventFunction
--- @return #BASE
-function BASE:AddEvent( Event, EventFunction )
- self:F( Event )
+do -- Event Handling
- self.Events[#self.Events+1] = {}
- self.Events[#self.Events].Event = Event
- self.Events[#self.Events].EventFunction = EventFunction
- self.Events[#self.Events].EventEnabled = false
-
- return self
-end
-
---- Returns the event dispatcher
--- @param #BASE self
--- @return Core.Event#EVENT
-function BASE:Event()
-
- return _EVENTDISPATCHER
-end
-
---- Remove all subscribed events
--- @param #BASE self
--- @return #BASE
-function BASE:EventRemoveAll()
-
- _EVENTDISPATCHER:RemoveAll( self )
+ --- Returns the event dispatcher
+ -- @param #BASE self
+ -- @return Core.Event#EVENT
+ function BASE:EventDispatcher()
- return self
-end
-
---- 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
-function BASE:EventOnShot( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOT )
+ return _EVENTDISPATCHER
+ end
- return self
-end
-
---- 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
-function BASE:EventOnHit( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_HIT )
- return self
-end
-
---- 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
-function BASE:EventOnTakeOff( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_TAKEOFF )
+ --- Get the Class @{Event} processing Priority.
+ -- The Event processing Priority is a number from 1 to 10,
+ -- reflecting the order of the classes subscribed to the Event to be processed.
+ -- @param #BASE self
+ -- @return #number The @{Event} processing Priority.
+ function BASE:GetEventPriority()
+ return self._Private.EventPriority or 5
+ end
- return self
-end
-
---- 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
-function BASE:EventOnLand( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_LAND )
+ --- Set the Class @{Event} processing Priority.
+ -- The Event processing Priority is a number from 1 to 10,
+ -- reflecting the order of the classes subscribed to the Event to be processed.
+ -- @param #BASE self
+ -- @param #number EventPriority The @{Event} processing Priority.
+ -- @return self
+ function BASE:SetEventPriority( EventPriority )
+ self._Private.EventPriority = EventPriority
+ end
- return self
-end
-
---- 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
-function BASE:EventOnCrash( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_CRASH )
+ --- Remove all subscribed events
+ -- @param #BASE self
+ -- @return #BASE
+ function BASE:EventRemoveAll()
- return self
-end
-
---- 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
-function BASE:EventOnEjection( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_EJECTION )
+ self:EventDispatcher():RemoveAll( self )
+
+ return self
+ end
- return self
-end
-
-
---- 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
-function BASE:EventOnRefueling( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_REFUELING )
+ --- Subscribe to a DCS Event.
+ -- @param #BASE self
+ -- @param Core.Event#EVENTS Event
+ -- @param #function EventFunction (optional) The function to be called when the event occurs for the unit.
+ -- @return #BASE
+ function BASE:HandleEvent( Event, EventFunction )
- return self
-end
-
---- 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
-function BASE:EventOnDead( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_DEAD )
+ self:EventDispatcher():OnEventGeneric( EventFunction, self, Event )
+
+ return self
+ end
- return self
-end
-
---- 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
-function BASE:EventOnPilotDead( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PILOT_DEAD )
+ --- UnSubscribe to a DCS event.
+ -- @param #BASE self
+ -- @param Core.Event#EVENTS Event
+ -- @return #BASE
+ function BASE:UnHandleEvent( Event )
- return self
-end
-
---- 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
-function BASE:EventOnBaseCaptured( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_BASE_CAPTURED )
+ self:EventDispatcher():Remove( self, Event )
+
+ return self
+ end
- return self
-end
-
---- 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
-function BASE:EventOnMissionStart( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_MISSION_START )
+ -- Event handling function prototypes
- return self
+ --- Occurs whenever any unit in a mission fires a weapon. But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart.
+ -- @function [parent=#BASE] OnEventShot
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs whenever an object is hit by a weapon.
+ -- initiator : The unit object the fired the weapon
+ -- weapon: Weapon object that hit the target
+ -- target: The Object that was hit.
+ -- @function [parent=#BASE] OnEventHit
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft takes off from an airbase, farp, or ship.
+ -- initiator : The unit that tookoff
+ -- place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
+ -- @function [parent=#BASE] OnEventTakeoff
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft lands at an airbase, farp or ship
+ -- initiator : The unit that has landed
+ -- place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships
+ -- @function [parent=#BASE] OnEventLand
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any aircraft crashes into the ground and is completely destroyed.
+ -- initiator : The unit that has crashed
+ -- @function [parent=#BASE] OnEventCrash
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a pilot ejects from an aircraft
+ -- initiator : The unit that has ejected
+ -- @function [parent=#BASE] OnEventEjection
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft connects with a tanker and begins taking on fuel.
+ -- initiator : The unit that is receiving fuel.
+ -- @function [parent=#BASE] OnEventRefueling
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an object is completely destroyed.
+ -- initiator : The unit that is was destroyed.
+ -- @function [parent=#BASE] OnEvent
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when the pilot of an aircraft is killed. Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane.
+ -- initiator : The unit that the pilot has died in.
+ -- @function [parent=#BASE] OnEventPilotDead
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a ground unit captures either an airbase or a farp.
+ -- initiator : The unit that captured the base
+ -- place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
+ -- @function [parent=#BASE] OnEventBaseCaptured
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a mission starts
+ -- @function [parent=#BASE] OnEventMissionStart
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when a mission ends
+ -- @function [parent=#BASE] OnEventMissionEnd
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when an aircraft is finished taking fuel.
+ -- initiator : The unit that was receiving fuel.
+ -- @function [parent=#BASE] OnEventRefuelingStop
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any object is spawned into the mission.
+ -- initiator : The unit that was spawned
+ -- @function [parent=#BASE] OnEventBirth
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any system fails on a human controlled aircraft.
+ -- initiator : The unit that had the failure
+ -- @function [parent=#BASE] OnEventHumanFailure
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any aircraft starts its engines.
+ -- initiator : The unit that is starting its engines.
+ -- @function [parent=#BASE] OnEventEngineStartup
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any aircraft shuts down its engines.
+ -- initiator : The unit that is stopping its engines.
+ -- @function [parent=#BASE] OnEventEngineShutdown
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any player assumes direct control of a unit.
+ -- initiator : The unit that is being taken control of.
+ -- @function [parent=#BASE] OnEventPlayerEnterUnit
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any player relieves control of a unit to the AI.
+ -- initiator : The unit that the player left.
+ -- @function [parent=#BASE] OnEventPlayerLeaveUnit
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any unit begins firing a weapon that has a high rate of fire. Most common with aircraft cannons (GAU-8), autocannons, and machine guns.
+ -- initiator : The unit that is doing the shooing.
+ -- target: The unit that is being targeted.
+ -- @function [parent=#BASE] OnEventShootingStart
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
+ --- Occurs when any unit stops firing its weapon. Event will always correspond with a shooting start event.
+ -- initiator : The unit that was doing the shooing.
+ -- @function [parent=#BASE] OnEventShootingEnd
+ -- @param #BASE self
+ -- @param Core.Event#EVENTDATA EventData The EventData structure.
+
end
-
---- 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
-function BASE:EventOnPlayerMissionEnd( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_MISSION_END )
-
- return self
-end
-
---- 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
-function BASE:EventOnTookControl( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_TOOK_CONTROL )
-
- return self
-end
-
---- 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
-function BASE:EventOnRefuelingStop( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_REFUELING_STOP )
-
- return self
-end
-
---- 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
-function BASE:EventOnBirth( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_BIRTH )
-
- return self
-end
-
---- 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
-function BASE:EventOnHumanFailure( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_HUMAN_FAILURE )
-
- return self
-end
-
---- 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
-function BASE:EventOnEngineStartup( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_ENGINE_STARTUP )
-
- return self
-end
-
---- 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
-function BASE:EventOnEngineShutdown( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_ENGINE_SHUTDOWN )
-
- return self
-end
-
---- 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
-function BASE:EventOnPlayerEnterUnit( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_ENTER_UNIT )
-
- return self
-end
-
---- 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
-function BASE:EventOnPlayerLeaveUnit( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_LEAVE_UNIT )
-
- return self
-end
-
---- 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
-function BASE:EventOnPlayerComment( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_PLAYER_COMMENT )
-
- return self
-end
-
---- 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
-function BASE:EventOnShootingStart( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOOTING_START )
-
- return self
-end
-
---- 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
-function BASE:EventOnShootingEnd( EventFunction )
-
- _EVENTDISPATCHER:OnEventGeneric( EventFunction, self, world.event.S_EVENT_SHOOTING_END )
-
- return self
-end
-
-
-
-
-
-
-
---- Enable the event listeners for the class.
--- @param #BASE self
--- @return #BASE
-function BASE:EnableEvents()
- self:F( #self.Events )
-
- for EventID, Event in pairs( self.Events ) do
- Event.Self = self
- Event.EventEnabled = true
- end
- self.Events.Handler = world.addEventHandler( self )
-
- return self
-end
-
-
---- Disable the event listeners for the class.
--- @param #BASE self
--- @return #BASE
-function BASE:DisableEvents()
- self:F()
-
- world.removeEventHandler( self )
- for EventID, Event in pairs( self.Events ) do
- Event.Self = nil
- Event.EventEnabled = false
- end
-
- return self
-end
-
-
-local BaseEventCodes = {
- "S_EVENT_SHOT",
- "S_EVENT_HIT",
- "S_EVENT_TAKEOFF",
- "S_EVENT_LAND",
- "S_EVENT_CRASH",
- "S_EVENT_EJECTION",
- "S_EVENT_REFUELING",
- "S_EVENT_DEAD",
- "S_EVENT_PILOT_DEAD",
- "S_EVENT_BASE_CAPTURED",
- "S_EVENT_MISSION_START",
- "S_EVENT_MISSION_END",
- "S_EVENT_TOOK_CONTROL",
- "S_EVENT_REFUELING_STOP",
- "S_EVENT_BIRTH",
- "S_EVENT_HUMAN_FAILURE",
- "S_EVENT_ENGINE_STARTUP",
- "S_EVENT_ENGINE_SHUTDOWN",
- "S_EVENT_PLAYER_ENTER_UNIT",
- "S_EVENT_PLAYER_LEAVE_UNIT",
- "S_EVENT_PLAYER_COMMENT",
- "S_EVENT_SHOOTING_START",
- "S_EVENT_SHOOTING_END",
- "S_EVENT_MAX",
-}
---onEvent( {[1]="S_EVENT_BIRTH",[2]={["subPlace"]=5,["time"]=0,["initiator"]={["id_"]=16884480,},["place"]={["id_"]=5000040,},["id"]=15,["IniUnitName"]="US F-15C@RAMP-Air Support Mountains#001-01",},}
--- Event = {
--- id = enum world.event,
--- time = Time,
--- initiator = Unit,
--- target = Unit,
--- place = Unit,
--- subPlace = enum world.BirthPlace,
--- weapon = Weapon
--- }
--- Creation of a Birth Event.
-- @param #BASE self
@@ -3817,29 +3648,29 @@ end
--- This module contains the SCHEDULER class.
--
--- # 1) @{Core.Scheduler#SCHEDULER} class, extends @{Core.Base#BASE}
+-- # 1) @{Scheduler#SCHEDULER} class, extends @{Base#BASE}
--
--- The @{Core.Scheduler#SCHEDULER} class creates schedule.
+-- The @{Scheduler#SCHEDULER} class creates schedule.
--
-- ## 1.1) SCHEDULER constructor
--
-- The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters:
--
--- * @{Core.Scheduler#SCHEDULER.New}( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.
--- * @{Core.Scheduler#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
--- * @{Core.Scheduler#SCHEDULER.New}( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
--- * @{Core.Scheduler#SCHEDULER.New}( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
+-- * @{Scheduler#SCHEDULER.New}( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.
+-- * @{Scheduler#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
+-- * @{Scheduler#SCHEDULER.New}( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
+-- * @{Scheduler#SCHEDULER.New}( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
--
-- ## 1.2) SCHEDULER timer stopping and (re-)starting.
--
-- The SCHEDULER can be stopped and restarted with the following methods:
--
--- * @{Core.Scheduler#SCHEDULER.Start}(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.
--- * @{Core.Scheduler#SCHEDULER.Stop}(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.
+-- * @{Scheduler#SCHEDULER.Start}(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.
+-- * @{Scheduler#SCHEDULER.Stop}(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.
--
-- ## 1.3) Create a new schedule
--
--- With @{Core.Scheduler#SCHEDULER.Schedule}() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.
+-- With @{Scheduler#SCHEDULER.Schedule}() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.
--
-- ===
--
@@ -3878,7 +3709,7 @@ SCHEDULER = {
-- @param #number Repeat Specifies the interval in seconds when the scheduler will call the event function.
-- @param #number RandomizeFactor Specifies a randomization factor between 0 and 1 to randomize the Repeat.
-- @param #number Stop Specifies the amount of seconds when the scheduler will be stopped.
--- @return #SCHEDULER self
+-- @return #SCHEDULER self.
-- @return #number The ScheduleID of the planned schedule.
function SCHEDULER:New( SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop )
local self = BASE:Inherit( self, BASE:New() )
@@ -4002,7 +3833,7 @@ end
--
-- The SCHEDULEDISPATCHER allows multiple scheduled functions to be planned and executed for one SCHEDULER object.
-- The SCHEDULER object therefore keeps a table of "CallID's", which are returned after each planning of a new scheduled function by the SCHEDULEDISPATCHER.
--- The SCHEDULER object plans new scheduled functions through the @{Core.Scheduler#SCHEDULER.Schedule}() method.
+-- The SCHEDULER object plans new scheduled functions through the @{Scheduler#SCHEDULER.Schedule}() method.
-- The Schedule() method returns the CallID that is the reference ID for each planned schedule.
--
-- ===
@@ -4188,56 +4019,196 @@ end
---- This module contains the EVENT class.
+--- This core module models the dispatching of DCS Events to subscribed MOOSE classes,
+-- following a given priority.
+--
+-- 
--
-- ===
--
--- Takes care of EVENT dispatching between DCS events and event handling functions defined in MOOSE classes.
+-- # 1) Event Handling Overview
+--
+-- 
+--
+-- Within a running mission, various DCS events occur. Units are dynamically created, crash, die, shoot stuff, get hit etc.
+-- This module provides a mechanism to dispatch those events occuring within your running mission, to the different objects orchestrating your mission.
+--
+-- 
+--
+-- Objects can subscribe to different events. The Event dispatcher will publish the received DCS events to the subscribed MOOSE objects, in a specified order.
+-- In this way, the subscribed MOOSE objects are kept in sync with your evolving running mission.
+--
+-- ## 1.1) Event Dispatching
+--
+-- 
+--
+-- The _EVENTDISPATCHER object is automatically created within MOOSE,
+-- and handles the dispatching of DCS Events occurring
+-- in the simulator to the subscribed objects
+-- in the correct processing order.
+--
+-- 
+--
+-- There are 5 levels of kind of objects that the _EVENTDISPATCHER services:
+--
+-- * _DATABASE object: The core of the MOOSE objects. Any object that is created, deleted or updated, is done in this database.
+-- * SET_ derived classes: Subsets of the _DATABASE object. These subsets are updated by the _EVENTDISPATCHER as the second priority.
+-- * UNIT objects: UNIT objects can subscribe to DCS events. Each DCS event will be directly published to teh subscribed UNIT object.
+-- * GROUP objects: GROUP objects can subscribe to DCS events. Each DCS event will be directly published to the subscribed GROUP object.
+-- * Any other object: Various other objects can subscribe to DCS events. Each DCS event triggered will be published to each subscribed object.
+--
+-- 
+--
+-- For most DCS events, the above order of updating will be followed.1
+--
+-- 
+--
+-- But for some DCS events, the publishing order is reversed. This is due to the fact that objects need to be **erased** instead of added.
+--
+-- ## 1.2) Event Handling
+--
+-- 
+--
+-- The actual event subscribing and handling is not facilitated through the _EVENTDISPATCHER, but it is done through the @{BASE} class, @{UNIT} class and @{GROUP} class.
+-- The _EVENTDISPATCHER is a component that is quietly working in the background of MOOSE.
+--
+-- 
+--
+-- 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.
+--
+-- ### 1.2.1 Subscribe / Unsubscribe to DCS Events
+--
+-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
+-- So, when the DCS event occurs, the class will be notified of that event.
+-- There are two functions which you use to subscribe to or unsubscribe from an event.
+--
+-- * @{Base#BASE.HandleEvent}(): Subscribe to a DCS Event.
+-- * @{Base#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
+--
+-- ### 1.3.2 Event Handling of DCS Events
+--
+-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
+-- when the DCS event occurs. The Event Handling method receives an @{Event#EVENTDATA} structure, which contains a lot of information
+-- about the event that occurred.
+--
+-- Find below an example of the prototype how to write an event handling function for two units:
+--
+-- local Tank1 = UNIT:FindByName( "Tank A" )
+-- local Tank2 = UNIT:FindByName( "Tank B" )
+--
+-- -- Here we subscribe to the Dead events. So, if one of these tanks dies, the Tank1 or Tank2 objects will be notified.
+-- Tank1:HandleEvent( EVENTS.Dead )
+-- Tank2:HandleEvent( EVENTS.Dead )
+--
+-- --- This function is an Event Handling function that will be called when Tank1 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank1:OnEventDead( EventData )
+--
+-- self:SmokeGreen()
+-- end
+--
+-- --- This function is an Event Handling function that will be called when Tank2 is Dead.
+-- -- @param Wrapper.Unit#UNIT self
+-- -- @param Core.Event#EVENTDATA EventData
+-- function Tank2:OnEventDead( EventData )
+--
+-- self:SmokeBlue()
+-- end
+--
+-- ### 1.3.3 Event Handling methods that are automatically called upon subscribed DCS events
+--
+-- 
+--
+-- The following list outlines which EVENTS item in the structure corresponds to which Event Handling method.
+-- Always ensure that your event handling methods align with the events being subscribed to, or nothing will be executed.
+--
+-- # 2) EVENTS type
+--
+-- The EVENTS structure contains names for all the different DCS events that objects can subscribe to using the
+-- @{Base#BASE.HandleEvent}() method.
+--
+-- # 3) EVENTDATA type
+--
+-- The EVENTDATA contains all the fields that are populated with event information before
+-- an Event Handler method is being called by the event dispatcher.
+-- The Event Handler received the EVENTDATA object as a parameter, and can be used to investigate further the different events.
+-- There are basically 4 main categories of information stored in the EVENTDATA structure:
+--
+-- * Initiator Unit data: Several fields documenting the initiator unit related to the event.
+-- * Target Unit data: Several fields documenting the target unit related to the event.
+-- * Weapon data: Certain events populate weapon information.
+-- * Place data: Certain events populate place information.
+--
+-- Find below an overview which events populate which information categories:
+--
+-- 
+--
+-- ====
+--
+-- # **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-02-07: Did a complete revision of the Event Handing API and underlying mechanisms.
--
-- ===
--
--- The above menus classes **are derived** from 2 main **abstract** classes defined within the MOOSE framework (so don't use these):
+-- # **AUTHORS and CONTRIBUTIONS**
--
--- ===
+-- ### Contributions:
--
--- ### Contributions: -
--- ### Authors: FlightControl : Design & Programming
+-- ### Authors:
--
+-- * [**FlightControl**](https://forums.eagle.ru/member.php?u=89536): Design & Programming & documentation.
+--
-- @module Event
--- The EVENT structure
-- @type EVENT
-- @field #EVENT.Events Events
+-- @extends Core.Base#BASE
EVENT = {
ClassName = "EVENT",
ClassID = 0,
}
-local _EVENTCODES = {
- "S_EVENT_SHOT",
- "S_EVENT_HIT",
- "S_EVENT_TAKEOFF",
- "S_EVENT_LAND",
- "S_EVENT_CRASH",
- "S_EVENT_EJECTION",
- "S_EVENT_REFUELING",
- "S_EVENT_DEAD",
- "S_EVENT_PILOT_DEAD",
- "S_EVENT_BASE_CAPTURED",
- "S_EVENT_MISSION_START",
- "S_EVENT_MISSION_END",
- "S_EVENT_TOOK_CONTROL",
- "S_EVENT_REFUELING_STOP",
- "S_EVENT_BIRTH",
- "S_EVENT_HUMAN_FAILURE",
- "S_EVENT_ENGINE_STARTUP",
- "S_EVENT_ENGINE_SHUTDOWN",
- "S_EVENT_PLAYER_ENTER_UNIT",
- "S_EVENT_PLAYER_LEAVE_UNIT",
- "S_EVENT_PLAYER_COMMENT",
- "S_EVENT_SHOOTING_START",
- "S_EVENT_SHOOTING_END",
- "S_EVENT_MAX",
+--- The different types of events supported by MOOSE.
+-- Use this structure to subscribe to events using the @{Base#BASE.HandleEvent}() method.
+-- @type EVENTS
+EVENTS = {
+ Shot = world.event.S_EVENT_SHOT,
+ Hit = world.event.S_EVENT_HIT,
+ Takeoff = world.event.S_EVENT_TAKEOFF,
+ Land = world.event.S_EVENT_LAND,
+ Crash = world.event.S_EVENT_CRASH,
+ Ejection = world.event.S_EVENT_EJECTION,
+ Refueling = world.event.S_EVENT_REFUELING,
+ Dead = world.event.S_EVENT_DEAD,
+ PilotDead = world.event.S_EVENT_PILOT_DEAD,
+ BaseCaptured = world.event.S_EVENT_BASE_CAPTURED,
+ MissionStart = world.event.S_EVENT_MISSION_START,
+ MissionEnd = world.event.S_EVENT_MISSION_END,
+ TookControl = world.event.S_EVENT_TOOK_CONTROL,
+ RefuelingStop = world.event.S_EVENT_REFUELING_STOP,
+ Birth = world.event.S_EVENT_BIRTH,
+ HumanFailure = world.event.S_EVENT_HUMAN_FAILURE,
+ EngineStartup = world.event.S_EVENT_ENGINE_STARTUP,
+ EngineShutdown = world.event.S_EVENT_ENGINE_SHUTDOWN,
+ PlayerEnterUnit = world.event.S_EVENT_PLAYER_ENTER_UNIT,
+ PlayerLeaveUnit = world.event.S_EVENT_PLAYER_LEAVE_UNIT,
+ PlayerComment = world.event.S_EVENT_PLAYER_COMMENT,
+ ShootingStart = world.event.S_EVENT_SHOOTING_START,
+ ShootingEnd = world.event.S_EVENT_SHOOTING_END,
}
--- The Event structure
@@ -4262,6 +4233,126 @@ local _EVENTCODES = {
-- @field WeaponName
-- @field WeaponTgtDCSUnit
+
+local _EVENTMETA = {
+ [world.event.S_EVENT_SHOT] = {
+ Order = 1,
+ Event = "OnEventShot",
+ Text = "S_EVENT_SHOT"
+ },
+ [world.event.S_EVENT_HIT] = {
+ Order = 1,
+ Event = "OnEventHit",
+ Text = "S_EVENT_HIT"
+ },
+ [world.event.S_EVENT_TAKEOFF] = {
+ Order = 1,
+ Event = "OnEventTakeOff",
+ Text = "S_EVENT_TAKEOFF"
+ },
+ [world.event.S_EVENT_LAND] = {
+ Order = 1,
+ Event = "OnEventLand",
+ Text = "S_EVENT_LAND"
+ },
+ [world.event.S_EVENT_CRASH] = {
+ Order = -1,
+ Event = "OnEventCrash",
+ Text = "S_EVENT_CRASH"
+ },
+ [world.event.S_EVENT_EJECTION] = {
+ Order = 1,
+ Event = "OnEventEjection",
+ Text = "S_EVENT_EJECTION"
+ },
+ [world.event.S_EVENT_REFUELING] = {
+ Order = 1,
+ Event = "OnEventRefueling",
+ Text = "S_EVENT_REFUELING"
+ },
+ [world.event.S_EVENT_DEAD] = {
+ Order = -1,
+ Event = "OnEventDead",
+ Text = "S_EVENT_DEAD"
+ },
+ [world.event.S_EVENT_PILOT_DEAD] = {
+ Order = 1,
+ Event = "OnEventPilotDead",
+ Text = "S_EVENT_PILOT_DEAD"
+ },
+ [world.event.S_EVENT_BASE_CAPTURED] = {
+ Order = 1,
+ Event = "OnEventBaseCaptured",
+ Text = "S_EVENT_BASE_CAPTURED"
+ },
+ [world.event.S_EVENT_MISSION_START] = {
+ Order = 1,
+ Event = "OnEventMissionStart",
+ Text = "S_EVENT_MISSION_START"
+ },
+ [world.event.S_EVENT_MISSION_END] = {
+ Order = 1,
+ Event = "OnEventMissionEnd",
+ Text = "S_EVENT_MISSION_END"
+ },
+ [world.event.S_EVENT_TOOK_CONTROL] = {
+ Order = 1,
+ Event = "OnEventTookControl",
+ Text = "S_EVENT_TOOK_CONTROL"
+ },
+ [world.event.S_EVENT_REFUELING_STOP] = {
+ Order = 1,
+ Event = "OnEventRefuelingStop",
+ Text = "S_EVENT_REFUELING_STOP"
+ },
+ [world.event.S_EVENT_BIRTH] = {
+ Order = 1,
+ Event = "OnEventBirth",
+ Text = "S_EVENT_BIRTH"
+ },
+ [world.event.S_EVENT_HUMAN_FAILURE] = {
+ Order = 1,
+ Event = "OnEventHumanFailure",
+ Text = "S_EVENT_HUMAN_FAILURE"
+ },
+ [world.event.S_EVENT_ENGINE_STARTUP] = {
+ Order = 1,
+ Event = "OnEventEngineStartup",
+ Text = "S_EVENT_ENGINE_STARTUP"
+ },
+ [world.event.S_EVENT_ENGINE_SHUTDOWN] = {
+ Order = 1,
+ Event = "OnEventEngineShutdown",
+ Text = "S_EVENT_ENGINE_SHUTDOWN"
+ },
+ [world.event.S_EVENT_PLAYER_ENTER_UNIT] = {
+ Order = 1,
+ Event = "OnEventPlayerEnterUnit",
+ Text = "S_EVENT_PLAYER_ENTER_UNIT"
+ },
+ [world.event.S_EVENT_PLAYER_LEAVE_UNIT] = {
+ Order = -1,
+ Event = "OnEventPlayerLeaveUnit",
+ Text = "S_EVENT_PLAYER_LEAVE_UNIT"
+ },
+ [world.event.S_EVENT_PLAYER_COMMENT] = {
+ Order = 1,
+ Event = "OnEventPlayerComment",
+ Text = "S_EVENT_PLAYER_COMMENT"
+ },
+ [world.event.S_EVENT_SHOOTING_START] = {
+ Order = 1,
+ Event = "OnEventShootingStart",
+ Text = "S_EVENT_SHOOTING_START"
+ },
+ [world.event.S_EVENT_SHOOTING_END] = {
+ Order = 1,
+ Event = "OnEventShootingEnd",
+ Text = "S_EVENT_SHOOTING_END"
+ },
+}
+
+
--- The Events structure
-- @type EVENT.Events
-- @field #number IniUnit
@@ -4275,7 +4366,7 @@ end
function EVENT:EventText( EventID )
- local EventText = _EVENTCODES[EventID]
+ local EventText = _EVENTMETA[EventID].Text
return EventText
end
@@ -4287,18 +4378,23 @@ end
-- @param Core.Base#BASE EventClass
-- @return #EVENT.Events
function EVENT:Init( EventID, EventClass )
- self:F3( { _EVENTCODES[EventID], EventClass } )
+ self:F3( { _EVENTMETA[EventID].Text, EventClass } )
if not self.Events[EventID] then
-- Create a WEAK table to ensure that the garbage collector is cleaning the event links when the object usage is cleaned.
self.Events[EventID] = setmetatable( {}, { __mode = "k" } )
-
end
+
+ -- Each event has a subtable of EventClasses, ordered by EventPriority.
+ local EventPriority = EventClass:GetEventPriority()
+ if not self.Events[EventID][EventPriority] then
+ self.Events[EventID][EventPriority] = {}
+ end
- if not self.Events[EventID][EventClass] then
- self.Events[EventID][EventClass] = setmetatable( {}, { __mode = "k" } )
+ if not self.Events[EventID][EventPriority][EventClass] then
+ self.Events[EventID][EventPriority][EventClass] = setmetatable( {}, { __mode = "k" } )
end
- return self.Events[EventID][EventClass]
+ return self.Events[EventID][EventPriority][EventClass]
end
--- Removes an Events entry
@@ -4307,21 +4403,37 @@ end
-- @param Dcs.DCSWorld#world.event EventID
-- @return #EVENT.Events
function EVENT:Remove( EventClass, EventID )
- self:F3( { EventClass, _EVENTCODES[EventID] } )
+ self:F3( { EventClass, _EVENTMETA[EventID].Text } )
local EventClass = EventClass
- self.Events[EventID][EventClass] = nil
+ local EventPriority = EventClass:GetEventPriority()
+ self.Events[EventID][EventPriority][EventClass] = nil
end
---- Clears all event subscriptions for a @{Core.Base#BASE} derived object.
+--- Removes an Events entry for a Unit
+-- @param #EVENT self
+-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
+-- @param Dcs.DCSWorld#world.event EventID
+-- @return #EVENT.Events
+function EVENT:RemoveForUnit( UnitName, EventClass, EventID )
+ self:F3( { EventClass, _EVENTMETA[EventID].Text } )
+
+ local EventClass = EventClass
+ local EventPriority = EventClass:GetEventPriority()
+ local Event = self.Events[EventID][EventPriority][EventClass]
+ Event.IniUnit[UnitName] = nil
+end
+
+--- Clears all event subscriptions for a @{Base#BASE} derived object.
-- @param #EVENT self
-- @param Core.Base#BASE EventObject
function EVENT:RemoveAll( EventObject )
self:F3( { EventObject:GetClassNameAndID() } )
local EventClass = EventObject:GetClassNameAndID()
+ local EventPriority = EventClass:GetEventPriority()
for EventID, EventData in pairs( self.Events ) do
- self.Events[EventID][EventClass] = nil
+ self.Events[EventID][EventPriority][EventClass] = nil
end
end
@@ -4355,6 +4467,7 @@ function EVENT:OnEventGeneric( EventFunction, EventClass, EventID )
local Event = self:Init( EventID, EventClass )
Event.EventFunction = EventFunction
Event.EventClass = EventClass
+
return self
end
@@ -4840,7 +4953,7 @@ do -- OnHit
self:Remove( EventClass, world.event.S_EVENT_HIT )
return self
- end
+ end
end
@@ -4931,6 +5044,8 @@ function EVENT:onEvent( Event )
Event.IniDCSGroupName = ""
if Event.IniDCSGroup and Event.IniDCSGroup:isExist() then
Event.IniDCSGroupName = Event.IniDCSGroup:getName()
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+ self:E( { IniGroup = Event.IniGroup } )
end
end
if Event.target then
@@ -4951,36 +5066,100 @@ function EVENT:onEvent( Event )
Event.WeaponName = Event.Weapon:getTypeName()
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
end
- self:E( { _EVENTCODES[Event.id], Event, Event.IniDCSUnitName, Event.TgtDCSUnitName } )
- -- Okay, we got the event from DCS. Now loop the self.Events[] table for the received Event.id, and for each EventData registered, check if a function needs to be called.
- for EventClass, EventData in pairs( self.Events[Event.id] ) do
- -- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT.
- if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then
- self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName } )
- local Result, Value = xpcall( function() return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) end, ErrorHandler )
- --EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event )
- else
- -- If the EventData is not bound to a specific unit, then call the EventClass EventFunction.
- -- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon.
- if Event.IniDCSUnit and not EventData.IniUnit then
- if EventClass == EventData.EventClass then
- self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID() } )
- local Result, Value = xpcall( function() return EventData.EventFunction( EventData.EventClass, Event ) end, ErrorHandler )
- --EventData.EventFunction( EventData.EventClass, Event )
+ local PriorityOrder = _EVENTMETA[Event.id].Order
+ local PriorityBegin = PriorityOrder == -1 and 5 or 1
+ local PriorityEnd = PriorityOrder == -1 and 1 or 5
+
+ self:E( { _EVENTMETA[Event.id].Text, Event, Event.IniDCSUnitName, Event.TgtDCSUnitName, PriorityOrder } )
+
+ for EventPriority = PriorityBegin, PriorityEnd, PriorityOrder do
+
+ if self.Events[Event.id][EventPriority] then
+
+ -- Okay, we got the event from DCS. Now loop the SORTED self.EventSorted[] table for the received Event.id, and for each EventData registered, check if a function needs to be called.
+ for EventClass, EventData in pairs( self.Events[Event.id][EventPriority] ) do
+
+ -- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT.
+ if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then
+
+ -- First test if a EventFunction is Set, otherwise search for the default function
+ if EventData.IniUnit[Event.IniDCSUnitName].EventFunction then
+
+ self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventClass, Event )
+ end, ErrorHandler )
+
+ else
+
+ -- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
+ local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
+ if EventFunction and type( EventFunction ) == "function" then
+
+ -- Now call the default event function.
+ self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventFunction( EventClass, Event )
+ end, ErrorHandler )
+ end
+
+ end
+
+ else
+
+ -- If the EventData is not bound to a specific unit, then call the EventClass EventFunction.
+ -- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon.
+ if Event.IniDCSUnit and not EventData.IniUnit then
+
+ if EventClass == EventData.EventClass then
+
+ -- First test if a EventFunction is Set, otherwise search for the default function
+ if EventData.EventFunction then
+
+ -- There is an EventFunction defined, so call the EventFunction.
+ self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventData.EventFunction( EventClass, Event )
+ end, ErrorHandler )
+ else
+
+ -- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
+ local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
+ if EventFunction and type( EventFunction ) == "function" then
+
+ -- Now call the default event function.
+ self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
+ Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
+
+ local Result, Value = xpcall(
+ function()
+ return EventFunction( EventClass, Event )
+ end, ErrorHandler )
+ end
+ end
+ end
+ end
end
end
end
end
else
- self:E( { _EVENTCODES[Event.id], Event } )
+ self:E( { _EVENTMETA[Event.id].Text, Event } )
end
end
--- This module contains the MENU classes.
--
--- There is a small note... When you see a class like MENU_COMMAND_COALITION with COMMAND in italic, it acutally represents it like this: `MENU_COMMAND_COALITION`.
---
-- ===
--
-- DCS Menus can be managed using the MENU classes.
@@ -4994,17 +5173,17 @@ end
--
-- ### To manage **main menus**, the classes begin with **MENU_**:
--
--- * @{Core.Menu#MENU_MISSION}: Manages main menus for whole mission file.
--- * @{Core.Menu#MENU_COALITION}: Manages main menus for whole coalition.
--- * @{Core.Menu#MENU_GROUP}: Manages main menus for GROUPs.
--- * @{Core.Menu#MENU_CLIENT}: Manages main menus for CLIENTs. This manages menus for units with the skill level "Client".
+-- * @{Menu#MENU_MISSION}: Manages main menus for whole mission file.
+-- * @{Menu#MENU_COALITION}: Manages main menus for whole coalition.
+-- * @{Menu#MENU_GROUP}: Manages main menus for GROUPs.
+-- * @{Menu#MENU_CLIENT}: Manages main menus for CLIENTs. This manages menus for units with the skill level "Client".
--
-- ### To manage **command menus**, which are menus that allow the player to issue **functions**, the classes begin with **MENU_COMMAND_**:
--
--- * @{Core.Menu#MENU_MISSION_COMMAND}: Manages command menus for whole mission file.
--- * @{Core.Menu#MENU_COALITION_COMMAND}: Manages command menus for whole coalition.
--- * @{Core.Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
--- * @{Core.Menu#MENU_CLIENT_COMMAND}: Manages command menus for CLIENTs. This manages menus for units with the skill level "Client".
+-- * @{Menu#MENU_MISSION_COMMAND}: Manages command menus for whole mission file.
+-- * @{Menu#MENU_COALITION_COMMAND}: Manages command menus for whole coalition.
+-- * @{Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
+-- * @{Menu#MENU_CLIENT_COMMAND}: Manages command menus for CLIENTs. This manages menus for units with the skill level "Client".
--
-- ===
--
@@ -5016,11 +5195,11 @@ end
-- These are simply abstract base classes defining a couple of fields that are used by the
-- derived MENU_ classes to manage menus.
--
--- 1.1) @{Core.Menu#MENU_BASE} class, extends @{Core.Base#BASE}
+-- 1.1) @{#MENU_BASE} class, extends @{Base#BASE}
-- --------------------------------------------------
-- The @{#MENU_BASE} class defines the main MENU class where other MENU classes are derived from.
--
--- 1.2) @{Core.Menu#MENU_COMMAND_BASE} class, extends @{Core.Base#BASE}
+-- 1.2) @{#MENU_COMMAND_BASE} class, extends @{Base#BASE}
-- ----------------------------------------------------------
-- The @{#MENU_COMMAND_BASE} class defines the main MENU class where other MENU COMMAND_ classes are derived from, in order to set commands.
--
@@ -5032,15 +5211,15 @@ end
-- ======================
-- The underlying classes manage the menus for a complete mission file.
--
--- 2.1) @{Menu#MENU_MISSION} class, extends @{Core.Menu#MENU_BASE}
+-- 2.1) @{#MENU_MISSION} class, extends @{Menu#MENU_BASE}
-- ---------------------------------------------------------
--- The @{Core.Menu#MENU_MISSION} class manages the main menus for a complete mission.
+-- The @{Menu#MENU_MISSION} class manages the main menus for a complete mission.
-- You can add menus with the @{#MENU_MISSION.New} method, which constructs a MENU_MISSION object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_MISSION.Remove}.
--
--- 2.2) @{Menu#MENU_MISSION_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 2.2) @{#MENU_MISSION_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- -------------------------------------------------------------------------
--- The @{Core.Menu#MENU_MISSION_COMMAND} class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_MISSION_COMMAND} class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_MISSION_COMMAND.New} method, which constructs a MENU_MISSION_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_MISSION_COMMAND.Remove}.
--
@@ -5050,15 +5229,15 @@ end
-- =========================
-- The underlying classes manage the menus for whole coalitions.
--
--- 3.1) @{Menu#MENU_COALITION} class, extends @{Core.Menu#MENU_BASE}
+-- 3.1) @{#MENU_COALITION} class, extends @{Menu#MENU_BASE}
-- ------------------------------------------------------------
--- The @{Core.Menu#MENU_COALITION} class manages the main menus for coalitions.
+-- The @{Menu#MENU_COALITION} class manages the main menus for coalitions.
-- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}.
--
--- 3.2) @{Menu#MENU_COALITION_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 3.2) @{Menu#MENU_COALITION_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- ----------------------------------------------------------------------------
--- The @{Core.Menu#MENU_COALITION_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_COALITION_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_COALITION_COMMAND.New} method, which constructs a MENU_COALITION_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION_COMMAND.Remove}.
--
@@ -5068,15 +5247,15 @@ end
-- =====================
-- The underlying classes manage the menus for groups. Note that groups can be inactive, alive or can be destroyed.
--
--- 4.1) @{Menu#MENU_GROUP} class, extends @{Core.Menu#MENU_BASE}
+-- 4.1) @{Menu#MENU_GROUP} class, extends @{Menu#MENU_BASE}
-- --------------------------------------------------------
--- The @{Core.Menu#MENU_GROUP} class manages the main menus for coalitions.
+-- The @{Menu#MENU_GROUP} class manages the main menus for coalitions.
-- You can add menus with the @{#MENU_GROUP.New} method, which constructs a MENU_GROUP object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP.Remove}.
--
--- 4.2) @{Menu#MENU_GROUP_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 4.2) @{Menu#MENU_GROUP_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- ------------------------------------------------------------------------
--- The @{Core.Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_GROUP_COMMAND.New} method, which constructs a MENU_GROUP_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP_COMMAND.Remove}.
--
@@ -5086,15 +5265,15 @@ end
-- ======================
-- The underlying classes manage the menus for units with skill level client or player.
--
--- 5.1) @{Menu#MENU_CLIENT} class, extends @{Core.Menu#MENU_BASE}
+-- 5.1) @{Menu#MENU_CLIENT} class, extends @{Menu#MENU_BASE}
-- ---------------------------------------------------------
--- The @{Core.Menu#MENU_CLIENT} class manages the main menus for coalitions.
+-- The @{Menu#MENU_CLIENT} class manages the main menus for coalitions.
-- You can add menus with the @{#MENU_CLIENT.New} method, which constructs a MENU_CLIENT object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_CLIENT.Remove}.
--
--- 5.2) @{Menu#MENU_CLIENT_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
+-- 5.2) @{Menu#MENU_CLIENT_COMMAND} class, extends @{Menu#MENU_COMMAND_BASE}
-- -------------------------------------------------------------------------
--- The @{Core.Menu#MENU_CLIENT_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+-- The @{Menu#MENU_CLIENT_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-- You can add menus with the @{#MENU_CLIENT_COMMAND.New} method, which constructs a MENU_CLIENT_COMMAND object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_CLIENT_COMMAND.Remove}.
--
@@ -5601,9 +5780,8 @@ do -- MENU_CLIENT
-- @param #string MenuText The text for the menu.
-- @param #MENU_BASE ParentMenu The parent menu.
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
- -- @param CommandMenuArgument An argument for the function.
-- @return Menu#MENU_CLIENT_COMMAND self
- function MENU_CLIENT_COMMAND:New( MenuClient, MenuText, ParentMenu, CommandMenuFunction, ... )
+ function MENU_CLIENT_COMMAND:New( Client, MenuText, ParentMenu, CommandMenuFunction, ... )
-- Arrange meta tables
@@ -5614,8 +5792,8 @@ do -- MENU_CLIENT
local self = BASE:Inherit( self, MENU_COMMAND_BASE:New( MenuText, MenuParentPath, CommandMenuFunction, arg ) ) -- Menu#MENU_CLIENT_COMMAND
- self.MenuClient = MenuClient
- self.MenuClientGroupID = MenuClient:GetClientGroupID()
+ self.MenuClient = Client
+ self.MenuClientGroupID = Client:GetClientGroupID()
self.MenuParentPath = MenuParentPath
self.MenuText = MenuText
self.ParentMenu = ParentMenu
@@ -5626,7 +5804,7 @@ do -- MENU_CLIENT
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
- self:T( { MenuClient:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText, CommandMenuFunction, arg } )
+ self:T( { Client:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText, CommandMenuFunction, arg } )
local MenuPathID = table.concat(MenuParentPath) .. "/" .. MenuText
if MenuPath[MenuPathID] then
@@ -5636,7 +5814,9 @@ do -- MENU_CLIENT
self.MenuPath = missionCommands.addCommandForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath, self.MenuCallHandler, arg )
MenuPath[MenuPathID] = self.MenuPath
- ParentMenu.Menus[self.MenuPath] = self
+ if ParentMenu and ParentMenu.Menus then
+ ParentMenu.Menus[self.MenuPath] = self
+ end
return self
end
@@ -5870,7 +6050,7 @@ do
end
---- This module contains the ZONE classes, inherited from @{Core.Zone#ZONE_BASE}.
+--- This module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
-- There are essentially two core functions that zones accomodate:
--
-- * Test if an object is within the zone boundaries.
@@ -5879,7 +6059,7 @@ end
-- The object classes are using the zone classes to test the zone boundaries, which can take various forms:
--
-- * Test if completely within the zone.
--- * Test if partly within the zone (for @{Wrapper.Group#GROUP} objects).
+-- * Test if partly within the zone (for @{Group#GROUP} objects).
-- * Test if not in the zone.
-- * Distance to the nearest intersecting point of the zone.
-- * Distance to the center of the zone.
@@ -5887,16 +6067,16 @@ end
--
-- Each of these ZONE classes have a zone name, and specific parameters defining the zone type:
--
--- * @{Core.Zone#ZONE_BASE}: The ZONE_BASE class defining the base for all other zone classes.
--- * @{Core.Zone#ZONE_RADIUS}: The ZONE_RADIUS class defined by a zone name, a location and a radius.
--- * @{Core.Zone#ZONE}: The ZONE class, defined by the zone name as defined within the Mission Editor.
--- * @{Core.Zone#ZONE_UNIT}: The ZONE_UNIT class defines by a zone around a @{Wrapper.Unit#UNIT} with a radius.
--- * @{Core.Zone#ZONE_GROUP}: The ZONE_GROUP class defines by a zone around a @{Wrapper.Group#GROUP} with a radius.
--- * @{Core.Zone#ZONE_POLYGON}: The ZONE_POLYGON class defines by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+-- * @{Zone#ZONE_BASE}: The ZONE_BASE class defining the base for all other zone classes.
+-- * @{Zone#ZONE_RADIUS}: The ZONE_RADIUS class defined by a zone name, a location and a radius.
+-- * @{Zone#ZONE}: The ZONE class, defined by the zone name as defined within the Mission Editor.
+-- * @{Zone#ZONE_UNIT}: The ZONE_UNIT class defines by a zone around a @{Unit#UNIT} with a radius.
+-- * @{Zone#ZONE_GROUP}: The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius.
+-- * @{Zone#ZONE_POLYGON}: The ZONE_POLYGON class defines by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
--
-- ===
--
--- 1) @{Core.Zone#ZONE_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
-- ================================================
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
@@ -5904,10 +6084,10 @@ end
--
-- * @{#ZONE_BASE.GetName}(): Returns the name of the zone.
--
--- ### 1.2) Each zone implements two polymorphic functions defined in @{Core.Zone#ZONE_BASE}:
+-- ### 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
--
--- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Core.Point#POINT_VEC2} is within the zone.
--- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Core.Point#POINT_VEC3} is within the zone.
+-- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Point#POINT_VEC2} is within the zone.
+-- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Point#POINT_VEC3} is within the zone.
--
-- ### 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
--
@@ -5917,8 +6097,8 @@ end
--
-- ### 1.4) A zone manages Vectors:
--
--- * @{#ZONE_BASE.GetVec2}(): Returns the @{Dcs.DCSTypes#Vec2} coordinate of the zone.
--- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{Dcs.DCSTypes#Vec2} within the zone.
+-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} coordinate of the zone.
+-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{DCSTypes#Vec2} within the zone.
--
-- ### 1.5) A zone has a bounding square:
--
@@ -5931,12 +6111,12 @@ end
--
-- ===
--
--- 2) @{Core.Zone#ZONE_RADIUS} class, extends @{Core.Zone#ZONE_BASE}
+-- 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
-- =======================================================
-- The ZONE_RADIUS class defined by a zone name, a location and a radius.
-- This class implements the inherited functions from Core.Zone#ZONE_BASE taking into account the own zone format and properties.
--
--- ### 2.1) @{Core.Zone#ZONE_RADIUS} constructor:
+-- ### 2.1) @{Zone#ZONE_RADIUS} constructor:
--
-- * @{#ZONE_BASE.New}(): Constructor.
--
@@ -5947,45 +6127,45 @@ end
--
-- ### 2.3) Manage the location of the zone:
--
--- * @{#ZONE_BASE.SetVec2}(): Sets the @{Dcs.DCSTypes#Vec2} of the zone.
--- * @{#ZONE_BASE.GetVec2}(): Returns the @{Dcs.DCSTypes#Vec2} of the zone.
--- * @{#ZONE_BASE.GetVec3}(): Returns the @{Dcs.DCSTypes#Vec3} of the zone, taking an additional height parameter.
+-- * @{#ZONE_BASE.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone.
+-- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone.
+-- * @{#ZONE_BASE.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter.
--
-- ===
--
--- 3) @{Core.Zone#ZONE} class, extends @{Core.Zone#ZONE_RADIUS}
+-- 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
-- ==========================================
-- The ZONE class, defined by the zone name as defined within the Mission Editor.
-- This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
--- 4) @{Core.Zone#ZONE_UNIT} class, extends @{Core.Zone#ZONE_RADIUS}
+-- 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
--- The ZONE_UNIT class defined by a zone around a @{Wrapper.Unit#UNIT} with a radius.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
--- 5) @{Core.Zone#ZONE_GROUP} class, extends @{Core.Zone#ZONE_RADIUS}
+-- 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
-- =======================================================
--- The ZONE_GROUP class defines by a zone around a @{Wrapper.Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ===
--
--- 6) @{Core.Zone#ZONE_POLYGON_BASE} class, extends @{Core.Zone#ZONE_BASE}
+-- 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
-- ========================================================
--- The ZONE_POLYGON_BASE class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_POLYGON_BASE class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
--
-- ===
--
--- 7) @{Core.Zone#ZONE_POLYGON} class, extends @{Core.Zone#ZONE_POLYGON_BASE}
+-- 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
-- ================================================================
--- The ZONE_POLYGON class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
--- This class implements the inherited functions from @{Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
+-- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
--
-- ====
--
@@ -6076,7 +6256,7 @@ function ZONE_BASE:IsPointVec3InZone( Vec3 )
return InZone
end
---- Returns the @{Dcs.DCSTypes#Vec2} coordinate of the zone.
+--- Returns the @{DCSTypes#Vec2} coordinate of the zone.
-- @param #ZONE_BASE self
-- @return #nil.
function ZONE_BASE:GetVec2()
@@ -6084,7 +6264,7 @@ function ZONE_BASE:GetVec2()
return nil
end
---- Define a random @{Dcs.DCSTypes#Vec2} within the zone.
+--- Define a random @{DCSTypes#Vec2} within the zone.
-- @param #ZONE_BASE self
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinates.
function ZONE_BASE:GetRandomVec2()
@@ -6246,7 +6426,7 @@ function ZONE_RADIUS:SetRadius( Radius )
return self.Radius
end
---- Returns the @{Dcs.DCSTypes#Vec2} of the zone.
+--- Returns the @{DCSTypes#Vec2} of the zone.
-- @param #ZONE_RADIUS self
-- @return Dcs.DCSTypes#Vec2 The location of the zone.
function ZONE_RADIUS:GetVec2()
@@ -6257,7 +6437,7 @@ function ZONE_RADIUS:GetVec2()
return self.Vec2
end
---- Sets the @{Dcs.DCSTypes#Vec2} of the zone.
+--- Sets the @{DCSTypes#Vec2} of the zone.
-- @param #ZONE_RADIUS self
-- @param Dcs.DCSTypes#Vec2 Vec2 The new location of the zone.
-- @return Dcs.DCSTypes#Vec2 The new location of the zone.
@@ -6271,7 +6451,7 @@ function ZONE_RADIUS:SetVec2( Vec2 )
return self.Vec2
end
---- Returns the @{Dcs.DCSTypes#Vec3} of the ZONE_RADIUS.
+--- Returns the @{DCSTypes#Vec3} of the ZONE_RADIUS.
-- @param #ZONE_RADIUS self
-- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
-- @return Dcs.DCSTypes#Vec3 The point of the zone.
@@ -6373,7 +6553,7 @@ function ZONE:New( ZoneName )
end
---- The ZONE_UNIT class defined by a zone around a @{Wrapper.Unit#UNIT} with a radius.
+--- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
-- @type ZONE_UNIT
-- @field Wrapper.Unit#UNIT ZoneUNIT
-- @extends Core.Zone#ZONE_RADIUS
@@ -6398,9 +6578,9 @@ function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius )
end
---- Returns the current location of the @{Wrapper.Unit#UNIT}.
+--- Returns the current location of the @{Unit#UNIT}.
-- @param #ZONE_UNIT self
--- @return Dcs.DCSTypes#Vec2 The location of the zone based on the @{Wrapper.Unit#UNIT}location.
+-- @return Dcs.DCSTypes#Vec2 The location of the zone based on the @{Unit#UNIT}location.
function ZONE_UNIT:GetVec2()
self:F( self.ZoneName )
@@ -6439,7 +6619,7 @@ function ZONE_UNIT:GetRandomVec2()
return RandomVec2
end
---- Returns the @{Dcs.DCSTypes#Vec3} of the ZONE_UNIT.
+--- Returns the @{DCSTypes#Vec3} of the ZONE_UNIT.
-- @param #ZONE_UNIT self
-- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
-- @return Dcs.DCSTypes#Vec3 The point of the zone.
@@ -6465,7 +6645,7 @@ ZONE_GROUP = {
ClassName="ZONE_GROUP",
}
---- Constructor to create a ZONE_GROUP instance, taking the zone name, a zone @{Wrapper.Group#GROUP} and a radius.
+--- Constructor to create a ZONE_GROUP instance, taking the zone name, a zone @{Group#GROUP} and a radius.
-- @param #ZONE_GROUP self
-- @param #string ZoneName Name of the zone.
-- @param Wrapper.Group#GROUP ZoneGROUP The @{Group} as the center of the zone.
@@ -6516,9 +6696,9 @@ end
-- Polygons
---- The ZONE_POLYGON_BASE class defined by an array of @{Dcs.DCSTypes#Vec2}, forming a polygon.
+--- The ZONE_POLYGON_BASE class defined by an array of @{DCSTypes#Vec2}, forming a polygon.
-- @type ZONE_POLYGON_BASE
--- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{Dcs.DCSTypes#Vec2}.
+-- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{DCSTypes#Vec2}.
-- @extends Core.Zone#ZONE_BASE
ZONE_POLYGON_BASE = {
ClassName="ZONE_POLYGON_BASE",
@@ -6528,11 +6708,11 @@ ZONE_POLYGON_BASE = {
-- @type ZONE_POLYGON_BASE.ListVec2
-- @list
---- Constructor to create a ZONE_POLYGON_BASE instance, taking the zone name and an array of @{Dcs.DCSTypes#Vec2}, forming a polygon.
--- The @{Wrapper.Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected.
+--- Constructor to create a ZONE_POLYGON_BASE instance, taking the zone name and an array of @{DCSTypes#Vec2}, forming a polygon.
+-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected.
-- @param #ZONE_POLYGON_BASE self
-- @param #string ZoneName Name of the zone.
--- @param #ZONE_POLYGON_BASE.ListVec2 PointsArray An array of @{Dcs.DCSTypes#Vec2}, forming a polygon..
+-- @param #ZONE_POLYGON_BASE.ListVec2 PointsArray An array of @{DCSTypes#Vec2}, forming a polygon..
-- @return #ZONE_POLYGON_BASE self
function ZONE_POLYGON_BASE:New( ZoneName, PointsArray )
local self = BASE:Inherit( self, ZONE_BASE:New( ZoneName ) )
@@ -6629,7 +6809,7 @@ function ZONE_POLYGON_BASE:IsPointVec2InZone( Vec2 )
return InPolygon
end
---- Define a random @{Dcs.DCSTypes#Vec2} within the zone.
+--- Define a random @{DCSTypes#Vec2} within the zone.
-- @param #ZONE_POLYGON_BASE self
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinate.
function ZONE_POLYGON_BASE:GetRandomVec2()
@@ -6681,15 +6861,15 @@ end
---- The ZONE_POLYGON class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
+--- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
-- @type ZONE_POLYGON
-- @extends Core.Zone#ZONE_POLYGON_BASE
ZONE_POLYGON = {
ClassName="ZONE_POLYGON",
}
---- Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the @{Wrapper.Group#GROUP} defined within the Mission Editor.
--- The @{Wrapper.Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
+--- Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the @{Group#GROUP} defined within the Mission Editor.
+-- The @{Group#GROUP} waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
-- @param #ZONE_POLYGON self
-- @param #string ZoneName Name of the zone.
-- @param Wrapper.Group#GROUP ZoneGroup The GROUP waypoints as defined within the Mission Editor define the polygon shape.
@@ -6708,7 +6888,7 @@ end
--
-- ====
--
--- 1) @{Core.Database#DATABASE} class, extends @{Core.Base#BASE}
+-- 1) @{#DATABASE} class, extends @{Base#BASE}
-- ===================================================
-- Mission designers can use the DATABASE class to refer to:
--
@@ -6789,15 +6969,16 @@ function DATABASE:New()
-- Inherits from BASE
local self = BASE:Inherit( self, BASE:New() )
+
+ self:SetEventPriority( 1 )
- _EVENTDISPATCHER:OnBirth( self._EventOnBirth, self )
- _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
-
+ self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
+ self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
-- Follow alive players and clients
- _EVENTDISPATCHER:OnPlayerEnterUnit( self._EventOnPlayerEnterUnit, self )
- _EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventOnPlayerLeaveUnit, self )
+ self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit )
+ self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
self:_RegisterTemplates()
self:_RegisterGroupsAndUnits()
@@ -6934,6 +7115,7 @@ end
function DATABASE:AddGroup( GroupName )
if not self.GROUPS[GroupName] then
+ self:E( { "Add GROUP:", GroupName } )
self.GROUPS[GroupName] = GROUP:Register( GroupName )
end
@@ -7275,6 +7457,8 @@ function DATABASE:_EventOnPlayerEnterUnit( Event )
self:F2( { Event } )
if Event.IniUnit then
+ self:AddUnit( Event.IniDCSUnitName )
+ self:AddGroup( Event.IniDCSGroupName )
local PlayerName = Event.IniUnit:GetPlayerName()
if not self.PLAYERS[PlayerName] then
self:AddPlayer( Event.IniUnitName, PlayerName )
@@ -7419,6 +7603,8 @@ function DATABASE:_RegisterTemplates()
if (CoalitionName == 'red' or CoalitionName == 'blue') and type(coa_data) == 'table' then
--self.Units[coa_name] = {}
+
+ local CoalitionSide = coalition.side[string.upper(CoalitionName)]
----------------------------------------------
-- build nav points DB
@@ -7442,6 +7628,8 @@ function DATABASE:_RegisterTemplates()
for cntry_id, cntry_data in pairs(coa_data.country) do
local CountryName = string.upper(cntry_data.name)
+ local CountryID = cntry_data.id
+
--self.Units[coa_name][countryName] = {}
--self.Units[coa_name][countryName]["countryId"] = cntry_data.id
@@ -7462,9 +7650,9 @@ function DATABASE:_RegisterTemplates()
if GroupTemplate and GroupTemplate.units and type(GroupTemplate.units) == 'table' then --making sure again- this is a valid group
self:_RegisterTemplate(
GroupTemplate,
- coalition.side[string.upper(CoalitionName)],
+ CoalitionSide,
_DATABASECategory[string.lower(CategoryName)],
- country.id[string.upper(CountryName)]
+ CountryID
)
end --if GroupTemplate and GroupTemplate.units then
end --for group_num, GroupTemplate in pairs(obj_type_data.group) do
@@ -7487,9 +7675,9 @@ end
--
-- ===
--
--- 1) @{Core.Set#SET_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{Set#SET_BASE} class, extends @{Base#BASE}
-- ==============================================
--- The @{Core.Set#SET_BASE} class defines the core functions that define a collection of objects.
+-- The @{Set#SET_BASE} class defines the core functions that define a collection of objects.
-- A SET provides iterators to iterate the SET, but will **temporarily** yield the ForEach interator loop at defined **"intervals"** to the mail simulator loop.
-- In this way, large loops can be done while not blocking the simulator main processing loop.
-- The default **"yield interval"** is after 10 objects processed.
@@ -7497,18 +7685,18 @@ end
--
-- 1.1) Add or remove objects from the SET
-- ---------------------------------------
--- Some key core functions are @{Core.Set#SET_BASE.Add} and @{Core.Set#SET_BASE.Remove} to add or remove objects from the SET in your logic.
+-- Some key core functions are @{Set#SET_BASE.Add} and @{Set#SET_BASE.Remove} to add or remove objects from the SET in your logic.
--
-- 1.2) Define the SET iterator **"yield interval"** and the **"time interval"**
-- -----------------------------------------------------------------------------
--- Modify the iterator intervals with the @{Core.Set#SET_BASE.SetInteratorIntervals} method.
+-- Modify the iterator intervals with the @{Set#SET_BASE.SetInteratorIntervals} method.
-- You can set the **"yield interval"**, and the **"time interval"**. (See above).
--
-- ===
--
--- 2) @{Core.Set#SET_GROUP} class, extends @{Core.Set#SET_BASE}
+-- 2) @{Set#SET_GROUP} class, extends @{Set#SET_BASE}
-- ==================================================
--- Mission designers can use the @{Core.Set#SET_GROUP} class to build sets of groups belonging to certain:
+-- Mission designers can use the @{Set#SET_GROUP} class to build sets of groups belonging to certain:
--
-- * Coalitions
-- * Categories
@@ -7523,7 +7711,7 @@ end
--
-- 2.2) Add or Remove GROUP(s) from SET_GROUP:
-- -------------------------------------------
--- GROUPS can be added and removed using the @{Core.Set#SET_GROUP.AddGroupsByName} and @{Core.Set#SET_GROUP.RemoveGroupsByName} respectively.
+-- GROUPS can be added and removed using the @{Set#SET_GROUP.AddGroupsByName} and @{Set#SET_GROUP.RemoveGroupsByName} respectively.
-- These methods take a single GROUP name or an array of GROUP names to be added or removed from SET_GROUP.
--
-- 2.3) SET_GROUP filter criteria:
@@ -7542,7 +7730,7 @@ end
--
-- Planned filter criteria within development are (so these are not yet available):
--
--- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Core.Zone#ZONE}.
+-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Zone#ZONE}.
--
-- 2.4) SET_GROUP iterators:
-- -------------------------
@@ -7557,9 +7745,9 @@ end
--
-- ====
--
--- 3) @{Core.Set#SET_UNIT} class, extends @{Core.Set#SET_BASE}
+-- 3) @{Set#SET_UNIT} class, extends @{Set#SET_BASE}
-- ===================================================
--- Mission designers can use the @{Core.Set#SET_UNIT} class to build sets of units belonging to certain:
+-- Mission designers can use the @{Set#SET_UNIT} class to build sets of units belonging to certain:
--
-- * Coalitions
-- * Categories
@@ -7575,7 +7763,7 @@ end
--
-- 3.2) Add or Remove UNIT(s) from SET_UNIT:
-- -----------------------------------------
--- UNITs can be added and removed using the @{Core.Set#SET_UNIT.AddUnitsByName} and @{Core.Set#SET_UNIT.RemoveUnitsByName} respectively.
+-- UNITs can be added and removed using the @{Set#SET_UNIT.AddUnitsByName} and @{Set#SET_UNIT.RemoveUnitsByName} respectively.
-- These methods take a single UNIT name or an array of UNIT names to be added or removed from SET_UNIT.
--
-- 3.3) SET_UNIT filter criteria:
@@ -7595,7 +7783,7 @@ end
--
-- Planned filter criteria within development are (so these are not yet available):
--
--- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Core.Zone#ZONE}.
+-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Zone#ZONE}.
--
-- 3.4) SET_UNIT iterators:
-- ------------------------
@@ -7615,9 +7803,9 @@ end
--
-- ===
--
--- 4) @{Core.Set#SET_CLIENT} class, extends @{Core.Set#SET_BASE}
+-- 4) @{Set#SET_CLIENT} class, extends @{Set#SET_BASE}
-- ===================================================
--- Mission designers can use the @{Core.Set#SET_CLIENT} class to build sets of units belonging to certain:
+-- Mission designers can use the @{Set#SET_CLIENT} class to build sets of units belonging to certain:
--
-- * Coalitions
-- * Categories
@@ -7633,7 +7821,7 @@ end
--
-- 4.2) Add or Remove CLIENT(s) from SET_CLIENT:
-- -----------------------------------------
--- CLIENTs can be added and removed using the @{Core.Set#SET_CLIENT.AddClientsByName} and @{Core.Set#SET_CLIENT.RemoveClientsByName} respectively.
+-- CLIENTs can be added and removed using the @{Set#SET_CLIENT.AddClientsByName} and @{Set#SET_CLIENT.RemoveClientsByName} respectively.
-- These methods take a single CLIENT name or an array of CLIENT names to be added or removed from SET_CLIENT.
--
-- 4.3) SET_CLIENT filter criteria:
@@ -7653,7 +7841,7 @@ end
--
-- Planned filter criteria within development are (so these are not yet available):
--
--- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Core.Zone#ZONE}.
+-- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Zone#ZONE}.
--
-- 4.4) SET_CLIENT iterators:
-- ------------------------
@@ -7665,9 +7853,9 @@ end
--
-- ====
--
--- 5) @{Core.Set#SET_AIRBASE} class, extends @{Core.Set#SET_BASE}
+-- 5) @{Set#SET_AIRBASE} class, extends @{Set#SET_BASE}
-- ====================================================
--- Mission designers can use the @{Core.Set#SET_AIRBASE} class to build sets of airbases optionally belonging to certain:
+-- Mission designers can use the @{Set#SET_AIRBASE} class to build sets of airbases optionally belonging to certain:
--
-- * Coalitions
--
@@ -7679,7 +7867,7 @@ end
--
-- 5.2) Add or Remove AIRBASEs from SET_AIRBASE
-- --------------------------------------------
--- AIRBASEs can be added and removed using the @{Core.Set#SET_AIRBASE.AddAirbasesByName} and @{Core.Set#SET_AIRBASE.RemoveAirbasesByName} respectively.
+-- AIRBASEs can be added and removed using the @{Set#SET_AIRBASE.AddAirbasesByName} and @{Set#SET_AIRBASE.RemoveAirbasesByName} respectively.
-- These methods take a single AIRBASE name or an array of AIRBASE names to be added or removed from SET_AIRBASE.
--
-- 5.3) SET_AIRBASE filter criteria
@@ -7749,10 +7937,12 @@ function SET_BASE:New( Database )
self.CallScheduler = SCHEDULER:New( self )
+ self:SetEventPriority( 2 )
+
return self
end
---- Finds an @{Core.Base#BASE} object based on the object Name.
+--- Finds an @{Base#BASE} object based on the object Name.
-- @param #SET_BASE self
-- @param #string ObjectName
-- @return Core.Base#BASE The Object found.
@@ -7772,7 +7962,7 @@ function SET_BASE:GetSet()
return self.Set
end
---- Adds a @{Core.Base#BASE} object in the @{Core.Set#SET_BASE}, using a given ObjectName as the index.
+--- Adds a @{Base#BASE} object in the @{Set#SET_BASE}, using a given ObjectName as the index.
-- @param #SET_BASE self
-- @param #string ObjectName
-- @param Core.Base#BASE Object
@@ -7798,7 +7988,7 @@ function SET_BASE:Add( ObjectName, Object )
end
---- Adds a @{Core.Base#BASE} object in the @{Core.Set#SET_BASE}, using the Object Name as the index.
+--- Adds a @{Base#BASE} object in the @{Set#SET_BASE}, using the Object Name as the index.
-- @param #SET_BASE self
-- @param Wrapper.Object#OBJECT Object
-- @return Core.Base#BASE The added BASE Object.
@@ -7813,7 +8003,7 @@ end
---- Removes a @{Core.Base#BASE} object from the @{Core.Set#SET_BASE} and derived classes, based on the Object Name.
+--- Removes a @{Base#BASE} object from the @{Set#SET_BASE} and derived classes, based on the Object Name.
-- @param #SET_BASE self
-- @param #string ObjectName
function SET_BASE:Remove( ObjectName )
@@ -7852,7 +8042,7 @@ function SET_BASE:Remove( ObjectName )
end
---- Gets a @{Core.Base#BASE} object from the @{Core.Set#SET_BASE} and derived classes, based on the Object Name.
+--- Gets a @{Base#BASE} object from the @{Set#SET_BASE} and derived classes, based on the Object Name.
-- @param #SET_BASE self
-- @param #string ObjectName
-- @return Core.Base#BASE
@@ -7867,7 +8057,7 @@ function SET_BASE:Get( ObjectName )
end
---- Retrieves the amount of objects in the @{Core.Set#SET_BASE} and derived classes.
+--- Retrieves the amount of objects in the @{Set#SET_BASE} and derived classes.
-- @param #SET_BASE self
-- @return #number Count
function SET_BASE:Count()
@@ -7936,13 +8126,13 @@ function SET_BASE:_FilterStart()
end
end
- _EVENTDISPATCHER:OnBirth( self._EventOnBirth, self )
- _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
+ self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
+ self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
-- Follow alive players and clients
- _EVENTDISPATCHER:OnPlayerEnterUnit( self._EventOnPlayerEnterUnit, self )
- _EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventOnPlayerLeaveUnit, self )
+ self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit )
+ self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventOnPlayerLeaveUnit )
return self
@@ -7953,16 +8143,16 @@ end
-- @return #SET_BASE self
function SET_BASE:FilterStop()
- _EVENTDISPATCHER:OnBirthRemove( self )
- _EVENTDISPATCHER:OnDeadRemove( self )
- _EVENTDISPATCHER:OnCrashRemove( self )
+ self:UnHandleEvent( EVENTS.Birth )
+ self:UnHandleEvent( EVENTS.Dead )
+ self:UnHandleEvent( EVENTS.Crash )
return self
end
---- Iterate the SET_BASE while identifying the nearest object from a @{Core.Point#POINT_VEC2}.
+--- Iterate the SET_BASE while identifying the nearest object from a @{Point#POINT_VEC2}.
-- @param #SET_BASE self
--- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest object in the set.
+-- @param Core.Point#POINT_VEC2 PointVec2 A @{Point#POINT_VEC2} object from where to evaluate the closest object in the set.
-- @return Core.Base#BASE The closest object.
function SET_BASE:FindNearestObjectFromPointVec2( PointVec2 )
self:F2( PointVec2 )
@@ -9709,10 +9899,10 @@ function SET_AIRBASE:ForEachAirbase( IteratorFunction, ... )
return self
end
---- Iterate the SET_AIRBASE while identifying the nearest @{Wrapper.Airbase#AIRBASE} from a @{Core.Point#POINT_VEC2}.
+--- Iterate the SET_AIRBASE while identifying the nearest @{Airbase#AIRBASE} from a @{Point#POINT_VEC2}.
-- @param #SET_AIRBASE self
--- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest @{Wrapper.Airbase#AIRBASE}.
--- @return Wrapper.Airbase#AIRBASE The closest @{Wrapper.Airbase#AIRBASE}.
+-- @param Core.Point#POINT_VEC2 PointVec2 A @{Point#POINT_VEC2} object from where to evaluate the closest @{Airbase#AIRBASE}.
+-- @return Wrapper.Airbase#AIRBASE The closest @{Airbase#AIRBASE}.
function SET_AIRBASE:FindNearestAirbaseFromPointVec2( PointVec2 )
self:F2( PointVec2 )
@@ -9766,9 +9956,9 @@ function SET_AIRBASE:IsIncludeObject( MAirbase )
end
--- This module contains the POINT classes.
--
--- 1) @{Core.Point#POINT_VEC3} class, extends @{Core.Base#BASE}
+-- 1) @{Point#POINT_VEC3} class, extends @{Base#BASE}
-- ==================================================
--- The @{Core.Point#POINT_VEC3} class defines a 3D point in the simulator.
+-- The @{Point#POINT_VEC3} class defines a 3D point in the simulator.
--
-- **Important Note:** Most of the functions in this section were taken from MIST, and reworked to OO concepts.
-- In order to keep the credibility of the the author, I want to emphasize that the of the MIST framework was created by Grimes, who you can find on the Eagle Dynamics Forums.
@@ -9777,20 +9967,20 @@ end
-- ---------------------------
-- A new POINT_VEC3 instance can be created with:
--
--- * @{#POINT_VEC3.New}(): a 3D point.
--- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{Dcs.DCSTypes#Vec3}.
+-- * @{Point#POINT_VEC3.New}(): a 3D point.
+-- * @{Point#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
--
--
--- 2) @{Core.Point#POINT_VEC2} class, extends @{Core.Point#POINT_VEC3}
+-- 2) @{Point#POINT_VEC2} class, extends @{Point#POINT_VEC3}
-- =========================================================
--- The @{Core.Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
+-- The @{Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
--
-- 2.1) POINT_VEC2 constructor
-- ---------------------------
-- A new POINT_VEC2 instance can be created with:
--
--- * @{#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
--- * @{#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{Dcs.DCSTypes#Vec2}.
+-- * @{Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
+-- * @{Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
--
-- ===
--
@@ -10438,10 +10628,10 @@ function POINT_VEC2:DistanceFromPointVec2( PointVec2Reference )
return Distance
end
---- Calculate the distance from a reference @{Dcs.DCSTypes#Vec2}.
+--- Calculate the distance from a reference @{DCSTypes#Vec2}.
-- @param #POINT_VEC2 self
--- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{Dcs.DCSTypes#Vec2}.
--- @return Dcs.DCSTypes#Distance The distance from the reference @{Dcs.DCSTypes#Vec2} in meters.
+-- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{DCSTypes#Vec2}.
+-- @return Dcs.DCSTypes#Distance The distance from the reference @{DCSTypes#Vec2} in meters.
function POINT_VEC2:DistanceFromVec2( Vec2Reference )
self:F2( Vec2Reference )
@@ -10479,7 +10669,7 @@ end
--- This module contains the MESSAGE class.
--
--- 1) @{Core.Message#MESSAGE} class, extends @{Core.Base#BASE}
+-- 1) @{Message#MESSAGE} class, extends @{Base#BASE}
-- =================================================
-- Message System to display Messages to Clients, Coalitions or All.
-- Messages are shown on the display panel for an amount of seconds, and will then disappear.
@@ -10487,16 +10677,16 @@ end
--
-- 1.1) MESSAGE construction methods
-- ---------------------------------
--- Messages are created with @{Core.Message#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet.
+-- Messages are created with @{Message#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet.
-- To send messages, you need to use the To functions.
--
-- 1.2) Send messages with MESSAGE To methods
-- ------------------------------------------
-- Messages are sent to:
--
--- * Clients with @{Core.Message#MESSAGE.ToClient}.
--- * Coalitions with @{Core.Message#MESSAGE.ToCoalition}.
--- * All Players with @{Core.Message#MESSAGE.ToAll}.
+-- * Clients with @{Message#MESSAGE.ToClient}.
+-- * Coalitions with @{Message#MESSAGE.ToCoalition}.
+-- * All Players with @{Message#MESSAGE.ToAll}.
--
-- @module Message
-- @author FlightControl
@@ -10762,6 +10952,8 @@ end
--
-- 
--
+-- ===
+--
-- A FSM can only be in one of a finite number of states.
-- The machine is in only one state at a time; the state it is in at any given time is called the **current state**.
-- It can change from one state to another when initiated by an **__internal__ or __external__ triggering event**, which is called a **transition**.
@@ -10805,7 +10997,7 @@ end
--
-- ===
--
--- # 1) @{Core.Fsm#FSM} class, extends @{Core.Base#BASE}
+-- # 1) @{#FSM} class, extends @{Base#BASE}
--
-- 
--
@@ -11085,6 +11277,7 @@ do -- FSM
self._Processes = {}
self._EndStates = {}
self._Scores = {}
+ self._EventSchedules = {}
self.CallScheduler = SCHEDULER:New( self )
@@ -11285,9 +11478,10 @@ do -- FSM
end
- function FSM:_call_handler(handler, params)
+ function FSM:_call_handler( handler, params, EventName )
if self[handler] then
self:T( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
local Value = self[handler]( self, unpack(params) )
return Value
end
@@ -11311,10 +11505,10 @@ do -- FSM
self:T( "FSM Transition:" .. self.current .. " --> " .. EventName .. " --> " .. to )
end
- if ( self:_call_handler("onbefore" .. EventName, params) == false )
- or ( self:_call_handler("OnBefore" .. EventName, params) == false )
- or ( self:_call_handler("onleave" .. from, params) == false )
- or ( self:_call_handler("OnLeave" .. from, params) == false ) then
+ if ( self:_call_handler("onbefore" .. EventName, params, EventName ) == false )
+ or ( self:_call_handler("OnBefore" .. EventName, params, EventName ) == false )
+ or ( self:_call_handler("onleave" .. from, params, EventName ) == false )
+ or ( self:_call_handler("OnLeave" .. from, params, EventName ) == false ) then
self:T( "Cancel Transition" )
return false
end
@@ -11339,11 +11533,11 @@ do -- FSM
local fsmparent, Event = self:_isendstate( to )
if fsmparent and Event then
self:F2( { "end state: ", fsmparent, Event } )
- self:_call_handler("onenter" .. to, params)
- self:_call_handler("OnEnter" .. to, params)
- self:_call_handler("onafter" .. EventName, params)
- self:_call_handler("OnAfter" .. EventName, params)
- self:_call_handler("onstatechange", params)
+ self:_call_handler("onenter" .. to, params, EventName )
+ self:_call_handler("OnEnter" .. to, params, EventName )
+ self:_call_handler("onafter" .. EventName, params, EventName )
+ self:_call_handler("OnAfter" .. EventName, params, EventName )
+ self:_call_handler("onstatechange", params, EventName )
fsmparent[Event]( fsmparent )
execute = false
end
@@ -11351,14 +11545,14 @@ do -- FSM
if execute then
-- only execute the call if the From state is not equal to the To state! Otherwise this function should never execute!
--if from ~= to then
- self:_call_handler("onenter" .. to, params)
- self:_call_handler("OnEnter" .. to, params)
+ self:_call_handler("onenter" .. to, params, EventName )
+ self:_call_handler("OnEnter" .. to, params, EventName )
--end
- self:_call_handler("onafter" .. EventName, params)
- self:_call_handler("OnAfter" .. EventName, params)
+ self:_call_handler("onafter" .. EventName, params, EventName )
+ self:_call_handler("OnAfter" .. EventName, params, EventName )
- self:_call_handler("onstatechange", params)
+ self:_call_handler("onstatechange", params, EventName )
end
else
self:T( "Cannot execute transition." )
@@ -11371,7 +11565,18 @@ do -- FSM
function FSM:_delayed_transition( EventName )
return function( self, DelaySeconds, ... )
self:T2( "Delayed Event: " .. EventName )
- local CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
+ local CallID = 0
+ if DelaySeconds < 0 then -- Only call the event ONCE!
+ DelaySeconds = math.abs( DelaySeconds )
+ if not self._EventSchedules[EventName] then
+ CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
+ self._EventSchedules[EventName] = CallID
+ else
+ -- reschedule
+ end
+ else
+ CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
+ end
self:T2( { CallID = CallID } )
end
end
@@ -11491,7 +11696,7 @@ do -- FSM_CONTROLLABLE
return self.Controllable
end
- function FSM_CONTROLLABLE:_call_handler( handler, params )
+ function FSM_CONTROLLABLE:_call_handler( handler, params, EventName )
local ErrorHandler = function( errmsg )
@@ -11505,6 +11710,7 @@ do -- FSM_CONTROLLABLE
if self[handler] then
self:F3( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
local Result, Value = xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler )
return Value
--return self[handler]( self, self.Controllable, unpack( params ) )
@@ -11726,9 +11932,10 @@ do -- FSM_TASK
return self
end
- function FSM_TASK:_call_handler( handler, params )
+ function FSM_TASK:_call_handler( handler, params, EventName )
if self[handler] then
self:T( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
return self[handler]( self, unpack( params ) )
end
end
@@ -11778,9 +11985,10 @@ do -- FSM_SET
return self.Controllable
end
- function FSM_SET:_call_handler( handler, params )
+ function FSM_SET:_call_handler( handler, params, EventName )
if self[handler] then
self:T( "Calling " .. handler )
+ self._EventSchedules[EventName] = nil
return self[handler]( self, self.Set, unpack( params ) )
end
end
@@ -11789,9 +11997,9 @@ end -- FSM_SET
--- This module contains the OBJECT class.
--
--- 1) @{Wrapper.Object#OBJECT} class, extends @{Core.Base#BASE}
+-- 1) @{Object#OBJECT} class, extends @{Base#BASE}
-- ===========================================================
--- The @{Wrapper.Object#OBJECT} class is a wrapper class to handle the DCS Object objects:
+-- The @{Object#OBJECT} class is a wrapper class to handle the DCS Object objects:
--
-- * Support all DCS Object APIs.
-- * Enhance with Object specific APIs not in the DCS Object API set.
@@ -11801,13 +12009,13 @@ end -- FSM_SET
-- ------------------------------
-- The OBJECT class provides the following functions to construct a OBJECT instance:
--
--- * @{Wrapper.Object#OBJECT.New}(): Create a OBJECT instance.
+-- * @{Object#OBJECT.New}(): Create a OBJECT instance.
--
-- 1.2) OBJECT methods:
-- --------------------------
-- The following methods can be used to identify an Object object:
--
--- * @{Wrapper.Object#OBJECT.GetID}(): Returns the ID of the Object object.
+-- * @{Object#OBJECT.GetID}(): Returns the ID of the Object object.
--
-- ===
--
@@ -11877,7 +12085,7 @@ end
--- This module contains the IDENTIFIABLE class.
--
--- 1) @{#IDENTIFIABLE} class, extends @{Wrapper.Object#OBJECT}
+-- 1) @{#IDENTIFIABLE} class, extends @{Object#OBJECT}
-- ===============================================================
-- The @{#IDENTIFIABLE} class is a wrapper class to handle the DCS Identifiable objects:
--
@@ -12103,9 +12311,9 @@ end
--- This module contains the POSITIONABLE class.
--
--- 1) @{Wrapper.Positionable#POSITIONABLE} class, extends @{Wrapper.Identifiable#IDENTIFIABLE}
+-- 1) @{Positionable#POSITIONABLE} class, extends @{Identifiable#IDENTIFIABLE}
-- ===========================================================
--- The @{Wrapper.Positionable#POSITIONABLE} class is a wrapper class to handle the POSITIONABLE objects:
+-- The @{Positionable#POSITIONABLE} class is a wrapper class to handle the POSITIONABLE objects:
--
-- * Support all DCS APIs.
-- * Enhance with POSITIONABLE specific APIs not in the DCS API set.
@@ -12115,14 +12323,14 @@ end
-- ------------------------------
-- The POSITIONABLE class provides the following functions to construct a POSITIONABLE instance:
--
--- * @{Wrapper.Positionable#POSITIONABLE.New}(): Create a POSITIONABLE instance.
+-- * @{Positionable#POSITIONABLE.New}(): Create a POSITIONABLE instance.
--
-- 1.2) POSITIONABLE methods:
-- --------------------------
-- The following methods can be used to identify an measurable object:
--
--- * @{Wrapper.Positionable#POSITIONABLE.GetID}(): Returns the ID of the measurable object.
--- * @{Wrapper.Positionable#POSITIONABLE.GetName}(): Returns the name of the measurable object.
+-- * @{Positionable#POSITIONABLE.GetID}(): Returns the ID of the measurable object.
+-- * @{Positionable#POSITIONABLE.GetName}(): Returns the name of the measurable object.
--
-- ===
--
@@ -12152,12 +12360,12 @@ function POSITIONABLE:New( PositionableName )
return self
end
---- Returns the @{Dcs.DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
function POSITIONABLE:GetPositionVec3()
- self:E( self.PositionableName )
+ self:F2( self.PositionableName )
local DCSPositionable = self:GetDCSObject()
@@ -12170,7 +12378,7 @@ function POSITIONABLE:GetPositionVec3()
return nil
end
---- Returns the @{Dcs.DCSTypes#Vec2} vector indicating the point in 2D of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Vec2} vector indicating the point in 2D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Vec2 The 2D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -12236,7 +12444,7 @@ function POSITIONABLE:GetPointVec3()
end
---- Returns a random @{Dcs.DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
+--- Returns a random @{DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -12260,7 +12468,7 @@ function POSITIONABLE:GetRandomVec3( Radius )
return nil
end
---- Returns the @{Dcs.DCSTypes#Vec3} vector indicating the 3D vector of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Vec3} vector indicating the 3D vector of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -12541,9 +12749,9 @@ end
--- This module contains the CONTROLLABLE class.
--
--- 1) @{Wrapper.Controllable#CONTROLLABLE} class, extends @{Wrapper.Positionable#POSITIONABLE}
+-- 1) @{Controllable#CONTROLLABLE} class, extends @{Positionable#POSITIONABLE}
-- ===========================================================
--- The @{Wrapper.Controllable#CONTROLLABLE} class is a wrapper class to handle the DCS Controllable objects:
+-- The @{Controllable#CONTROLLABLE} class is a wrapper class to handle the DCS Controllable objects:
--
-- * Support all DCS Controllable APIs.
-- * Enhance with Controllable specific APIs not in the DCS Controllable API set.
@@ -12559,7 +12767,7 @@ end
-- 1.2) CONTROLLABLE task methods
-- ------------------------------
-- Several controllable task methods are available that help you to prepare tasks.
--- These methods return a string consisting of the task description, which can then be given to either a @{Wrapper.Controllable#CONTROLLABLE.PushTask} or @{Wrapper.Controllable#SetTask} method to assign the task to the CONTROLLABLE.
+-- These methods return a string consisting of the task description, which can then be given to either a @{Controllable#CONTROLLABLE.PushTask} or @{Controllable#SetTask} method to assign the task to the CONTROLLABLE.
-- Tasks are specific for the category of the CONTROLLABLE, more specific, for AIR, GROUND or AIR and GROUND.
-- Each task description where applicable indicates for which controllable category the task is valid.
-- There are 2 main subdivisions of tasks: Assigned tasks and EnRoute tasks.
@@ -12585,7 +12793,7 @@ end
-- * @{#CONTROLLABLE.TaskHold}: (GROUND) Hold ground controllable from moving.
-- * @{#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the controllable.
-- * @{#CONTROLLABLE.TaskLand}: (AIR HELICOPTER) Landing at the ground. For helicopters only.
--- * @{#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the controllable at a @{Core.Zone#ZONE_RADIUS).
+-- * @{#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the controllable at a @{Zone#ZONE_RADIUS).
-- * @{#CONTROLLABLE.TaskOrbitCircle}: (AIR) Orbit at the current position of the first unit of the controllable at a specified alititude.
-- * @{#CONTROLLABLE.TaskOrbitCircleAtVec2}: (AIR) Orbit at a specified position at a specified alititude during a specified duration with a specified speed.
-- * @{#CONTROLLABLE.TaskRefueling}: (AIR) Refueling from the nearest tanker. No parameters.
@@ -12885,7 +13093,7 @@ end
--- Return a Combo Task taking an array of Tasks.
-- @param #CONTROLLABLE self
--- @param Dcs.DCSTasking.Task#TaskArray DCSTasks Array of @{Dcs.DCSTasking.Task#Task}
+-- @param Dcs.DCSTasking.Task#TaskArray DCSTasks Array of @{DCSTasking.Task#Task}
-- @return Dcs.DCSTasking.Task#Task
function CONTROLLABLE:TaskCombo( DCSTasks )
self:F2( { DCSTasks } )
@@ -13370,7 +13578,7 @@ function CONTROLLABLE:TaskLandAtVec2( Point, Duration )
return DCSTask
end
---- (AIR) Land the controllable at a @{Core.Zone#ZONE_RADIUS).
+--- (AIR) Land the controllable at a @{Zone#ZONE_RADIUS).
-- @param #CONTROLLABLE self
-- @param Core.Zone#ZONE Zone The zone where to land.
-- @param #number Duration The duration in seconds to stay on the ground.
@@ -13716,17 +13924,18 @@ end
--- (AIR) Attack the Unit.
-- @param #CONTROLLABLE self
--- @param Wrapper.Unit#UNIT AttackUnit The UNIT.
--- @param #number Priority All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
--- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
+-- @param Wrapper.Unit#UNIT EngageUnit The UNIT.
+-- @param #number Priority (optional) All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
+-- @param #boolean GroupAttack (optional) If true, all units in the group will attack the Unit when found.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend WeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- @param #number AttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
-- @param Dcs.DCSTypes#Azimuth Direction (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
--- @param #boolean AttackQtyLimit (optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackControllable" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
+-- @param Dcs.DCSTypes#Distance Altitude (optional) Desired altitude to perform the unit engagement.
+-- @param #boolean Visible (optional) Unit must be visible.
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
-- @return Dcs.DCSTasking.Task#Task The DCS task structure.
-function CONTROLLABLE:EnRouteTaskEngageUnit( AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack )
- self:F2( { self.ControllableName, AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack } )
+function CONTROLLABLE:EnRouteTaskEngageUnit( EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack )
+ self:F2( { self.ControllableName, EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack } )
-- EngageUnit = {
-- id = 'EngageUnit',
@@ -13745,14 +13954,18 @@ function CONTROLLABLE:EnRouteTaskEngageUnit( AttackUnit, Priority, WeaponType, W
local DCSTask
DCSTask = { id = 'EngageUnit',
params = {
- unitId = AttackUnit:GetID(),
- weaponType = WeaponType,
- expend = WeaponExpend,
- attackQty = AttackQty,
+ unitId = EngageUnit:GetID(),
+ priority = Priority or 1,
+ groupAttack = GroupAttack or false,
+ visible = Visible or false,
+ expend = WeaponExpend or "Auto",
+ directionEnabled = Direction and true or false,
direction = Direction,
- attackQtyLimit = AttackQtyLimit,
+ altitudeEnabled = Altitude and true or false,
+ altitude = Altitude,
+ attackQtyLimit = AttackQty and true or false,
+ attackQty = AttackQty,
controllableAttack = ControllableAttack,
- priority = Priority,
},
},
@@ -14179,11 +14392,11 @@ function CONTROLLABLE:TaskRouteToZone( Zone, Randomize, Speed, Formation )
return nil
end
---- (AIR) Return the Controllable to an @{Wrapper.Airbase#AIRBASE}
+--- (AIR) Return the Controllable to an @{Airbase#AIRBASE}
-- A speed can be given in km/h.
-- A given formation can be given.
-- @param #CONTROLLABLE self
--- @param Wrapper.Airbase#AIRBASE ReturnAirbase The @{Wrapper.Airbase#AIRBASE} to return to.
+-- @param Wrapper.Airbase#AIRBASE ReturnAirbase The @{Airbase#AIRBASE} to return to.
-- @param #number Speed (optional) The speed.
-- @return #string The route
function CONTROLLABLE:RouteReturnToAirbase( ReturnAirbase, Speed )
@@ -14303,7 +14516,7 @@ function CONTROLLABLE:GetTaskRoute()
return routines.utils.deepCopy( _DATABASE.Templates.Controllables[self.ControllableName].Template.route.points )
end
---- Return the route of a controllable by using the @{Core.Database#DATABASE} class.
+--- Return the route of a controllable by using the @{Database#DATABASE} class.
-- @param #CONTROLLABLE self
-- @param #number Begin The route point from where the copy will start. The base route point is 0.
-- @param #number End The route point where the copy will end. The End point is the last point - the End point. The last point has base 0.
@@ -14728,7 +14941,7 @@ function CONTROLLABLE:OptionROTVertical()
end
--- Retrieve the controllable mission and allow to place function hooks within the mission waypoint plan.
--- Use the method @{Wrapper.Controllable#CONTROLLABLE:WayPointFunction} to define the hook functions for specific waypoints.
+-- Use the method @{Controllable#CONTROLLABLE:WayPointFunction} to define the hook functions for specific waypoints.
-- Use the method @{Controllable@CONTROLLABLE:WayPointExecute) to start the execution of the new mission plan.
-- Note that when WayPointInitialize is called, the Mission of the controllable is RESTARTED!
-- @param #CONTROLLABLE self
@@ -14828,9 +15041,9 @@ end
-- Message APIs--- This module contains the GROUP class.
--
--- 1) @{Wrapper.Group#GROUP} class, extends @{Wrapper.Controllable#CONTROLLABLE}
+-- 1) @{Group#GROUP} class, extends @{Controllable#CONTROLLABLE}
-- =============================================================
--- The @{Wrapper.Group#GROUP} class is a wrapper class to handle the DCS Group objects:
+-- The @{Group#GROUP} class is a wrapper class to handle the DCS Group objects:
--
-- * Support all DCS Group APIs.
-- * Enhance with Group specific APIs not in the DCS Group API set.
@@ -14864,7 +15077,7 @@ end
--
-- Group templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a group and assign it to another:
--
--- * @{Wrapper.Controllable#CONTROLLABLE.TaskMission}: (AIR + GROUND) Return a mission task from a mission template.
+-- * @{Controllable#CONTROLLABLE.TaskMission}: (AIR + GROUND) Return a mission task from a mission template.
--
-- ## 1.3) GROUP Command methods
--
@@ -14883,7 +15096,7 @@ end
-- * @{#GROUP.IsPartlyInZone}: Returns true if some units of the group are within a @{Zone}.
-- * @{#GROUP.IsNotInZone}: Returns true if none of the group units of the group are within a @{Zone}.
--
--- The zone can be of any @{Zone} class derived from @{Core.Zone#ZONE_BASE}. So, these methods are polymorphic to the zones tested on.
+-- The zone can be of any @{Zone} class derived from @{Zone#ZONE_BASE}. So, these methods are polymorphic to the zones tested on.
--
-- ## 1.6) GROUP AI methods
--
@@ -14941,6 +15154,8 @@ function GROUP:Register( GroupName )
local self = BASE:Inherit( self, CONTROLLABLE:New( GroupName ) )
self:F2( GroupName )
self.GroupName = GroupName
+
+ self:SetEventPriority( 4 )
return self
end
@@ -14982,7 +15197,7 @@ function GROUP:GetDCSObject()
return nil
end
---- Returns the @{Dcs.DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+--- Returns the @{DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
@@ -15123,7 +15338,6 @@ function GROUP:GetUnit( UnitNumber )
if DCSGroup then
local UnitFound = UNIT:Find( DCSGroup:getUnit( UnitNumber ) )
- self:T3( UnitFound.UnitName )
self:T2( UnitFound )
return UnitFound
end
@@ -15276,7 +15490,7 @@ do -- Is Zone methods
--- Returns true if all units of the group are within a @{Zone}.
-- @param #GROUP self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the Group is completely within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
function GROUP:IsCompletelyInZone( Zone )
self:F2( { self.GroupName, Zone } )
@@ -15295,7 +15509,7 @@ end
--- Returns true if some units of the group are within a @{Zone}.
-- @param #GROUP self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the Group is completely within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
function GROUP:IsPartlyInZone( Zone )
self:F2( { self.GroupName, Zone } )
@@ -15312,7 +15526,7 @@ end
--- Returns true if none of the group units of the group are within a @{Zone}.
-- @param #GROUP self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the Group is completely within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the Group is completely within the @{Zone#ZONE_BASE}
function GROUP:IsNotInZone( Zone )
self:F2( { self.GroupName, Zone } )
@@ -15529,7 +15743,7 @@ end
-- SPAWNING
--- Respawn the @{GROUP} using a (tweaked) template of the Group.
--- The template must be retrieved with the @{Wrapper.Group#GROUP.GetTemplate}() function.
+-- The template must be retrieved with the @{Group#GROUP.GetTemplate}() function.
-- The template contains all the definitions as declared within the mission file.
-- To understand templates, do the following:
--
@@ -15631,7 +15845,7 @@ function GROUP:GetTaskRoute()
return routines.utils.deepCopy( _DATABASE.Templates.Groups[self.GroupName].Template.route.points )
end
---- Return the route of a group by using the @{Core.Database#DATABASE} class.
+--- Return the route of a group by using the @{Database#DATABASE} class.
-- @param #GROUP self
-- @param #number Begin The route point from where the copy will start. The base route point is 0.
-- @param #number End The route point where the copy will end. The End point is the last point - the End point. The last point has base 0.
@@ -15728,7 +15942,7 @@ end
--- This module contains the UNIT class.
--
--- 1) @{#UNIT} class, extends @{Wrapper.Controllable#CONTROLLABLE}
+-- 1) @{#UNIT} class, extends @{Controllable#CONTROLLABLE}
-- ===========================================================
-- The @{#UNIT} class is a wrapper class to handle the DCS Unit objects:
--
@@ -15761,7 +15975,7 @@ end
-- ------------------
-- The DCS Unit APIs are used extensively within MOOSE. The UNIT class has for each DCS Unit API a corresponding method.
-- To be able to distinguish easily in your code the difference between a UNIT API call and a DCS Unit API call,
--- the first letter of the method is also capitalized. So, by example, the DCS Unit method @{Dcs.DCSWrapper.Unit#Unit.getName}()
+-- the first letter of the method is also capitalized. So, by example, the DCS Unit method @{DCSWrapper.Unit#Unit.getName}()
-- is implemented in the UNIT class as @{#UNIT.GetName}().
--
-- 1.3) Smoke, Flare Units
@@ -15788,7 +16002,7 @@ end
-- The UNIT class contains methods to test the location or proximity against zones or other objects.
--
-- ### 1.6.1) Zones
--- To test whether the Unit is within a **zone**, use the @{#UNIT.IsInZone}() or the @{#UNIT.IsNotInZone}() methods. Any zone can be tested on, but the zone must be derived from @{Core.Zone#ZONE_BASE}.
+-- To test whether the Unit is within a **zone**, use the @{#UNIT.IsInZone}() or the @{#UNIT.IsNotInZone}() methods. Any zone can be tested on, but the zone must be derived from @{Zone#ZONE_BASE}.
--
-- ### 1.6.2) Units
-- Test if another DCS Unit is within a given radius of the current DCS Unit, use the @{#UNIT.OtherUnitInRadius}() method.
@@ -15825,6 +16039,8 @@ UNIT = {
function UNIT:Register( UnitName )
local self = BASE:Inherit( self, CONTROLLABLE:New( UnitName ) )
self.UnitName = UnitName
+
+ self:SetEventPriority( 3 )
return self
end
@@ -16310,7 +16526,7 @@ end
--- Returns true if the unit is within a @{Zone}.
-- @param #UNIT self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the unit is within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the unit is within the @{Zone#ZONE_BASE}
function UNIT:IsInZone( Zone )
self:F2( { self.UnitName, Zone } )
@@ -16327,7 +16543,7 @@ end
--- Returns true if the unit is not within a @{Zone}.
-- @param #UNIT self
-- @param Core.Zone#ZONE_BASE Zone The zone to test.
--- @return #boolean Returns true if the unit is not within the @{Core.Zone#ZONE_BASE}
+-- @return #boolean Returns true if the unit is not within the @{Zone#ZONE_BASE}
function UNIT:IsNotInZone( Zone )
self:F2( { self.UnitName, Zone } )
@@ -16564,13 +16780,38 @@ function UNIT:InAir()
return nil
end
---- This module contains the CLIENT class.
+do -- Event Handling
+
+ --- Subscribe to a DCS Event.
+ -- @param #UNIT self
+ -- @param Core.Event#EVENTS Event
+ -- @param #function EventFunction (optional) The function to be called when the event occurs for the unit.
+ -- @return #UNIT
+ function UNIT:HandleEvent( Event, EventFunction )
+
+ self:EventDispatcher():OnEventForUnit( self:GetName(), EventFunction, self, Event )
+
+ return self
+ end
+
+ --- UnSubscribe to a DCS event.
+ -- @param #UNIT self
+ -- @param Core.Event#EVENTS Event
+ -- @return #UNIT
+ function UNIT:UnHandleEvent( Event )
+
+ self:EventDispatcher():RemoveForUnit( self:GetName(), self, Event )
+
+ return self
+ end
+
+end--- This module contains the CLIENT class.
--
--- 1) @{Wrapper.Client#CLIENT} class, extends @{Wrapper.Unit#UNIT}
+-- 1) @{Client#CLIENT} class, extends @{Unit#UNIT}
-- ===============================================
-- Clients are those **Units** defined within the Mission Editor that have the skillset defined as __Client__ or __Player__.
-- Note that clients are NOT the same as Units, they are NOT necessarily alive.
--- The @{Wrapper.Client#CLIENT} class is a wrapper class to handle the DCS Unit objects that have the skillset defined as __Client__ or __Player__:
+-- The @{Client#CLIENT} class is a wrapper class to handle the DCS Unit objects that have the skillset defined as __Client__ or __Player__:
--
-- * Wraps the DCS Unit objects with skill level set to Player or Client.
-- * Support all DCS Unit APIs.
@@ -16601,7 +16842,6 @@ end
-- IMPORTANT: ONE SHOULD NEVER SANATIZE these CLIENT OBJECT REFERENCES! (make the CLIENT object references nil).
--
-- @module Client
--- @author FlightControl
--- The CLIENT class
-- @type CLIENT
@@ -16792,7 +17032,7 @@ end
--- Checks for a client alive event and calls a function on a continuous basis.
-- @param #CLIENT self
--- @param #function CallBack Function.
+-- @param #function CallBackFunction Create a function that will be called when a player joins the slot.
-- @return #CLIENT
function CLIENT:Alive( CallBackFunction, ... )
self:F()
@@ -16965,8 +17205,8 @@ function CLIENT:IsTransport()
return self.ClientTransport
end
---- Shows the @{AI.AI_Cargo#CARGO} contained within the CLIENT to the player as a message.
--- The @{AI.AI_Cargo#CARGO} is shown using the @{Core.Message#MESSAGE} distribution system.
+--- Shows the @{AI_Cargo#CARGO} contained within the CLIENT to the player as a message.
+-- The @{AI_Cargo#CARGO} is shown using the @{Message#MESSAGE} distribution system.
-- @param #CLIENT self
function CLIENT:ShowCargo()
self:F()
@@ -16999,7 +17239,7 @@ end
-- @param #string Message is the text describing the message.
-- @param #number MessageDuration is the duration in seconds that the Message should be displayed.
-- @param #string MessageCategory is the category of the message (the title).
--- @param #number MessageInterval is the interval in seconds between the display of the @{Core.Message#MESSAGE} when the CLIENT is in the air.
+-- @param #number MessageInterval is the interval in seconds between the display of the @{Message#MESSAGE} when the CLIENT is in the air.
-- @param #string MessageID is the identifier of the message when displayed with intervals.
function CLIENT:Message( Message, MessageDuration, MessageCategory, MessageInterval, MessageID )
self:F( { Message, MessageDuration, MessageCategory, MessageInterval } )
@@ -17040,11 +17280,11 @@ function CLIENT:Message( Message, MessageDuration, MessageCategory, MessageInter
end
--- This module contains the STATIC class.
--
--- 1) @{Wrapper.Static#STATIC} class, extends @{Wrapper.Positionable#POSITIONABLE}
+-- 1) @{Static#STATIC} class, extends @{Positionable#POSITIONABLE}
-- ===============================================================
-- Statics are **Static Units** defined within the Mission Editor.
-- Note that Statics are almost the same as Units, but they don't have a controller.
--- The @{Wrapper.Static#STATIC} class is a wrapper class to handle the DCS Static objects:
+-- The @{Static#STATIC} class is a wrapper class to handle the DCS Static objects:
--
-- * Wraps the DCS Static objects.
-- * Support all DCS Static APIs.
@@ -17123,7 +17363,7 @@ end
--
-- ===
--
--- 1) @{Wrapper.Airbase#AIRBASE} class, extends @{Wrapper.Positionable#POSITIONABLE}
+-- 1) @{Airbase#AIRBASE} class, extends @{Positionable#POSITIONABLE}
-- =================================================================
-- The @{AIRBASE} class is a wrapper class to handle the DCS Airbase objects:
--
@@ -17154,7 +17394,7 @@ end
-- ---------------------
-- The DCS Airbase APIs are used extensively within MOOSE. The AIRBASE class has for each DCS Airbase API a corresponding method.
-- To be able to distinguish easily in your code the difference between a AIRBASE API call and a DCS Airbase API call,
--- the first letter of the method is also capitalized. So, by example, the DCS Airbase method @{Dcs.DCSWrapper.Airbase#Airbase.getName}()
+-- the first letter of the method is also capitalized. So, by example, the DCS Airbase method @{DCSWrapper.Airbase#Airbase.getName}()
-- is implemented in the AIRBASE class as @{#AIRBASE.GetName}().
--
-- More functions will be added
@@ -17281,9 +17521,9 @@ function SCORING:New( GameName )
end
- _EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
- _EVENTDISPATCHER:OnHit( self._EventOnHit, self )
+ self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
+ self:HandleEvent( EVENTS.Hit, self._EventOnHit )
--self.SchedulerId = routines.scheduleFunction( SCORING._FollowPlayersScheduled, { self }, 0, 5 )
self.SchedulerId = SCHEDULER:New( self, self._FollowPlayersScheduled, {}, 0, 5 )
@@ -18120,7 +18360,7 @@ function CLEANUP:_DestroyGroup( GroupObject, CleanUpGroupName )
end
end
---- Destroys a @{Dcs.DCSWrapper.Unit#Unit} from the simulator, but checks first if it is still existing!
+--- Destroys a @{DCSWrapper.Unit#Unit} from the simulator, but checks first if it is still existing!
-- @param #CLEANUP self
-- @param Dcs.DCSWrapper.Unit#Unit CleanUpUnit The object to be destroyed.
-- @param #string CleanUpUnitName The Unit name ...
@@ -18257,7 +18497,7 @@ function CLEANUP:_EventHitCleanUp( Event )
end
end
---- Add the @{Dcs.DCSWrapper.Unit#Unit} to the CleanUpList for CleanUp.
+--- Add the @{DCSWrapper.Unit#Unit} to the CleanUpList for CleanUp.
function CLEANUP:_AddForCleanUp( CleanUpUnit, CleanUpUnitName )
self:F( { CleanUpUnit, CleanUpUnitName } )
@@ -18376,9 +18616,14 @@ function CLEANUP:_CleanUpScheduler()
return true
end
---- This module contains the SPAWN class.
+--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**All** --
+-- **Spawn groups of units dynamically in your missions.**
+--
+-- 
--
--- # 1) @{Functional.Spawn#SPAWN} class, extends @{Core.Base#BASE}
+-- ===
+--
+-- # 1) @{#SPAWN} class, extends @{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.
@@ -18420,7 +18665,7 @@ end
-- * @{#SPAWN.InitLimit}(): Limits the amount of groups that can be alive at the same time and that can be dynamically spawned.
-- * @{#SPAWN.InitRandomizeRoute}(): Randomize the routes of spawned groups, and for air groups also optionally the height.
-- * @{#SPAWN.InitRandomizeTemplate}(): Randomize the group templates so that when a new group is spawned, a random group template is selected from one of the templates defined.
--- * @{#SPAWN.InitUncontrolled}(): Spawn plane groups uncontrolled.
+-- * @{#SPAWN.InitUnControlled}(): Spawn plane groups uncontrolled.
-- * @{#SPAWN.InitArray}(): Make groups visible before they are actually activated, and order these groups like a batallion in an array.
-- * @{#SPAWN.InitRepeat}(): Re-spawn groups when they land at the home base. Similar methods are @{#SPAWN.InitRepeatOnLanding} and @{#SPAWN.InitRepeatOnEngineShutDown}.
-- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Unit}s in the @{Group} that is spawned within a **radius band**, given an Outer and Inner radius.
@@ -18490,6 +18735,8 @@ end
--
-- Hereby the change log:
--
+-- 2017-02-04: SPAWN:InitUnControlled( **UnControlled** ) replaces SPAWN:InitUnControlled().
+--
-- 2017-01-24: SPAWN:**InitAIOnOff( AIOnOff )** added.
--
-- 2017-01-24: SPAWN:**InitAIOn()** added.
@@ -18590,6 +18837,7 @@ function SPAWN:New( SpawnTemplatePrefix )
self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false.
self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
self.AIOnOff = true -- The AI is on by default when spawning a group.
+ self.SpawnUnControlled = false
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@@ -18628,6 +18876,7 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false.
self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
self.AIOnOff = true -- The AI is on by default when spawning a group.
+ self.SpawnUnControlled = false
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@@ -19024,6 +19273,12 @@ function SPAWN:SpawnWithIndex( SpawnIndex )
self:T( 'SpawnTemplate.units['..UnitID..'].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units['..UnitID..'].y = ' .. SpawnTemplate.units[UnitID].y )
end
end
+
+ if SpawnTemplate.CategoryID == Group.Category.HELICOPTER or SpawnTemplate.CategoryID == Group.Category.AIRPLANE then
+ if SpawnTemplate.route.points[1].type == "TakeOffParking" then
+ SpawnTemplate.uncontrolled = self.SpawnUnControlled
+ end
+ end
end
_EVENTDISPATCHER:OnBirthForTemplate( SpawnTemplate, self._OnBirth, self )
@@ -19112,7 +19367,7 @@ end
--- Allows to place a CallFunction hook when a new group spawns.
-- The provided method will be called when a new group is spawned, including its given parameters.
--- The first parameter of the SpawnFunction is the @{Wrapper.Group#GROUP} that was spawned.
+-- The first parameter of the SpawnFunction is the @{Group#GROUP} that was spawned.
-- @param #SPAWN self
-- @param #function SpawnCallBackFunction The function to be called when a group spawns.
-- @param SpawnFunctionArguments A random amount of arguments to be provided to the function when the group spawns.
@@ -19252,7 +19507,7 @@ function SPAWN:SpawnFromStatic( HostStatic, SpawnIndex )
end
--- Will spawn a Group within a given @{Zone}.
--- The @{Zone} can be of any type derived from @{Core.Zone#ZONE_BASE}.
+-- The @{Zone} can be of any type derived from @{Zone#ZONE_BASE}.
-- Once the @{Group} is spawned within the zone, the @{Group} will continue on its route.
-- The **first waypoint** (where the group is spawned) is replaced with the zone location coordinates.
-- @param #SPAWN self
@@ -19275,17 +19530,20 @@ function SPAWN:SpawnInZone( Zone, RandomizeGroup, SpawnIndex )
return nil
end
---- (AIR) Will spawn a plane group in uncontrolled mode...
+--- (**AIR**) Will spawn a plane group in UnControlled or Controlled mode...
-- This will be similar to the uncontrolled flag setting in the ME.
+-- You can use UnControlled mode to simulate planes startup and ready for take-off but aren't moving (yet).
+-- ReSpawn the plane in Controlled mode, and the plane will move...
-- @param #SPAWN self
+-- @param #boolean UnControlled true if UnControlled, false if Controlled.
-- @return #SPAWN self
-function SPAWN:InitUnControlled()
- self:F( { self.SpawnTemplatePrefix } )
+function SPAWN:InitUnControlled( UnControlled )
+ self:F2( { self.SpawnTemplatePrefix, UnControlled } )
- self.SpawnUnControlled = true
+ self.SpawnUnControlled = UnControlled
for SpawnGroupID = 1, self.SpawnMaxGroups do
- self.SpawnGroups[SpawnGroupID].UnControlled = true
+ self.SpawnGroups[SpawnGroupID].UnControlled = UnControlled
end
return self
@@ -19605,9 +19863,6 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex )
SpawnTemplate.visible = false
end
- if SpawnTemplate.CategoryID == Group.Category.HELICOPTER or SpawnTemplate.CategoryID == Group.Category.AIRPLANE then
- SpawnTemplate.uncontrolled = false
- end
for UnitID = 1, #SpawnTemplate.units do
SpawnTemplate.units[UnitID].name = string.format( SpawnTemplate.name .. '-%02d', UnitID )
@@ -20312,7 +20567,7 @@ end
-- ============================
-- Create a new SPAWN object with the @{#ESCORT.New} method:
--
--- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Wrapper.Group#GROUP} for a @{Wrapper.Client#CLIENT}, with an optional briefing text.
+-- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Group#GROUP} for a @{Client#CLIENT}, with an optional briefing text.
--
-- ESCORT initialization methods.
-- ==============================
@@ -21515,7 +21770,7 @@ end
--
-- ===
--
--- 1) @{Functional.MissileTrainer#MISSILETRAINER} class, extends @{Core.Base#BASE}
+-- 1) @{MissileTrainer#MISSILETRAINER} class, extends @{Base#BASE}
-- ===============================================================
-- The @{#MISSILETRAINER} class uses the DCS world messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft,
-- the class will destroy the missile within a certain range, to avoid damage to your aircraft.
@@ -22222,9 +22477,9 @@ end
--
-- ===
--
--- 1) @{Functional.AirbasePolice#AIRBASEPOLICE_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{AirbasePolice#AIRBASEPOLICE_BASE} class, extends @{Base#BASE}
-- ==================================================================
--- The @{Functional.AirbasePolice#AIRBASEPOLICE_BASE} class provides the main methods to monitor CLIENT behaviour at airbases.
+-- The @{AirbasePolice#AIRBASEPOLICE_BASE} class provides the main methods to monitor CLIENT behaviour at airbases.
-- CLIENTS should not be allowed to:
--
-- * Don't taxi faster than 40 km/h.
@@ -22232,7 +22487,7 @@ end
-- * Avoid to hit other planes on the airbase.
-- * Obey ground control orders.
--
--- 2) @{Functional.AirbasePolice#AIRBASEPOLICE_CAUCASUS} class, extends @{Functional.AirbasePolice#AIRBASEPOLICE_BASE}
+-- 2) @{AirbasePolice#AIRBASEPOLICE_CAUCASUS} class, extends @{AirbasePolice#AIRBASEPOLICE_BASE}
-- =============================================================================================
-- All the airbases on the caucasus map can be monitored using this class.
-- If you want to monitor specific airbases, you need to use the @{#AIRBASEPOLICE_BASE.Monitor}() method, which takes a table or airbase names.
@@ -22259,7 +22514,7 @@ end
-- * TbilisiLochini
-- * Vaziani
--
--- 3) @{Functional.AirbasePolice#AIRBASEPOLICE_NEVADA} class, extends @{Functional.AirbasePolice#AIRBASEPOLICE_BASE}
+-- 3) @{AirbasePolice#AIRBASEPOLICE_NEVADA} class, extends @{AirbasePolice#AIRBASEPOLICE_BASE}
-- =============================================================================================
-- All the airbases on the NEVADA map can be monitored using this class.
-- If you want to monitor specific airbases, you need to use the @{#AIRBASEPOLICE_BASE.Monitor}() method, which takes a table or airbase names.
@@ -22402,7 +22657,8 @@ function AIRBASEPOLICE_BASE:_AirbaseMonitor()
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
else
MESSAGE:New( "Player " .. Client:GetPlayerName() .. " has been removed from the airbase, due to a speeding violation ...", 10, "Airbase Police" ):ToAll()
- Client:GetGroup():Destroy()
+ Client:Destroy()
+ trigger.action.setUserFlag( "AIRCRAFT_"..Client:GetID(), 100)
Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0 )
end
@@ -23417,14 +23673,14 @@ end
--
-- ===
--
--- 1) @{Functional.Detection#DETECTION_BASE} class, extends @{Core.Base#BASE}
+-- 1) @{Detection#DETECTION_BASE} class, extends @{Base#BASE}
-- ==========================================================
--- The @{Functional.Detection#DETECTION_BASE} class defines the core functions to administer detected objects.
--- The @{Functional.Detection#DETECTION_BASE} class will detect objects within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s).
+-- The @{Detection#DETECTION_BASE} class defines the core functions to administer detected objects.
+-- The @{Detection#DETECTION_BASE} class will detect objects within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s).
--
-- 1.1) DETECTION_BASE constructor
-- -------------------------------
--- Construct a new DETECTION_BASE instance using the @{Functional.Detection#DETECTION_BASE.New}() method.
+-- Construct a new DETECTION_BASE instance using the @{Detection#DETECTION_BASE.New}() method.
--
-- 1.2) DETECTION_BASE initialization
-- ----------------------------------
@@ -23435,46 +23691,46 @@ end
--
-- Use the following functions to report the objects it detected using the methods Visual, Optical, Radar, IRST, RWR, DLINK:
--
--- * @{Functional.Detection#DETECTION_BASE.InitDetectVisual}(): Detected using Visual.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectOptical}(): Detected using Optical.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectRadar}(): Detected using Radar.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectIRST}(): Detected using IRST.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectRWR}(): Detected using RWR.
--- * @{Functional.Detection#DETECTION_BASE.InitDetectDLINK}(): Detected using DLINK.
+-- * @{Detection#DETECTION_BASE.InitDetectVisual}(): Detected using Visual.
+-- * @{Detection#DETECTION_BASE.InitDetectOptical}(): Detected using Optical.
+-- * @{Detection#DETECTION_BASE.InitDetectRadar}(): Detected using Radar.
+-- * @{Detection#DETECTION_BASE.InitDetectIRST}(): Detected using IRST.
+-- * @{Detection#DETECTION_BASE.InitDetectRWR}(): Detected using RWR.
+-- * @{Detection#DETECTION_BASE.InitDetectDLINK}(): Detected using DLINK.
--
-- 1.3) Obtain objects detected by DETECTION_BASE
-- ----------------------------------------------
--- DETECTION_BASE builds @{Set}s of objects detected. These @{Core.Set#SET_BASE}s can be retrieved using the method @{Functional.Detection#DETECTION_BASE.GetDetectedSets}().
--- The method will return a list (table) of @{Core.Set#SET_BASE} objects.
+-- DETECTION_BASE builds @{Set}s of objects detected. These @{Set#SET_BASE}s can be retrieved using the method @{Detection#DETECTION_BASE.GetDetectedSets}().
+-- The method will return a list (table) of @{Set#SET_BASE} objects.
--
-- ===
--
--- 2) @{Functional.Detection#DETECTION_AREAS} class, extends @{Functional.Detection#DETECTION_BASE}
+-- 2) @{Detection#DETECTION_AREAS} class, extends @{Detection#DETECTION_BASE}
-- ===============================================================================
--- The @{Functional.Detection#DETECTION_AREAS} class will detect units within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s),
--- and will build a list (table) of @{Core.Set#SET_UNIT}s containing the @{Wrapper.Unit#UNIT}s detected.
+-- The @{Detection#DETECTION_AREAS} class will detect units within the battle zone for a list of @{Group}s detecting targets following (a) detection method(s),
+-- and will build a list (table) of @{Set#SET_UNIT}s containing the @{Unit#UNIT}s detected.
-- The class is group the detected units within zones given a DetectedZoneRange parameter.
-- A set with multiple detected zones will be created as there are groups of units detected.
--
-- 2.1) Retrieve the Detected Unit sets and Detected Zones
-- -------------------------------------------------------
--- The DetectedUnitSets methods are implemented in @{Functional.Detection#DECTECTION_BASE} and the DetectedZones methods is implemented in @{Functional.Detection#DETECTION_AREAS}.
+-- The DetectedUnitSets methods are implemented in @{Detection#DECTECTION_BASE} and the DetectedZones methods is implemented in @{Detection#DETECTION_AREAS}.
--
--- Retrieve the DetectedUnitSets with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSets}(). A table will be return of @{Core.Set#SET_UNIT}s.
--- To understand the amount of sets created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectedSetCount}().
--- If you want to obtain a specific set from the DetectedSets, use the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}() with a given index.
+-- Retrieve the DetectedUnitSets with the method @{Detection#DETECTION_BASE.GetDetectedSets}(). A table will be return of @{Set#SET_UNIT}s.
+-- To understand the amount of sets created, use the method @{Detection#DETECTION_BASE.GetDetectedSetCount}().
+-- If you want to obtain a specific set from the DetectedSets, use the method @{Detection#DETECTION_BASE.GetDetectedSet}() with a given index.
--
--- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}().
--- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}().
--- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
+-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Detection#DETECTION_BASE.GetDetectionZones}().
+-- To understand the amount of zones created, use the method @{Detection#DETECTION_BASE.GetDetectionZoneCount}().
+-- If you want to obtain a specific zone from the DetectedZones, use the method @{Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
--
-- 1.4) Flare or Smoke detected units
-- ----------------------------------
--- Use the methods @{Functional.Detection#DETECTION_AREAS.FlareDetectedUnits}() or @{Functional.Detection#DETECTION_AREAS.SmokeDetectedUnits}() to flare or smoke the detected units when a new detection has taken place.
+-- Use the methods @{Detection#DETECTION_AREAS.FlareDetectedUnits}() or @{Detection#DETECTION_AREAS.SmokeDetectedUnits}() to flare or smoke the detected units when a new detection has taken place.
--
-- 1.5) Flare or Smoke detected zones
-- ----------------------------------
--- Use the methods @{Functional.Detection#DETECTION_AREAS.FlareDetectedZones}() or @{Functional.Detection#DETECTION_AREAS.SmokeDetectedZones}() to flare or smoke the detected zones when a new detection has taken place.
+-- Use the methods @{Detection#DETECTION_AREAS.FlareDetectedZones}() or @{Detection#DETECTION_AREAS.SmokeDetectedZones}() to flare or smoke the detected zones when a new detection has taken place.
--
-- ===
--
@@ -23660,7 +23916,7 @@ function DETECTION_BASE:GetDetectedObject( ObjectName )
return nil
end
---- Get the detected @{Core.Set#SET_BASE}s.
+--- Get the detected @{Set#SET_BASE}s.
-- @param #DETECTION_BASE self
-- @return #DETECTION_BASE.DetectedSets DetectedSets
function DETECTION_BASE:GetDetectedSets()
@@ -23723,12 +23979,12 @@ function DETECTION_BASE:Schedule( DelayTime, RepeatInterval )
self.ScheduleDelayTime = DelayTime
self.ScheduleRepeatInterval = RepeatInterval
- self.DetectionScheduler = SCHEDULER:New(self, self._DetectionScheduler, { self, "Detection" }, DelayTime, RepeatInterval )
+ self.DetectionScheduler = SCHEDULER:New( self, self._DetectionScheduler, { self, "Detection" }, DelayTime, RepeatInterval )
return self
end
---- Form @{Set}s of detected @{Wrapper.Unit#UNIT}s in an array of @{Core.Set#SET_BASE}s.
+--- Form @{Set}s of detected @{Unit#UNIT}s in an array of @{Set#SET_BASE}s.
-- @param #DETECTION_BASE self
function DETECTION_BASE:_DetectionScheduler( SchedulerName )
self:F2( { SchedulerName } )
@@ -23848,7 +24104,7 @@ function DETECTION_AREAS:New( DetectionSetGroup, DetectionRange, DetectionZoneRa
self._SmokeDetectedZones = false
self._FlareDetectedZones = false
- self:Schedule( 0, 30 )
+ self:Schedule( 10, 10 )
return self
end
@@ -23902,7 +24158,7 @@ function DETECTION_AREAS:GetDetectedAreaCount()
return DetectedAreaCount
end
---- Get the @{Core.Set#SET_UNIT} of a detecttion area using a given numeric index.
+--- Get the @{Set#SET_UNIT} of a detecttion area using a given numeric index.
-- @param #DETECTION_AREAS self
-- @param #number Index
-- @return Core.Set#SET_UNIT DetectedSet
@@ -23916,7 +24172,7 @@ function DETECTION_AREAS:GetDetectedSet( Index )
return nil
end
---- Get the @{Core.Zone#ZONE_UNIT} of a detection area using a given numeric index.
+--- Get the @{Zone#ZONE_UNIT} of a detection area using a given numeric index.
-- @param #DETECTION_AREAS self
-- @param #number Index
-- @return Core.Zone#ZONE_UNIT DetectedZone
@@ -24403,17 +24659,16 @@ end
-- even when there are hardly any players in the mission.**
--
-- 
---
---
+--
-- ===
--
--- # 1) @{AI.AI_Balancer#AI_BALANCER} class, extends @{Core.Fsm#FSM_SET}
+-- # 1) @{AI_Balancer#AI_BALANCER} class, extends @{Fsm#FSM_SET}
--
--- The @{AI.AI_Balancer#AI_BALANCER} class monitors and manages as many replacement AI groups as there are
+-- The @{AI_Balancer#AI_BALANCER} class monitors and manages as many replacement AI groups as there are
-- CLIENTS in a SET_CLIENT collection, which are not occupied by human players.
-- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.
--
--- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
+-- The parent class @{Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
-- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods.
-- An explanation about state and event transition methods can be found in the @{FSM} module documentation.
--
@@ -24455,8 +24710,8 @@ end
-- However, there are 2 additional options that you can use to customize the destroy behaviour.
-- When a human player joins a slot, you can configure to let the AI return to:
--
--- * @{#AI_BALANCER.ReturnToHomeAirbase}: Returns the AI to the **home** @{Wrapper.Airbase#AIRBASE}.
--- * @{#AI_BALANCER.ReturnToNearestAirbases}: Returns the AI to the **nearest friendly** @{Wrapper.Airbase#AIRBASE}.
+-- * @{#AI_BALANCER.ReturnToHomeAirbase}: Returns the AI to the **home** @{Airbase#AIRBASE}.
+-- * @{#AI_BALANCER.ReturnToNearestAirbases}: Returns the AI to the **nearest friendly** @{Airbase#AIRBASE}.
--
-- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return,
-- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed.
@@ -24552,10 +24807,10 @@ function AI_BALANCER:InitSpawnInterval( Earliest, Latest )
return self
end
---- Returns the AI to the nearest friendly @{Wrapper.Airbase#AIRBASE}.
+--- Returns the AI to the nearest friendly @{Airbase#AIRBASE}.
-- @param #AI_BALANCER self
--- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Wrapper.Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Wrapper.Airbase#AIRBASE}.
--- @param Core.Set#SET_AIRBASE ReturnAirbaseSet The SET of @{Core.Set#SET_AIRBASE}s to evaluate where to return to.
+-- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Airbase#AIRBASE}.
+-- @param Core.Set#SET_AIRBASE ReturnAirbaseSet The SET of @{Set#SET_AIRBASE}s to evaluate where to return to.
function AI_BALANCER:ReturnToNearestAirbases( ReturnTresholdRange, ReturnAirbaseSet )
self.ToNearestAirbase = true
@@ -24563,9 +24818,9 @@ function AI_BALANCER:ReturnToNearestAirbases( ReturnTresholdRange, ReturnAirbase
self.ReturnAirbaseSet = ReturnAirbaseSet
end
---- Returns the AI to the home @{Wrapper.Airbase#AIRBASE}.
+--- Returns the AI to the home @{Airbase#AIRBASE}.
-- @param #AI_BALANCER self
--- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Wrapper.Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Wrapper.Airbase#AIRBASE}.
+-- @param Dcs.DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Airbase#AIRBASE}.
function AI_BALANCER:ReturnToHomeAirbase( ReturnTresholdRange )
self.ToHomeAirbase = true
@@ -24702,14 +24957,14 @@ end
---- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Air Patrolling or Staging.**
+--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** --
+-- **Air Patrolling or Staging.**
--
-- 
--
---
-- ===
--
--- # 1) @{#AI_PATROL_ZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE}
+-- # 1) @{#AI_PATROL_ZONE} class, extends @{Fsm#FSM_CONTROLLABLE}
--
-- The @{#AI_PATROL_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}.
--
@@ -24893,14 +25148,13 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
-- defafult PatrolAltType to "RADIO" if not specified
self.PatrolAltType = PatrolAltType or "RADIO"
- self:SetDetectionOn()
-
+ self:SetDetectionInterval( 30 )
+
self.CheckStatus = true
self:ManageFuel( .2, 60 )
self:ManageDamage( 1 )
- self:SetDetectionInterval( 30 )
self.DetectedUnits = {} -- This table contains the targets detected during patrol.
@@ -25154,7 +25408,7 @@ end
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:SetDetectionOn()
self:F2()
-
+
self.DetectOn = true
end
@@ -25164,7 +25418,7 @@ end
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:SetDetectionOff()
self:F2()
-
+
self.DetectOn = false
end
@@ -25183,8 +25437,9 @@ end
function AI_PATROL_ZONE:SetDetectionActivated()
self:F2()
+ self:ClearDetectedUnits()
self.DetectActivated = true
- self:__Detect( self.DetectInterval )
+ self:__Detect( -self.DetectInterval )
end
--- Deactivate the detection. The AI will NOT detect for targets.
@@ -25193,6 +25448,7 @@ end
function AI_PATROL_ZONE:SetDetectionDeactivated()
self:F2()
+ self:ClearDetectedUnits()
self.DetectActivated = false
end
@@ -25228,17 +25484,23 @@ function AI_PATROL_ZONE:SetDetectionZone( DetectionZone )
end
end
---- Gets a list of @{Wrapper.Unit#UNIT}s that were detected by the AI.
+--- Gets a list of @{Unit#UNIT}s that were detected by the AI.
-- No filtering is applied, so, ANY detected UNIT can be in this list.
-- It is up to the mission designer to use the @{Unit} class and methods to filter the targets.
-- @param #AI_PATROL_ZONE self
--- @return #table The list of @{Wrapper.Unit#UNIT}s
+-- @return #table The list of @{Unit#UNIT}s
function AI_PATROL_ZONE:GetDetectedUnits()
self:F2()
return self.DetectedUnits
end
+--- Clears the list of @{Unit#UNIT}s that were detected by the AI.
+-- @param #AI_PATROL_ZONE self
+function AI_PATROL_ZONE:ClearDetectedUnits()
+ self:F2()
+ self.DetectedUnits = {}
+end
--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated.
@@ -25288,10 +25550,9 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
self:__Status( 60 ) -- Check status status every 30 seconds.
self:SetDetectionActivated()
- self:EventOnPilotDead( self.OnPilotDead )
- self:EventOnCrash( self.OnCrash )
- self:EventOnEjection( self.OnEjection )
-
+ self:HandleEvent( EVENTS.PilotDead, self.OnPilotDead )
+ self:HandleEvent( EVENTS.Crash, self.OnCrash )
+ self:HandleEvent( EVENTS.Ejection, self.OnEjection )
Controllable:OptionROEHoldFire()
Controllable:OptionROTVertical()
@@ -25303,6 +25564,8 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
self:__Route( 5 )
end
)
+
+ self:SetDetectionOn()
end
@@ -25323,7 +25586,7 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
local DetectedTargets = Controllable:GetDetectedTargets()
for TargetID, Target in pairs( DetectedTargets or {} ) do
local TargetObject = Target.object
- self:T( TargetObject )
+
if TargetObject and TargetObject:isExist() and TargetObject.id_ < 50000000 then
local TargetUnit = UNIT:Find( TargetObject )
@@ -25332,18 +25595,22 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
if self.DetectionZone then
if TargetUnit:IsInZone( self.DetectionZone ) then
self:T( {"Detected ", TargetUnit } )
- self.DetectedUnits[TargetUnit] = TargetUnit
+ if self.DetectedUnits[TargetUnit] == nil then
+ self.DetectedUnits[TargetUnit] = true
+ end
Detected = true
end
else
- self.DetectedUnits[TargetUnit] = TargetUnit
+ if self.DetectedUnits[TargetUnit] == nil then
+ self.DetectedUnits[TargetUnit] = true
+ end
Detected = true
end
end
end
-
- self:__Detect( self.DetectInterval )
+ self:__Detect( -self.DetectInterval )
+
if Detected == true then
self:__Detected( 1.5 )
end
@@ -25578,17 +25845,16 @@ function AI_PATROL_ZONE:OnPilotDead( EventData )
self:__PilotDead( 1, EventData )
end
end
-
---- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Provide Close Air Support to friendly ground troops.**
+--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** --
+-- **Provide Close Air Support to friendly ground troops.**
--
-- 
--
---
-- ===
--
--- # 1) @{#AI_CAS_ZONE} class, extends @{AI.AI_Patrol#AI_PATROL_ZONE}
+-- # 1) @{#AI_CAS_ZONE} class, extends @{AI_Patrol#AI_PATROL_ZONE}
--
--- @{#AI_CAS_ZONE} derives from the @{AI.AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour.
+-- @{#AI_CAS_ZONE} derives from the @{AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour.
--
-- The @{#AI_CAS_ZONE} class implements the core functions to provide Close Air Support in an Engage @{Zone} by an AIR @{Controllable} or @{Group}.
-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
@@ -25729,7 +25995,7 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
self.Accomplished = false
self:SetDetectionZone( self.EngageZone )
-
+
self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE.
--- OnBefore Transition Handler for Event Engage.
@@ -25739,6 +26005,12 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
+ -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
+ -- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+ -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
+ -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+ -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
+
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Engage.
@@ -25748,6 +26020,11 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
+ -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
+ -- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+ -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
+ -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+ -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
--- Synchronous Event Trigger for Event Engage.
-- @function [parent=#AI_CAS_ZONE] Engage
@@ -25775,6 +26052,8 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string Event The Event string.
-- @param #string To The To State string.
+ self:AddTransition( "Engaging", "Target", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE.
+
self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE.
--- OnBefore Transition Handler for Event Fired.
@@ -25918,8 +26197,9 @@ function AI_CAS_ZONE:onafterStart( Controllable, From, Event, To )
-- Call the parent Start event handler
self:GetParent(self).onafterStart( self, Controllable, From, Event, To )
- self:EventOnDead( self.OnDead )
+ self:HandleEvent( EVENTS.Dead, self.OnDead )
+ self:SetDetectionDeactivated() -- When not engaging, set the detection off.
end
--- @param Wrapper.Controllable#CONTROLLABLE AIControllable
@@ -25942,15 +26222,62 @@ function AI_CAS_ZONE:onbeforeEngage( Controllable, From, Event, To )
end
end
+--- @param #AI_CAS_ZONE self
+-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
+-- @param #string From The From State string.
+-- @param #string Event The Event string.
+-- @param #string To The To State string.
+function AI_CAS_ZONE:onafterTarget( Controllable, From, Event, To )
+ self:E("onafterTarget")
+
+ if Controllable:IsAlive() then
+
+ local AttackTasks = {}
+
+ for DetectedUnit, Detected in pairs( self.DetectedUnits ) do
+ local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
+ if DetectedUnit:IsAlive() then
+ if DetectedUnit:IsInZone( self.EngageZone ) then
+ if Detected == true then
+ self:E( {"Target: ", DetectedUnit } )
+ self.DetectedUnits[DetectedUnit] = false
+ local AttackTask = Controllable:EnRouteTaskEngageUnit( DetectedUnit, 1, true, self.EngageWeaponExpend, self.EngageAttackQty, self.EngageDirection, self.EngageAltitude, nil )
+ self.Controllable:PushTask( AttackTask, 1 )
+ end
+ end
+ else
+ self.DetectedUnits[DetectedUnit] = nil
+ end
+ end
+
+ self:__Target( -10 )
+
+ end
+end
+
+
--- @param #AI_CAS_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
+-- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
+-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+-- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
+-- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+-- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
+function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection )
+ self:E("onafterEngage")
+
+ self.EngageSpeed = EngageSpeed or 400
+ self.EngageAltitude = EngageAltitude or 2000
+ self.EngageWeaponExpend = EngageWeaponExpend
+ self.EngageAttackQty = EngageAttackQty
+ self.EngageDirection = EngageDirection
if Controllable:IsAlive() then
+
local EngageRoute = {}
@@ -25965,7 +26292,7 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
- ToEngageZoneSpeed,
+ self.EngageSpeed,
true
)
@@ -25978,20 +26305,15 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
local ToEngageZoneVec2 = self.EngageZone:GetRandomVec2()
self:T2( ToEngageZoneVec2 )
- -- Define Speed and Altitude.
- local ToEngageZoneAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude )
- local ToEngageZoneSpeed = self.PatrolMaxSpeed
- self:T2( ToEngageZoneSpeed )
-
-- Obtain a 3D @{Point} from the 2D point + altitude.
- local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, ToEngageZoneAltitude, ToEngageZoneVec2.y )
+ local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, self.EngageAltitude, ToEngageZoneVec2.y )
-- Create a route point of type air.
local ToEngageZoneRoutePoint = ToEngageZonePointVec3:RoutePointAir(
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
- ToEngageZoneSpeed,
+ self.EngageSpeed,
true
)
@@ -26005,20 +26327,15 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
local ToTargetVec2 = self.EngageZone:GetRandomVec2()
self:T2( ToTargetVec2 )
- --- Define Speed and Altitude.
- local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude )
- local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
- self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
-
--- Obtain a 3D @{Point} from the 2D point + altitude.
- local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
+ local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y )
--- Create a route point of type air.
local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir(
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
- ToTargetSpeed,
+ self.EngageSpeed,
true
)
@@ -26028,24 +26345,24 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
Controllable:OptionROEOpenFire()
- Controllable:OptionROTPassiveDefense()
+ Controllable:OptionROTVertical()
- local AttackTasks = {}
-
- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do
- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
- self:T( DetectedUnit )
- if DetectedUnit:IsAlive() then
- if DetectedUnit:IsInZone( self.EngageZone ) then
- self:E( {"Engaging ", DetectedUnit } )
- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit )
- end
- else
- self.DetectedUnits[DetectedUnit] = nil
- end
- end
-
- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
+-- local AttackTasks = {}
+--
+-- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do
+-- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
+-- self:T( DetectedUnit )
+-- if DetectedUnit:IsAlive() then
+-- if DetectedUnit:IsInZone( self.EngageZone ) then
+-- self:E( {"Engaging ", DetectedUnit } )
+-- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit )
+-- end
+-- else
+-- self.DetectedUnits[DetectedUnit] = nil
+-- end
+-- end
+--
+-- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
self.Controllable:WayPointInitialize( EngageRoute )
@@ -26056,7 +26373,11 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To )
self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" )
--- NOW ROUTE THE GROUP!
- self.Controllable:WayPointExecute( 1, 2 )
+ self.Controllable:WayPointExecute( 1 )
+
+ self:SetDetectionInterval( 10 )
+ self:SetDetectionActivated()
+ self:__Target( -10 ) -- Start Targetting
end
end
@@ -26082,7 +26403,7 @@ end
-- @param #string To The To State string.
function AI_CAS_ZONE:onafterAccomplish( Controllable, From, Event, To )
self.Accomplished = true
- self:SetDetectionOff()
+ self:SetDetectionDeactivated()
end
--- @param #AI_CAS_ZONE self
@@ -26100,10 +26421,9 @@ end
--
-- 
--
---
-- ===
--
--- # 1) @{#AI_CAP_ZONE} class, extends @{AI.AI_CAP#AI_PATROL_ZONE}
+-- # 1) @{#AI_CAP_ZONE} class, extends @{AI_CAP#AI_PATROL_ZONE}
--
-- The @{#AI_CAP_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
@@ -26169,7 +26489,7 @@ end
-- that will define when the AI will engage with the detected airborne enemy targets.
-- The range can be beyond or smaller than the range of the Patrol Zone.
-- The range is applied at the position of the AI.
--- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range.
+-- Use the method @{AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range.
--
-- ## 1.4) Set the Zone of Engagement
--
@@ -26177,7 +26497,7 @@ end
--
-- An optional @{Zone} can be set,
-- that will define when the AI will engage with the detected airborne enemy targets.
--- Use the method @{AI.AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
+-- Use the method @{AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
--
-- ====
--
@@ -26579,7 +26899,7 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
if #AttackTasks == 0 then
self:E("No targets found -> Going back to Patrolling")
- self:__Accomplish( 1 )
+ self:__Abort( 1 )
self:__Route( 1 )
self:SetDetectionActivated()
else
@@ -26625,7 +26945,10 @@ function AI_CAP_ZONE:onafterAccomplish( Controllable, From, Event, To )
end
---- Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground -- Management of logical cargo objects, that can be transported from and to transportation carriers.
+---Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Ground** --
+-- **Management of logical cargo objects, that can be transported from and to transportation carriers.**
+--
+-- 
--
-- ===
--
@@ -26639,8 +26962,8 @@ end
--
-- * AI_CARGO_GROUPED, represented by a Group of CARGO_UNITs.
--
--- 1) @{AI.AI_Cargo#AI_CARGO} class, extends @{Core.Fsm#FSM_PROCESS}
--- ==========================================================================
+-- # 1) @{#AI_CARGO} class, extends @{Fsm#FSM_PROCESS}
+--
-- The @{#AI_CARGO} class defines the core functions that defines a cargo object within MOOSE.
-- A cargo is a logical object defined that is available for transport, and has a life status within a simulation.
--
@@ -26679,13 +27002,13 @@ end
-- The state transition method needs to start with the name **OnEnter + the name of the state**.
-- These state transition methods need to provide a return value, which is specified at the function description.
--
--- 2) #AI_CARGO_UNIT class
--- ====================
+-- # 2) #AI_CARGO_UNIT class
+--
-- The AI_CARGO_UNIT class defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the AI_CARGO_UNIT objects to and from carriers.
--
--- 5) #AI_CARGO_GROUPED class
--- =======================
+-- # 5) #AI_CARGO_GROUPED class
+--
-- The AI_CARGO_GROUPED class defines a cargo that is represented by a group of UNIT objects within the simulator, and can be transported by a carrier.
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the AI_CARGO_UNIT objects to and from carriers.
--
@@ -26717,14 +27040,14 @@ end
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] UnBoard
-- @param #AI_CARGO self
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
--- UnBoards the cargo to a Carrier. The event will create a movement (= running or driving) of the cargo from the Carrier.
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] __UnBoard
-- @param #AI_CARGO self
-- @param #number DelaySeconds The amount of seconds to delay the action.
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
-- Load
@@ -26749,14 +27072,14 @@ end
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] UnLoad
-- @param #AI_CARGO self
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
--- UnLoads the cargo to a Carrier. The event will unload the cargo from the Carrier. There will be no movement simulated of the cargo loading.
-- The cargo must be in the **Loaded** state.
-- @function [parent=#AI_CARGO] __UnLoad
-- @param #AI_CARGO self
-- @param #number DelaySeconds The amount of seconds to delay the action.
--- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
+-- @param Core.Point#POINT_VEC2 ToPointVec2 (optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
-- State Transition Functions
@@ -27654,7 +27977,7 @@ end -- AI_CARGO_GROUPED
--
-- ===
--
--- # @{#ACT_ASSIGN} FSM template class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ASSIGN} FSM template class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ASSIGN state machine:
--
@@ -27947,7 +28270,7 @@ end -- ACT_ASSIGN_MENU_ACCEPT
--
-- ===
--
--- # @{#ACT_ROUTE} FSM class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ROUTE} FSM class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ROUTE state machine:
--
@@ -28199,7 +28522,7 @@ end -- ACT_ROUTE_ZONE
--
-- ===
--
--- # @{#ACT_ACCOUNT} FSM class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ACCOUNT} FSM class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ACCOUNT state machine:
--
@@ -28314,7 +28637,7 @@ do -- ACT_ACCOUNT
-- @param #string To
function ACT_ACCOUNT:onafterStart( ProcessUnit, From, Event, To )
- self:EventOnDead( self.onfuncEventDead )
+ self:HandleEvent( EVENTS.Dead, self.onfuncEventDead )
self:__Wait( 1 )
end
@@ -28465,7 +28788,7 @@ end -- ACT_ACCOUNT DEADS
--
-- ===
--
--- # @{#ACT_ASSIST} FSM class, extends @{Core.Fsm#FSM_PROCESS}
+-- # @{#ACT_ASSIST} FSM class, extends @{Fsm#FSM_PROCESS}
--
-- ## ACT_ASSIST state machine:
--
@@ -28734,7 +29057,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
self.Missions = {}
- self:EventOnBirth(
+ self:HandleEvent( EVENTS.Birth,
--- @param #COMMANDCENTER self
--- @param Core.Event#EVENTDATA EventData
function( self, EventData )
@@ -28749,7 +29072,8 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
local PlayerUnit = EventData.IniUnit
for MissionID, Mission in pairs( self:GetMissions() ) do
local Mission = Mission -- Tasking.Mission#MISSION
- Mission:JoinUnit( PlayerUnit )
+ local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled!
+ Mission:JoinUnit( PlayerUnit, PlayerGroup )
Mission:ReportDetails()
end
@@ -28761,14 +29085,15 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- - Set the correct menu.
-- - Assign the PlayerUnit to the Task if required.
-- - Send a message to the other players in the group that this player has joined.
- self:EventOnPlayerEnterUnit(
+ self:HandleEvent( EVENTS.PlayerEnterUnit,
--- @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 )
+ local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled!
+ Mission:JoinUnit( PlayerUnit, PlayerGroup )
Mission:ReportDetails()
end
end
@@ -28777,12 +29102,13 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task.
-- When there is no Unit left running the Task, the Task goes into Abort...
- self:EventOnPlayerLeaveUnit(
+ self:HandleEvent( EVENTS.PlayerLeaveUnit,
--- @param #TASK 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:AbortUnit( PlayerUnit )
end
end
@@ -28791,7 +29117,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
-- Handle when a player leaves a slot and goes back to spectators ...
-- The PlayerUnit will be UnAssigned from the Task.
-- When there is no Unit left running the Task, the Task goes into Abort...
- self:EventOnCrash(
+ self:HandleEvent( EVENTS.Crash,
--- @param #TASK self
-- @param Core.Event#EVENTDATA EventData
function( self, EventData )
@@ -29050,15 +29376,16 @@ end
-- If the Unit is part of a Task in the Mission, true is returned.
-- @param #MISSION self
-- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player joining the Mission.
+-- @param Wrapper.Group#GROUP PlayerGroup The GROUP of the player joining the Mission.
-- @return #boolean true if Unit is part of a Task in the Mission.
-function MISSION:JoinUnit( PlayerUnit )
- self:F( { PlayerUnit = PlayerUnit } )
+function MISSION:JoinUnit( PlayerUnit, PlayerGroup )
+ self:F( { PlayerUnit = PlayerUnit, PlayerGroup = PlayerGroup } )
local PlayerUnitAdded = false
for TaskID, Task in pairs( self:GetTasks() ) do
local Task = Task -- Tasking.Task#TASK
- if Task:JoinUnit( PlayerUnit ) then
+ if Task:JoinUnit( PlayerUnit, PlayerGroup ) then
PlayerUnitAdded = true
end
end
@@ -29901,7 +30228,7 @@ end
--- This module contains the TASK class.
--
--- 1) @{#TASK} class, extends @{Core.Base#BASE}
+-- 1) @{#TASK} class, extends @{Base#BASE}
-- ============================================
-- 1.1) The @{#TASK} class implements the methods for task orchestration within MOOSE.
-- ----------------------------------------------------------------------------------------
@@ -30082,31 +30409,6 @@ function TASK:New( Mission, SetGroupAssign, TaskName, TaskType )
self.TaskBriefing = "You are invited for the task: " .. self.TaskName .. "."
self.FsmTemplate = self.FsmTemplate or FSM_PROCESS:New()
-
- -- Handle the birth of new planes within the assigned set.
-
-
- -- Handle when a player crashes ...
- -- The Task is UnAssigned from the Unit.
- -- When there is no Unit left running the Task, and all of the Players crashed, the Task goes into Failed ...
--- self:EventOnCrash(
--- --- @param #TASK self
--- -- @param Core.Event#EVENTDATA EventData
--- function( self, EventData )
--- self:E( "In LeaveUnit" )
--- self:E( { "State", self:GetState() } )
--- if self:IsStateAssigned() then
--- local TaskUnit = EventData.IniUnit
--- local TaskGroup = EventData.IniUnit:GetGroup()
--- self:E( self.SetGroup:IsIncludeObject( TaskGroup ) )
--- if self.SetGroup:IsIncludeObject( TaskGroup ) then
--- self:UnAssignFromUnit( TaskUnit )
--- end
--- self:MessageToGroups( TaskUnit:GetPlayerName() .. " crashed!, and has aborted Task " .. self:GetName() )
--- end
--- end
--- )
---
Mission:AddTask( self )
@@ -30135,14 +30437,14 @@ end
-- If the Unit is part of the Task, true is returned.
-- @param #TASK self
-- @param Wrapper.Unit#UNIT PlayerUnit The CLIENT or UNIT of the Player joining the Mission.
+-- @param Wrapper.Group#GROUP PlayerGroup The GROUP of the player joining the Mission.
-- @return #boolean true if Unit is part of the Task.
-function TASK:JoinUnit( PlayerUnit )
- self:F( { PlayerUnit = PlayerUnit } )
+function TASK:JoinUnit( PlayerUnit, PlayerGroup )
+ self:F( { PlayerUnit = PlayerUnit, PlayerGroup = PlayerGroup } )
local PlayerUnitAdded = false
local PlayerGroups = self:GetGroups()
- local PlayerGroup = PlayerUnit:GetGroup()
-- Is the PlayerGroup part of the PlayerGroups?
if PlayerGroups:IsIncludeObject( PlayerGroup ) then
@@ -30295,7 +30597,6 @@ end
-- @return #boolean
function TASK:HasGroup( FindGroup )
- self:GetGroups():FilterOnce() -- Ensure that the filter is updated.
return self:GetGroups():IsIncludeObject( FindGroup )
end
@@ -30925,37 +31226,37 @@ end -- Reporting
--
-- ===
--
--- 1) @{Tasking.DetectionManager#DETECTION_MANAGER} class, extends @{Core.Base#BASE}
+-- 1) @{DetectionManager#DETECTION_MANAGER} class, extends @{Base#BASE}
-- ====================================================================
--- The @{Tasking.DetectionManager#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
+-- The @{DetectionManager#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
-- Reportings can be done in several manners, and it is up to the derived classes if DETECTION_MANAGER to model the reporting behaviour.
--
-- 1.1) DETECTION_MANAGER constructor:
-- -----------------------------------
--- * @{Tasking.DetectionManager#DETECTION_MANAGER.New}(): Create a new DETECTION_MANAGER instance.
+-- * @{DetectionManager#DETECTION_MANAGER.New}(): Create a new DETECTION_MANAGER instance.
--
-- 1.2) DETECTION_MANAGER reporting:
-- ---------------------------------
--- Derived DETECTION_MANAGER classes will reports detected units using the method @{Tasking.DetectionManager#DETECTION_MANAGER.ReportDetected}(). This method implements polymorphic behaviour.
+-- Derived DETECTION_MANAGER classes will reports detected units using the method @{DetectionManager#DETECTION_MANAGER.ReportDetected}(). This method implements polymorphic behaviour.
--
--- The time interval in seconds of the reporting can be changed using the methods @{Tasking.DetectionManager#DETECTION_MANAGER.SetReportInterval}().
--- To control how long a reporting message is displayed, use @{Tasking.DetectionManager#DETECTION_MANAGER.SetReportDisplayTime}().
--- Derived classes need to implement the method @{Tasking.DetectionManager#DETECTION_MANAGER.GetReportDisplayTime}() to use the correct display time for displayed messages during a report.
+-- The time interval in seconds of the reporting can be changed using the methods @{DetectionManager#DETECTION_MANAGER.SetReportInterval}().
+-- To control how long a reporting message is displayed, use @{DetectionManager#DETECTION_MANAGER.SetReportDisplayTime}().
+-- Derived classes need to implement the method @{DetectionManager#DETECTION_MANAGER.GetReportDisplayTime}() to use the correct display time for displayed messages during a report.
--
--- Reporting can be started and stopped using the methods @{Tasking.DetectionManager#DETECTION_MANAGER.StartReporting}() and @{Tasking.DetectionManager#DETECTION_MANAGER.StopReporting}() respectively.
--- If an ad-hoc report is requested, use the method @{Tasking.DetectionManager#DETECTION_MANAGER#ReportNow}().
+-- Reporting can be started and stopped using the methods @{DetectionManager#DETECTION_MANAGER.StartReporting}() and @{DetectionManager#DETECTION_MANAGER.StopReporting}() respectively.
+-- If an ad-hoc report is requested, use the method @{DetectionManager#DETECTION_MANAGER#ReportNow}().
--
-- The default reporting interval is every 60 seconds. The reporting messages are displayed 15 seconds.
--
-- ===
--
--- 2) @{Tasking.DetectionManager#DETECTION_REPORTING} class, extends @{Tasking.DetectionManager#DETECTION_MANAGER}
+-- 2) @{DetectionManager#DETECTION_REPORTING} class, extends @{DetectionManager#DETECTION_MANAGER}
-- =========================================================================================
--- The @{Tasking.DetectionManager#DETECTION_REPORTING} class implements detected units reporting. Reporting can be controlled using the reporting methods available in the @{Tasking.DetectionManager#DETECTION_MANAGER} class.
+-- The @{DetectionManager#DETECTION_REPORTING} class implements detected units reporting. Reporting can be controlled using the reporting methods available in the @{DetectionManager#DETECTION_MANAGER} class.
--
-- 2.1) DETECTION_REPORTING constructor:
-- -------------------------------
--- The @{Tasking.DetectionManager#DETECTION_REPORTING.New}() method creates a new DETECTION_REPORTING instance.
+-- The @{DetectionManager#DETECTION_REPORTING.New}() method creates a new DETECTION_REPORTING instance.
--
-- ===
--
@@ -31071,7 +31372,7 @@ do -- DETECTION MANAGER
return self
end
- --- Report the detected @{Wrapper.Unit#UNIT}s detected within the @{Functional.Detection#DETECTION_BASE} object to the @{Set#SET_GROUP}s.
+ --- Report the detected @{Unit#UNIT}s detected within the @{Detection#DETECTION_BASE} object to the @{Set#SET_GROUP}s.
-- @param #DETECTION_MANAGER self
function DETECTION_MANAGER:_FacScheduler( SchedulerName )
self:F2( { SchedulerName } )
@@ -31121,7 +31422,7 @@ do -- DETECTION_REPORTING
--- Creates a string of the detected items in a @{Detection}.
-- @param #DETECTION_MANAGER self
- -- @param Set#SET_UNIT DetectedSet The detected Set created by the @{Functional.Detection#DETECTION_BASE} object.
+ -- @param Set#SET_UNIT DetectedSet The detected Set created by the @{Detection#DETECTION_BASE} object.
-- @return #DETECTION_MANAGER self
function DETECTION_REPORTING:GetDetectedItemsText( DetectedSet )
self:F2()
@@ -31154,7 +31455,7 @@ do -- DETECTION_REPORTING
--- Reports the detected items to the @{Set#SET_GROUP}.
-- @param #DETECTION_REPORTING self
-- @param Wrapper.Group#GROUP Group The @{Group} object to where the report needs to go.
- -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Functional.Detection#DETECTION_BASE} object.
+ -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Detection#DETECTION_BASE} object.
-- @return #boolean Return true if you want the reporting to continue... false will cancel the reporting loop.
function DETECTION_REPORTING:ProcessDetected( Group, Detection )
self:F2( Group )
@@ -31315,7 +31616,7 @@ do -- DETECTION_DISPATCHER
--- Assigns tasks in relation to the detected items to the @{Set#SET_GROUP}.
-- @param #DETECTION_DISPATCHER self
- -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Functional.Detection#DETECTION_AREAS} object.
+ -- @param Functional.Detection#DETECTION_AREAS Detection The detection created by the @{Detection#DETECTION_AREAS} object.
-- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop.
function DETECTION_DISPATCHER:ProcessDetected( Detection )
self:F2()
@@ -31430,15 +31731,15 @@ do -- DETECTION_DISPATCHER
end--- This module contains the TASK_SEAD classes.
--
--- 1) @{#TASK_SEAD} class, extends @{Tasking.Task#TASK}
+-- 1) @{#TASK_SEAD} class, extends @{Task#TASK}
-- =================================================
-- The @{#TASK_SEAD} class defines a SEAD task for a @{Set} of Target Units, located at a Target Zone,
--- based on the tasking capabilities defined in @{Tasking.Task#TASK}.
+-- based on the tasking capabilities defined in @{Task#TASK}.
-- The TASK_SEAD is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
--
-- * **None**: Start of the process
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_ASSIGN_ACCEPT} is started to accept the task.
--- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
+-- * **Assigned**: The SEAD task is assigned to a @{Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
--
@@ -31508,15 +31809,15 @@ do -- TASK_SEAD
end
--- (AI) (SP) (MP) Tasking for Air to Ground Processes.
--
--- 1) @{#TASK_A2G} class, extends @{Tasking.Task#TASK}
+-- 1) @{#TASK_A2G} class, extends @{Task#TASK}
-- =================================================
-- The @{#TASK_A2G} class defines a CAS or BAI task of a @{Set} of Target Units,
--- located at a Target Zone, based on the tasking capabilities defined in @{Tasking.Task#TASK}.
+-- located at a Target Zone, based on the tasking capabilities defined in @{Task#TASK}.
-- The TASK_A2G is implemented using a @{Statemachine#FSM_TASK}, and has the following statuses:
--
-- * **None**: Start of the process
-- * **Planned**: The SEAD task is planned. Upon Planned, the sub-process @{Process_Fsm.Assign#ACT_ASSIGN_ACCEPT} is started to accept the task.
--- * **Assigned**: The SEAD task is assigned to a @{Wrapper.Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
+-- * **Assigned**: The SEAD task is assigned to a @{Group#GROUP}. Upon Assigned, the sub-process @{Process_Fsm.Route#ACT_ROUTE} is started to route the active Units in the Group to the attack zone.
-- * **Success**: The SEAD task is successfully completed. Upon Success, the sub-process @{Process_SEAD#PROCESS_SEAD} is started to follow-up successful SEADing of the targets assigned in the task.
-- * **Failed**: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
--
diff --git a/Moose Presentations/EVENT.pptx b/Moose Presentations/EVENT.pptx
new file mode 100644
index 000000000..940cff234
Binary files /dev/null and b/Moose Presentations/EVENT.pptx differ
diff --git a/Moose Presentations/SETUP.pptx b/Moose Presentations/SETUP.pptx
index fc03fc4c9..226ce6869 100644
Binary files a/Moose Presentations/SETUP.pptx and b/Moose Presentations/SETUP.pptx differ
diff --git a/Moose Presentations/SPAWN.pptx b/Moose Presentations/SPAWN.pptx
index 060aeabea..afd38a8b5 100644
Binary files a/Moose Presentations/SPAWN.pptx and b/Moose Presentations/SPAWN.pptx differ
diff --git a/Moose Test Missions/ABP - Airbase Police/APL-001 - Caucasus/APL-001 - Caucasus.miz b/Moose Test Missions/ABP - Airbase Police/APL-001 - Caucasus/APL-001 - Caucasus.miz
index 3973875f2..a92708a20 100644
Binary files a/Moose Test Missions/ABP - Airbase Police/APL-001 - Caucasus/APL-001 - Caucasus.miz and b/Moose Test Missions/ABP - Airbase Police/APL-001 - Caucasus/APL-001 - Caucasus.miz differ
diff --git a/Moose Test Missions/ABP - Airbase Police/APL-002 - Nevada/APL-002 - Nevada.miz b/Moose Test Missions/ABP - Airbase Police/APL-002 - Nevada/APL-002 - Nevada.miz
index 5f6d100ac..c9594ebf9 100644
Binary files a/Moose Test Missions/ABP - Airbase Police/APL-002 - Nevada/APL-002 - Nevada.miz and b/Moose Test Missions/ABP - Airbase Police/APL-002 - Nevada/APL-002 - Nevada.miz differ
diff --git a/Moose Test Missions/ACL - Airbase Cleaner/ACL-001 - Airbase CleanUp/ACL-001 - Airbase CleanUp.miz b/Moose Test Missions/ACL - Airbase Cleaner/ACL-001 - Airbase CleanUp/ACL-001 - Airbase CleanUp.miz
index 25ef5d2af..05200e0d0 100644
Binary files a/Moose Test Missions/ACL - Airbase Cleaner/ACL-001 - Airbase CleanUp/ACL-001 - Airbase CleanUp.miz and b/Moose Test Missions/ACL - Airbase Cleaner/ACL-001 - Airbase CleanUp/ACL-001 - Airbase CleanUp.miz differ
diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua
index 5315ae2e7..a3104d156 100644
--- a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua
+++ b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua
@@ -1,3 +1,4 @@
+---
-- Name: AIB-001 - Spawned AI
-- Author: FlightControl
-- Date Created: 07 Dec 2016
diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.miz b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.miz
index cc5984a01..b1a2d652f 100644
Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.miz differ
diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz b/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz
index ceb060cbc..960ed1183 100644
Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz differ
diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.miz b/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.miz
index 3feeeb1a7..8013dd776 100644
Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.miz differ
diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.miz b/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.miz
index 0eb17b930..8dd20559c 100644
Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.miz differ
diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.miz b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.miz
index f36a9a476..9fe4f4a9e 100644
Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.miz differ
diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.miz b/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.miz
index eb1db3feb..a3b4a7b75 100644
Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.miz differ
diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.lua b/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.lua
index 92d27b1b2..64d6475c5 100644
--- a/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.lua
+++ b/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.lua
@@ -1,11 +1,16 @@
+---
-- Name: CAP-001 - Combat Air Patrol
-- Author: FlightControl
-- Date Created: 16 January 2017
--
-- # Situation:
---
+-- The Su-27 airplane will patrol in PatrolZone.
+-- It will not engage any enemy automatically.
+--
-- # Test cases:
--
+-- 1. Observe the Su-27 patrolling.
+--
local CapPlane = GROUP:FindByName( "Plane" )
diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.miz b/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.miz
index ac476310f..db542095d 100644
Binary files a/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.miz and b/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.miz differ
diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.lua b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.lua
index 283396d73..683395146 100644
--- a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.lua
+++ b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.lua
@@ -1,11 +1,19 @@
--- Name: CAP-001 - Combat Air Patrol
+---
+-- Name: CAP-010 - CAP and Engage within Range
-- Author: FlightControl
-- Date Created: 16 January 2017
--
-- # Situation:
--
+-- The Su-27 airplane will patrol in PatrolZone.
+-- It will engage when it detects the airplane and when the A-10C is within the engage range.
+--
-- # Test cases:
--
+-- 1. Observe the Su-27 patrolling.
+-- 2. Observe that, when the A-10C is within the engage range, it will engage.
+-- 3. After engage, observe that the Su-27 returns to the PatrolZone.
+-- 4. If you want, you can wait until the Su-27 is out of fuel and will land.
local CapPlane = GROUP:FindByName( "Plane" )
diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.miz b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.miz
index 83dc5b234..c9169826f 100644
Binary files a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.miz and b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.miz differ
diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.miz b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.miz
deleted file mode 100644
index 818f3886c..000000000
Binary files a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.miz and /dev/null differ
diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.lua b/Moose Test Missions/CAP - Combat Air Patrol/CAP-011 - CAP and Engage within Zone/CAP-011 - CAP and Engage within Zone.lua
similarity index 58%
rename from Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.lua
rename to Moose Test Missions/CAP - Combat Air Patrol/CAP-011 - CAP and Engage within Zone/CAP-011 - CAP and Engage within Zone.lua
index 5e911a096..5cf3b6e74 100644
--- a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.lua
+++ b/Moose Test Missions/CAP - Combat Air Patrol/CAP-011 - CAP and Engage within Zone/CAP-011 - CAP and Engage within Zone.lua
@@ -1,11 +1,20 @@
--- Name: CAP-001 - Combat Air Patrol
+---
+-- Name: CAP-011 - CAP and Engage within Zone
-- Author: FlightControl
-- Date Created: 16 January 2017
--
-- # Situation:
--
+-- The Su-27 airplane will patrol in PatrolZone.
+-- It will engage when it detects the airplane and when the A-10C is within the CapEngageZone.
+--
-- # Test cases:
--
+-- 1. Observe the Su-27 patrolling.
+-- 2. Observe that, when the A-10C is within the engage zone, it will engage.
+-- 3. After engage, observe that the Su-27 returns to the PatrolZone.
+-- 4. If you want, you can wait until the Su-27 is out of fuel and will land.
+
local CapPlane = GROUP:FindByName( "Plane" )
diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-011 - CAP and Engage within Zone/CAP-011 - CAP and Engage within Zone.miz b/Moose Test Missions/CAP - Combat Air Patrol/CAP-011 - CAP and Engage within Zone/CAP-011 - CAP and Engage within Zone.miz
new file mode 100644
index 000000000..f0ba54913
Binary files /dev/null and b/Moose Test Missions/CAP - Combat Air Patrol/CAP-011 - CAP and Engage within Zone/CAP-011 - CAP and Engage within Zone.miz differ
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.miz b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.miz
deleted file mode 100644
index 698e0358a..000000000
Binary files a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.miz and /dev/null differ
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - Manual Test.miz b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - Manual Test.miz
deleted file mode 100644
index a4be72495..000000000
Binary files a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - Manual Test.miz and /dev/null differ
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a ZONE-ME Test.miz b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a ZONE-ME Test.miz
new file mode 100644
index 000000000..80f6d46f0
Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a ZONE-ME Test.miz differ
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.lua b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a Zone by Airplane Group.lua
similarity index 69%
rename from Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.lua
rename to Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a Zone by Airplane Group.lua
index f5f267f69..42f82baf7 100644
--- a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.lua
+++ b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a Zone by Airplane Group.lua
@@ -1,11 +1,26 @@
--- Name: CAS in a ZONE
+---
+-- Name: CAS-001 - CAS in a Zone by Airplane Group
-- Author: FlightControl
-- Date Created: 13 January 2017
--
-- # Situation:
--
+-- A group of 4 Su-25T at patrolling north of an engage zone for 10 minutes.
+-- After 10 minutes, the command center orders the Su-25T to engage the zone and execute a CAS.
+--
-- # Test cases:
--
+-- 1. Observe that the Su-25T is patrolling in the patrol zone, until the engage command is given.
+-- 2. The Su-25T are not detecting any target during the patrol.
+-- 3. When the Su-25T is commanded to engage, the group will fly to the engage zone.
+-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
+-- 5. Observe the Su-25T eliminating the targets.
+-- 6. Observe the Su-25T defenses.
+-- 7. When all targets within the engage zone are destroyed, the Su-25T CAS task is set to Accomplished.
+-- 8. The Su-25T will return to base.
+
+
+
-- Create a local variable (in this case called CASEngagementZone) and
-- using the ZONE function find the pre-defined zone called "Engagement Zone"
-- currently on the map and assign it to this variable
@@ -42,18 +57,18 @@ AICasZone:__Engage( 600 )
-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
- BASE:E( { "In Scheduler: ", Targets:GetSize() } )
if Targets:IsAlive() and Targets:GetSize() > 5 then
- BASE:E("Still alive")
+ BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
else
- BASE:E("Destroyed")
+ BASE:E( "Test Mission: The required targets are destroyed." )
AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
- Check:Stop(CheckScheduleID)
end
end, {}, 20, 60, 0.2 )
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
+ BASE:E( "Test Mission: Sending the Su-25T back to base." )
+ Check:Stop( CheckScheduleID )
AICasZone:__RTB( 1 )
end
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a Zone by Airplane Group.miz b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a Zone by Airplane Group.miz
new file mode 100644
index 000000000..8dfc2ccd6
Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a Zone by Airplane Group.miz differ
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed.lua b/Moose Test Missions/CAS - Close Air Support/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed.lua
new file mode 100644
index 000000000..230c3d414
--- /dev/null
+++ b/Moose Test Missions/CAS - Close Air Support/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed.lua
@@ -0,0 +1,75 @@
+---
+-- Name: CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed
+-- Author: FlightControl
+-- Date Created: 06 February 2017
+--
+-- # Situation:
+--
+-- A group of 4 Su-25T at patrolling north of an engage zone for 1 minute.
+-- After 1 minute, the command center orders the Su-25T to engage the zone and execute a CAS.
+--
+-- # Test cases:
+--
+-- 1. Observe that the Su-25T is patrolling in the patrol zone, until the engage command is given.
+-- 2. The Su-25T are not detecting any target during the patrol.
+-- 3. When the Su-25T is commanded to engage, the group will fly to the engage zone.
+-- 3.1. The approach speed to the engage zone is set to 400 km/h.
+-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
+-- 5. Observe the Su-25T eliminating the targets.
+-- 6. Observe the Su-25T defenses.
+-- 7. When all targets within the engage zone are destroyed, the Su-25T CAS task is set to Accomplished.
+-- 8. The Su-25T will return to base.
+
+
+
+-- Create a local variable (in this case called CASEngagementZone) and
+-- using the ZONE function find the pre-defined zone called "Engagement Zone"
+-- currently on the map and assign it to this variable
+local CASEngagementZone = ZONE:New( "Engagement Zone" )
+
+-- Create a local variable (in this case called CASPlane) and
+-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
+local CASPlane = GROUP:FindByName( "Plane" )
+
+-- Create a local Variable (in this cased called PatrolZone and
+-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
+local PatrolZone = ZONE:New( "Patrol Zone" )
+
+-- Create and object (in this case called AICasZone) and
+-- using the functions AI_CAS_ZONE assign the parameters that define this object
+-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
+local AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
+
+-- Create an object (in this case called Targets) and
+-- using the GROUP function find the group labeled "Targets" and assign it to this object
+local Targets = GROUP:FindByName("Targets")
+
+
+-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
+AICasZone:SetControllable( CASPlane )
+
+-- Tell the group CASPlane to start the mission in 1 second.
+AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
+
+-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
+AICasZone:__Engage( 60, 400 ) -- Engage after one minute with a speed of 400 km/h.
+
+-- Check every 60 seconds whether the Targets have been eliminated.
+-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
+Check, CheckScheduleID = SCHEDULER:New(nil,
+ function()
+ if Targets:IsAlive() and Targets:GetSize() > 5 then
+ BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
+ else
+ BASE:E( "Test Mission: The required targets are destroyed." )
+ AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
+ end
+ end, {}, 20, 60, 0.2 )
+
+
+-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
+function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
+ BASE:E( "Test Mission: Sending the Su-25T back to base." )
+ Check:Stop( CheckScheduleID )
+ AICasZone:__RTB( 1 )
+end
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed.miz b/Moose Test Missions/CAS - Close Air Support/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed.miz
new file mode 100644
index 000000000..40393d7fa
Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed.miz differ
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude.lua b/Moose Test Missions/CAS - Close Air Support/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude.lua
new file mode 100644
index 000000000..d5ffcc4a3
--- /dev/null
+++ b/Moose Test Missions/CAS - Close Air Support/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude.lua
@@ -0,0 +1,76 @@
+---
+-- Name: CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude
+-- Author: FlightControl
+-- Date Created: 6 February 2017
+--
+-- # Situation:
+--
+-- A group of 4 Su-25T at patrolling north of an engage zone for 1 minute.
+-- After 1 minute, the command center orders the Su-25T to engage the zone and execute a CAS.
+--
+-- # Test cases:
+--
+-- 1. Observe that the Su-25T is patrolling in the patrol zone, until the engage command is given.
+-- 2. The Su-25T are not detecting any target during the patrol.
+-- 3. When the Su-25T is commanded to engage, the group will fly to the engage zone
+-- 3.1. The approach speed to the engage zone is set to 400 km/h.
+-- 3.2. The altitude to the engage zone and CAS execution is set to 500 meters.
+-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
+-- 5. Observe the Su-25T eliminating the targets.
+-- 6. Observe the Su-25T defenses.
+-- 7. When all targets within the engage zone are destroyed, the Su-25T CAS task is set to Accomplished.
+-- 8. The Su-25T will return to base.
+
+
+
+-- Create a local variable (in this case called CASEngagementZone) and
+-- using the ZONE function find the pre-defined zone called "Engagement Zone"
+-- currently on the map and assign it to this variable
+local CASEngagementZone = ZONE:New( "Engagement Zone" )
+
+-- Create a local variable (in this case called CASPlane) and
+-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
+local CASPlane = GROUP:FindByName( "Plane" )
+
+-- Create a local Variable (in this cased called PatrolZone and
+-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
+local PatrolZone = ZONE:New( "Patrol Zone" )
+
+-- Create and object (in this case called AICasZone) and
+-- using the functions AI_CAS_ZONE assign the parameters that define this object
+-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
+local AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
+
+-- Create an object (in this case called Targets) and
+-- using the GROUP function find the group labeled "Targets" and assign it to this object
+local Targets = GROUP:FindByName("Targets")
+
+
+-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
+AICasZone:SetControllable( CASPlane )
+
+-- Tell the group CASPlane to start the mission in 1 second.
+AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
+
+-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
+AICasZone:__Engage( 60, 400, 500 ) -- Engage after one minute with a speed of 400 km/h and an altitude of 500 meters.
+
+-- Check every 60 seconds whether the Targets have been eliminated.
+-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
+Check, CheckScheduleID = SCHEDULER:New(nil,
+ function()
+ if Targets:IsAlive() and Targets:GetSize() > 5 then
+ BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
+ else
+ BASE:E( "Test Mission: The required targets are destroyed." )
+ AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
+ end
+ end, {}, 20, 60, 0.2 )
+
+
+-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
+function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
+ BASE:E( "Test Mission: Sending the Su-25T back to base." )
+ Check:Stop( CheckScheduleID )
+ AICasZone:__RTB( 1 )
+end
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude.miz b/Moose Test Missions/CAS - Close Air Support/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude.miz
new file mode 100644
index 000000000..e55f2ab4b
Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude.miz differ
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.lua b/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.lua
new file mode 100644
index 000000000..72fb90bb8
--- /dev/null
+++ b/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.lua
@@ -0,0 +1,76 @@
+---
+-- Name: CAS-010 - CAS in a Zone by Helicopter
+-- Author: FlightControl
+-- Date Created: 6 February 2017
+--
+-- # Situation:
+--
+-- A group of 1 Ka-50 patrolling north of an engage zone for 1 minute.
+-- After 1 minute, the command center orders the Ka-50 to engage the zone and execute a CAS.
+--
+-- # Test cases:
+--
+-- 1. Observe that the Ka-50 is patrolling in the patrol zone, until the engage command is given.
+-- 2. The Ka-50 are not detecting any target during the patrol.
+-- 3. When the Ka-50 is commanded to engage, the group will fly to the engage zone.
+-- 3.1. Engage Speed is set to 100 km/h.
+-- 3.2. Engage Altitude is set to 150 meters.
+-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
+-- 5. Observe the Ka-50 eliminating the targets.
+-- 6. Observe the Ka-50 defenses.
+-- 7. When all targets within the engage zone are destroyed, the Ka-50 CAS task is set to Accomplished.
+-- 8. The Ka-50 will return to base.
+
+
+
+-- Create a local variable (in this case called CASEngagementZone) and
+-- using the ZONE function find the pre-defined zone called "Engagement Zone"
+-- currently on the map and assign it to this variable
+local CASEngagementZone = ZONE:New( "Engagement Zone" )
+
+-- Create a local variable (in this case called CASPlane) and
+-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
+local CASPlane = GROUP:FindByName( "Helicopter" )
+
+-- Create a local Variable (in this cased called PatrolZone and
+-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
+local PatrolZone = ZONE:New( "Patrol Zone" )
+
+-- Create and object (in this case called AICasZone) and
+-- using the functions AI_CAS_ZONE assign the parameters that define this object
+-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
+local AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
+
+-- Create an object (in this case called Targets) and
+-- using the GROUP function find the group labeled "Targets" and assign it to this object
+local Targets = GROUP:FindByName("Targets")
+
+
+-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
+AICasZone:SetControllable( CASPlane )
+
+-- Tell the group CASPlane to start the mission in 1 second.
+AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
+
+-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
+AICasZone:__Engage( 60, 100, 150 )
+
+-- Check every 60 seconds whether the Targets have been eliminated.
+-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
+Check, CheckScheduleID = SCHEDULER:New(nil,
+ function()
+ if Targets:IsAlive() and Targets:GetSize() > 5 then
+ BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
+ else
+ BASE:E( "Test Mission: The required targets are destroyed." )
+ AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
+ end
+ end, {}, 20, 60, 0.2 )
+
+
+-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
+function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
+ BASE:E( "Test Mission: Sending the Su-25T back to base." )
+ Check:Stop( CheckScheduleID )
+ AICasZone:__RTB( 1 )
+end
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.miz b/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.miz
new file mode 100644
index 000000000..7f2cfb35c
Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.miz differ
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-011 - CAS in a Zone by Helicopter Group/CAS-011 - CAS in a Zone by Helicopter Group.lua b/Moose Test Missions/CAS - Close Air Support/CAS-011 - CAS in a Zone by Helicopter Group/CAS-011 - CAS in a Zone by Helicopter Group.lua
new file mode 100644
index 000000000..f922107fb
--- /dev/null
+++ b/Moose Test Missions/CAS - Close Air Support/CAS-011 - CAS in a Zone by Helicopter Group/CAS-011 - CAS in a Zone by Helicopter Group.lua
@@ -0,0 +1,75 @@
+---
+-- Name: CAS-011 - CAS in a Zone by Helicopter Group
+-- Author: FlightControl
+-- Date Created: 6 February 2017
+--
+-- # Situation:
+--
+-- A group of 4 Ka-50 patrolling north of an engage zone for 1 minute.
+-- After 1 minute, the command center orders the Ka-50 to engage the zone and execute a CAS.
+--
+-- # Test cases:
+--
+-- 1. Observe that the Ka-50 is patrolling in the patrol zone, until the engage command is given.
+-- 2. The Ka-50 are not detecting any target during the patrol.
+-- 3. When the Ka-50 is commanded to engage, the group will fly to the engage zone.
+-- 3.1. Engage Speed is set to 100 km/h.
+-- 3.2. Engage Altitude is set to 150 meters.
+-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
+-- 5. Observe the Ka-50 eliminating the targets.
+-- 6. Observe the Ka-50 defenses.
+-- 7. When all targets within the engage zone are destroyed, the Ka-50 CAS task is set to Accomplished.
+-- 8. The Ka-50 will return to base.
+
+
+-- Create a local variable (in this case called CASEngagementZone) and
+-- using the ZONE function find the pre-defined zone called "Engagement Zone"
+-- currently on the map and assign it to this variable
+local CASEngagementZone = ZONE:New( "Engagement Zone" )
+
+-- Create a local variable (in this case called CASPlane) and
+-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
+local CASPlane = GROUP:FindByName( "Helicopter" )
+
+-- Create a local Variable (in this cased called PatrolZone and
+-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
+local PatrolZone = ZONE:New( "Patrol Zone" )
+
+-- Create and object (in this case called AICasZone) and
+-- using the functions AI_CAS_ZONE assign the parameters that define this object
+-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
+local AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
+
+-- Create an object (in this case called Targets) and
+-- using the GROUP function find the group labeled "Targets" and assign it to this object
+local Targets = GROUP:FindByName("Targets")
+
+
+-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
+AICasZone:SetControllable( CASPlane )
+
+-- Tell the group CASPlane to start the mission in 1 second.
+AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
+
+-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
+AICasZone:__Engage( 60, 100, 150 )
+
+-- Check every 60 seconds whether the Targets have been eliminated.
+-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
+Check, CheckScheduleID = SCHEDULER:New(nil,
+ function()
+ if Targets:IsAlive() and Targets:GetSize() > 5 then
+ BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
+ else
+ BASE:E( "Test Mission: The required targets are destroyed." )
+ AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
+ end
+ end, {}, 20, 60, 0.2 )
+
+
+-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
+function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
+ BASE:E( "Test Mission: Sending the Su-25T back to base." )
+ Check:Stop( CheckScheduleID )
+ AICasZone:__RTB( 1 )
+end
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-011 - CAS in a Zone by Helicopter Group/CAS-011 - CAS in a Zone by Helicopter Group.miz b/Moose Test Missions/CAS - Close Air Support/CAS-011 - CAS in a Zone by Helicopter Group/CAS-011 - CAS in a Zone by Helicopter Group.miz
new file mode 100644
index 000000000..b92279c95
Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-011 - CAS in a Zone by Helicopter Group/CAS-011 - CAS in a Zone by Helicopter Group.miz differ
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups.lua b/Moose Test Missions/CAS - Close Air Support/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups.lua
new file mode 100644
index 000000000..ae3aecf3c
--- /dev/null
+++ b/Moose Test Missions/CAS - Close Air Support/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups.lua
@@ -0,0 +1,91 @@
+---
+-- Name: CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups
+-- Author: FlightControl
+-- Date Created: 6 February 2017
+--
+-- # Situation:
+--
+-- A group of 4 Ka-50 and 5 Su-25T are patrolling north in two engage zone for 5 minutes.
+-- After 5 minutes, the command center orders the groups to engage the zone and execute a CAS.
+--
+-- # Test cases:
+--
+-- 1. Observe that the groups is patrolling in the patrol zone, until the engage command is given.
+-- 2. The groups are not detecting any target during the patrol.
+-- 3. When the groups is commanded to engage, the group will fly to the engage zone.
+-- 3.1. Engage Speed for the Su-25T is set to 350 km/h.
+-- 3.2. Engage Altitude for the Su-25T is set to 1500 meters.
+-- 3.3. Engage Speed for the Ka-50 is set to 100 km/h.
+-- 3.4. Engage Altitude for the Ka-50 is set to 150 meters.
+-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
+-- 5. Observe the groups eliminating the targets.
+-- 6. Observe the groups defenses.
+-- 7. When all targets within the engage zone are destroyed, the groups CAS task is set to Accomplished.
+-- 8. The groups will return to base.
+
+
+
+-- Create a local variable (in this case called CASEngagementZone) and
+-- using the ZONE function find the pre-defined zone called "Engagement Zone"
+-- currently on the map and assign it to this variable
+local CASEngagementZone = ZONE:New( "Engagement Zone" )
+
+-- Create a local variables (in this case called CASPlane and CASHelicopters) and
+-- using the GROUP function find the aircraft group called "Plane" and "Helicopter" and assign to these variables
+local CASPlane = GROUP:FindByName( "Plane" )
+local CASHelicopter = GROUP:FindByName( "Helicopter" )
+
+-- Create two patrol zones, one for the Planes and one for the Helicopters.
+local PatrolZonePlanes = ZONE:New( "Patrol Zone Planes" )
+local PatrolZoneHelicopters = ZONE:New( "Patrol Zone Helicopters" )
+
+-- Create and object (in this case called AICasZone) and
+-- using the functions AI_CAS_ZONE assign the parameters that define this object
+-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
+local AICasZonePlanes = AI_CAS_ZONE:New( PatrolZonePlanes, 400, 500, 500, 2500, CASEngagementZone )
+local AICasZoneHelicopters = AI_CAS_ZONE:New( PatrolZoneHelicopters, 100, 250, 300, 1000, CASEngagementZone )
+
+-- Create an object (in this case called Targets) and
+-- using the GROUP function find the group labeled "Targets" and assign it to this object
+local Targets = GROUP:FindByName("Targets")
+
+
+-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
+AICasZonePlanes:SetControllable( CASPlane )
+AICasZoneHelicopters:SetControllable( CASHelicopter )
+
+-- Tell the group CASPlane to start the mission in 1 second.
+AICasZonePlanes:__Start( 1 ) -- They should startup, and start patrolling in the PatrolZone.
+AICasZoneHelicopters:__Start( 1 ) -- They should startup, and start patrolling in the PatrolZone.
+
+-- After 10 minutes, tell the group CASPlanes and CASHelicopters to engage the targets located in the engagement zone called CASEngagement Zone.
+AICasZonePlanes:__Engage( 300, 350, 1500 ) -- Engage with a speed of 350 km/h and 1500 meter altitude.
+AICasZoneHelicopters:__Engage( 300, 100, 150 ) -- Engage with a speed of 100 km/h and 150 meter altitude.
+
+
+-- Check every 60 seconds whether the Targets have been eliminated.
+-- When the trigger completed has been fired, the Planes and Helicopters will go back to the Patrol Zone.
+Check, CheckScheduleID = SCHEDULER:New(nil,
+ function()
+ if Targets:IsAlive() and Targets:GetSize() > 5 then
+ BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
+ else
+ BASE:E( "Test Mission: The required targets are destroyed." )
+ Check:Stop( CheckScheduleID )
+ AICasZonePlanes:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
+ AICasZoneHelicopters:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
+ end
+ end, {}, 20, 60, 0.2 )
+
+
+-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
+function AICasZonePlanes:OnAfterAccomplish( Controllable, From, Event, To )
+ BASE:E( "Test Mission: Sending the Su-25T back to base." )
+ AICasZonePlanes:__RTB( 1 )
+end
+
+-- When the targets in the zone are destroyed, (see scheduled function), the helicpters will return home ...
+function AICasZoneHelicopters:OnAfterAccomplish( Controllable, From, Event, To )
+ BASE:E( "Test Mission: Sending the Ka-50 back to base." )
+ AICasZoneHelicopters:__RTB( 1 )
+end
diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups.miz b/Moose Test Missions/CAS - Close Air Support/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups.miz
new file mode 100644
index 000000000..3b7402fef
Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups.miz differ
diff --git a/Moose Test Missions/CGO - Cargo/CGO-001 - Unit Boarding/CGO-001 - Unit Boarding.miz b/Moose Test Missions/CGO - Cargo/CGO-001 - Unit Boarding/CGO-001 - Unit Boarding.miz
index 408240b41..8b7db196b 100644
Binary files a/Moose Test Missions/CGO - Cargo/CGO-001 - Unit Boarding/CGO-001 - Unit Boarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-001 - Unit Boarding/CGO-001 - Unit Boarding.miz differ
diff --git a/Moose Test Missions/CGO - Cargo/CGO-002 - Unit Unboarding/CGO-002 - Unit Unboarding.miz b/Moose Test Missions/CGO - Cargo/CGO-002 - Unit Unboarding/CGO-002 - Unit Unboarding.miz
index 9e8678047..0299810fe 100644
Binary files a/Moose Test Missions/CGO - Cargo/CGO-002 - Unit Unboarding/CGO-002 - Unit Unboarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-002 - Unit Unboarding/CGO-002 - Unit Unboarding.miz differ
diff --git a/Moose Test Missions/CGO - Cargo/CGO-003 - Unit Transferring/CGO-003 - Unit Transferring.miz b/Moose Test Missions/CGO - Cargo/CGO-003 - Unit Transferring/CGO-003 - Unit Transferring.miz
index 406d1ea2d..0effbd035 100644
Binary files a/Moose Test Missions/CGO - Cargo/CGO-003 - Unit Transferring/CGO-003 - Unit Transferring.miz and b/Moose Test Missions/CGO - Cargo/CGO-003 - Unit Transferring/CGO-003 - Unit Transferring.miz differ
diff --git a/Moose Test Missions/CGO - Cargo/CGO-101 - Group Boarding/CGO-101 - Group Boarding.miz b/Moose Test Missions/CGO - Cargo/CGO-101 - Group Boarding/CGO-101 - Group Boarding.miz
index 48b4390a6..5c193fb1b 100644
Binary files a/Moose Test Missions/CGO - Cargo/CGO-101 - Group Boarding/CGO-101 - Group Boarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-101 - Group Boarding/CGO-101 - Group Boarding.miz differ
diff --git a/Moose Test Missions/CGO - Cargo/CGO-102 - Group Unboarding/CGO-102 - Group Unboarding.miz b/Moose Test Missions/CGO - Cargo/CGO-102 - Group Unboarding/CGO-102 - Group Unboarding.miz
index 58a83e558..61f5b3deb 100644
Binary files a/Moose Test Missions/CGO - Cargo/CGO-102 - Group Unboarding/CGO-102 - Group Unboarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-102 - Group Unboarding/CGO-102 - Group Unboarding.miz differ
diff --git a/Moose Test Missions/CGO - Cargo/CGO-103 - Group Transferring/CGO-103 - Group Transferring.miz b/Moose Test Missions/CGO - Cargo/CGO-103 - Group Transferring/CGO-103 - Group Transferring.miz
index 8cb8af7fe..d34fb28ae 100644
Binary files a/Moose Test Missions/CGO - Cargo/CGO-103 - Group Transferring/CGO-103 - Group Transferring.miz and b/Moose Test Missions/CGO - Cargo/CGO-103 - Group Transferring/CGO-103 - Group Transferring.miz differ
diff --git a/Moose Test Missions/CGO - Cargo/CGO-201 - Package Boarding/CGO-201 - Package Boarding.miz b/Moose Test Missions/CGO - Cargo/CGO-201 - Package Boarding/CGO-201 - Package Boarding.miz
index 034515f4f..c530b30f8 100644
Binary files a/Moose Test Missions/CGO - Cargo/CGO-201 - Package Boarding/CGO-201 - Package Boarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-201 - Package Boarding/CGO-201 - Package Boarding.miz differ
diff --git a/Moose Test Missions/CGO - Cargo/CGO-202 - Package Unboarding/CGO-202 - Package Unboarding.miz b/Moose Test Missions/CGO - Cargo/CGO-202 - Package Unboarding/CGO-202 - Package Unboarding.miz
index d3d4231ec..f2e15c186 100644
Binary files a/Moose Test Missions/CGO - Cargo/CGO-202 - Package Unboarding/CGO-202 - Package Unboarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-202 - Package Unboarding/CGO-202 - Package Unboarding.miz differ
diff --git a/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.lua b/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.lua
index f48027238..be56c16f9 100644
--- a/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.lua
+++ b/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.lua
@@ -1,5 +1,23 @@
+---
+-- Name: DET-001 - Detection Areas
+-- Author: FlightControl
+-- Date Created: 04 Feb 2017
+--
+-- # Situation:
+--
+-- A small blue vehicle with laser detection methods is detecting targets.
+-- Targets are grouped within areas. A detection range and zone range is given to group the detected units.
+-- This demo will group 5 red vehicles in areas. One vehicle is diving from one group to the other.
+--
+-- # Test cases:
+--
+-- 1. Observe the flaring of the areas formed
+-- 2. Observe the smoking of the units detected
+-- 3. Observe the areas being flexibly changed very detection run.
+-- 4. The truck driving from the one group to the other, will leave the first area, and will join the second.
+-- 5. While driving in between the areas, it will have a separate area.
-local FACGroup = GROUP:FindByName( "FAC Group" )
+local FACSetGroup = SET_GROUP:New():FilterPrefixes( "FAC Group" ):FilterStart()
-local FACDetection = DETECTION_AREAS:New( FACGroup, 1000, 250 ):FlareDetectedZones():FlareDetectedUnits()
+local FACDetection = DETECTION_AREAS:New( FACSetGroup, 1000, 250 ):FlareDetectedZones():SmokeDetectedUnits()
diff --git a/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.miz b/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.miz
index 670aa650b..520f18df4 100644
Binary files a/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.miz and b/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.miz differ
diff --git a/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.lua b/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.lua
index 1717feeb7..35cac114a 100644
--- a/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.lua
+++ b/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.lua
@@ -1,8 +1,8 @@
-local FACGroup = GROUP:FindByName( "FAC Group" )
+local FACSetGroup = SET_GROUP:New():FilterPrefixes( "FAC Group" ):FilterStart()
-local FACDetection = DETECTION_AREAS:New( FACGroup, 1000, 250 )
+local FACDetection = DETECTION_AREAS:New( FACSetGroup, 1000, 250 )
local SeadClientSet = SET_CLIENT:New():FilterCoalitions( "blue" ):FilterStart()
local DestroyClientSet = SET_CLIENT:New():FilterCoalitions( "blue" ):FilterStart()
diff --git a/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.miz b/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.miz
index 5f8be5603..1a840c590 100644
Binary files a/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.miz and b/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.miz differ
diff --git a/Moose Test Missions/ESC - Escorting/ESC-001 - Escorting Helicopters/ESC-001 - Escorting Helicopters.miz b/Moose Test Missions/ESC - Escorting/ESC-001 - Escorting Helicopters/ESC-001 - Escorting Helicopters.miz
index 7186b303d..f4eab73e7 100644
Binary files a/Moose Test Missions/ESC - Escorting/ESC-001 - Escorting Helicopters/ESC-001 - Escorting Helicopters.miz and b/Moose Test Missions/ESC - Escorting/ESC-001 - Escorting Helicopters/ESC-001 - Escorting Helicopters.miz differ
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-001 - API Demo 1/EVT-001 - API Demo 1.lua b/Moose Test Missions/EVT - Event Handling/EVT-001 - API Demo 1/EVT-001 - API Demo 1.lua
new file mode 100644
index 000000000..b2257c66a
--- /dev/null
+++ b/Moose Test Missions/EVT - Event Handling/EVT-001 - API Demo 1/EVT-001 - API Demo 1.lua
@@ -0,0 +1,40 @@
+---
+-- Name: EVT-001 - API Demo 1
+-- Author: FlightControl
+-- Date Created: 7 February 2017
+--
+-- # Situation:
+--
+-- A task shoots another tank. If one of the is dead, the event will be catched.
+--
+-- # Test cases:
+--
+-- 1. Observe the tanks shooting each other.
+-- 2. If one of the tanks die, an event will be catched.
+-- 3. Observe the surviving unit smoking.
+
+
+local Tank1 = UNIT:FindByName( "Tank A" )
+local Tank2 = UNIT:FindByName( "Tank B" )
+
+Tank1:HandleEvent( EVENTS.Dead )
+
+Tank2:HandleEvent( EVENTS.Dead )
+
+--- @param Wrapper.Unit#UNIT self
+function Tank1:OnEventDead( EventData )
+
+ self:SmokeGreen()
+end
+
+--- @param Wrapper.Unit#UNIT self
+function Tank2:OnEventDead( EventData )
+
+ self:SmokeBlue()
+end
+
+function Tank2:OnEventCrash(EventData)
+
+end
+
+
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-001 - API Demo 1/EVT-001 - API Demo 1.miz b/Moose Test Missions/EVT - Event Handling/EVT-001 - API Demo 1/EVT-001 - API Demo 1.miz
new file mode 100644
index 000000000..5fada8827
Binary files /dev/null and b/Moose Test Missions/EVT - Event Handling/EVT-001 - API Demo 1/EVT-001 - API Demo 1.miz differ
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-100 - OnEventShot Example/EVT-100 - OnEventShot Example.lua b/Moose Test Missions/EVT - Event Handling/EVT-100 - OnEventShot Example/EVT-100 - OnEventShot Example.lua
new file mode 100644
index 000000000..92b008506
--- /dev/null
+++ b/Moose Test Missions/EVT - Event Handling/EVT-100 - OnEventShot Example/EVT-100 - OnEventShot Example.lua
@@ -0,0 +1,25 @@
+---
+-- Name: EVT-100 - OnEventShot Example
+-- Author: FlightControl
+-- Date Created: 7 February 2017
+--
+-- # Situation:
+--
+-- A plane is flying in the air and shoots an missile to a ground target.
+--
+-- # Test cases:
+--
+-- 1. Observe the plane shooting the missile.
+-- 2. Observe when the plane shoots the missile, a dcs.log entry is written in the logging.
+-- 3. Check the contents of the fields of the S_EVENT_SHOT entry.
+
+local Plane = UNIT:FindByName( "Plane" )
+
+Plane:HandleEvent( EVENTS.Shot )
+
+function Plane:OnEventShot( EventData )
+
+ Plane:MessageToAll( "I just fired a missile!", 15, "Alert!" )
+end
+
+
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-100 - OnEventShot Example/EVT-100 - OnEventShot Example.miz b/Moose Test Missions/EVT - Event Handling/EVT-100 - OnEventShot Example/EVT-100 - OnEventShot Example.miz
new file mode 100644
index 000000000..0bcaa430e
Binary files /dev/null and b/Moose Test Missions/EVT - Event Handling/EVT-100 - OnEventShot Example/EVT-100 - OnEventShot Example.miz differ
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-101 - OnEventHit Example/EVT-101 - OnEventHit Example.lua b/Moose Test Missions/EVT - Event Handling/EVT-101 - OnEventHit Example/EVT-101 - OnEventHit Example.lua
new file mode 100644
index 000000000..26c89daf5
--- /dev/null
+++ b/Moose Test Missions/EVT - Event Handling/EVT-101 - OnEventHit Example/EVT-101 - OnEventHit Example.lua
@@ -0,0 +1,32 @@
+---
+-- Name: EVT-101 - OnEventHit Example
+-- Author: FlightControl
+-- Date Created: 7 February 2017
+--
+-- # Situation:
+--
+-- A plane is flying in the air and shoots an missile to a ground target.
+--
+-- # Test cases:
+--
+-- 1. Observe the plane shooting the missile.
+-- 2. Observe when the missile hits the target, a dcs.log entry is written in the logging.
+-- 3. Check the contents of the fields of the S_EVENT_HIT entry.
+
+local Plane = UNIT:FindByName( "Plane" )
+
+local Tank = UNIT:FindByName( "Tank" )
+
+Plane:HandleEvent( EVENTS.Hit )
+Tank:HandleEvent( EVENTS.Hit )
+
+function Plane:OnEventHit( EventData )
+
+ Plane:MessageToAll( "I just got hit!", 15, "Alert!" )
+end
+
+function Tank:OnEventHit( EventData )
+ Tank:MessageToAll( "I just got hit!", 15, "Alert!" )
+end
+
+
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-101 - OnEventHit Example/EVT-101 - OnEventHit Example.miz b/Moose Test Missions/EVT - Event Handling/EVT-101 - OnEventHit Example/EVT-101 - OnEventHit Example.miz
new file mode 100644
index 000000000..e31ecdbfb
Binary files /dev/null and b/Moose Test Missions/EVT - Event Handling/EVT-101 - OnEventHit Example/EVT-101 - OnEventHit Example.miz differ
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-102 - OnEventTakeoff Example/EVT-102 - OnEventTakeoff Example.lua b/Moose Test Missions/EVT - Event Handling/EVT-102 - OnEventTakeoff Example/EVT-102 - OnEventTakeoff Example.lua
new file mode 100644
index 000000000..4b36e09ec
--- /dev/null
+++ b/Moose Test Missions/EVT - Event Handling/EVT-102 - OnEventTakeoff Example/EVT-102 - OnEventTakeoff Example.lua
@@ -0,0 +1,33 @@
+---
+-- Name: EVT-102 - OnEventTakeoff Example
+-- Author: FlightControl
+-- Date Created: 7 February 2017
+--
+-- # Situation:
+--
+-- A human plane and an AI plane are taking off from an airfield.
+--
+-- # Test cases:
+--
+-- 1. Take-Off the planes from the runway.
+-- 2. When the planes take-off, observe the message being sent.
+-- 3. Check the contents of the fields of the S_EVENT_TAKEOFF entry in the dcs.log file.
+
+local PlaneAI = UNIT:FindByName( "PlaneAI" )
+
+local PlaneHuman = UNIT:FindByName( "PlaneHuman" )
+
+PlaneAI:HandleEvent( EVENTS.Takeoff )
+PlaneHuman:HandleEvent( EVENTS.Takeoff )
+
+function PlaneAI:OnEventTakeoff( EventData )
+
+ PlaneHuman:MessageToAll( "AI Taking Off", 15, "Alert!" )
+end
+
+function PlaneHuman:OnEventTakeoff( EventData )
+
+ PlaneHuman:MessageToAll( "Player " .. PlaneHuman:GetPlayerName() .. " is Taking Off", 15, "Alert!" )
+end
+
+
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-102 - OnEventTakeoff Example/EVT-102 - OnEventTakeoff Example.miz b/Moose Test Missions/EVT - Event Handling/EVT-102 - OnEventTakeoff Example/EVT-102 - OnEventTakeoff Example.miz
new file mode 100644
index 000000000..89f5b1673
Binary files /dev/null and b/Moose Test Missions/EVT - Event Handling/EVT-102 - OnEventTakeoff Example/EVT-102 - OnEventTakeoff Example.miz differ
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-103 - OnEventLand Example/EVT-103 - OnEventLand Example.lua b/Moose Test Missions/EVT - Event Handling/EVT-103 - OnEventLand Example/EVT-103 - OnEventLand Example.lua
new file mode 100644
index 000000000..a3d5007a4
--- /dev/null
+++ b/Moose Test Missions/EVT - Event Handling/EVT-103 - OnEventLand Example/EVT-103 - OnEventLand Example.lua
@@ -0,0 +1,38 @@
+---
+-- Name: EVT-103 - OnEventLand Example
+-- Author: FlightControl
+-- Date Created: 7 February 2017
+--
+-- # Situation:
+--
+-- An AI plane is landing on an airfield.
+-- When the plane landed, a new plane is spawned.
+--
+-- # Test cases:
+--
+-- 1. Observe the plane landing.
+-- 2. When the AI plane lands, observe the new plane being spawned.
+-- 3. Check the contents of the fields of the S_EVENT_LAND entry in the dcs.log file.
+
+-- Create a variable PlaneAI that holds a reference to UNIT object (created by moose at the beginning of the mission) with the name "PlaneAI".
+local PlaneAI = UNIT:FindByName( "PlaneAI" )
+
+-- Create a SPAWN object to spawn a new plane once the hold one lands.
+local SpawnPlane = SPAWN:New( "SpawnPlaneAI" )
+
+-- Declare a new variable that will hold the new spawned SpawnPlaneAI
+local NewPlane
+
+
+-- Subscribe to the event Land. The Land event occurs when a plane lands at an airfield.
+PlaneAI:HandleEvent( EVENTS.Land )
+
+-- Because the PlaneAI object is subscribed to the Land event, the following method will be automatically
+-- called when the land event is happening FOR THE PlaneAI UNIT only!
+function PlaneAI:OnEventLand( EventData )
+
+ -- Okay, the PlaneAI has landed, now spawn the new plane ( a predator )
+ NewPlane = SpawnPlane:Spawn()
+end
+
+
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-103 - OnEventLand Example/EVT-103 - OnEventLand Example.miz b/Moose Test Missions/EVT - Event Handling/EVT-103 - OnEventLand Example/EVT-103 - OnEventLand Example.miz
new file mode 100644
index 000000000..0e0e8de81
Binary files /dev/null and b/Moose Test Missions/EVT - Event Handling/EVT-103 - OnEventLand Example/EVT-103 - OnEventLand Example.miz differ
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-104 - OnEventCrash Example/EVT-104 - OnEventCrash Example.lua b/Moose Test Missions/EVT - Event Handling/EVT-104 - OnEventCrash Example/EVT-104 - OnEventCrash Example.lua
new file mode 100644
index 000000000..bef1cb322
--- /dev/null
+++ b/Moose Test Missions/EVT - Event Handling/EVT-104 - OnEventCrash Example/EVT-104 - OnEventCrash Example.lua
@@ -0,0 +1,35 @@
+---
+-- Name: EVT-104 - OnEventCrash Example
+-- Author: FlightControl
+-- Date Created: 7 February 2017
+--
+-- # Situation:
+--
+-- A human plane is fyling in the air. Crash it into the ground.
+-- Once you are crashed into the ground, at the place where you crashed, a smoke should start burning ...
+--
+-- # Test cases:
+--
+-- 1. Fly the plane into the ground.
+-- 2. When your plane crashes, observe a smoke starting to burn right were you crashed.
+-- 3. Check the contents of the fields of the S_EVENT_CRASH entry in the dcs.log file.
+
+-- Create a variable PlaneHuman that holds a reference to UNIT object (created by moose at the beginning of the mission) with the name "PlaneHuman".
+local PlaneHuman = UNIT:FindByName( "PlaneHuman" )
+
+-- Subscribe to the event Crash. The Crash event occurs when a plane crashes into the ground (or into something else).
+PlaneHuman:HandleEvent( EVENTS.Crash )
+
+-- Because the PlaneHuman object is subscribed to the Crash event, the following method will be automatically
+-- called when the Crash event is happening FOR THE PlaneHuman UNIT only!
+
+--- @param self
+-- @param Core.Event#EVENTDATA EventData
+function PlaneHuman:OnEventCrash( EventData )
+
+ -- Okay, the PlaneHuman has crashed, now smoke at the x, z position.
+ self:E( "Smoking at the position" )
+ EventData.IniUnit:SmokeOrange()
+end
+
+
diff --git a/Moose Test Missions/EVT - Event Handling/EVT-104 - OnEventCrash Example/EVT-104 - OnEventCrash Example.miz b/Moose Test Missions/EVT - Event Handling/EVT-104 - OnEventCrash Example/EVT-104 - OnEventCrash Example.miz
new file mode 100644
index 000000000..d9bd0b7ac
Binary files /dev/null and b/Moose Test Missions/EVT - Event Handling/EVT-104 - OnEventCrash Example/EVT-104 - OnEventCrash Example.miz differ
diff --git a/Moose Test Missions/FSM - Finite State Machine/FSM-100 - Transition Explanation/FSM-100 - Transition Explanation.miz b/Moose Test Missions/FSM - Finite State Machine/FSM-100 - Transition Explanation/FSM-100 - Transition Explanation.miz
index a5e5ff1aa..1a61d2cf2 100644
Binary files a/Moose Test Missions/FSM - Finite State Machine/FSM-100 - Transition Explanation/FSM-100 - Transition Explanation.miz and b/Moose Test Missions/FSM - Finite State Machine/FSM-100 - Transition Explanation/FSM-100 - Transition Explanation.miz differ
diff --git a/Moose Test Missions/GRP - Group Commands/GRP-200 - Follow Group/GRP-200 - Follow Group.miz b/Moose Test Missions/GRP - Group Commands/GRP-200 - Follow Group/GRP-200 - Follow Group.miz
index 014ce79c4..cbee90e8a 100644
Binary files a/Moose Test Missions/GRP - Group Commands/GRP-200 - Follow Group/GRP-200 - Follow Group.miz and b/Moose Test Missions/GRP - Group Commands/GRP-200 - Follow Group/GRP-200 - Follow Group.miz differ
diff --git a/Moose Test Missions/GRP - Group Commands/GRP-300 - Switch WayPoints/GRP-300 - Switch WayPoints.miz b/Moose Test Missions/GRP - Group Commands/GRP-300 - Switch WayPoints/GRP-300 - Switch WayPoints.miz
index e8d7f7209..128598299 100644
Binary files a/Moose Test Missions/GRP - Group Commands/GRP-300 - Switch WayPoints/GRP-300 - Switch WayPoints.miz and b/Moose Test Missions/GRP - Group Commands/GRP-300 - Switch WayPoints/GRP-300 - Switch WayPoints.miz differ
diff --git a/Moose Test Missions/GRP - Group Commands/Moose_Test_WRAPPER.miz b/Moose Test Missions/GRP - Group Commands/Moose_Test_WRAPPER.miz
index 948a18e31..5721d8cfb 100644
Binary files a/Moose Test Missions/GRP - Group Commands/Moose_Test_WRAPPER.miz and b/Moose Test Missions/GRP - Group Commands/Moose_Test_WRAPPER.miz differ
diff --git a/Moose Test Missions/MEN - Menu Options/MEN-001 - Menu Client/MEN-001 - Menu Client.miz b/Moose Test Missions/MEN - Menu Options/MEN-001 - Menu Client/MEN-001 - Menu Client.miz
index 6c64db365..bcb843cfb 100644
Binary files a/Moose Test Missions/MEN - Menu Options/MEN-001 - Menu Client/MEN-001 - Menu Client.miz and b/Moose Test Missions/MEN - Menu Options/MEN-001 - Menu Client/MEN-001 - Menu Client.miz differ
diff --git a/Moose Test Missions/MEN - Menu Options/MEN-002 - Menu Coalition/MEN-002 - Menu Coalition.miz b/Moose Test Missions/MEN - Menu Options/MEN-002 - Menu Coalition/MEN-002 - Menu Coalition.miz
index 63d3e306c..4836a1edc 100644
Binary files a/Moose Test Missions/MEN - Menu Options/MEN-002 - Menu Coalition/MEN-002 - Menu Coalition.miz and b/Moose Test Missions/MEN - Menu Options/MEN-002 - Menu Coalition/MEN-002 - Menu Coalition.miz differ
diff --git a/Moose Test Missions/MEN - Menu Options/MEN-003 - Menu Group/MEN-003 - Menu Group.miz b/Moose Test Missions/MEN - Menu Options/MEN-003 - Menu Group/MEN-003 - Menu Group.miz
index 40723eeb2..798978c62 100644
Binary files a/Moose Test Missions/MEN - Menu Options/MEN-003 - Menu Group/MEN-003 - Menu Group.miz and b/Moose Test Missions/MEN - Menu Options/MEN-003 - Menu Group/MEN-003 - Menu Group.miz differ
diff --git a/Moose Test Missions/MIT - Missile Trainer/MIT-001 - Missile Trainer/MIT-001 - Missile Trainer.miz b/Moose Test Missions/MIT - Missile Trainer/MIT-001 - Missile Trainer/MIT-001 - Missile Trainer.miz
index 89e89d96b..8793ea1bb 100644
Binary files a/Moose Test Missions/MIT - Missile Trainer/MIT-001 - Missile Trainer/MIT-001 - Missile Trainer.miz and b/Moose Test Missions/MIT - Missile Trainer/MIT-001 - Missile Trainer/MIT-001 - Missile Trainer.miz differ
diff --git a/Moose Test Missions/MOOSE_Test_Template.miz b/Moose Test Missions/MOOSE_Test_Template.miz
index e272cfdad..5d7be787c 100644
Binary files a/Moose Test Missions/MOOSE_Test_Template.miz and b/Moose Test Missions/MOOSE_Test_Template.miz differ
diff --git a/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.miz b/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.miz
index 896613e0b..e91836eea 100644
Binary files a/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.miz and b/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.miz differ
diff --git a/Moose Test Missions/SCH - Scheduler/SCH-000 - Simple Scheduling/SCH-000 - Simple Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-000 - Simple Scheduling/SCH-000 - Simple Scheduling.miz
index 3efe78840..56f71fdb0 100644
Binary files a/Moose Test Missions/SCH - Scheduler/SCH-000 - Simple Scheduling/SCH-000 - Simple Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-000 - Simple Scheduling/SCH-000 - Simple Scheduling.miz differ
diff --git a/Moose Test Missions/SCH - Scheduler/SCH-001 - Simple Object Scheduling/SCH-001 - Simple Object Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-001 - Simple Object Scheduling/SCH-001 - Simple Object Scheduling.miz
index 85a492e5e..abbe628ff 100644
Binary files a/Moose Test Missions/SCH - Scheduler/SCH-001 - Simple Object Scheduling/SCH-001 - Simple Object Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-001 - Simple Object Scheduling/SCH-001 - Simple Object Scheduling.miz differ
diff --git a/Moose Test Missions/SCH - Scheduler/SCH-100 - Simple Repeat Scheduling/SCH-100 - Simple Repeat Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-100 - Simple Repeat Scheduling/SCH-100 - Simple Repeat Scheduling.miz
index 2358dafb5..43b678e8b 100644
Binary files a/Moose Test Missions/SCH - Scheduler/SCH-100 - Simple Repeat Scheduling/SCH-100 - Simple Repeat Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-100 - Simple Repeat Scheduling/SCH-100 - Simple Repeat Scheduling.miz differ
diff --git a/Moose Test Missions/SCH - Scheduler/SCH-110 - Object Repeat Scheduling/SCH-110 - Object Repeat Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-110 - Object Repeat Scheduling/SCH-110 - Object Repeat Scheduling.miz
index b24865b53..1170aa752 100644
Binary files a/Moose Test Missions/SCH - Scheduler/SCH-110 - Object Repeat Scheduling/SCH-110 - Object Repeat Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-110 - Object Repeat Scheduling/SCH-110 - Object Repeat Scheduling.miz differ
diff --git a/Moose Test Missions/SCH - Scheduler/SCH-200 - Simple Repeat Scheduling Stop and Start/SCH-200 - Simple Repeat Scheduling Stop and Start.miz b/Moose Test Missions/SCH - Scheduler/SCH-200 - Simple Repeat Scheduling Stop and Start/SCH-200 - Simple Repeat Scheduling Stop and Start.miz
index 7232e635e..b626e8e07 100644
Binary files a/Moose Test Missions/SCH - Scheduler/SCH-200 - Simple Repeat Scheduling Stop and Start/SCH-200 - Simple Repeat Scheduling Stop and Start.miz and b/Moose Test Missions/SCH - Scheduler/SCH-200 - Simple Repeat Scheduling Stop and Start/SCH-200 - Simple Repeat Scheduling Stop and Start.miz differ
diff --git a/Moose Test Missions/SCH - Scheduler/SCH-300 - GC Simple Object Scheduling/SCH-300 - GC Simple Object Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-300 - GC Simple Object Scheduling/SCH-300 - GC Simple Object Scheduling.miz
index 05a5d07d6..ee1e90978 100644
Binary files a/Moose Test Missions/SCH - Scheduler/SCH-300 - GC Simple Object Scheduling/SCH-300 - GC Simple Object Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-300 - GC Simple Object Scheduling/SCH-300 - GC Simple Object Scheduling.miz differ
diff --git a/Moose Test Missions/SCH - Scheduler/SCH-310 - GC Object Repeat Scheduling/SCH-310 - GC Object Repeat Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-310 - GC Object Repeat Scheduling/SCH-310 - GC Object Repeat Scheduling.miz
index 629391f82..d9e14ab63 100644
Binary files a/Moose Test Missions/SCH - Scheduler/SCH-310 - GC Object Repeat Scheduling/SCH-310 - GC Object Repeat Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-310 - GC Object Repeat Scheduling/SCH-310 - GC Object Repeat Scheduling.miz differ
diff --git a/Moose Test Missions/SET - Data Sets/SET-001 - Airbase Sets/SET-001 - Airbase Sets.miz b/Moose Test Missions/SET - Data Sets/SET-001 - Airbase Sets/SET-001 - Airbase Sets.miz
index 250448ff8..4be01e31f 100644
Binary files a/Moose Test Missions/SET - Data Sets/SET-001 - Airbase Sets/SET-001 - Airbase Sets.miz and b/Moose Test Missions/SET - Data Sets/SET-001 - Airbase Sets/SET-001 - Airbase Sets.miz differ
diff --git a/Moose Test Missions/SET - Data Sets/SET-101 - Group Sets/SET-101 - Group Sets.miz b/Moose Test Missions/SET - Data Sets/SET-101 - Group Sets/SET-101 - Group Sets.miz
index 6e2f66de4..ce532069d 100644
Binary files a/Moose Test Missions/SET - Data Sets/SET-101 - Group Sets/SET-101 - Group Sets.miz and b/Moose Test Missions/SET - Data Sets/SET-101 - Group Sets/SET-101 - Group Sets.miz differ
diff --git a/Moose Test Missions/SET - Data Sets/SET-201 - Client Sets/SET-201 - Client Sets.miz b/Moose Test Missions/SET - Data Sets/SET-201 - Client Sets/SET-201 - Client Sets.miz
index e62678b67..f5c22613a 100644
Binary files a/Moose Test Missions/SET - Data Sets/SET-201 - Client Sets/SET-201 - Client Sets.miz and b/Moose Test Missions/SET - Data Sets/SET-201 - Client Sets/SET-201 - Client Sets.miz differ
diff --git a/Moose Test Missions/SEV - SEAD Evasion/SEV-001 - SEAD Evasion/SEV-001 - SEAD Evasion.miz b/Moose Test Missions/SEV - SEAD Evasion/SEV-001 - SEAD Evasion/SEV-001 - SEAD Evasion.miz
index 7982420d4..077732a14 100644
Binary files a/Moose Test Missions/SEV - SEAD Evasion/SEV-001 - SEAD Evasion/SEV-001 - SEAD Evasion.miz and b/Moose Test Missions/SEV - SEAD Evasion/SEV-001 - SEAD Evasion/SEV-001 - SEAD Evasion.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz b/Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz
index 2dd55d76c..de1c7d7af 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz and b/Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz b/Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz
index 7ba6a0a43..47dbdc50a 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz and b/Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz b/Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz
index 363239a0b..ff26c613b 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz and b/Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz b/Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz
index c212e1e61..a00865974 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz and b/Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz b/Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz
index ed17829ed..208b8b62a 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz and b/Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz b/Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz
index 1fb3bc5d7..e71d14063 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz and b/Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz b/Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz
index 23ec1282f..1cf0e16dc 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz and b/Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.miz b/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.miz
index 9fee7d9a9..b2d298cc0 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.miz and b/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-018 - Ground Ops - Randomize Templates/SPA-018 - Ground Ops - Randomize Templates.lua b/Moose Test Missions/SPA - Spawning/SPA-018 - Ground Ops - Randomize Templates/SPA-018 - Ground Ops - Randomize Templates.lua
new file mode 100644
index 000000000..b5db1d32d
--- /dev/null
+++ b/Moose Test Missions/SPA - Spawning/SPA-018 - Ground Ops - Randomize Templates/SPA-018 - Ground Ops - Randomize Templates.lua
@@ -0,0 +1,27 @@
+-- Name: SPA-018 - Ground Ops - Randomize Templates
+-- Author: FlightControl
+-- Date Created: 10 January 2017
+--
+-- # Situation:
+--
+-- At Gudauta spawn multiple ground vehicles, in a scheduled fashion.
+--
+-- # Test cases:
+--
+-- 1. Observe that the ground vehicles are spawned with randomized templates.
+
+
+-- Tests Gudauta
+-- -------------
+-- Create a zone table of the 2 zones.
+ZoneTable = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ) }
+
+TemplateTable = { "A", "B", "C" }
+
+Spawn_Vehicle_1 = SPAWN:New( "Spawn Vehicle 1" )
+ :InitLimit( 10, 10 )
+ :InitRandomizeRoute( 1, 1, 200 )
+ :InitRandomizeTemplate( TemplateTable )
+ --:InitRandomizeZones( ZoneTable )
+ :SpawnScheduled( 5, .5 )
+
diff --git a/Moose Test Missions/SPA - Spawning/SPA-018 - Ground Ops - Randomize Templates/SPA-018 - Ground Ops - Randomize Templates.miz b/Moose Test Missions/SPA - Spawning/SPA-018 - Ground Ops - Randomize Templates/SPA-018 - Ground Ops - Randomize Templates.miz
new file mode 100644
index 000000000..6b64dbe0b
Binary files /dev/null and b/Moose Test Missions/SPA - Spawning/SPA-018 - Ground Ops - Randomize Templates/SPA-018 - Ground Ops - Randomize Templates.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz b/Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz
index dc945bbc9..98ded3f0c 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz and b/Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz b/Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz
index 7658bd657..cfeb56530 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz and b/Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.miz b/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.miz
index bd0b7ac7d..0d1b4a490 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.miz and b/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit.lua b/Moose Test Missions/SPA - Spawning/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit.lua
new file mode 100644
index 000000000..cfe69b7ba
--- /dev/null
+++ b/Moose Test Missions/SPA - Spawning/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit.lua
@@ -0,0 +1,47 @@
+---
+-- Name: SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit
+-- Author: FlightControl
+-- Date Created: 05 Feb 2017
+--
+-- # Situation:
+--
+-- Multiple airplanes will be spawned at a scheduled interval.
+-- There is a limit on how many airplanes can be alive at the same time.
+-- Upon landing, the airplanes will respawn at Kutaisi.
+--
+-- # Test cases:
+--
+-- 1. Observe the spawning of the airplanes
+-- 2. There should not be more airplanes alive than there are set by InitLimit.
+-- 3. Upon landing, the planes should respawn.
+-- 4. The KA-50 and the C-101EB should respawn itself directly when landed.
+-- 5. the MI-8MTV2 and the A-10C should respawn itself when the air unit has parked at the ramp.
+
+
+do
+
+ -- Declare SPAWN objects
+ local Spawn_KA_50 = SPAWN:New("KA-50"):InitLimit( 2, 10 )
+ local Spawn_MI_8MTV2 = SPAWN:New("MI-8MTV2"):InitLimit( 2, 10 )
+ local Spawn_C_101EB = SPAWN:New("C-101EB"):InitLimit( 2, 10 )
+ local Spawn_A_10C = SPAWN:New("A-10C"):InitLimit( 2, 10 )
+
+ -- Choose repeat functionality
+
+ -- Repeat on landing
+ Spawn_KA_50:InitRepeatOnLanding()
+ Spawn_C_101EB:InitRepeatOnLanding()
+
+ -- Repeat on enging shutdown (when landed on the airport)
+ Spawn_MI_8MTV2:InitRepeatOnEngineShutDown()
+ Spawn_A_10C:InitRepeatOnEngineShutDown()
+
+ -- Now SPAWN the GROUPs
+ Spawn_KA_50:SpawnScheduled(30,0)
+ Spawn_C_101EB:SpawnScheduled(30,0)
+ Spawn_MI_8MTV2:SpawnScheduled(30,0)
+ Spawn_A_10C:SpawnScheduled(30,0)
+
+ -- Now run the mission and observe the behaviour.
+
+end
diff --git a/Moose Test Missions/SPA - Spawning/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit.miz b/Moose Test Missions/SPA - Spawning/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit.miz
new file mode 100644
index 000000000..1e1cb5430
Binary files /dev/null and b/Moose Test Missions/SPA - Spawning/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-130 - Uncontrolled Spawning/SPA-130 - Uncontrolled Spawning.lua b/Moose Test Missions/SPA - Spawning/SPA-130 - Uncontrolled Spawning/SPA-130 - Uncontrolled Spawning.lua
new file mode 100644
index 000000000..49d3f0951
--- /dev/null
+++ b/Moose Test Missions/SPA - Spawning/SPA-130 - Uncontrolled Spawning/SPA-130 - Uncontrolled Spawning.lua
@@ -0,0 +1,47 @@
+---
+-- Name: SPA-130 - Uncontrolled Spawning
+-- Author: FlightControl
+-- Date Created: 04 Feb 2017
+--
+-- # Situation:
+--
+-- A plane will be spawned Uncontrolled and later one will be spawned Controlled.
+-- Only the Controlled plane will move, the other will remain idle at the parking spot.
+--
+-- # Test cases:
+--
+-- 1. Observe the spawning of the UnControlled Plane.
+-- 2. Observe the spawning of the Controlled Plane.
+
+
+-- Create the SPAWN object looking for the group (template) "Plane".
+local SpawnPlane = SPAWN:New( "Plane" )
+
+-- Set the spawn mode to UnControlled.
+SpawnPlane:InitUnControlled( true )
+
+-- Spawn the UnControlled Group
+local UnControlledPlane = SpawnPlane:Spawn()
+
+-- Set the spawn mode back to Controlled.
+SpawnPlane:InitUnControlled( false )
+
+local ControlledPlane = SpawnPlane:Spawn()
+
+-- Now, let's create a menu option at a player slot plane...
+-- We can only create the menu option if the player has joined the slot ...
+local PlayerPlane = CLIENT:FindByName( "PlayerPlane", "Select Menu item to activate UnControlled plane" )
+
+PlayerPlane:Alive(
+ function( Client, SpawnPlane )
+
+ --- @param Functional.Spawn#SPAWN SpawnPlane
+ local function ActivatePlane( SpawnPlane )
+ SpawnPlane:InitUnControlled( false )
+ SpawnPlane:ReSpawn( 1 )
+ end
+
+ local Menu = MENU_CLIENT_COMMAND:New( Client, "Select to activate UnControlled plane", nil, ActivatePlane, SpawnPlane )
+ end
+ , SpawnPlane
+)
\ No newline at end of file
diff --git a/Moose Test Missions/SPA - Spawning/SPA-130 - Uncontrolled Spawning/SPA-130 - Uncontrolled Spawning.miz b/Moose Test Missions/SPA - Spawning/SPA-130 - Uncontrolled Spawning/SPA-130 - Uncontrolled Spawning.miz
new file mode 100644
index 000000000..d2a17e9e1
Binary files /dev/null and b/Moose Test Missions/SPA - Spawning/SPA-130 - Uncontrolled Spawning/SPA-130 - Uncontrolled Spawning.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz b/Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz
index 644ca630a..38fd934c0 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz and b/Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz b/Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz
index 36e8416e6..14b0667dd 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz and b/Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz b/Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz
index 7cad1deb6..a4c409b8f 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz and b/Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz b/Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz
index e02c08e08..ad8637aa4 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz and b/Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz b/Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz
index 60bab00e5..72117b9d5 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz and b/Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz differ
diff --git a/Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz b/Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz
index 468ae9c66..51a9723e4 100644
Binary files a/Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz and b/Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz differ
diff --git a/Moose Test Missions/TAD - Task Dispatching/TAD-010 - Task Dispatching Demo/TAD-010 - Task Dispatching Demo.miz b/Moose Test Missions/TAD - Task Dispatching/TAD-010 - Task Dispatching Demo/TAD-010 - Task Dispatching Demo.miz
index 0d5f4a7cc..4877e06f6 100644
Binary files a/Moose Test Missions/TAD - Task Dispatching/TAD-010 - Task Dispatching Demo/TAD-010 - Task Dispatching Demo.miz and b/Moose Test Missions/TAD - Task Dispatching/TAD-010 - Task Dispatching Demo/TAD-010 - Task Dispatching Demo.miz differ
diff --git a/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.miz b/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.miz
index 8e56e629c..a5fd0c93e 100644
Binary files a/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.miz and b/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.miz differ
diff --git a/Moose Test Missions/TSK - Task Modelling/TSK-020 - Task Modelling - Pickup/TSK-020 - Task Modelling - Pickup.miz b/Moose Test Missions/TSK - Task Modelling/TSK-020 - Task Modelling - Pickup/TSK-020 - Task Modelling - Pickup.miz
index e7f90ff5b..ff3cbc1f0 100644
Binary files a/Moose Test Missions/TSK - Task Modelling/TSK-020 - Task Modelling - Pickup/TSK-020 - Task Modelling - Pickup.miz and b/Moose Test Missions/TSK - Task Modelling/TSK-020 - Task Modelling - Pickup/TSK-020 - Task Modelling - Pickup.miz differ
diff --git a/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz b/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz
index bc0246b3d..68418e802 100644
Binary files a/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz differ
diff --git a/Moose Test Missions/ZON - Zones/ZON-200 - Group Zone/ZON-200 - Group Zone.miz b/Moose Test Missions/ZON - Zones/ZON-200 - Group Zone/ZON-200 - Group Zone.miz
index 0af0a21e4..9da64fae9 100644
Binary files a/Moose Test Missions/ZON - Zones/ZON-200 - Group Zone/ZON-200 - Group Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-200 - Group Zone/ZON-200 - Group Zone.miz differ
diff --git a/Moose Test Missions/ZON - Zones/ZON-300 - Unit Zone/ZON-300 - Unit Zone.miz b/Moose Test Missions/ZON - Zones/ZON-300 - Unit Zone/ZON-300 - Unit Zone.miz
index 7b0cf0758..d6d7825e6 100644
Binary files a/Moose Test Missions/ZON - Zones/ZON-300 - Unit Zone/ZON-300 - Unit Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-300 - Unit Zone/ZON-300 - Unit Zone.miz differ
diff --git a/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.miz b/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.miz
index 28a664c8e..94f46f0c7 100644
Binary files a/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.miz differ
diff --git a/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.miz b/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.miz
index d79a2c175..391252595 100644
Binary files a/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.miz differ
diff --git a/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.miz b/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.miz
index a9a725b63..c2c1675b2 100644
Binary files a/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.miz and b/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.miz differ
diff --git a/docs/Documentation/AI_Balancer.html b/docs/Documentation/AI_Balancer.html
index 02a4952eb..7b1a36cfe 100644
--- a/docs/Documentation/AI_Balancer.html
+++ b/docs/Documentation/AI_Balancer.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -76,18 +77,17 @@ even when there are hardly any players in the mission.

-
-
+
-The AI.AIBalancer#AIBALANCER class monitors and manages as many replacement AI groups as there are
+
The AIBalancer#AIBALANCER class monitors and manages as many replacement AI groups as there are
CLIENTS in a SET_CLIENT collection, which are not occupied by human players.
In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.
-The parent class Core.Fsm#FSM_SET manages the functionality to control the Finite State Machine (FSM).
+
The parent class Fsm#FSM_SET manages the functionality to control the Finite State Machine (FSM).
The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods.
An explanation about state and event transition methods can be found in the FSM module documentation.
@@ -136,8 +136,8 @@ However, there are 2 additional options that you can use to customize the destro
When a human player joins a slot, you can configure to let the AI return to:
Note that when AI returns to an airbase, the AIBALANCER will trigger the Return event and the AI will return,
@@ -240,13 +240,13 @@ otherwise the AIBALANCER will trigger a Destroy event, and
| AI_BALANCER:ReturnToHomeAirbase(ReturnTresholdRange) |
- Returns the AI to the home Wrapper.Airbase#AIRBASE.
+Returns the AI to the home Airbase#AIRBASE.
|
| AI_BALANCER:ReturnToNearestAirbases(ReturnTresholdRange, ReturnAirbaseSet) |
- Returns the AI to the nearest friendly Wrapper.Airbase#AIRBASE.
+Returns the AI to the nearest friendly Airbase#AIRBASE.
|
@@ -495,14 +495,14 @@ The default Spawn object to spawn new AI Groups when needed.
-Returns the AI to the home Wrapper.Airbase#AIRBASE.
+Returns the AI to the home Airbase#AIRBASE.
Parameter
@@ -517,20 +517,20 @@ If there is an enemy Wrapper.Client#CLIE
-Returns the AI to the nearest friendly Wrapper.Airbase#AIRBASE.
+Returns the AI to the nearest friendly Airbase#AIRBASE.
Parameters
diff --git a/docs/Documentation/AI_Cap.html b/docs/Documentation/AI_Cap.html
index c71293951..ec34c1a56 100644
--- a/docs/Documentation/AI_Cap.html
+++ b/docs/Documentation/AI_Cap.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -74,10 +75,9 @@

-
-
+
The #AICAPZONE class implements the core functions to patrol a Zone by an AI Controllable or Group
and automatically engage any airborne enemies that are within a certain range or within a certain zone.
@@ -151,7 +151,7 @@ When the fuel treshold has been reached, the airplane will fly towards the neare
that will define when the AI will engage with the detected airborne enemy targets.
The range can be beyond or smaller than the range of the Patrol Zone.
The range is applied at the position of the AI.
-Use the method AI.AICAP#AICAP_ZONE.SetEngageRange() to define that range.
+Use the method AICAP#AICAP_ZONE.SetEngageRange() to define that range.
1.4) Set the Zone of Engagement
@@ -159,7 +159,7 @@ Use the method AI.AIC
An optional Zone can be set,
that will define when the AI will engage with the detected airborne enemy targets.
-Use the method AI.AICap#AICAP_ZONE.SetEngageZone() to define that Zone.
+Use the method AICap#AICAP_ZONE.SetEngageZone() to define that Zone.
@@ -281,7 +281,7 @@ Use the method AI.AICa
- | AI_CAP_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed) |
+ AI_CAP_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType) |
Creates a new AICAPZONE object
|
@@ -640,7 +640,7 @@ Use the method AI.AICa
-AI_CAP_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed)
+AI_CAP_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType)
@@ -678,6 +678,12 @@ The minimum speed of the Controllable in km/h.
Dcs.DCSTypes#Speed PatrolMaxSpeed :
The maximum speed of the Controllable in km/h.
+
+
+
+Dcs.DCSTypes#AltitudeType PatrolAltType :
+The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
+
Return value
diff --git a/docs/Documentation/AI_Cas.html b/docs/Documentation/AI_Cas.html
index 5089134a9..a18c40a16 100644
--- a/docs/Documentation/AI_Cas.html
+++ b/docs/Documentation/AI_Cas.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -70,16 +71,16 @@
Module AI_Cas
-
Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- Provide Close Air Support to friendly ground troops.
+
Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air --
+Provide Close Air Support to friendly ground troops.

-
-
+
-
#AICASZONE derives from the AI.AIPatrol#AIPATROL_ZONE, inheriting its methods and behaviour.
+
#AICASZONE derives from the AIPatrol#AIPATROL_ZONE, inheriting its methods and behaviour.
@@ -261,6 +262,36 @@ It can be notified to go RTB through the RTB event.
AI_CAS_ZONE:Engage() |
Synchronous Event Trigger for Event Engage.
+ |
+
+
+ | AI_CAS_ZONE.EngageAltitude |
+
+
+ |
+
+
+ | AI_CAS_ZONE.EngageAttackQty |
+
+
+ |
+
+
+ | AI_CAS_ZONE.EngageDirection |
+
+
+ |
+
+
+ | AI_CAS_ZONE.EngageSpeed |
+
+
+ |
+
+
+ | AI_CAS_ZONE.EngageWeaponExpend |
+
+
|
@@ -276,7 +307,7 @@ It can be notified to go RTB through the RTB event.
- | AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone) |
+ AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType, EngageZone) |
Creates a new AICASZONE object
|
@@ -300,7 +331,7 @@ It can be notified to go RTB through the RTB event.
- | AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To) |
+ AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection) |
OnAfter Transition Handler for Event Engage.
|
@@ -330,7 +361,7 @@ It can be notified to go RTB through the RTB event.
- | AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To) |
+ AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection) |
OnBefore Transition Handler for Event Engage.
|
@@ -414,7 +445,7 @@ It can be notified to go RTB through the RTB event.
- | AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To) |
+ AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection) |
|
@@ -423,6 +454,12 @@ It can be notified to go RTB through the RTB event.
AI_CAS_ZONE:onafterStart(Controllable, From, Event, To) |
onafter State Transition for Event Start.
+ |
+
+
+ | AI_CAS_ZONE:onafterTarget(Controllable, From, Event, To) |
+
+
|
@@ -568,6 +605,74 @@ It can be notified to go RTB through the RTB event.
Synchronous Event Trigger for Event Engage.
+
+
+
+-
+
+
+AI_CAS_ZONE.EngageAltitude
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+AI_CAS_ZONE.EngageAttackQty
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+AI_CAS_ZONE.EngageDirection
+
+
+-
+
+
+
+
+
+
+-
+
+
+AI_CAS_ZONE.EngageSpeed
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+AI_CAS_ZONE.EngageWeaponExpend
+
+
+-
+
+
+
@@ -601,7 +706,7 @@ It can be notified to go RTB through the RTB event.
-
-AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone)
+AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType, EngageZone)
-
@@ -642,6 +747,12 @@ The maximum speed of the Controllable in km/h.
-
+
Dcs.DCSTypes#AltitudeType PatrolAltType :
+The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
+
+
+ -
+
Core.Zone#ZONE EngageZone :
@@ -777,7 +888,7 @@ The To State string.
-
-AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To)
+AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)
-
@@ -809,6 +920,36 @@ The Event string.
#string To :
The To State string.
+
+ -
+
+
#number EngageSpeed :
+(optional) The speed the Group will hold when engaging to the target zone.
+
+
+ -
+
+
Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend :
+(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+
+
+ -
+
+
Dcs.DCSTypes#Distance EngageAltitude :
+(optional) Desired altitude to perform the unit engagement.
+
+
+ -
+
+
#number EngageAttackQty :
+(optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+
+
+ -
+
+
Dcs.DCSTypes#Azimuth EngageDirection :
+(optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
+
@@ -992,7 +1133,7 @@ Return false to cancel Transition.
-
-AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To)
+AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)
-
@@ -1025,12 +1166,37 @@ The Event string.
The To State string.
-
-
Return value
+ -
-
#boolean:
-Return false to cancel Transition.
+#number EngageSpeed :
+(optional) The speed the Group will hold when engaging to the target zone.
+
+ -
+
+
Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend :
+(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+
+
+ -
+
+
Dcs.DCSTypes#Distance EngageAltitude :
+(optional) Desired altitude to perform the unit engagement.
+
+
+ -
+
+
#number EngageAttackQty :
+(optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+
+
+ -
+
+
Dcs.DCSTypes#Azimuth EngageDirection :
+(optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
+
+
+
@@ -1427,13 +1593,83 @@ The To State string.
-
-AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To)
+AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)
-
+
Parameters
+
+ -
+
+
Wrapper.Controllable#CONTROLLABLE Controllable :
+The Controllable Object managed by the FSM.
+
+
+ -
+
+
#string From :
+The From State string.
+
+
+ -
+
+
#string Event :
+The Event string.
+
+
+ -
+
+
#string To :
+The To State string.
+
+
+ -
+
+
#number EngageSpeed :
+(optional) The speed the Group will hold when engaging to the target zone.
+
+
+ -
+
+
Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend :
+(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
+
+
+ -
+
+
Dcs.DCSTypes#Distance EngageAltitude :
+(optional) Desired altitude to perform the unit engagement.
+
+
+ -
+
+
#number EngageAttackQty :
+(optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
+
+
+ -
+
+
Dcs.DCSTypes#Azimuth EngageDirection :
+(optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
+
+
+
+
+
+
+-
+
+
+AI_CAS_ZONE:onafterStart(Controllable, From, Event, To)
+
+
+-
+
+
onafter State Transition for Event Start.
+
Parameters
-
@@ -1466,13 +1702,13 @@ The To State string.
-
-
-AI_CAS_ZONE:onafterStart(Controllable, From, Event, To)
+
+AI_CAS_ZONE:onafterTarget(Controllable, From, Event, To)
-
-
onafter State Transition for Event Start.
+
Parameters
diff --git a/docs/Documentation/AI_Patrol.html b/docs/Documentation/AI_Patrol.html
index 36cd59344..cfd08e72f 100644
--- a/docs/Documentation/AI_Patrol.html
+++ b/docs/Documentation/AI_Patrol.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -70,14 +71,14 @@
Module AI_Patrol
-
Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- Air Patrolling or Staging.
+
Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air --
+Air Patrolling or Staging.

-
-
+
The #AIPATROLZONE class implements the core functions to patrol a Zone by an AI Controllable or Group.
@@ -264,6 +265,12 @@ Use the method
AIPATROLZONE.M
AI_PATROL_ZONE.ClassName |
+ |
+
+
+ | AI_PATROL_ZONE:ClearDetectedUnits() |
+
+ Clears the list of Unit#UNITs that were detected by the AI.
|
@@ -317,7 +324,7 @@ Use the method AIPATROLZONE.M
| AI_PATROL_ZONE:GetDetectedUnits() |
- Gets a list of Wrapper.Unit#UNITs that were detected by the AI.
+Gets a list of Unit#UNITs that were detected by the AI.
|
@@ -333,7 +340,7 @@ Use the method AIPATROLZONE.M
- | AI_PATROL_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed) |
+ AI_PATROL_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType) |
Creates a new AIPATROLZONE object
|
@@ -450,6 +457,12 @@ Use the method AIPATROLZONE.M
AI_PATROL_ZONE:OnPilotDead(EventData) |
+ |
+
+
+ | AI_PATROL_ZONE.PatrolAltType |
+
+
|
@@ -744,6 +757,19 @@ Use the method AIPATROLZONE.M
+
+
+
+-
+
+
+AI_PATROL_ZONE:ClearDetectedUnits()
+
+
+-
+
+
Clears the list of Unit#UNITs that were detected by the AI.
+
@@ -868,7 +894,7 @@ Use the method AIPATROLZONE.M
-
-
Gets a list of Wrapper.Unit#UNITs that were detected by the AI.
+Gets a list of Unit#UNITs that were detected by the AI.
No filtering is applied, so, ANY detected UNIT can be in this list.
@@ -877,7 +903,7 @@ It is up to the mission designer to use the Unit class a
Return value
#table:
-The list of Wrapper.Unit#UNITs
+The list of Unit#UNITs
@@ -957,7 +983,7 @@ self
-AI_PATROL_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed)
+AI_PATROL_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType)
@@ -995,6 +1021,12 @@ The minimum speed of the Controllable in km/h.
Dcs.DCSTypes#Speed PatrolMaxSpeed :
The maximum speed of the Controllable in km/h.
+
+
+
+Dcs.DCSTypes#AltitudeType PatrolAltType :
+The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
+
Return value
@@ -1751,6 +1783,22 @@ Return false to cancel Transition.
+
+
+
+-
+
+
+AI_PATROL_ZONE.PatrolAltType
+
+
+-
+
+
+
+
+
defafult PatrolAltType to "RADIO" if not specified
+
diff --git a/docs/Documentation/Account.html b/docs/Documentation/Account.html
index 51eb80f32..5b145b1df 100644
--- a/docs/Documentation/Account.html
+++ b/docs/Documentation/Account.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -76,7 +77,7 @@
-
+
ACT_ACCOUNT state machine:
diff --git a/docs/Documentation/Airbase.html b/docs/Documentation/Airbase.html
index edb97e0d9..65dbb7cab 100644
--- a/docs/Documentation/Airbase.html
+++ b/docs/Documentation/Airbase.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -76,7 +77,7 @@
-
+
The AIRBASE class is a wrapper class to handle the DCS Airbase objects:
@@ -108,7 +109,7 @@ If the DCS Airbase object does not exist or is nil, the AIRBASE methods will ret
1.2) DCS AIRBASE APIs
The DCS Airbase APIs are used extensively within MOOSE. The AIRBASE class has for each DCS Airbase API a corresponding method.
To be able to distinguish easily in your code the difference between a AIRBASE API call and a DCS Airbase API call,
-the first letter of the method is also capitalized. So, by example, the DCS Airbase method Dcs.DCSWrapper.Airbase#Airbase.getName()
+the first letter of the method is also capitalized. So, by example, the DCS Airbase method DCSWrapper.Airbase#Airbase.getName()
is implemented in the AIRBASE class as AIRBASE.GetName().
More functions will be added
diff --git a/docs/Documentation/AirbasePolice.html b/docs/Documentation/AirbasePolice.html
index 6e70005b2..7abdaf4aa 100644
--- a/docs/Documentation/AirbasePolice.html
+++ b/docs/Documentation/AirbasePolice.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -76,8 +77,8 @@
-
-The Functional.AirbasePolice#AIRBASEPOLICE_BASE class provides the main methods to monitor CLIENT behaviour at airbases.
+
+The AirbasePolice#AIRBASEPOLICE_BASE class provides the main methods to monitor CLIENT behaviour at airbases.
CLIENTS should not be allowed to:
@@ -87,7 +88,7 @@ CLIENTS should not be allowed to:
- Obey ground control orders.
-
+
All the airbases on the caucasus map can be monitored using this class.
If you want to monitor specific airbases, you need to use the AIRBASEPOLICE_BASE.Monitor() method, which takes a table or airbase names.
The following names can be given:
@@ -113,7 +114,7 @@ The following names can be given:
* TbilisiLochini
* Vaziani
-
+
All the airbases on the NEVADA map can be monitored using this class.
If you want to monitor specific airbases, you need to use the AIRBASEPOLICE_BASE.Monitor() method, which takes a table or airbase names.
The following names can be given:
diff --git a/docs/Documentation/Assign.html b/docs/Documentation/Assign.html
index 5c9b66176..93bdb60ae 100644
--- a/docs/Documentation/Assign.html
+++ b/docs/Documentation/Assign.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -76,7 +77,7 @@
-
+
ACT_ASSIGN state machine:
diff --git a/docs/Documentation/Base.html b/docs/Documentation/Base.html
index 9d7ccc16f..39c311970 100644
--- a/docs/Documentation/Base.html
+++ b/docs/Documentation/Base.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -88,7 +89,7 @@
1.1) BASE constructor
-Any class derived from BASE, must use the Core.Base#BASE.New method how this is done.
+Any class derived from BASE, must use the Base#BASE.New method how this is done.
1.2) BASE Trace functionality
@@ -138,59 +139,54 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l
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:
+and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently.
+
+1.3.1 Subscribe / Unsubscribe to DCS Events
+
+At first, the mission designer will need to Subscribe to a specific DCS event for the class.
+So, when the DCS event occurs, the class will be notified of that event.
+There are two functions which you use to subscribe to or unsubscribe from an event.
-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.
+1.3.2 Event Handling of DCS Events
-Find below an example of the prototype how to write an event handling function:
+Once the class is subscribed to the event, an Event Handling method on the object or class needs to be written that will be called
+when the DCS event occurs. The Event Handling method receives an Event#EVENTDATA structure, which contains a lot of information
+about the event that occurred.
-
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
- )
+Find below an example of the prototype how to write an event handling function for two units:
+
+ local Tank1 = UNIT:FindByName( "Tank A" )
+ local Tank2 = UNIT:FindByName( "Tank B" )
+
+ -- Here we subscribe to the Dead events. So, if one of these tanks dies, the Tank1 or Tank2 objects will be notified.
+ Tank1:HandleEvent( EVENTS.Dead )
+ Tank2:HandleEvent( EVENTS.Dead )
+
+ --- This function is an Event Handling function that will be called when Tank1 is Dead.
+ -- @param Wrapper.Unit#UNIT self
+ -- @param Core.Event#EVENTDATA EventData
+ function Tank1:OnEventDead( EventData )
+
+ self:SmokeGreen()
+ end
+
+ --- This function is an Event Handling function that will be called when Tank2 is Dead.
+ -- @param Wrapper.Unit#UNIT self
+ -- @param Core.Event#EVENTDATA EventData
+ function Tank2:OnEventDead( EventData )
+
+ self:SmokeBlue()
+ 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.
-
+
+See the Event module for more information about event handling.
1.4) Class identification methods
@@ -275,12 +271,6 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
- | BASE:AddEvent(Event, EventFunction) |
-
- Set a new listener for the class.
- |
-
-
| BASE.ClassID |
The ID number of the class.
@@ -314,12 +304,6 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
| BASE:CreateEventCrash(EventTime, Initiator) |
Creation of a Crash Event.
- |
-
-
- | BASE:DisableEvents() |
-
- Disable the event listeners for the class.
|
@@ -329,153 +313,9 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
- | BASE:EnableEvents() |
-
- Enable the event listeners for the class.
- |
-
-
- | BASE:Event() |
+ BASE:EventDispatcher() |
Returns the event dispatcher
- |
-
-
- | BASE:EventOnBaseCaptured(EventFunction) |
-
- Subscribe to a SEVENTBASE_CAPTURED event.
- |
-
-
- | BASE:EventOnBirth(EventFunction) |
-
- Subscribe to a S_EVENT_BIRTH event.
- |
-
-
- | BASE:EventOnCrash(EventFunction) |
-
- Subscribe to a S_EVENT_CRASH event.
- |
-
-
- | BASE:EventOnDead(EventFunction) |
-
- Subscribe to a S_EVENT_DEAD event.
- |
-
-
- | BASE:EventOnEjection(EventFunction) |
-
- Subscribe to a S_EVENT_EJECTION event.
- |
-
-
- | BASE:EventOnEngineShutdown(EventFunction) |
-
- Subscribe to a SEVENTENGINE_SHUTDOWN event.
- |
-
-
- | BASE:EventOnEngineStartup(EventFunction) |
-
- Subscribe to a SEVENTENGINE_STARTUP event.
- |
-
-
- | BASE:EventOnHit(EventFunction) |
-
- Subscribe to a S_EVENT_HIT event.
- |
-
-
- | BASE:EventOnHumanFailure(EventFunction) |
-
- Subscribe to a SEVENTHUMAN_FAILURE event.
- |
-
-
- | BASE:EventOnLand(EventFunction) |
-
- Subscribe to a S_EVENT_LAND event.
- |
-
-
- | BASE:EventOnMissionStart(EventFunction) |
-
- Subscribe to a SEVENTMISSION_START event.
- |
-
-
- | BASE:EventOnPilotDead(EventFunction) |
-
- Subscribe to a SEVENTPILOT_DEAD event.
- |
-
-
- | BASE:EventOnPlayerComment(EventFunction) |
-
- Subscribe to a SEVENTPLAYER_COMMENT event.
- |
-
-
- | BASE:EventOnPlayerEnterUnit(EventFunction) |
-
- Subscribe to a SEVENTPLAYER_ENTER_UNIT event.
- |
-
-
- | BASE:EventOnPlayerLeaveUnit(EventFunction) |
-
- Subscribe to a SEVENTPLAYER_LEAVE_UNIT event.
- |
-
-
- | BASE:EventOnPlayerMissionEnd(EventFunction) |
-
- Subscribe to a SEVENTMISSION_END event.
- |
-
-
- | BASE:EventOnRefueling(EventFunction) |
-
- Subscribe to a S_EVENT_REFUELING event.
- |
-
-
- | BASE:EventOnRefuelingStop(EventFunction) |
-
- Subscribe to a SEVENTREFUELING_STOP event.
- |
-
-
- | BASE:EventOnShootingEnd(EventFunction) |
-
- Subscribe to a SEVENTSHOOTING_END event.
- |
-
-
- | BASE:EventOnShootingStart(EventFunction) |
-
- Subscribe to a SEVENTSHOOTING_START event.
- |
-
-
- | BASE:EventOnShot(EventFunction) |
-
- Subscribe to a S_EVENT_SHOT event.
- |
-
-
- | BASE:EventOnTakeOff(EventFunction) |
-
- Subscribe to a S_EVENT_TAKEOFF event.
- |
-
-
- | BASE:EventOnTookControl(EventFunction) |
-
- Subscribe to a SEVENTTOOK_CONTROL event.
|
@@ -524,6 +364,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
| BASE:GetClassNameAndID() |
Get the ClassName + ClassID of the class instance.
+ |
+
+
+ | BASE:GetEventPriority() |
+
+ Get the Class Event processing Priority.
|
@@ -536,6 +382,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
| BASE:GetState(Object, Key, Value) |
Get a Value given a Key from the Object.
+ |
+
+
+ | BASE:HandleEvent(Event, EventFunction) |
+
+ Subscribe to a DCS Event.
|
@@ -554,6 +406,141 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
| BASE:New() |
+ |
+
+
+ | BASE:OnEvent(EventData) |
+
+ Occurs when an object is completely destroyed.
+ |
+
+
+ | BASE:OnEventBaseCaptured(EventData) |
+
+ Occurs when a ground unit captures either an airbase or a farp.
+ |
+
+
+ | BASE:OnEventBirth(EventData) |
+
+ Occurs when any object is spawned into the mission.
+ |
+
+
+ | BASE:OnEventCrash(EventData) |
+
+ Occurs when any aircraft crashes into the ground and is completely destroyed.
+ |
+
+
+ | BASE:OnEventEjection(EventData) |
+
+ Occurs when a pilot ejects from an aircraft
+initiator : The unit that has ejected
+ |
+
+
+ | BASE:OnEventEngineShutdown(EventData) |
+
+ Occurs when any aircraft shuts down its engines.
+ |
+
+
+ | BASE:OnEventEngineStartup(EventData) |
+
+ Occurs when any aircraft starts its engines.
+ |
+
+
+ | BASE:OnEventHit(EventData) |
+
+ Occurs whenever an object is hit by a weapon.
+ |
+
+
+ | BASE:OnEventHumanFailure(EventData) |
+
+ Occurs when any system fails on a human controlled aircraft.
+ |
+
+
+ | BASE:OnEventLand(EventData) |
+
+ Occurs when an aircraft lands at an airbase, farp or ship
+initiator : The unit that has landed
+place: Object that the unit landed on.
+ |
+
+
+ | BASE:OnEventMissionEnd(EventData) |
+
+ Occurs when a mission ends
+ |
+
+
+ | BASE:OnEventMissionStart(EventData) |
+
+ Occurs when a mission starts
+ |
+
+
+ | BASE:OnEventPilotDead(EventData) |
+
+ Occurs when the pilot of an aircraft is killed.
+ |
+
+
+ | BASE:OnEventPlayerEnterUnit(EventData) |
+
+ Occurs when any player assumes direct control of a unit.
+ |
+
+
+ | BASE:OnEventPlayerLeaveUnit(EventData) |
+
+ Occurs when any player relieves control of a unit to the AI.
+ |
+
+
+ | BASE:OnEventRefueling(EventData) |
+
+ Occurs when an aircraft connects with a tanker and begins taking on fuel.
+ |
+
+
+ | BASE:OnEventRefuelingStop(EventData) |
+
+ Occurs when an aircraft is finished taking fuel.
+ |
+
+
+ | BASE:OnEventShootingEnd(EventData) |
+
+ Occurs when any unit stops firing its weapon.
+ |
+
+
+ | BASE:OnEventShootingStart(EventData) |
+
+ Occurs when any unit begins firing a weapon that has a high rate of fire.
+ |
+
+
+ | BASE:OnEventShot(EventData) |
+
+ Occurs whenever any unit in a mission fires a weapon.
+ |
+
+
+ | BASE:OnEventTakeoff(EventData) |
+
+ Occurs when an aircraft takes off from an airbase, farp, or ship.
+ |
+
+
+ | BASE:SetEventPriority(EventPriority) |
+
+ Set the Class Event processing Priority.
|
@@ -616,6 +603,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
Set trace on or off
Note that when trace is off, no debug statement is performed, increasing performance!
When Moose is loaded statically, (as one file), tracing is switched off by default.
+
+
+
+ | BASE:UnHandleEvent(Event) |
+
+ UnSubscribe to a DCS event.
|
@@ -628,6 +621,12 @@ When Moose is loaded statically, (as one file), tracing is switched off by defau
| BASE:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam) |
Trace a function call.
+ |
+
+
+ | BASE._Private |
+
+
|
@@ -699,37 +698,6 @@ When Moose is loaded statically, (as one file), tracing is switched off by defau
-
-
-BASE:AddEvent(Event, EventFunction)
-
-
--
-
-
Set a new listener for the class.
-
- Parameters
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
BASE.ClassID
@@ -867,24 +835,6 @@ The initiating object of the event.
-
-
-BASE:DisableEvents()
-
-
--
-
-
Disable the event listeners for the class.
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
BASE:E(Arguments)
@@ -910,26 +860,8 @@ A #table or any field.
-
-
-BASE:EnableEvents()
-
-
--
-
-
Enable the event listeners for the class.
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:Event()
+
+BASE:EventDispatcher()
-
@@ -941,627 +873,6 @@ A #table or any field.
Core.Event#EVENT:
-
-
-
--
-
-
-BASE:EventOnBaseCaptured(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTBASE_CAPTURED event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnBirth(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_BIRTH event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnCrash(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_CRASH event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnDead(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_DEAD event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnEjection(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_EJECTION event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnEngineShutdown(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTENGINE_SHUTDOWN event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnEngineStartup(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTENGINE_STARTUP event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnHit(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_HIT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnHumanFailure(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTHUMAN_FAILURE event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnLand(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_LAND event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnMissionStart(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTMISSION_START event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnPilotDead(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTPILOT_DEAD event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-
--
-
-
Subscribe to a SEVENTPLAYER_COMMENT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnPlayerEnterUnit(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTPLAYER_ENTER_UNIT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnPlayerLeaveUnit(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTPLAYER_LEAVE_UNIT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnPlayerMissionEnd(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTMISSION_END event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnRefueling(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_REFUELING event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnRefuelingStop(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTREFUELING_STOP event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnShootingEnd(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTSHOOTING_END event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnShootingStart(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTSHOOTING_START event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnShot(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_SHOT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnTakeOff(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_TAKEOFF event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnTookControl(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTTOOK_CONTROL event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
@@ -1731,6 +1042,28 @@ The ClassName + ClassID of the class instance.
-
+
+BASE:GetEventPriority()
+
+
+-
+
+
Get the Class Event processing Priority.
+
+
+The Event processing Priority is a number from 1 to 10,
+reflecting the order of the classes subscribed to the Event to be processed.
+
+ Return value
+
+#number:
+The Event processing Priority.
+
+
+
+
+-
+
BASE:GetParent(Child)
@@ -1795,6 +1128,38 @@ The value to is stored in the Object.
The Value retrieved.
+
+
+
+-
+
+
+BASE:HandleEvent(Event, EventFunction)
+
+
+-
+
+
Subscribe to a DCS Event.
+
+ Parameters
+
+ Return value
+
+#BASE:
+
+
@@ -1867,6 +1232,564 @@ Child
-
+
+BASE:OnEvent(EventData)
+
+
+-
+
+
Occurs when an object is completely destroyed.
+
+
+initiator : The unit that is was destroyed.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventBaseCaptured(EventData)
+
+
+-
+
+
Occurs when a ground unit captures either an airbase or a farp.
+
+
+initiator : The unit that captured the base
+place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventBirth(EventData)
+
+
+-
+
+
Occurs when any object is spawned into the mission.
+
+
+initiator : The unit that was spawned
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventCrash(EventData)
+
+
+-
+
+
Occurs when any aircraft crashes into the ground and is completely destroyed.
+
+
+initiator : The unit that has crashed
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventEjection(EventData)
+
+
+-
+
+
Occurs when a pilot ejects from an aircraft
+initiator : The unit that has ejected
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventEngineShutdown(EventData)
+
+
+-
+
+
Occurs when any aircraft shuts down its engines.
+
+
+initiator : The unit that is stopping its engines.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventEngineStartup(EventData)
+
+
+-
+
+
Occurs when any aircraft starts its engines.
+
+
+initiator : The unit that is starting its engines.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventHit(EventData)
+
+
+-
+
+
Occurs whenever an object is hit by a weapon.
+
+
+initiator : The unit object the fired the weapon
+weapon: Weapon object that hit the target
+target: The Object that was hit.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventHumanFailure(EventData)
+
+
+-
+
+
Occurs when any system fails on a human controlled aircraft.
+
+
+initiator : The unit that had the failure
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventLand(EventData)
+
+
+-
+
+
Occurs when an aircraft lands at an airbase, farp or ship
+initiator : The unit that has landed
+place: Object that the unit landed on.
+
+
+Can be an Airbase Object, FARP, or Ships
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventMissionEnd(EventData)
+
+
+-
+
+
Occurs when a mission ends
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventMissionStart(EventData)
+
+
+-
+
+
Occurs when a mission starts
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventPilotDead(EventData)
+
+
+-
+
+
Occurs when the pilot of an aircraft is killed.
+
+
+Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane.
+initiator : The unit that the pilot has died in.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventPlayerEnterUnit(EventData)
+
+
+-
+
+
Occurs when any player assumes direct control of a unit.
+
+
+initiator : The unit that is being taken control of.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventPlayerLeaveUnit(EventData)
+
+
+-
+
+
Occurs when any player relieves control of a unit to the AI.
+
+
+initiator : The unit that the player left.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventRefueling(EventData)
+
+
+-
+
+
Occurs when an aircraft connects with a tanker and begins taking on fuel.
+
+
+initiator : The unit that is receiving fuel.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventRefuelingStop(EventData)
+
+
+-
+
+
Occurs when an aircraft is finished taking fuel.
+
+
+initiator : The unit that was receiving fuel.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventShootingEnd(EventData)
+
+
+-
+
+
Occurs when any unit stops firing its weapon.
+
+
+Event will always correspond with a shooting start event.
+initiator : The unit that was doing the shooing.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventShootingStart(EventData)
+
+
+-
+
+
Occurs when any unit begins firing a weapon that has a high rate of fire.
+
+
+Most common with aircraft cannons (GAU-8), autocannons, and machine guns.
+initiator : The unit that is doing the shooing.
+target: The unit that is being targeted.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventShot(EventData)
+
+
+-
+
+
Occurs whenever any unit in a mission fires a weapon.
+
+
+But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventTakeoff(EventData)
+
+
+-
+
+
Occurs when an aircraft takes off from an airbase, farp, or ship.
+
+
+initiator : The unit that tookoff
+place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:SetEventPriority(EventPriority)
+
+
+-
+
+
Set the Class Event processing Priority.
+
+
+The Event processing Priority is a number from 1 to 10,
+reflecting the order of the classes subscribed to the Event to be processed.
+
+ Parameter
+
+ Return value
+
+
+self
+
+
+
+
+-
+
BASE:SetState(Object, Key, Value)
@@ -2128,6 +2051,32 @@ BASE:TraceOnOff( true )
-- Switch the tracing Off
BASE:TraceOnOff( false )
+
+
+
+-
+
+
+BASE:UnHandleEvent(Event)
+
+
+-
+
+
UnSubscribe to a DCS event.
+
+ Parameter
+
+ Return value
+
+#BASE:
+
+
@@ -2176,6 +2125,20 @@ A #table or any field.
+
+
+
+-
+
+
+
+BASE._Private
+
+
+-
+
+
+
diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html
index 749df60ca..fb98d54a5 100644
--- a/docs/Documentation/Cargo.html
+++ b/docs/Documentation/Cargo.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -70,24 +71,32 @@
Module Cargo
-
Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground -- Management of logical cargo objects, that can be transported from and to transportation carriers.
+
Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground --
+Management of logical cargo objects, that can be transported from and to transportation carriers.
-
+

Cargo can be of various forms, always are composed out of ONE object ( one unit or one static or one slingload crate ):
- AICARGOUNIT, represented by a Unit in a Group: Cargo can be represented by a Unit in a Group. Destruction of the Unit will mean that the cargo is lost.
- CARGO_STATIC, represented by a Static: Cargo can be represented by a Static. Destruction of the Static will mean that the cargo is lost.
- AICARGOPACKAGE, contained in a Unit of a Group: Cargo can be contained within a Unit of a Group. The cargo can be delivered by the Unit. If the Unit is destroyed, the cargo will be destroyed also.
- AICARGOPACKAGE, Contained in a Static: Cargo can be contained within a Static. The cargo can be collected from the @Static. If the Static is destroyed, the cargo will be destroyed.
- CARGO_SLINGLOAD, represented by a Cargo that is transportable: Cargo can be represented by a Cargo object that is transportable. Destruction of the Cargo will mean that the cargo is lost.
- AICARGOGROUPED, represented by a Group of CARGO_UNITs.
+ - AICARGOUNIT, represented by a Unit in a Group: Cargo can be represented by a Unit in a Group.
-
+
+
Destruction of the Unit will mean that the cargo is lost.
+ * CARGO_STATIC, represented by a Static: Cargo can be represented by a Static. Destruction of the Static will mean that the cargo is lost.
+ * AICARGOPACKAGE, contained in a Unit of a Group: Cargo can be contained within a Unit of a Group. The cargo can be delivered by the Unit. If the Unit is destroyed, the cargo will be destroyed also.
+ * AICARGOPACKAGE, Contained in a Static: Cargo can be contained within a Static. The cargo can be collected from the @Static. If the Static is destroyed, the cargo will be destroyed.
+ * CARGO_SLINGLOAD, represented by a Cargo that is transportable: Cargo can be represented by a Cargo object that is transportable. Destruction of the Cargo will mean that the cargo is lost.
+
+
+ - AICARGOGROUPED, represented by a Group of CARGO_UNITs.
+
+
+
+
The #AI_CARGO class defines the core functions that defines a cargo object within MOOSE.
A cargo is a logical object defined that is available for transport, and has a life status within a simulation.
@@ -132,10 +141,12 @@ There are 2 moments when state transition methods will be called by the state ma
2) #AICARGOUNIT class
+
The AICARGOUNIT class defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.
Use the event functions as described above to Load, UnLoad, Board, UnBoard the AICARGOUNIT objects to and from carriers.
5) #AICARGOGROUPED class
+
The AICARGOGROUPED class defines a cargo that is represented by a group of UNIT objects within the simulator, and can be transported by a carrier.
Use the event functions as described above to Load, UnLoad, Board, UnBoard the AICARGOUNIT objects to and from carriers.
@@ -1263,7 +1274,7 @@ The cargo must be in the
Loaded state.
Core.Point#POINT_VEC2 ToPointVec2 :
-(optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
+(optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
@@ -1289,7 +1300,7 @@ The cargo must be in the
Loaded state.
Core.Point#POINT_VEC2 ToPointVec2 :
-(optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
+(optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
@@ -1399,7 +1410,7 @@ The amount of seconds to delay the action.
Core.Point#POINT_VEC2 ToPointVec2 :
-(optional) @{Core.Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
+(optional) @{Point#POINT_VEC2) to where the cargo should run after onboarding. If not provided, the cargo will run to 60 meters behind the Carrier location.
@@ -1431,7 +1442,7 @@ The amount of seconds to delay the action.
Core.Point#POINT_VEC2 ToPointVec2 :
-(optional) @{Core.Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
+(optional) @{Point#POINT_VEC2) to where the cargo will be placed after unloading. If not provided, the cargo will be placed 60 meters behind the Carrier location.
@@ -2413,7 +2424,6 @@ The UNIT carrying the package.
-
-
AI_CARGO_UNIT.CargoCarrier
diff --git a/docs/Documentation/CleanUp.html b/docs/Documentation/CleanUp.html
index 99477fdf2..41e24b2d7 100644
--- a/docs/Documentation/CleanUp.html
+++ b/docs/Documentation/CleanUp.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -119,7 +120,7 @@
| CLEANUP:_AddForCleanUp(CleanUpUnit, CleanUpUnitName) |
- Add the Dcs.DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.
+Add the DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.
|
@@ -143,7 +144,7 @@
| CLEANUP:_DestroyUnit(CleanUpUnit, CleanUpUnitName) |
- Destroys a Dcs.DCSWrapper.Unit#Unit from the simulator, but checks first if it is still existing!
+Destroys a DCSWrapper.Unit#Unit from the simulator, but checks first if it is still existing!
|
@@ -291,7 +292,7 @@
-
-
Add the Dcs.DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.
+Add the DCSWrapper.Unit#Unit to the CleanUpList for CleanUp.
Parameters
@@ -385,7 +386,7 @@ The groupname...
-
-
Destroys a Dcs.DCSWrapper.Unit#Unit from the simulator, but checks first if it is still existing!
+Destroys a DCSWrapper.Unit#Unit from the simulator, but checks first if it is still existing!
Parameters
diff --git a/docs/Documentation/Client.html b/docs/Documentation/Client.html
index 36cc65c9a..ebcef655e 100644
--- a/docs/Documentation/Client.html
+++ b/docs/Documentation/Client.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,10 +75,10 @@
-
+
Clients are those Units defined within the Mission Editor that have the skillset defined as Client or Player.
Note that clients are NOT the same as Units, they are NOT necessarily alive.
-The Wrapper.Client#CLIENT class is a wrapper class to handle the DCS Unit objects that have the skillset defined as Client or Player:
+The Client#CLIENT class is a wrapper class to handle the DCS Unit objects that have the skillset defined as Client or Player:
- Wraps the DCS Unit objects with skill level set to Player or Client.
@@ -129,7 +130,7 @@ If the DCS Unit object does not exist or is nil, the CLIENT methods will return
- | CLIENT:Alive(CallBack, CallBackFunction, ...) |
+ CLIENT:Alive(CallBackFunction, ...) |
Checks for a client alive event and calls a function on a continuous basis.
|
@@ -299,7 +300,7 @@ If the DCS Unit object does not exist or is nil, the CLIENT methods will return
| CLIENT:ShowCargo() |
- Shows the AI.AI_Cargo#CARGO contained within the CLIENT to the player as a message.
+Shows the AI_Cargo#CARGO contained within the CLIENT to the player as a message.
|
@@ -393,7 +394,7 @@ self
-
-CLIENT:Alive(CallBack, CallBackFunction, ...)
+CLIENT:Alive(CallBackFunction, ...)
-
@@ -404,13 +405,8 @@ self
-
-
#function CallBack :
-Function.
-
-
- -
-
-
CallBackFunction :
+#function CallBackFunction :
+Create a function that will be called when a player joins the slot.
-
@@ -859,7 +855,7 @@ is the category of the message (the title).
-
#number MessageInterval :
-is the interval in seconds between the display of the Core.Message#MESSAGE when the CLIENT is in the air.
+is the interval in seconds between the display of the Message#MESSAGE when the CLIENT is in the air.
-
@@ -969,10 +965,10 @@ self
-
-
Shows the AI.AI_Cargo#CARGO contained within the CLIENT to the player as a message.
+Shows the AI_Cargo#CARGO contained within the CLIENT to the player as a message.
-The AI.AI_Cargo#CARGO is shown using the Core.Message#MESSAGE distribution system.
+The AI_Cargo#CARGO is shown using the Message#MESSAGE distribution system.
diff --git a/docs/Documentation/CommandCenter.html b/docs/Documentation/CommandCenter.html
index a840108a0..23bc8a52b 100644
--- a/docs/Documentation/CommandCenter.html
+++ b/docs/Documentation/CommandCenter.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
diff --git a/docs/Documentation/Controllable.html b/docs/Documentation/Controllable.html
index f631f02e5..c9540f79e 100644
--- a/docs/Documentation/Controllable.html
+++ b/docs/Documentation/Controllable.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,8 +75,8 @@
-
-The Wrapper.Controllable#CONTROLLABLE class is a wrapper class to handle the DCS Controllable objects:
+
+The Controllable#CONTROLLABLE class is a wrapper class to handle the DCS Controllable objects:
- Support all DCS Controllable APIs.
@@ -93,7 +94,7 @@
1.2) CONTROLLABLE task methods
Several controllable task methods are available that help you to prepare tasks.
-These methods return a string consisting of the task description, which can then be given to either a Wrapper.Controllable#CONTROLLABLE.PushTask or Wrapper.Controllable#SetTask method to assign the task to the CONTROLLABLE.
+These methods return a string consisting of the task description, which can then be given to either a Controllable#CONTROLLABLE.PushTask or Controllable#SetTask method to assign the task to the CONTROLLABLE.
Tasks are specific for the category of the CONTROLLABLE, more specific, for AIR, GROUND or AIR and GROUND.
Each task description where applicable indicates for which controllable category the task is valid.
There are 2 main subdivisions of tasks: Assigned tasks and EnRoute tasks.
@@ -257,7 +258,7 @@ This is different from the EnRoute tasks, where the targets of the task need to
| CONTROLLABLE:CopyRoute(Begin, End, Randomize, Radius) |
- Return the route of a controllable by using the Core.Database#DATABASE class.
+Return the route of a controllable by using the Database#DATABASE class.
|
@@ -291,7 +292,7 @@ This is different from the EnRoute tasks, where the targets of the task need to
- | CONTROLLABLE:EnRouteTaskEngageUnit(AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack) |
+ CONTROLLABLE:EnRouteTaskEngageUnit(EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack) |
(AIR) Attack the Unit.
|
@@ -479,7 +480,7 @@ This is different from the EnRoute tasks, where the targets of the task need to
| CONTROLLABLE:RouteReturnToAirbase(ReturnAirbase, Speed) |
- (AIR) Return the Controllable to an Wrapper.Airbase#AIRBASE
+ (AIR) Return the Controllable to an Airbase#AIRBASE
A speed can be given in km/h.
|
@@ -606,7 +607,7 @@ A speed can be given in km/h.
| CONTROLLABLE:TaskLandAtZone(Zone, Duration, RandomPoint) |
- (AIR) Land the controllable at a @{Core.Zone#ZONE_RADIUS).
+(AIR) Land the controllable at a @{Zone#ZONE_RADIUS).
|
@@ -861,7 +862,7 @@ SCHEDULER:New( nil,
-
-
Return the route of a controllable by using the Core.Database#DATABASE class.
+Return the route of a controllable by using the Database#DATABASE class.
Parameters
@@ -1063,7 +1064,7 @@ The DCS task structure.
-
-CONTROLLABLE:EnRouteTaskEngageUnit(AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack)
+CONTROLLABLE:EnRouteTaskEngageUnit(EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack)
-
@@ -1074,20 +1075,20 @@ The DCS task structure.
-
-
Wrapper.Unit#UNIT AttackUnit :
+
Wrapper.Unit#UNIT EngageUnit :
The UNIT.
-
#number Priority :
-All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
+(optional) All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
-
-
#number WeaponType :
-(optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
+#boolean GroupAttack :
+(optional) If true, all units in the group will attack the Unit when found.
-
@@ -1110,8 +1111,14 @@ All en-route tasks have the priority parameter. This is a number (less value - h
-
-
#boolean AttackQtyLimit :
-(optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackControllable" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
+Dcs.DCSTypes#Distance Altitude :
+(optional) Desired altitude to perform the unit engagement.
+
+
+ -
+
+
#boolean Visible :
+(optional) Unit must be visible.
-
@@ -1827,7 +1834,7 @@ self
-
-
(AIR) Return the Controllable to an Wrapper.Airbase#AIRBASE
+
(AIR) Return the Controllable to an Airbase#AIRBASE
A speed can be given in km/h.
@@ -1838,7 +1845,7 @@ A speed can be given in km/h.
-
Wrapper.Airbase#AIRBASE ReturnAirbase :
-The Wrapper.Airbase#AIRBASE to return to.
+The Airbase#AIRBASE to return to.
-
@@ -2225,7 +2232,7 @@ The DCS task structure.
-
Dcs.DCSTasking.Task#TaskArray DCSTasks :
-Array of Dcs.DCSTasking.Task#Task
+Array of DCSTasking.Task#Task
@@ -2708,7 +2715,7 @@ self
-
-
(AIR) Land the controllable at a @{Core.Zone#ZONE_RADIUS).
+(AIR) Land the controllable at a @{Zone#ZONE_RADIUS).
Parameters
@@ -3133,7 +3140,7 @@ The waypoint function to be called when the controllable moves over the waypoint
Retrieve the controllable mission and allow to place function hooks within the mission waypoint plan.
- Use the method Wrapper.Controllable#CONTROLLABLE to define the hook functions for specific waypoints.
+
Use the method Controllable#CONTROLLABLE to define the hook functions for specific waypoints.
Use the method @{Controllable@CONTROLLABLE:WayPointExecute) to start the execution of the new mission plan.
Note that when WayPointInitialize is called, the Mission of the controllable is RESTARTED!
diff --git a/docs/Documentation/Database.html b/docs/Documentation/Database.html
index cd538dd3f..82e423ee5 100644
--- a/docs/Documentation/Database.html
+++ b/docs/Documentation/Database.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -76,7 +77,7 @@
-
+
Mission designers can use the DATABASE class to refer to:
diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html
index 792e9f0ca..f53ea7c43 100644
--- a/docs/Documentation/Detection.html
+++ b/docs/Documentation/Detection.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -75,12 +76,12 @@
-
- The Functional.Detection#DETECTION_BASE class defines the core functions to administer detected objects.
- The Functional.Detection#DETECTION_BASE class will detect objects within the battle zone for a list of Groups detecting targets following (a) detection method(s).
+
+ The Detection#DETECTION_BASE class defines the core functions to administer detected objects.
+ The Detection#DETECTION_BASE class will detect objects within the battle zone for a list of Groups detecting targets following (a) detection method(s).
1.1) DETECTION_BASE constructor
- Construct a new DETECTION_BASE instance using the Functional.Detection#DETECTION_BASE.New() method.
+ Construct a new DETECTION_BASE instance using the Detection#DETECTION_BASE.New() method.
1.2) DETECTION_BASE initialization
By default, detection will return detected objects with all the detection sensors available.
@@ -91,42 +92,42 @@
Use the following functions to report the objects it detected using the methods Visual, Optical, Radar, IRST, RWR, DLINK:
1.3) Obtain objects detected by DETECTION_BASE
- DETECTION_BASE builds Sets of objects detected. These Core.Set#SET_BASEs can be retrieved using the method Functional.Detection#DETECTION_BASE.GetDetectedSets().
- The method will return a list (table) of Core.Set#SET_BASE objects.
+ DETECTION_BASE builds Sets of objects detected. These Set#SET_BASEs can be retrieved using the method Detection#DETECTION_BASE.GetDetectedSets().
+ The method will return a list (table) of Set#SET_BASE objects.
-
- The Functional.Detection#DETECTION_AREAS class will detect units within the battle zone for a list of Groups detecting targets following (a) detection method(s),
- and will build a list (table) of Core.Set#SET_UNITs containing the Wrapper.Unit#UNITs detected.
+
+ The Detection#DETECTION_AREAS class will detect units within the battle zone for a list of Groups detecting targets following (a) detection method(s),
+ and will build a list (table) of Set#SET_UNITs containing the Unit#UNITs detected.
The class is group the detected units within zones given a DetectedZoneRange parameter.
A set with multiple detected zones will be created as there are groups of units detected.
2.1) Retrieve the Detected Unit sets and Detected Zones
- The DetectedUnitSets methods are implemented in Functional.Detection#DECTECTION_BASE and the DetectedZones methods is implemented in Functional.Detection#DETECTION_AREAS.
+ The DetectedUnitSets methods are implemented in Detection#DECTECTION_BASE and the DetectedZones methods is implemented in Detection#DETECTION_AREAS.
- Retrieve the DetectedUnitSets with the method Functional.Detection#DETECTION_BASE.GetDetectedSets(). A table will be return of Core.Set#SET_UNITs.
- To understand the amount of sets created, use the method Functional.Detection#DETECTION_BASE.GetDetectedSetCount().
- If you want to obtain a specific set from the DetectedSets, use the method Functional.Detection#DETECTION_BASE.GetDetectedSet() with a given index.
+ Retrieve the DetectedUnitSets with the method Detection#DETECTION_BASE.GetDetectedSets(). A table will be return of Set#SET_UNITs.
+ To understand the amount of sets created, use the method Detection#DETECTION_BASE.GetDetectedSetCount().
+ If you want to obtain a specific set from the DetectedSets, use the method Detection#DETECTION_BASE.GetDetectedSet() with a given index.
- Retrieve the formed Zones as a result of the grouping the detected units within the DetectionZoneRange, use the method Functional.Detection#DETECTION_BASE.GetDetectionZones().
- To understand the amount of zones created, use the method Functional.Detection#DETECTION_BASE.GetDetectionZoneCount().
- If you want to obtain a specific zone from the DetectedZones, use the method Functional.Detection#DETECTION_BASE.GetDetectionZone() with a given index.
+ Retrieve the formed Zones as a result of the grouping the detected units within the DetectionZoneRange, use the method Detection#DETECTION_BASE.GetDetectionZones().
+ To understand the amount of zones created, use the method Detection#DETECTION_BASE.GetDetectionZoneCount().
+ If you want to obtain a specific zone from the DetectedZones, use the method Detection#DETECTION_BASE.GetDetectionZone() with a given index.
1.4) Flare or Smoke detected units
- Use the methods Functional.Detection#DETECTION_AREAS.FlareDetectedUnits() or Functional.Detection#DETECTION_AREAS.SmokeDetectedUnits() to flare or smoke the detected units when a new detection has taken place.
+ Use the methods Detection#DETECTION_AREAS.FlareDetectedUnits() or Detection#DETECTION_AREAS.SmokeDetectedUnits() to flare or smoke the detected units when a new detection has taken place.
1.5) Flare or Smoke detected zones
- Use the methods Functional.Detection#DETECTION_AREAS.FlareDetectedZones() or Functional.Detection#DETECTION_AREAS.SmokeDetectedZones() to flare or smoke the detected zones when a new detection has taken place.
+ Use the methods Detection#DETECTION_AREAS.FlareDetectedZones() or Detection#DETECTION_AREAS.SmokeDetectedZones() to flare or smoke the detected zones when a new detection has taken place.
@@ -247,13 +248,13 @@
| DETECTION_AREAS:GetDetectedSet(Index) |
- Get the Core.Set#SET_UNIT of a detecttion area using a given numeric index.
+Get the Set#SET_UNIT of a detecttion area using a given numeric index.
|
| DETECTION_AREAS:GetDetectedZone(Index) |
- Get the Core.Zone#ZONE_UNIT of a detection area using a given numeric index.
+Get the Zone#ZONE_UNIT of a detection area using a given numeric index.
|
@@ -489,7 +490,7 @@
| DETECTION_BASE:GetDetectedSets() |
- Get the detected Core.Set#SET_BASEs.
+Get the detected Set#SET_BASEs.
|
@@ -585,7 +586,7 @@
| DETECTION_BASE:_DetectionScheduler(SchedulerName) |
- Form Sets of detected Wrapper.Unit#UNITs in an array of Core.Set#SET_BASEs.
+Form Sets of detected Unit#UNITs in an array of Set#SET_BASEs.
|
@@ -987,7 +988,7 @@ DetectedAreas
-Get the Core.Set#SET_UNIT of a detecttion area using a given numeric index.
+Get the Set#SET_UNIT of a detecttion area using a given numeric index.
Parameter
+
+ | EVENTS |
+
+
|
@@ -378,7 +535,13 @@
| EVENT:RemoveAll(EventObject) |
- Clears all event subscriptions for a Core.Base#BASE derived object.
+Clears all event subscriptions for a Base#BASE derived object.
+ |
+
+
+ | EVENT:RemoveForUnit(EventClass, EventID, UnitName) |
+
+ Removes an Events entry for a Unit
|
@@ -423,6 +586,12 @@
| EVENTDATA.IniDCSUnitName |
+ |
+
+
+ | EVENTDATA.IniGroup |
+
+
|
@@ -513,6 +682,148 @@
| EVENTDATA.weapon |
+ |
+
+
+
+
+
@@ -530,6 +841,20 @@
+
+
+
+-
+
+ #EVENTS
+
+EVENTS
+
+
+-
+
+
+
@@ -1978,7 +2303,7 @@ The self instance of the class for which the event is.
-Clears all event subscriptions for a Core.Base#BASE derived object.
+Clears all event subscriptions for a Base#BASE derived object.
Parameter
+
+
+-
+
+
+
+EVENTDATA.IniGroup
+
+
+-
+
+
+
@@ -2286,6 +2662,337 @@ The self instance of the class for which the event is.
+
+
+
+
+
+The different types of events supported by MOOSE.
+
+
+Use this structure to subscribe to events using the Base#BASE.HandleEvent() method.
+
+ Field(s)
+
+-
+
+
+
+EVENTS.BaseCaptured
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.Birth
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.Crash
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.Dead
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.Ejection
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.EngineShutdown
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.EngineStartup
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.Hit
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.HumanFailure
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.Land
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.MissionEnd
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.MissionStart
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.PilotDead
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.PlayerEnterUnit
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.PlayerLeaveUnit
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.Refueling
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.RefuelingStop
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.ShootingEnd
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.ShootingStart
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.Shot
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.Takeoff
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+EVENTS.TookControl
+
+
+-
+
+
+
diff --git a/docs/Documentation/Fsm.html b/docs/Documentation/Fsm.html
index e509e364b..3ef15c2df 100644
--- a/docs/Documentation/Fsm.html
+++ b/docs/Documentation/Fsm.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -77,6 +78,8 @@

+
+
A FSM can only be in one of a finite number of states.
The machine is in only one state at a time; the state it is in at any given time is called the current state.
It can change from one state to another when initiated by an internal or external triggering event, which is called a transition.
@@ -124,7 +127,7 @@ Additionally, I've added extendability and created an API that allows seamless F
-
+

@@ -568,6 +571,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
FSM._EndStates |
+ |
+
+
+ | FSM._EventSchedules |
+
+
|
@@ -601,7 +610,7 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
- | FSM:_call_handler(handler, params) |
+ FSM:_call_handler(handler, params, EventName) |
|
@@ -725,7 +734,7 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
- | FSM_CONTROLLABLE:_call_handler(handler, params) |
+ FSM_CONTROLLABLE:_call_handler(handler, params, EventName) |
|
@@ -853,7 +862,7 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
- | FSM_SET:_call_handler(handler, params) |
+ FSM_SET:_call_handler(handler, params, EventName) |
|
@@ -881,7 +890,7 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
- | FSM_TASK:_call_handler(handler, params) |
+ FSM_TASK:_call_handler(handler, params, EventName) |
|
@@ -1449,6 +1458,20 @@ A string defining the start state.
+
+
+
+-
+
+
+
+FSM._EventSchedules
+
+
+-
+
+
+
@@ -1482,7 +1505,7 @@ A string defining the start state.
-
- #string
+
FSM._StartState
@@ -1537,7 +1560,7 @@ A string defining the start state.
-
-FSM:_call_handler(handler, params)
+FSM:_call_handler(handler, params, EventName)
-
@@ -1555,6 +1578,11 @@ A string defining the start state.
params :
+
+ -
+
+
EventName :
+
@@ -1776,6 +1804,7 @@ A string defining the start state.
-
+
FSM.current
@@ -1963,7 +1992,7 @@ Finite State Machine Table
-
-FSM_CONTROLLABLE:_call_handler(handler, params)
+FSM_CONTROLLABLE:_call_handler(handler, params, EventName)
-
@@ -1981,6 +2010,11 @@ Finite State Machine Table
params :
+
+ -
+
+
EventName :
+
@@ -2432,7 +2466,7 @@ FSMSet (optional) The Set object that the FSM_SET governs.
-
-FSM_SET:_call_handler(handler, params)
+FSM_SET:_call_handler(handler, params, EventName)
-
@@ -2450,6 +2484,11 @@ FSMSet (optional) The Set object that the FSM_SET governs.
params :
+
+ -
+
+
EventName :
+
@@ -2528,7 +2567,7 @@ FSMSet (optional) The Set object that the FSM_SET governs.
-
-FSM_TASK:_call_handler(handler, params)
+FSM_TASK:_call_handler(handler, params, EventName)
-
@@ -2546,6 +2585,11 @@ FSMSet (optional) The Set object that the FSM_SET governs.
params :
+
+ -
+
+
EventName :
+
diff --git a/docs/Documentation/Group.html b/docs/Documentation/Group.html
index 9feadfaf4..519182d0f 100644
--- a/docs/Documentation/Group.html
+++ b/docs/Documentation/Group.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -74,8 +75,8 @@
-
-The Wrapper.Group#GROUP class is a wrapper class to handle the DCS Group objects:
+
+The Group#GROUP class is a wrapper class to handle the DCS Group objects:
- Support all DCS Group APIs.
@@ -113,7 +114,7 @@ If the DCS Group object does not exist or is nil, the GROUP methods will return
Group templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a group and assign it to another:
1.3) GROUP Command methods
@@ -135,7 +136,7 @@ Use the following Zone validation methods on the group:
- GROUP.IsNotInZone: Returns true if none of the group units of the group are within a Zone.
-The zone can be of any Zone class derived from Core.Zone#ZONE_BASE. So, these methods are polymorphic to the zones tested on.
+The zone can be of any Zone class derived from Zone#ZONE_BASE. So, these methods are polymorphic to the zones tested on.
1.6) GROUP AI methods
@@ -221,7 +222,7 @@ Use the following Zone validation methods on the group:
| GROUP:CopyRoute(Begin, End, Randomize, Radius) |
- Return the route of a group by using the Core.Database#DATABASE class.
+Return the route of a group by using the Database#DATABASE class.
|
@@ -319,7 +320,7 @@ Use the following Zone validation methods on the group:
| GROUP:GetPositionVec3() |
- Returns the Dcs.DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+Returns the DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
|
@@ -584,7 +585,7 @@ All units on the ground result.
-Return the route of a group by using the Core.Database#DATABASE class.
+Return the route of a group by using the Database#DATABASE class.
Parameters
@@ -947,7 +948,7 @@ Minimum height found.
-
-
Returns the Dcs.DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+Returns the DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
Return values
@@ -1250,7 +1251,7 @@ The zone to test.
Return value
#boolean:
-Returns true if the Group is completely within the Core.Zone#ZONE_BASE
+Returns true if the Group is completely within the Zone#ZONE_BASE
@@ -1313,7 +1314,7 @@ The zone to test.
Return value
#boolean:
-Returns true if the Group is completely within the Core.Zone#ZONE_BASE
+Returns true if the Group is completely within the Zone#ZONE_BASE
@@ -1340,7 +1341,7 @@ The zone to test.
Return value
#boolean:
-Returns true if the Group is completely within the Core.Zone#ZONE_BASE
+Returns true if the Group is completely within the Zone#ZONE_BASE
@@ -1422,7 +1423,7 @@ self
Respawn the GROUP using a (tweaked) template of the Group.
-The template must be retrieved with the Wrapper.Group#GROUP.GetTemplate() function.
+
The template must be retrieved with the Group#GROUP.GetTemplate() function.
The template contains all the definitions as declared within the mission file.
To understand templates, do the following:
diff --git a/docs/Documentation/Identifiable.html b/docs/Documentation/Identifiable.html
index 4f55a41e4..d40418a42 100644
--- a/docs/Documentation/Identifiable.html
+++ b/docs/Documentation/Identifiable.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -74,7 +75,7 @@
-
+
The #IDENTIFIABLE class is a wrapper class to handle the DCS Identifiable objects:
diff --git a/docs/Documentation/MOVEMENT.html b/docs/Documentation/MOVEMENT.html
index f450af146..8d474972f 100644
--- a/docs/Documentation/MOVEMENT.html
+++ b/docs/Documentation/MOVEMENT.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
diff --git a/docs/Documentation/Menu.html b/docs/Documentation/Menu.html
index 623dc657c..07adea583 100644
--- a/docs/Documentation/Menu.html
+++ b/docs/Documentation/Menu.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,8 +75,6 @@
- There is a small note... When you see a class like MENUCOMMANDCOALITION with COMMAND in italic, it acutally represents it like this: MENU_COMMAND_COALITION.
-
DCS Menus can be managed using the MENU classes.
@@ -90,19 +89,19 @@ On top, MOOSE implements variable parameter passing for command
To manage main menus, the classes begin with MENU_:
To manage command menus, which are menus that allow the player to issue functions, the classes begin with MENUCOMMAND:
@@ -114,10 +113,10 @@ On top, MOOSE implements variable parameter passing for command
These are simply abstract base classes defining a couple of fields that are used by the
derived MENU_ classes to manage menus.
-
+
The #MENU_BASE class defines the main MENU class where other MENU classes are derived from.
-
+
The #MENUCOMMANDBASE class defines the main MENU class where other MENU COMMAND_ classes are derived from, in order to set commands.
@@ -127,13 +126,13 @@ derived MENU_ classes to manage menus.
2) MENU MISSION classes
The underlying classes manage the menus for a complete mission file.
-
-The Core.Menu#MENU_MISSION class manages the main menus for a complete mission.
+
+The Menu#MENU_MISSION class manages the main menus for a complete mission.
You can add menus with the MENU_MISSION.New method, which constructs a MENU_MISSION object and returns you the object reference.
Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENU_MISSION.Remove.
-
-The Core.Menu#MENUMISSIONCOMMAND class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
+
+The Menu#MENUMISSIONCOMMAND class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
You can add menus with the MENUMISSIONCOMMAND.New method, which constructs a MENUMISSIONCOMMAND object and returns you the object reference.
Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUMISSIONCOMMAND.Remove.
@@ -142,13 +141,13 @@ Using this object reference, you can then remove ALL the menus and submenus unde
3) MENU COALITION classes
The underlying classes manage the menus for whole coalitions.
-
-The Core.Menu#MENU_COALITION class manages the main menus for coalitions.
+
+The Menu#MENU_COALITION class manages the main menus for coalitions.
You can add menus with the MENU_COALITION.New method, which constructs a MENU_COALITION object and returns you the object reference.
Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENU_COALITION.Remove.
-
-The Core.Menu#MENUCOALITIONCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+
+The Menu#MENUCOALITIONCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution.
You can add menus with the MENUCOALITIONCOMMAND.New method, which constructs a MENUCOALITIONCOMMAND object and returns you the object reference.
Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUCOALITIONCOMMAND.Remove.
@@ -157,13 +156,13 @@ Using this object reference, you can then remove ALL the menus and submenus unde
4) MENU GROUP classes
The underlying classes manage the menus for groups. Note that groups can be inactive, alive or can be destroyed.
-
-The Core.Menu#MENU_GROUP class manages the main menus for coalitions.
+
+The Menu#MENU_GROUP class manages the main menus for coalitions.
You can add menus with the MENU_GROUP.New method, which constructs a MENU_GROUP object and returns you the object reference.
Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENU_GROUP.Remove.
-
-The Core.Menu#MENUGROUPCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+
+The Menu#MENUGROUPCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution.
You can add menus with the MENUGROUPCOMMAND.New method, which constructs a MENUGROUPCOMMAND object and returns you the object reference.
Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUGROUPCOMMAND.Remove.
@@ -172,13 +171,13 @@ Using this object reference, you can then remove ALL the menus and submenus unde
5) MENU CLIENT classes
The underlying classes manage the menus for units with skill level client or player.
-
-The Core.Menu#MENU_CLIENT class manages the main menus for coalitions.
+
+The Menu#MENU_CLIENT class manages the main menus for coalitions.
You can add menus with the MENU_CLIENT.New method, which constructs a MENU_CLIENT object and returns you the object reference.
Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENU_CLIENT.Remove.
-
-The Core.Menu#MENUCLIENTCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution.
+
+The Menu#MENUCLIENTCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution.
You can add menus with the MENUCLIENTCOMMAND.New method, which constructs a MENUCLIENTCOMMAND object and returns you the object reference.
Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUCLIENTCOMMAND.Remove.
@@ -322,7 +321,7 @@ Using this object reference, you can then remove ALL the menus and submenus unde
- | MENU_CLIENT_COMMAND:New(Client, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument, MenuClient, ...) |
+ MENU_CLIENT_COMMAND:New(Client, MenuText, ParentMenu, CommandMenuFunction, ...) |
MENUCLIENTCOMMAND constructor.
|
@@ -1000,7 +999,7 @@ self
-MENU_CLIENT_COMMAND:New(Client, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument, MenuClient, ...)
+MENU_CLIENT_COMMAND:New(Client, MenuText, ParentMenu, CommandMenuFunction, ...)
@@ -1038,17 +1037,6 @@ A function that is called when the menu key is pressed.
- CommandMenuArgument :
-An argument for the function.
-
-
-
-
- MenuClient :
-
-
-
-
... :
diff --git a/docs/Documentation/Message.html b/docs/Documentation/Message.html
index b09d9bdb1..87363f12e 100644
--- a/docs/Documentation/Message.html
+++ b/docs/Documentation/Message.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -74,22 +75,22 @@
-
+
Message System to display Messages to Clients, Coalitions or All.
Messages are shown on the display panel for an amount of seconds, and will then disappear.
Messages can contain a category which is indicating the category of the message.
1.1) MESSAGE construction methods
-Messages are created with Core.Message#MESSAGE.New. Note that when the MESSAGE object is created, no message is sent yet.
+
Messages are created with Message#MESSAGE.New. Note that when the MESSAGE object is created, no message is sent yet.
To send messages, you need to use the To functions.
1.2) Send messages with MESSAGE To methods
Messages are sent to:
diff --git a/docs/Documentation/MissileTrainer.html b/docs/Documentation/MissileTrainer.html
index a07498c67..3a8e89a6a 100644
--- a/docs/Documentation/MissileTrainer.html
+++ b/docs/Documentation/MissileTrainer.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -76,7 +77,7 @@
-
+
The #MISSILETRAINER class uses the DCS world messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft,
the class will destroy the missile within a certain range, to avoid damage to your aircraft.
It suports the following functionality:
diff --git a/docs/Documentation/Mission.html b/docs/Documentation/Mission.html
index 286b2922e..ca0aeff1c 100644
--- a/docs/Documentation/Mission.html
+++ b/docs/Documentation/Mission.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -256,7 +257,7 @@ A CLIENT needs to be registered within the MISSION:JoinUnit(PlayerUnit)
+ MISSION:JoinUnit(PlayerUnit, PlayerGroup) |
Add a Unit to join the Mission.
|
@@ -1294,7 +1295,7 @@ env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" )
-MISSION:JoinUnit(PlayerUnit)
+MISSION:JoinUnit(PlayerUnit, PlayerGroup)
@@ -1306,13 +1307,19 @@ env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" )
If the Unit was not part of a Task in the Mission, false is returned.
If the Unit is part of a Task in the Mission, true is returned.
- Parameter
+ Parameters
Return value
diff --git a/docs/Documentation/Object.html b/docs/Documentation/Object.html
index 6c48629c2..cabd59cca 100644
--- a/docs/Documentation/Object.html
+++ b/docs/Documentation/Object.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
@@ -74,8 +75,8 @@
-
-The Wrapper.Object#OBJECT class is a wrapper class to handle the DCS Object objects:
+
+The Object#OBJECT class is a wrapper class to handle the DCS Object objects:
- Support all DCS Object APIs.
@@ -87,14 +88,14 @@
The OBJECT class provides the following functions to construct a OBJECT instance:
1.2) OBJECT methods:
The following methods can be used to identify an Object object:
diff --git a/docs/Documentation/Point.html b/docs/Documentation/Point.html
index b3b817bad..3146ea03a 100644
--- a/docs/Documentation/Point.html
+++ b/docs/Documentation/Point.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,8 +75,8 @@
-
-The Core.Point#POINT_VEC3 class defines a 3D point in the simulator.
+
+The Point#POINT_VEC3 class defines a 3D point in the simulator.
Important Note: Most of the functions in this section were taken from MIST, and reworked to OO concepts.
In order to keep the credibility of the the author, I want to emphasize that the of the MIST framework was created by Grimes, who you can find on the Eagle Dynamics Forums.
@@ -84,20 +85,20 @@ In order to keep the credibility of the the author, I want to emphasize that the
A new POINT_VEC3 instance can be created with:
-
-The Core.Point#POINT_VEC2 class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
+
+The Point#POINT_VEC2 class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
2.1) POINT_VEC2 constructor
A new POINT_VEC2 instance can be created with:
@@ -165,7 +166,7 @@ In order to keep the credibility of the the author, I want to emphasize that the
| POINT_VEC2:DistanceFromVec2(Vec2Reference) |
- Calculate the distance from a reference Dcs.DCSTypes#Vec2.
+Calculate the distance from a reference DCSTypes#Vec2.
|
@@ -668,21 +669,21 @@ The distance from the reference #POINT_VEC2 in mete
-
-
Calculate the distance from a reference Dcs.DCSTypes#Vec2.
+Calculate the distance from a reference DCSTypes#Vec2.
Parameter
Return value
Dcs.DCSTypes#Distance:
-The distance from the reference Dcs.DCSTypes#Vec2 in meters.
+The distance from the reference DCSTypes#Vec2 in meters.
diff --git a/docs/Documentation/Positionable.html b/docs/Documentation/Positionable.html
index a438b42a0..d5a2d3300 100644
--- a/docs/Documentation/Positionable.html
+++ b/docs/Documentation/Positionable.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,8 +75,8 @@
-
-The Wrapper.Positionable#POSITIONABLE class is a wrapper class to handle the POSITIONABLE objects:
+
+The Positionable#POSITIONABLE class is a wrapper class to handle the POSITIONABLE objects:
- Support all DCS APIs.
@@ -87,15 +88,15 @@
The POSITIONABLE class provides the following functions to construct a POSITIONABLE instance:
1.2) POSITIONABLE methods:
The following methods can be used to identify an measurable object:
@@ -161,25 +162,25 @@
| POSITIONABLE:GetPositionVec3() |
- Returns the Dcs.DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+Returns the DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
|
| POSITIONABLE:GetRandomVec3(Radius) |
- Returns a random Dcs.DCSTypes#Vec3 vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
+Returns a random DCSTypes#Vec3 vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
|
| POSITIONABLE:GetVec2() |
- Returns the Dcs.DCSTypes#Vec2 vector indicating the point in 2D of the POSITIONABLE within the mission.
+Returns the DCSTypes#Vec2 vector indicating the point in 2D of the POSITIONABLE within the mission.
|
| POSITIONABLE:GetVec3() |
- Returns the Dcs.DCSTypes#Vec3 vector indicating the 3D vector of the POSITIONABLE within the mission.
+Returns the DCSTypes#Vec3 vector indicating the 3D vector of the POSITIONABLE within the mission.
|
@@ -467,7 +468,7 @@ The POSITIONABLE is not existing or alive.
-
-
Returns the Dcs.DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
+Returns the DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
Return values
@@ -495,7 +496,7 @@ The POSITIONABLE is not existing or alive.
-
-
Returns a random Dcs.DCSTypes#Vec3 vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
+Returns a random DCSTypes#Vec3 vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
Parameter
@@ -531,7 +532,7 @@ The POSITIONABLE is not existing or alive.
-
-
Returns the Dcs.DCSTypes#Vec2 vector indicating the point in 2D of the POSITIONABLE within the mission.
+Returns the DCSTypes#Vec2 vector indicating the point in 2D of the POSITIONABLE within the mission.
Return values
@@ -559,7 +560,7 @@ The POSITIONABLE is not existing or alive.
-
-
Returns the Dcs.DCSTypes#Vec3 vector indicating the 3D vector of the POSITIONABLE within the mission.
+Returns the DCSTypes#Vec3 vector indicating the 3D vector of the POSITIONABLE within the mission.
Return values
diff --git a/docs/Documentation/Process_JTAC.html b/docs/Documentation/Process_JTAC.html
index 194cee4de..06e2a3e2d 100644
--- a/docs/Documentation/Process_JTAC.html
+++ b/docs/Documentation/Process_JTAC.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
diff --git a/docs/Documentation/Process_Pickup.html b/docs/Documentation/Process_Pickup.html
index a41d3827c..385792385 100644
--- a/docs/Documentation/Process_Pickup.html
+++ b/docs/Documentation/Process_Pickup.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
diff --git a/docs/Documentation/Route.html b/docs/Documentation/Route.html
index dd3547df8..375de7d0f 100644
--- a/docs/Documentation/Route.html
+++ b/docs/Documentation/Route.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -76,7 +77,7 @@
-
+
ACT_ROUTE state machine:
diff --git a/docs/Documentation/ScheduleDispatcher.html b/docs/Documentation/ScheduleDispatcher.html
index 6c2e3ee11..890b6ca4f 100644
--- a/docs/Documentation/ScheduleDispatcher.html
+++ b/docs/Documentation/ScheduleDispatcher.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -99,7 +100,7 @@ these will not be executed anymore when the SCHEDULER object has been destroyed.
The SCHEDULEDISPATCHER allows multiple scheduled functions to be planned and executed for one SCHEDULER object.
The SCHEDULER object therefore keeps a table of "CallID's", which are returned after each planning of a new scheduled function by the SCHEDULEDISPATCHER.
-The SCHEDULER object plans new scheduled functions through the Core.Scheduler#SCHEDULER.Schedule() method.
+The SCHEDULER object plans new scheduled functions through the Scheduler#SCHEDULER.Schedule() method.
The Schedule() method returns the CallID that is the reference ID for each planned schedule.
diff --git a/docs/Documentation/Scheduler.html b/docs/Documentation/Scheduler.html
index c0ea390bc..e4d0d899f 100644
--- a/docs/Documentation/Scheduler.html
+++ b/docs/Documentation/Scheduler.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,19 +75,19 @@
-
+
-The Core.Scheduler#SCHEDULER class creates schedule.
+The Scheduler#SCHEDULER class creates schedule.
1.1) SCHEDULER constructor
The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters:
- - Core.Scheduler#SCHEDULER.New( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.
- - Core.Scheduler#SCHEDULER.New( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
- - Core.Scheduler#SCHEDULER.New( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
- - Core.Scheduler#SCHEDULER.New( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
+ - Scheduler#SCHEDULER.New( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.
+ - Scheduler#SCHEDULER.New( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
+ - Scheduler#SCHEDULER.New( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
+ - Scheduler#SCHEDULER.New( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
1.2) SCHEDULER timer stopping and (re-)starting.
@@ -94,13 +95,13 @@
The SCHEDULER can be stopped and restarted with the following methods:
- - Core.Scheduler#SCHEDULER.Start(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.
- - Core.Scheduler#SCHEDULER.Stop(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.
+ - Scheduler#SCHEDULER.Start(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.
+ - Scheduler#SCHEDULER.Stop(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.
1.3) Create a new schedule
-With Core.Scheduler#SCHEDULER.Schedule() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.
+With Scheduler#SCHEDULER.Schedule() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.
@@ -289,7 +290,7 @@ Specifies the amount of seconds when the scheduler will be stopped.
-
#SCHEDULER:
-self
+self.
-
diff --git a/docs/Documentation/Scoring.html b/docs/Documentation/Scoring.html
index 4e41c2562..1e707ab2a 100644
--- a/docs/Documentation/Scoring.html
+++ b/docs/Documentation/Scoring.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
diff --git a/docs/Documentation/Sead.html b/docs/Documentation/Sead.html
index 4d0842d24..88c8dfb7f 100644
--- a/docs/Documentation/Sead.html
+++ b/docs/Documentation/Sead.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
diff --git a/docs/Documentation/Set.html b/docs/Documentation/Set.html
index c9ca6872e..e998dfd0e 100644
--- a/docs/Documentation/Set.html
+++ b/docs/Documentation/Set.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -76,24 +77,24 @@
-
-The Core.Set#SET_BASE class defines the core functions that define a collection of objects.
+
+The Set#SET_BASE class defines the core functions that define a collection of objects.
A SET provides iterators to iterate the SET, but will temporarily yield the ForEach interator loop at defined "intervals" to the mail simulator loop.
In this way, large loops can be done while not blocking the simulator main processing loop.
The default "yield interval" is after 10 objects processed.
The default "time interval" is after 0.001 seconds.
1.1) Add or remove objects from the SET
-Some key core functions are Core.Set#SET_BASE.Add and Core.Set#SET_BASE.Remove to add or remove objects from the SET in your logic.
+Some key core functions are Set#SET_BASE.Add and Set#SET_BASE.Remove to add or remove objects from the SET in your logic.
1.2) Define the SET iterator "yield interval" and the "time interval"
-Modify the iterator intervals with the Core.Set#SET_BASE.SetInteratorIntervals method.
+
Modify the iterator intervals with the Set#SET_BASE.SetInteratorIntervals method.
You can set the "yield interval", and the "time interval". (See above).
-
-Mission designers can use the Core.Set#SET_GROUP class to build sets of groups belonging to certain:
+
+Mission designers can use the Set#SET_GROUP class to build sets of groups belonging to certain:
- Coalitions
@@ -110,7 +111,7 @@ You can set the "yield interval", and the "time interva
2.2) Add or Remove GROUP(s) from SET_GROUP:
-GROUPS can be added and removed using the Core.Set#SET_GROUP.AddGroupsByName and Core.Set#SET_GROUP.RemoveGroupsByName respectively.
+
GROUPS can be added and removed using the Set#SET_GROUP.AddGroupsByName and Set#SET_GROUP.RemoveGroupsByName respectively.
These methods take a single GROUP name or an array of GROUP names to be added or removed from SET_GROUP.
2.3) SET_GROUP filter criteria:
@@ -133,7 +134,7 @@ Filter criteria are defined by:
Planned filter criteria within development are (so these are not yet available):
2.4) SET_GROUP iterators:
@@ -150,8 +151,8 @@ The following iterator methods are currently available within the SETGROUP:
-
-Mission designers can use the Core.Set#SET_UNIT class to build sets of units belonging to certain:
+
+Mission designers can use the Set#SET_UNIT class to build sets of units belonging to certain:
- Coalitions
@@ -169,7 +170,7 @@ The following iterator methods are currently available within the SETGROUP:
3.2) Add or Remove UNIT(s) from SET_UNIT:
-UNITs can be added and removed using the Core.Set#SET_UNIT.AddUnitsByName and Core.Set#SET_UNIT.RemoveUnitsByName respectively.
+
UNITs can be added and removed using the Set#SET_UNIT.AddUnitsByName and Set#SET_UNIT.RemoveUnitsByName respectively.
These methods take a single UNIT name or an array of UNIT names to be added or removed from SET_UNIT.
3.3) SET_UNIT filter criteria:
@@ -193,7 +194,7 @@ Filter criteria are defined by:
Planned filter criteria within development are (so these are not yet available):
3.4) SET_UNIT iterators:
@@ -217,8 +218,8 @@ The following iterator methods are currently available within the SETUNIT:<
-
-Mission designers can use the Core.Set#SET_CLIENT class to build sets of units belonging to certain:
+
+Mission designers can use the Set#SET_CLIENT class to build sets of units belonging to certain:
- Coalitions
@@ -236,7 +237,7 @@ The following iterator methods are currently available within the SETUNIT:<
4.2) Add or Remove CLIENT(s) from SET_CLIENT:
-CLIENTs can be added and removed using the Core.Set#SET_CLIENT.AddClientsByName and Core.Set#SET_CLIENT.RemoveClientsByName respectively.
+
CLIENTs can be added and removed using the Set#SET_CLIENT.AddClientsByName and Set#SET_CLIENT.RemoveClientsByName respectively.
These methods take a single CLIENT name or an array of CLIENT names to be added or removed from SET_CLIENT.
4.3) SET_CLIENT filter criteria:
@@ -260,7 +261,7 @@ Filter criteria are defined by:
Planned filter criteria within development are (so these are not yet available):
4.4) SET_CLIENT iterators:
@@ -274,8 +275,8 @@ The following iterator methods are currently available within the SETCLIENT
-
-Mission designers can use the Core.Set#SET_AIRBASE class to build sets of airbases optionally belonging to certain:
+
+Mission designers can use the Set#SET_AIRBASE class to build sets of airbases optionally belonging to certain:
- Coalitions
@@ -289,7 +290,7 @@ The following iterator methods are currently available within the SETCLIENT
5.2) Add or Remove AIRBASEs from SET_AIRBASE
-AIRBASEs can be added and removed using the Core.Set#SET_AIRBASE.AddAirbasesByName and Core.Set#SET_AIRBASE.RemoveAirbasesByName respectively.
+
AIRBASEs can be added and removed using the Set#SET_AIRBASE.AddAirbasesByName and Set#SET_AIRBASE.RemoveAirbasesByName respectively.
These methods take a single AIRBASE name or an array of AIRBASE names to be added or removed from SET_AIRBASE.
5.3) SET_AIRBASE filter criteria
@@ -431,7 +432,7 @@ The following iterator methods are currently available within the SETAIRBAS
| SET_AIRBASE:FindNearestAirbaseFromPointVec2(PointVec2) |
- Iterate the SET_AIRBASE while identifying the nearest Wrapper.Airbase#AIRBASE from a Core.Point#POINT_VEC2.
+Iterate the SET_AIRBASE while identifying the nearest Airbase#AIRBASE from a Point#POINT_VEC2.
|
@@ -465,13 +466,13 @@ The following iterator methods are currently available within the SETAIRBAS
| SET_BASE:Add(ObjectName, Object) |
- Adds a Core.Base#BASE object in the Core.Set#SET_BASE, using a given ObjectName as the index.
+Adds a Base#BASE object in the Set#SET_BASE, using a given ObjectName as the index.
|
| SET_BASE:AddObject(Object) |
- Adds a Core.Base#BASE object in the Core.Set#SET_BASE, using the Object Name as the index.
+Adds a Base#BASE object in the Set#SET_BASE, using the Object Name as the index.
|
@@ -489,7 +490,7 @@ The following iterator methods are currently available within the SETAIRBAS
| SET_BASE:Count() |
- Retrieves the amount of objects in the Core.Set#SET_BASE and derived classes.
+Retrieves the amount of objects in the Set#SET_BASE and derived classes.
|
@@ -519,7 +520,7 @@ The following iterator methods are currently available within the SETAIRBAS
| SET_BASE:FindNearestObjectFromPointVec2(PointVec2) |
- Iterate the SET_BASE while identifying the nearest object from a Core.Point#POINT_VEC2.
+Iterate the SET_BASE while identifying the nearest object from a Point#POINT_VEC2.
|
@@ -537,7 +538,7 @@ The following iterator methods are currently available within the SETAIRBAS
| SET_BASE:Get(ObjectName) |
- Gets a Core.Base#BASE object from the Core.Set#SET_BASE and derived classes, based on the Object Name.
+Gets a Base#BASE object from the Set#SET_BASE and derived classes, based on the Object Name.
|
@@ -567,7 +568,7 @@ The following iterator methods are currently available within the SETAIRBAS
| SET_BASE:Remove(ObjectName) |
- Removes a Core.Base#BASE object from the Core.Set#SET_BASE and derived classes, based on the Object Name.
+Removes a Base#BASE object from the Set#SET_BASE and derived classes, based on the Object Name.
|
@@ -633,7 +634,7 @@ The following iterator methods are currently available within the SETAIRBAS
| SET_BASE:_Find(ObjectName) |
- Finds an Core.Base#BASE object based on the object Name.
+Finds an Base#BASE object based on the object Name.
|
@@ -1422,21 +1423,21 @@ The AIRBASE
-
-
Iterate the SET_AIRBASE while identifying the nearest Wrapper.Airbase#AIRBASE from a Core.Point#POINT_VEC2.
+Iterate the SET_AIRBASE while identifying the nearest Airbase#AIRBASE from a Point#POINT_VEC2.
Parameter
Return value
Wrapper.Airbase#AIRBASE:
-The closest Wrapper.Airbase#AIRBASE.
+The closest Airbase#AIRBASE.
@@ -1562,7 +1563,7 @@ A single name or an array of AIRBASE names.
-
-
Adds a Core.Base#BASE object in the Core.Set#SET_BASE, using a given ObjectName as the index.
+Adds a Base#BASE object in the Set#SET_BASE, using a given ObjectName as the index.
Parameters
- | SPAWN:InitUnControlled() |
+ SPAWN:InitUnControlled(UnControlled) |
- (AIR) Will spawn a plane group in uncontrolled mode...
+(AIR) Will spawn a plane group in UnControlled or Controlled mode...
|
@@ -1524,16 +1532,27 @@ self
-
-SPAWN:InitUnControlled()
+SPAWN:InitUnControlled(UnControlled)
-
-
(AIR) Will spawn a plane group in uncontrolled mode...
+(AIR) Will spawn a plane group in UnControlled or Controlled mode...
-This will be similar to the uncontrolled flag setting in the ME.
+This will be similar to the uncontrolled flag setting in the ME.
+You can use UnControlled mode to simulate planes startup and ready for take-off but aren't moving (yet).
+ReSpawn the plane in Controlled mode, and the plane will move...
+ Parameter
+
Return value
#SPAWN:
@@ -1656,7 +1675,7 @@ Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter
The provided method will be called when a new group is spawned, including its given parameters.
-The first parameter of the SpawnFunction is the Wrapper.Group#GROUP that was spawned.
+The first parameter of the SpawnFunction is the Group#GROUP that was spawned.
Parameters
@@ -2127,7 +2146,7 @@ SpawnGroupName
Will spawn a Group within a given Zone.
-The Zone can be of any type derived from Core.Zone#ZONE_BASE.
+
The Zone can be of any type derived from Zone#ZONE_BASE.
Once the Group is spawned within the zone, the Group will continue on its route.
The first waypoint (where the group is spawned) is replaced with the zone location coordinates.
@@ -2536,7 +2555,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
+ When the first Spawn executes, all the Groups need to be made visible before start.
diff --git a/docs/Documentation/Static.html b/docs/Documentation/Static.html
index 4be12f0c8..f71da321b 100644
--- a/docs/Documentation/Static.html
+++ b/docs/Documentation/Static.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,10 +75,10 @@
-
+
Statics are Static Units defined within the Mission Editor.
Note that Statics are almost the same as Units, but they don't have a controller.
-The Wrapper.Static#STATIC class is a wrapper class to handle the DCS Static objects:
+The Static#STATIC class is a wrapper class to handle the DCS Static objects:
- | TASK:JoinUnit(PlayerUnit) |
+ TASK:JoinUnit(PlayerUnit, PlayerGroup) |
Add a PlayerUnit to join the Task.
|
@@ -1310,7 +1311,7 @@ self
-
-TASK:JoinUnit(PlayerUnit)
+TASK:JoinUnit(PlayerUnit, PlayerGroup)
-
@@ -1322,13 +1323,19 @@ self
If the Unit was not part of the Task, false is returned.
If the Unit is part of the Task, true is returned.
-
Parameter
+ Parameters
Return value
diff --git a/docs/Documentation/Task_A2G.html b/docs/Documentation/Task_A2G.html
index 0c1877146..640bb4c66 100644
--- a/docs/Documentation/Task_A2G.html
+++ b/docs/Documentation/Task_A2G.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,15 +75,15 @@
-
+
The #TASK_A2G class defines a CAS or BAI task of a Set of Target Units,
-located at a Target Zone, based on the tasking capabilities defined in Tasking.Task#TASK.
+located at a Target Zone, based on the tasking capabilities defined in Task#TASK.
The TASK_A2G is implemented using a Statemachine#FSM_TASK, and has the following statuses:
- None: Start of the process
- Planned: The SEAD task is planned. Upon Planned, the sub-process ProcessFsm.Assign#ACTASSIGN_ACCEPT is started to accept the task.
- - Assigned: The SEAD task is assigned to a Wrapper.Group#GROUP. Upon Assigned, the sub-process ProcessFsm.Route#ACTROUTE is started to route the active Units in the Group to the attack zone.
+ - Assigned: The SEAD task is assigned to a Group#GROUP. Upon Assigned, the sub-process ProcessFsm.Route#ACTROUTE is started to route the active Units in the Group to the attack zone.
- Success: The SEAD task is successfully completed. Upon Success, the sub-process ProcessSEAD#PROCESSSEAD is started to follow-up successful SEADing of the targets assigned in the task.
- Failed: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
diff --git a/docs/Documentation/Task_PICKUP.html b/docs/Documentation/Task_PICKUP.html
index dcf9d7722..f1cbaadbf 100644
--- a/docs/Documentation/Task_PICKUP.html
+++ b/docs/Documentation/Task_PICKUP.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,15 +75,15 @@
-
+
The #TASK_PICKUP class defines a pickup task of a Set of CARGO objects defined within the mission.
-based on the tasking capabilities defined in Tasking.Task#TASK.
+based on the tasking capabilities defined in Task#TASK.
The TASK_PICKUP is implemented using a Statemachine#FSM_TASK, and has the following statuses:
- None: Start of the process
- Planned: The SEAD task is planned. Upon Planned, the sub-process ProcessFsm.Assign#ACTASSIGN_ACCEPT is started to accept the task.
- - Assigned: The SEAD task is assigned to a Wrapper.Group#GROUP. Upon Assigned, the sub-process ProcessFsm.Route#ACTROUTE is started to route the active Units in the Group to the attack zone.
+ - Assigned: The SEAD task is assigned to a Group#GROUP. Upon Assigned, the sub-process ProcessFsm.Route#ACTROUTE is started to route the active Units in the Group to the attack zone.
- Success: The SEAD task is successfully completed. Upon Success, the sub-process ProcessSEAD#PROCESSSEAD is started to follow-up successful SEADing of the targets assigned in the task.
- Failed: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
diff --git a/docs/Documentation/Task_SEAD.html b/docs/Documentation/Task_SEAD.html
index 85d3a1704..8aac84683 100644
--- a/docs/Documentation/Task_SEAD.html
+++ b/docs/Documentation/Task_SEAD.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,15 +75,15 @@
-
+
The #TASK_SEAD class defines a SEAD task for a Set of Target Units, located at a Target Zone,
-based on the tasking capabilities defined in Tasking.Task#TASK.
+based on the tasking capabilities defined in Task#TASK.
The TASK_SEAD is implemented using a Statemachine#FSM_TASK, and has the following statuses:
- None: Start of the process
- Planned: The SEAD task is planned. Upon Planned, the sub-process ProcessFsm.Assign#ACTASSIGN_ACCEPT is started to accept the task.
- - Assigned: The SEAD task is assigned to a Wrapper.Group#GROUP. Upon Assigned, the sub-process ProcessFsm.Route#ACTROUTE is started to route the active Units in the Group to the attack zone.
+ - Assigned: The SEAD task is assigned to a Group#GROUP. Upon Assigned, the sub-process ProcessFsm.Route#ACTROUTE is started to route the active Units in the Group to the attack zone.
- Success: The SEAD task is successfully completed. Upon Success, the sub-process ProcessSEAD#PROCESSSEAD is started to follow-up successful SEADing of the targets assigned in the task.
- Failed: The SEAD task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
diff --git a/docs/Documentation/Unit.html b/docs/Documentation/Unit.html
index 9efa9258b..7a731ad48 100644
--- a/docs/Documentation/Unit.html
+++ b/docs/Documentation/Unit.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -74,7 +75,7 @@
-
+
The #UNIT class is a wrapper class to handle the DCS Unit objects:
@@ -108,7 +109,7 @@ If the DCS Unit object does not exist or is nil, the UNIT methods will return ni
1.2) DCS UNIT APIs
The DCS Unit APIs are used extensively within MOOSE. The UNIT class has for each DCS Unit API a corresponding method.
To be able to distinguish easily in your code the difference between a UNIT API call and a DCS Unit API call,
-the first letter of the method is also capitalized. So, by example, the DCS Unit method Dcs.DCSWrapper.Unit#Unit.getName()
+the first letter of the method is also capitalized. So, by example, the DCS Unit method DCSWrapper.Unit#Unit.getName()
is implemented in the UNIT class as UNIT.GetName().
1.3) Smoke, Flare Units
@@ -131,7 +132,7 @@ If you want to obtain the complete 3D position including ori�
The UNIT class contains methods to test the location or proximity against zones or other objects.
1.6.1) Zones
-To test whether the Unit is within a zone, use the UNIT.IsInZone() or the UNIT.IsNotInZone() methods. Any zone can be tested on, but the zone must be derived from Core.Zone#ZONE_BASE.
+To test whether the Unit is within a zone, use the UNIT.IsInZone() or the UNIT.IsNotInZone() methods. Any zone can be tested on, but the zone must be derived from Zone#ZONE_BASE.
1.6.2) Units
Test if another DCS Unit is within a given radius of the current DCS Unit, use the UNIT.OtherUnitInRadius() method.
@@ -288,6 +289,12 @@ If you want to obtain the complete 3D position including ori�
UNIT:GetUnits() |
Returns the UNIT in a UNIT list of one element.
+ |
+
+
+ | UNIT:HandleEvent(Event, EventFunction) |
+
+ Subscribe to a DCS Event.
|
@@ -408,6 +415,12 @@ If you want to obtain the complete 3D position including ori�
| UNIT:SmokeWhite() |
Smoke the UNIT White.
+ |
+
+
+ | UNIT:UnHandleEvent(Event) |
+
+ UnSubscribe to a DCS event.
|
@@ -1023,6 +1036,38 @@ The DCS Unit is not existing or alive.
#list:
Wrapper.Unit#UNIT> The UNITs wrappers.
+
+
+
+-
+
+
+UNIT:HandleEvent(Event, EventFunction)
+
+
+-
+
+
Subscribe to a DCS Event.
+
+ Parameters
+
+ Return value
+
+#UNIT:
+
+
@@ -1236,7 +1281,7 @@ The zone to test.
Return value
#boolean:
-Returns true if the unit is within the Core.Zone#ZONE_BASE
+Returns true if the unit is within the Zone#ZONE_BASE
@@ -1263,7 +1308,7 @@ The zone to test.
Return value
#boolean:
-Returns true if the unit is not within the Core.Zone#ZONE_BASE
+Returns true if the unit is not within the Zone#ZONE_BASE
@@ -1504,6 +1549,32 @@ The name of the DCS unit.
Smoke the UNIT White.
+
+
+
+-
+
+
+UNIT:UnHandleEvent(Event)
+
+
+-
+
+
UnSubscribe to a DCS event.
+
+ Parameter
+
+ Return value
+
+#UNIT:
+
+
diff --git a/docs/Documentation/Utils.html b/docs/Documentation/Utils.html
index e0be30322..c4f2efc23 100644
--- a/docs/Documentation/Utils.html
+++ b/docs/Documentation/Utils.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
diff --git a/docs/Documentation/Zone.html b/docs/Documentation/Zone.html
index 5d9394bda..965854e1f 100644
--- a/docs/Documentation/Zone.html
+++ b/docs/Documentation/Zone.html
@@ -33,6 +33,7 @@
- Controllable
- Database
- Detection
+ - DetectionManager
- Escort
- Event
- Fsm
@@ -70,7 +71,7 @@
Module Zone
-
This module contains the ZONE classes, inherited from Core.Zone#ZONE_BASE.
+
This module contains the ZONE classes, inherited from Zone#ZONE_BASE.
There are essentially two core functions that zones accomodate:
@@ -84,7 +85,7 @@
- Test if completely within the zone.
- - Test if partly within the zone (for Wrapper.Group#GROUP objects).
+ - Test if partly within the zone (for Group#GROUP objects).
- Test if not in the zone.
- Distance to the nearest intersecting point of the zone.
- Distance to the center of the zone.
@@ -94,17 +95,17 @@
Each of these ZONE classes have a zone name, and specific parameters defining the zone type:
-
+
This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
1.1) Each zone has a name:
@@ -113,11 +114,11 @@
- ZONE_BASE.GetName(): Returns the name of the zone.
-
1.2) Each zone implements two polymorphic functions defined in Core.Zone#ZONE_BASE:
+
1.2) Each zone implements two polymorphic functions defined in Zone#ZONE_BASE:
1.3) A zone has a probability factor that can be set to randomize a selection between zones:
@@ -131,8 +132,8 @@
1.4) A zone manages Vectors:
1.5) A zone has a bounding square:
@@ -150,11 +151,11 @@
-
+
The ZONERADIUS class defined by a zone name, a location and a radius.
This class implements the inherited functions from Core.Zone#ZONEBASE taking into account the own zone format and properties.
-
+
- ZONE_BASE.New(): Constructor.
@@ -170,41 +171,41 @@ This class implements the inherited functions from Core.Zone#ZONEBASE takin
2.3) Manage the location of the zone:
-
+
The ZONE class, defined by the zone name as defined within the Mission Editor.
This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
-
-The ZONE_UNIT class defined by a zone around a Wrapper.Unit#UNIT with a radius.
-This class implements the inherited functions from Core.Zone#ZONE_RADIUS taking into account the own zone format and properties.
+
+The ZONE_UNIT class defined by a zone around a Unit#UNIT with a radius.
+This class implements the inherited functions from Zone#ZONE_RADIUS taking into account the own zone format and properties.
-
-The ZONE_GROUP class defines by a zone around a Wrapper.Group#GROUP with a radius. The current leader of the group defines the center of the zone.
-This class implements the inherited functions from Core.Zone#ZONE_RADIUS taking into account the own zone format and properties.
+
+The ZONE_GROUP class defines by a zone around a Group#GROUP with a radius. The current leader of the group defines the center of the zone.
+This class implements the inherited functions from Zone#ZONE_RADIUS taking into account the own zone format and properties.
-
-The ZONEPOLYGONBASE class defined by a sequence of Wrapper.Group#GROUP waypoints within the Mission Editor, forming a polygon.
-This class implements the inherited functions from Core.Zone#ZONE_RADIUS taking into account the own zone format and properties.
+
+The ZONEPOLYGONBASE class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.
+This class implements the inherited functions from Zone#ZONE_RADIUS taking into account the own zone format and properties.
This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
-
-The ZONE_POLYGON class defined by a sequence of Wrapper.Group#GROUP waypoints within the Mission Editor, forming a polygon.
-This class implements the inherited functions from Core.Zone#ZONE_RADIUS taking into account the own zone format and properties.
+
+The ZONE_POLYGON class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.
+This class implements the inherited functions from Zone#ZONE_RADIUS taking into account the own zone format and properties.
@@ -314,13 +315,13 @@ This class implements the inherited functions from ZONE_BASE:GetRandomVec2()
- Define a random Dcs.DCSTypes#Vec2 within the zone.
+Define a random DCSTypes#Vec2 within the zone.
|
| ZONE_BASE:GetVec2() |
- Returns the Dcs.DCSTypes#Vec2 coordinate of the zone.
+Returns the DCSTypes#Vec2 coordinate of the zone.
|
@@ -430,7 +431,7 @@ This class implements the inherited functions from ZONE_GROUP:New(ZoneName, ZoneGROUP, Radius)
|
- Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Wrapper.Group#GROUP and a radius.
+Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Group#GROUP and a radius.
|
@@ -452,7 +453,7 @@ This class implements the inherited functions from ZONE_POLYGON:New(ZoneName, ZoneGroup)
|
- Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Wrapper.Group#GROUP defined within the Mission Editor.
+Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Group#GROUP defined within the Mission Editor.
|
@@ -480,7 +481,7 @@ This class implements the inherited functions from ZONE_POLYGON_BASE:GetRandomVec2()
- Define a random Dcs.DCSTypes#Vec2 within the zone.
+Define a random DCSTypes#Vec2 within the zone.
|
@@ -492,13 +493,13 @@ This class implements the inherited functions from ZONE_POLYGON_BASE:New(ZoneName, PointsArray)
|
- Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of Dcs.DCSTypes#Vec2, forming a polygon.
+Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of DCSTypes#Vec2, forming a polygon.
|
| ZONE_POLYGON_BASE.Polygon |
- The polygon defined by an array of Dcs.DCSTypes#Vec2.
+The polygon defined by an array of DCSTypes#Vec2.
|
@@ -530,7 +531,7 @@ This class implements the inherited functions from ZONE_RADIUS:GetRandomVec2()
+ | ZONE_RADIUS:GetRandomVec2(inner, outer) |
Returns a random location within the zone.
|
@@ -538,13 +539,13 @@ This class implements the inherited functions from ZONE_RADIUS:GetVec2()
- Returns the Dcs.DCSTypes#Vec2 of the zone.
+Returns the DCSTypes#Vec2 of the zone.
|
| ZONE_RADIUS:GetVec3(Height) |
- Returns the Dcs.DCSTypes#Vec3 of the ZONE_RADIUS.
+Returns the DCSTypes#Vec3 of the ZONE_RADIUS.
|
@@ -580,7 +581,7 @@ This class implements the inherited functions from ZONE_RADIUS:SetVec2(Vec2)
|
- Sets the Dcs.DCSTypes#Vec2 of the zone.
+Sets the DCSTypes#Vec2 of the zone.
|
@@ -614,13 +615,13 @@ This class implements the inherited functions from ZONE_UNIT:GetVec2()
|
- Returns the current location of the Wrapper.Unit#UNIT.
+Returns the current location of the Unit#UNIT.
|
| ZONE_UNIT:GetVec3(Height) |
- Returns the Dcs.DCSTypes#Vec3 of the ZONE_UNIT.
+Returns the DCSTypes#Vec3 of the ZONE_UNIT.
|
@@ -858,7 +859,7 @@ The name of the zone.
-Define a random Dcs.DCSTypes#Vec2 within the zone.
+Define a random DCSTypes#Vec2 within the zone.
Return value
@@ -876,7 +877,7 @@ The Vec2 coordinates.
-Returns the Dcs.DCSTypes#Vec2 coordinate of the zone.
+Returns the DCSTypes#Vec2 coordinate of the zone.
Return value
@@ -1211,7 +1212,7 @@ The location of the zone based on the Group location.
-Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Wrapper.Group#GROUP and a radius.
+Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Group#GROUP and a radius.
Parameters
@@ -1258,7 +1259,7 @@ self
-The ZONE_POLYGON class defined by a sequence of Wrapper.Group#GROUP waypoints within the Mission Editor, forming a polygon.
+The ZONE_POLYGON class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.
Field(s)
@@ -1284,10 +1285,10 @@ self
-
-
Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Wrapper.Group#GROUP defined within the Mission Editor.
+Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Group#GROUP defined within the Mission Editor.
-The Wrapper.Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
+The Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
Parameters
@@ -1314,7 +1315,7 @@ self
-The ZONEPOLYGONBASE class defined by an array of Dcs.DCSTypes#Vec2, forming a polygon.
+The ZONEPOLYGONBASE class defined by an array of DCSTypes#Vec2, forming a polygon.
Field(s)
@@ -1376,7 +1377,7 @@ The bounding square.
-
-
Define a random Dcs.DCSTypes#Vec2 within the zone.
+Define a random DCSTypes#Vec2 within the zone.
Return value
@@ -1424,10 +1425,10 @@ true if the location is within the zone.
-
-
Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of Dcs.DCSTypes#Vec2, forming a polygon.
+Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of DCSTypes#Vec2, forming a polygon.
-The Wrapper.Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected.
+The Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected.
Parameters
@@ -1461,7 +1462,7 @@ self
-
-
The polygon defined by an array of Dcs.DCSTypes#Vec2.
+The polygon defined by an array of DCSTypes#Vec2.
@@ -1580,13 +1581,28 @@ The radius of the zone.
-
-ZONE_RADIUS:GetRandomVec2()
+ZONE_RADIUS:GetRandomVec2(inner, outer)
-
Returns a random location within the zone.
+ Parameters
+
Return value
Dcs.DCSTypes#Vec2:
@@ -1603,7 +1619,7 @@ The random location within the zone.
-
-
Returns the Dcs.DCSTypes#Vec2 of the zone.
+Returns the DCSTypes#Vec2 of the zone.
Return value
@@ -1621,7 +1637,7 @@ The location of the zone.
-
-
Returns the Dcs.DCSTypes#Vec3 of the ZONE_RADIUS.
+Returns the DCSTypes#Vec3 of the ZONE_RADIUS.
Parameter
@@ -95,10 +95,9 @@ CLIENTS in a SET_CLIENT collection, which are not occupied by human players.

-
-
+
The #AICAPZONE class implements the core functions to patrol a Zone by an AI Controllable or Group
and automatically engage any airborne enemies that are within a certain range or within a certain zone.
@@ -107,29 +106,29 @@ and automatically engage any airborne enemies that are within a certain range or
| AI_Cas |
- Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- Provide Close Air Support to friendly ground troops.
+Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air --
+Provide Close Air Support to friendly ground troops.

-
-
+
-#AICASZONE derives from the AI.AIPatrol#AIPATROL_ZONE, inheriting its methods and behaviour.
+#AICASZONE derives from the AIPatrol#AIPATROL_ZONE, inheriting its methods and behaviour.
|
| AI_Patrol |
- Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- Air Patrolling or Staging.
+Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air --
+Air Patrolling or Staging.

-
-
+
The #AIPATROLZONE class implements the core functions to patrol a Zone by an AI Controllable or Group.
|
@@ -167,7 +166,18 @@ and automatically engage any airborne enemies that are within a certain range or
| Cargo |
- Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground -- Management of logical cargo objects, that can be transported from and to transportation carriers.
+Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground --
+Management of logical cargo objects, that can be transported from and to transportation carriers.
+
+
+
+
+
+Cargo can be of various forms, always are composed out of ONE object ( one unit or one static or one slingload crate ):
+
+
+ - AICARGOUNIT, represented by a Unit in a Group: Cargo can be represented by a Unit in a Group.
+
|
@@ -204,6 +214,12 @@ and automatically engage any airborne enemies that are within a certain range or
| Detection |
This module contains the DETECTION classes.
+ |
+
+
+ | DetectionManager |
+
+ This module contains the DETECTION_MANAGER class and derived classes.
|
@@ -215,7 +231,8 @@ and automatically engage any airborne enemies that are within a certain range or
| Event |
- This module contains the EVENT class.
+This core module models the dispatching of DCS Events to subscribed MOOSE classes,
+following a given priority.
|
@@ -341,7 +358,16 @@ and automatically engage any airborne enemies that are within a certain range or
| Spawn |
- This module contains the SPAWN class.
+Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:All --
+Spawn groups of units dynamically in your missions.
+
+
+
+
+
+
+
+The #SPAWN class allows to spawn dynamically new groups, based on pre-defined initialization settings, modifying the behaviour when groups are spawned.
|
@@ -390,7 +416,7 @@ which are excellent tools to be reused in an OO environment!.
| Zone |
- This module contains the ZONE classes, inherited from Core.Zone#ZONE_BASE.
+This module contains the ZONE classes, inherited from Zone#ZONE_BASE.
|
diff --git a/docs/Documentation/routines.html b/docs/Documentation/routines.html
index f59f1eb4f..99337161d 100644
--- a/docs/Documentation/routines.html
+++ b/docs/Documentation/routines.html
@@ -33,6 +33,7 @@
Controllable
Database
Detection
+ DetectionManager
Escort
Event
Fsm
diff --git a/docs/Presentations/AI_CARGO/CARGO.JPG b/docs/Presentations/AI_CARGO/CARGO.JPG
new file mode 100644
index 000000000..3096fad05
Binary files /dev/null and b/docs/Presentations/AI_CARGO/CARGO.JPG differ
diff --git a/docs/Presentations/EVENT.pptx b/docs/Presentations/EVENT.pptx
new file mode 100644
index 000000000..5ae8628cb
Binary files /dev/null and b/docs/Presentations/EVENT.pptx differ
diff --git a/docs/Presentations/EVENT/Dia1.JPG b/docs/Presentations/EVENT/Dia1.JPG
new file mode 100644
index 000000000..2621f5880
Binary files /dev/null and b/docs/Presentations/EVENT/Dia1.JPG differ
diff --git a/docs/Presentations/EVENT/Dia10.JPG b/docs/Presentations/EVENT/Dia10.JPG
new file mode 100644
index 000000000..1bba3324c
Binary files /dev/null and b/docs/Presentations/EVENT/Dia10.JPG differ
diff --git a/docs/Presentations/EVENT/Dia11.JPG b/docs/Presentations/EVENT/Dia11.JPG
new file mode 100644
index 000000000..9a54dbe58
Binary files /dev/null and b/docs/Presentations/EVENT/Dia11.JPG differ
diff --git a/docs/Presentations/EVENT/Dia12.JPG b/docs/Presentations/EVENT/Dia12.JPG
new file mode 100644
index 000000000..c5d44cb5a
Binary files /dev/null and b/docs/Presentations/EVENT/Dia12.JPG differ
diff --git a/docs/Presentations/EVENT/Dia13.JPG b/docs/Presentations/EVENT/Dia13.JPG
new file mode 100644
index 000000000..a9527b996
Binary files /dev/null and b/docs/Presentations/EVENT/Dia13.JPG differ
diff --git a/docs/Presentations/EVENT/Dia14.JPG b/docs/Presentations/EVENT/Dia14.JPG
new file mode 100644
index 000000000..46773eef0
Binary files /dev/null and b/docs/Presentations/EVENT/Dia14.JPG differ
diff --git a/docs/Presentations/EVENT/Dia15.JPG b/docs/Presentations/EVENT/Dia15.JPG
new file mode 100644
index 000000000..430bf4cd8
Binary files /dev/null and b/docs/Presentations/EVENT/Dia15.JPG differ
diff --git a/docs/Presentations/EVENT/Dia16.JPG b/docs/Presentations/EVENT/Dia16.JPG
new file mode 100644
index 000000000..8290075f6
Binary files /dev/null and b/docs/Presentations/EVENT/Dia16.JPG differ
diff --git a/docs/Presentations/EVENT/Dia17.JPG b/docs/Presentations/EVENT/Dia17.JPG
new file mode 100644
index 000000000..340e62c88
Binary files /dev/null and b/docs/Presentations/EVENT/Dia17.JPG differ
diff --git a/docs/Presentations/EVENT/Dia18.JPG b/docs/Presentations/EVENT/Dia18.JPG
new file mode 100644
index 000000000..3e2df6692
Binary files /dev/null and b/docs/Presentations/EVENT/Dia18.JPG differ
diff --git a/docs/Presentations/EVENT/Dia2.JPG b/docs/Presentations/EVENT/Dia2.JPG
new file mode 100644
index 000000000..55116b7a4
Binary files /dev/null and b/docs/Presentations/EVENT/Dia2.JPG differ
diff --git a/docs/Presentations/EVENT/Dia3.JPG b/docs/Presentations/EVENT/Dia3.JPG
new file mode 100644
index 000000000..4cb2ee9a3
Binary files /dev/null and b/docs/Presentations/EVENT/Dia3.JPG differ
diff --git a/docs/Presentations/EVENT/Dia4.JPG b/docs/Presentations/EVENT/Dia4.JPG
new file mode 100644
index 000000000..23ff25bba
Binary files /dev/null and b/docs/Presentations/EVENT/Dia4.JPG differ
diff --git a/docs/Presentations/EVENT/Dia5.JPG b/docs/Presentations/EVENT/Dia5.JPG
new file mode 100644
index 000000000..f81a00aa2
Binary files /dev/null and b/docs/Presentations/EVENT/Dia5.JPG differ
diff --git a/docs/Presentations/EVENT/Dia6.JPG b/docs/Presentations/EVENT/Dia6.JPG
new file mode 100644
index 000000000..77cb3930d
Binary files /dev/null and b/docs/Presentations/EVENT/Dia6.JPG differ
diff --git a/docs/Presentations/EVENT/Dia7.JPG b/docs/Presentations/EVENT/Dia7.JPG
new file mode 100644
index 000000000..d55b937c9
Binary files /dev/null and b/docs/Presentations/EVENT/Dia7.JPG differ
diff --git a/docs/Presentations/EVENT/Dia8.JPG b/docs/Presentations/EVENT/Dia8.JPG
new file mode 100644
index 000000000..16b16bec1
Binary files /dev/null and b/docs/Presentations/EVENT/Dia8.JPG differ
diff --git a/docs/Presentations/EVENT/Dia9.JPG b/docs/Presentations/EVENT/Dia9.JPG
new file mode 100644
index 000000000..2ac82a4b6
Binary files /dev/null and b/docs/Presentations/EVENT/Dia9.JPG differ
diff --git a/docs/Presentations/SPAWN/SPAWN.JPG b/docs/Presentations/SPAWN/SPAWN.JPG
new file mode 100644
index 000000000..41b4fe35c
Binary files /dev/null and b/docs/Presentations/SPAWN/SPAWN.JPG differ
diff --git a/docs/README.md b/docs/README.md
index 8c2da4509..8b0e62149 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -199,11 +199,11 @@ MOOSE Functional Classes provide various functions that are useful in mission de
* [SPAWN](Documentation/Spawn.html): Spawn new groups (and units) during mission execution.
-* [ESCORT](Moose Training/Documentation/Escort.html): Makes groups consisting of helicopters, airplanes, ground troops or ships within a mission joining your flight. You can control these groups through the ratio menu during your flight. Available commands are around: Navigation, Position Hold, Reporting (Target Detection), Attacking, Assisted Attacks, ROE, Evasion, Mission Execution and more ...
+* [ESCORT](Documentation/Escort.html): Makes groups consisting of helicopters, airplanes, ground troops or ships within a mission joining your flight. You can control these groups through the ratio menu during your flight. Available commands are around: Navigation, Position Hold, Reporting (Target Detection), Attacking, Assisted Attacks, ROE, Evasion, Mission Execution and more ...
-* [MISSILETRAINER](Moose Training/Documentation/MissileTrainer.html): Missile trainer, it destroys missiles when they are within a certain range of player airplanes, displays tracking and alert messages of missile launches; approach; destruction, and configure with radio menu commands. Various APIs available to configure the trainer.
+* [MISSILETRAINER](Documentation/MissileTrainer.html): Missile trainer, it destroys missiles when they are within a certain range of player airplanes, displays tracking and alert messages of missile launches; approach; destruction, and configure with radio menu commands. Various APIs available to configure the trainer.
-* [DETECTION](Moose Training/Documentation/Detection.html): Detect other units using the available sensors of the detection unit. The DETECTION_BASE derived classes will provide different methods how the sets of detected objects are built.
+* [DETECTION](Documentation/Detection.html): Detect other units using the available sensors of the detection unit. The DETECTION_BASE derived classes will provide different methods how the sets of detected objects are built.
## 7.4) MOOSE AI Controlling Classes
@@ -214,6 +214,10 @@ These AI Controlling Classes are based on FSM (Finite State Machine) Classes, an
* [AI_PATROLZONE](Documentation/AI_PatrolZone.html): Make an alive AI Group patrol a zone derived from the ZONE_BASE class. Manage out-of-fuel events and set altitude and speed ranges for the patrol.
+* [AI_CAP](Documentation/AI_Cap.html): Make an alive AI Group perform Combat Air Patrol in a dynamic process.
+
+* [AI_CAS](Documentation/AI_Cas.html): Make an alive AI Group perform Close Air Support in a dynamic process.
+
* [AI_CARGO](Documentation/AI_Cargo.html): Make AI behave as cargo. Various CARGO types exist.
## 7.5) MOOSE Human Tasking Classes