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.** -- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) --- --- +-- -- === -- --- # 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..5c7d2f3c9 100644 --- a/Moose Development/Moose/AI/AI_CAP.lua +++ b/Moose Development/Moose/AI/AI_CAP.lua @@ -2,10 +2,9 @@ -- -- ![Banner Image](..\Presentations\AI_CAP\Dia1.JPG) -- --- -- === -- --- # 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. -- -- ==== -- diff --git a/Moose Development/Moose/AI/AI_CAS.lua b/Moose Development/Moose/AI/AI_CAS.lua index adeaddfd3..988ed11f8 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.** -- -- ![Banner Image](..\Presentations\AI_CAS\Dia1.JPG) -- --- -- === -- --- # 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. 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.** +-- +-- ![Banner Image](..\Presentations\AI_CARGO\CARGO.JPG) -- -- === -- @@ -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..48e27b2ba 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.** -- -- ![Banner Image](..\Presentations\AI_PATROL\Dia1.JPG) -- --- -- === -- --- # 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}. -- @@ -524,11 +524,11 @@ 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() diff --git a/Moose Development/Moose/Actions/Act_Account.lua b/Moose Development/Moose/Actions/Act_Account.lua index 684d1742d..18854aa18 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: -- 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..a25db9edb 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 -- @@ -84,8 +84,8 @@ -- * @{#BASE.EventOnTakeOff}(): Handle the event when a unit takes off from a runway. -- * @{#BASE.EventOnTookControl}(): Handle the event when a player takes control of a unit. -- --- The EventOn() methods provide the @{Core.Event#EVENTDATA} structure to the event handling function. --- The @{Core.Event#EVENTDATA} structure contains an enriched data set of information about the event being handled. +-- The EventOn() methods provide the @{Event#EVENTDATA} structure to the event handling function. +-- The @{Event#EVENTDATA} structure contains an enriched data set of information about the event being handled. -- -- Find below an example of the prototype how to write an event handling function: -- @@ -105,7 +105,7 @@ -- 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. +-- * EventData = the @{Event#EVENTDATA} structure, containing more information of the Event. -- -- ## 1.4) Class identification methods -- @@ -181,6 +181,7 @@ local _ClassID = 0 BASE = { ClassName = "BASE", ClassID = 0, + _Private = {}, Events = {}, States = {} } @@ -287,6 +288,26 @@ function BASE:GetClassID() return self.ClassID end +--- 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 + +--- 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 + + --- Set a new listener for the class. -- @param self -- @param Dcs.DCSTypes#Event Event diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua index 37b76490c..e40bcdf9d 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: -- @@ -100,6 +100,8 @@ function DATABASE:New() self:_RegisterPlayers() self:_RegisterAirbases() + self:SetEventPriority( 1 ) + return self end @@ -228,6 +230,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 +572,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 ) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index cedee92e6..bb341f103 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -50,6 +50,33 @@ local _EVENTCODES = { "S_EVENT_MAX", } +local _EVENTORDER = { + [world.event.S_EVENT_SHOT] = 1, + [world.event.S_EVENT_HIT] = 1, + [world.event.S_EVENT_TAKEOFF] = 1, + [world.event.S_EVENT_LAND] = 1, + [world.event.S_EVENT_CRASH] = -1, + [world.event.S_EVENT_EJECTION] = -1, + [world.event.S_EVENT_REFUELING] = 1, + [world.event.S_EVENT_DEAD] = -1, + [world.event.S_EVENT_PILOT_DEAD] = -1, + [world.event.S_EVENT_BASE_CAPTURED] = 1, + [world.event.S_EVENT_MISSION_START] = 1, + [world.event.S_EVENT_MISSION_END] = -1, + [world.event.S_EVENT_TOOK_CONTROL] = 1, + [world.event.S_EVENT_REFUELING_STOP] = 1, + [world.event.S_EVENT_BIRTH] = 1, + [world.event.S_EVENT_HUMAN_FAILURE] = 1, + [world.event.S_EVENT_ENGINE_STARTUP] = 1, + [world.event.S_EVENT_ENGINE_SHUTDOWN] = 1, + [world.event.S_EVENT_PLAYER_ENTER_UNIT] = 1, + [world.event.S_EVENT_PLAYER_LEAVE_UNIT] = -1, + [world.event.S_EVENT_PLAYER_COMMENT] = 1, + [world.event.S_EVENT_SHOOTING_START] = 1, + [world.event.S_EVENT_SHOOTING_END] = 1, + [world.event.S_EVENT_MAX] = 1, +} + --- The Event structure -- @type EVENTDATA -- @field id @@ -94,6 +121,7 @@ end --- Initializes the Events structure for the event -- @param #EVENT self -- @param Dcs.DCSWorld#world.event EventID +-- @param #number EventPriority The priority of the EventClass. -- @param Core.Base#BASE EventClass -- @return #EVENT.Events function EVENT:Init( EventID, EventClass ) @@ -102,8 +130,13 @@ function EVENT:Init( EventID, 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" } ) @@ -120,18 +153,20 @@ function EVENT:Remove( EventClass, EventID ) self:F3( { EventClass, _EVENTCODES[EventID] } ) 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. +--- 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 +200,7 @@ function EVENT:OnEventGeneric( EventFunction, EventClass, EventID ) local Event = self:Init( EventID, EventClass ) Event.EventFunction = EventFunction Event.EventClass = EventClass + return self end @@ -741,6 +777,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 @@ -763,21 +801,33 @@ function EVENT:onEvent( Event ) 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 Order = _EVENTORDER[Event.id] + self:E( { Order = Order } ) + + for EventPriority = Order == -1 and 5 or 1, Order == -1 and 1 or 5, Order 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 + self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName } ) + Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName ) + 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:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID() } ) + Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName ) + local Result, Value = xpcall( function() return EventData.EventFunction( EventData.EventClass, Event ) end, ErrorHandler ) + --EventData.EventFunction( EventData.EventClass, Event ) + end + end end end end diff --git a/Moose Development/Moose/Core/Fsm.lua b/Moose Development/Moose/Core/Fsm.lua index acf7a73ce..fe4ad1d95 100644 --- a/Moose Development/Moose/Core/Fsm.lua +++ b/Moose Development/Moose/Core/Fsm.lua @@ -3,6 +3,8 @@ -- -- ![Banner Image](..\Presentations\FSM\Dia1.JPG) -- +-- === +-- -- 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} -- -- ![Transition Rules and Transition Handlers and Event Triggers](..\Presentations\FSM\Dia3.JPG) -- 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..3ea8b2e4b 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. -- -- === -- diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index f20832639..0966b39c8 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() @@ -475,9 +477,9 @@ function SET_BASE:FilterStop() 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..e0b14d61b 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,7 @@ 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() 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/Spawn.lua b/Moose Development/Moose/Functional/Spawn.lua index 4db8a032f..b921ad8f0 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.** +-- +-- ![Banner Image](..\Presentations\SPAWN\SPAWN.JPG) -- --- # 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. @@ -646,6 +653,10 @@ 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 + SpawnTemplate.uncontrolled = self.SpawnUnControlled + end end _EVENTDISPATCHER:OnBirthForTemplate( SpawnTemplate, self._OnBirth, self ) @@ -734,7 +745,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 +885,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 +908,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 +1241,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..83b5d3581 100644 --- a/Moose Development/Moose/Tasking/CommandCenter.lua +++ b/Moose Development/Moose/Tasking/CommandCenter.lua @@ -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 @@ -100,7 +101,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 end @@ -115,6 +117,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName ) 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 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..694cd269e 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. -- ---------------------------------------------------------------------------------------- @@ -234,14 +234,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 +394,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..514a0681c 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. @@ -1638,11 +1638,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 +1762,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 +2187,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..8c0be85a9 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,7 +49,7 @@ 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. @@ -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..6f58e404c 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 } ) 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..c89d1ec84 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: 20170204_1514' ) 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 -- @@ -2876,8 +2876,8 @@ end -- * @{#BASE.EventOnTakeOff}(): Handle the event when a unit takes off from a runway. -- * @{#BASE.EventOnTookControl}(): Handle the event when a player takes control of a unit. -- --- The EventOn() methods provide the @{Core.Event#EVENTDATA} structure to the event handling function. --- The @{Core.Event#EVENTDATA} structure contains an enriched data set of information about the event being handled. +-- The EventOn() methods provide the @{Event#EVENTDATA} structure to the event handling function. +-- The @{Event#EVENTDATA} structure contains an enriched data set of information about the event being handled. -- -- Find below an example of the prototype how to write an event handling function: -- @@ -2897,7 +2897,7 @@ 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. +-- * EventData = the @{Event#EVENTDATA} structure, containing more information of the Event. -- -- ## 1.4) Class identification methods -- @@ -2973,6 +2973,7 @@ local _ClassID = 0 BASE = { ClassName = "BASE", ClassID = 0, + _Private = {}, Events = {}, States = {} } @@ -3079,6 +3080,26 @@ function BASE:GetClassID() return self.ClassID end +--- 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 + +--- 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 + + --- Set a new listener for the class. -- @param self -- @param Dcs.DCSTypes#Event Event @@ -3817,29 +3838,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. -- -- === -- @@ -4002,7 +4023,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. -- -- === @@ -4240,6 +4261,33 @@ local _EVENTCODES = { "S_EVENT_MAX", } +local _EVENTORDER = { + [world.event.S_EVENT_SHOT] = 1, + [world.event.S_EVENT_HIT] = 1, + [world.event.S_EVENT_TAKEOFF] = 1, + [world.event.S_EVENT_LAND] = 1, + [world.event.S_EVENT_CRASH] = -1, + [world.event.S_EVENT_EJECTION] = -1, + [world.event.S_EVENT_REFUELING] = 1, + [world.event.S_EVENT_DEAD] = -1, + [world.event.S_EVENT_PILOT_DEAD] = -1, + [world.event.S_EVENT_BASE_CAPTURED] = 1, + [world.event.S_EVENT_MISSION_START] = 1, + [world.event.S_EVENT_MISSION_END] = -1, + [world.event.S_EVENT_TOOK_CONTROL] = 1, + [world.event.S_EVENT_REFUELING_STOP] = 1, + [world.event.S_EVENT_BIRTH] = 1, + [world.event.S_EVENT_HUMAN_FAILURE] = 1, + [world.event.S_EVENT_ENGINE_STARTUP] = 1, + [world.event.S_EVENT_ENGINE_SHUTDOWN] = 1, + [world.event.S_EVENT_PLAYER_ENTER_UNIT] = 1, + [world.event.S_EVENT_PLAYER_LEAVE_UNIT] = -1, + [world.event.S_EVENT_PLAYER_COMMENT] = 1, + [world.event.S_EVENT_SHOOTING_START] = 1, + [world.event.S_EVENT_SHOOTING_END] = 1, + [world.event.S_EVENT_MAX] = 1, +} + --- The Event structure -- @type EVENTDATA -- @field id @@ -4284,6 +4332,7 @@ end --- Initializes the Events structure for the event -- @param #EVENT self -- @param Dcs.DCSWorld#world.event EventID +-- @param #number EventPriority The priority of the EventClass. -- @param Core.Base#BASE EventClass -- @return #EVENT.Events function EVENT:Init( EventID, EventClass ) @@ -4292,8 +4341,13 @@ function EVENT:Init( EventID, 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" } ) @@ -4310,18 +4364,20 @@ function EVENT:Remove( EventClass, EventID ) self:F3( { EventClass, _EVENTCODES[EventID] } ) 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. +--- 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 +4411,7 @@ function EVENT:OnEventGeneric( EventFunction, EventClass, EventID ) local Event = self:Init( EventID, EventClass ) Event.EventFunction = EventFunction Event.EventClass = EventClass + return self end @@ -4931,6 +4988,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 @@ -4953,21 +5012,33 @@ function EVENT:onEvent( Event ) 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 Order = _EVENTORDER[Event.id] + self:E( { Order = Order } ) + + for EventPriority = Order == -1 and 5 or 1, Order == -1 and 1 or 5, Order 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 + self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName } ) + Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName ) + 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:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID() } ) + Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName ) + local Result, Value = xpcall( function() return EventData.EventFunction( EventData.EventClass, Event ) end, ErrorHandler ) + --EventData.EventFunction( EventData.EventClass, Event ) + end + end end end end @@ -4979,8 +5050,6 @@ 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 +5063,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 +5085,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 +5101,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 +5119,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 +5137,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 +5155,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 +5670,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 +5682,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 +5694,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 +5704,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 +5835,7 @@ do end end - self:F( { MenuGroup:GetName(), MenuText, ParentMenu.MenuPath } ) + --self:F( { MenuGroup:GetName(), MenuText, ParentMenu.MenuPath } ) return self end @@ -5844,7 +5914,7 @@ do end end - self:F( { MenuGroup:GetName(), MenuText, ParentMenu.MenuPath } ) + --self:F( { MenuGroup:GetName(), MenuText, ParentMenu.MenuPath } ) return self end @@ -5870,7 +5940,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 +5949,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 +5957,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 +5974,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 +5987,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 +6001,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 +6017,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 +6146,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 +6154,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 +6316,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 +6327,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 +6341,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 +6391,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 +6443,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 +6468,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 +6509,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 +6535,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 +6586,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 +6598,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 +6699,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 +6751,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 +6778,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: -- @@ -6802,6 +6876,8 @@ function DATABASE:New() self:_RegisterPlayers() self:_RegisterAirbases() + self:SetEventPriority( 1 ) + return self end @@ -6930,6 +7006,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 +7348,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 ) @@ -7483,9 +7562,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 +7572,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 +7598,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 +7617,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 +7632,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 +7650,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 +7670,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 +7690,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 +7708,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 +7728,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 +7740,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 +7754,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 +7824,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 +7849,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 +7875,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 +7890,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 +7929,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 +7944,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() @@ -7956,9 +8037,9 @@ function SET_BASE:FilterStop() 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 +9786,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 +9843,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 +9854,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 +10515,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 +10556,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 +10564,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 +10839,8 @@ end -- -- ![Banner Image](..\Presentations\FSM\Dia1.JPG) -- +-- === +-- -- 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 +10884,7 @@ end -- -- === -- --- # 1) @{Core.Fsm#FSM} class, extends @{Core.Base#BASE} +-- # 1) @{#FSM} class, extends @{Base#BASE} -- -- ![Transition Rules and Transition Handlers and Event Triggers](..\Presentations\FSM\Dia3.JPG) -- @@ -11785,9 +11868,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 +11880,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 +11956,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 +12182,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 +12194,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,7 +12231,7 @@ 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. @@ -12166,7 +12249,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 +12315,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 +12339,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 +12620,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 +12638,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 +12664,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 +12964,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 +13449,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. @@ -14175,11 +14258,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 +14382,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 +14807,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 +14907,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 +14943,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 +14962,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 +15020,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 +15063,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 +15204,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 +15356,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 +15375,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 +15392,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 +15609,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 +15711,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 +15808,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 +15841,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 +15868,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 +15905,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 +16392,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 +16409,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 } ) @@ -16562,11 +16648,11 @@ 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 +16683,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 +16873,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 +17046,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 +17080,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 +17121,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 +17204,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 +17235,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 @@ -18116,7 +18201,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 +18338,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 +18457,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.** +-- +-- ![Banner Image](..\Presentations\SPAWN\SPAWN.JPG) -- --- # 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 +18506,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 +18576,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. @@ -19020,6 +19112,10 @@ 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 + SpawnTemplate.uncontrolled = self.SpawnUnControlled + end end _EVENTDISPATCHER:OnBirthForTemplate( SpawnTemplate, self._OnBirth, self ) @@ -19108,7 +19204,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 +19344,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 +19367,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 +19700,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 +20404,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 +21607,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 +22314,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 +22324,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 +22351,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 +22494,7 @@ 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() Client:SetState( self, "Speeding", false ) Client:SetState( self, "Warnings", 0 ) end @@ -23413,14 +23509,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 +23527,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 +23752,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 +23815,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 +23940,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 +23994,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 +24008,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 +24495,16 @@ end -- even when there are hardly any players in the mission.** -- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) --- --- +-- -- === -- --- # 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 +24546,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 +24643,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 +24654,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 +24793,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.** -- -- ![Banner Image](..\Presentations\AI_PATROL\Dia1.JPG) -- --- -- === -- --- # 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 +24962,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,6 +24981,9 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit self.PatrolMinSpeed = PatrolMinSpeed self.PatrolMaxSpeed = PatrolMaxSpeed + -- defafult PatrolAltType to "RADIO" if not specified + self.PatrolAltType = PatrolAltType or "RADIO" + self:SetDetectionOn() self.CheckStatus = true @@ -25220,11 +25319,11 @@ 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() @@ -25390,7 +25489,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 +25504,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 +25530,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 +25618,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, @@ -25571,16 +25670,16 @@ function AI_PATROL_ZONE:OnPilotDead( 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.** -- -- ![Banner Image](..\Presentations\AI_CAS\Dia1.JPG) -- --- -- === -- --- # 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,12 +25808,13 @@ 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 @@ -25953,7 +26053,7 @@ 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, @@ -25979,7 +26079,7 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To ) -- 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, @@ -26006,7 +26106,7 @@ function AI_CAS_ZONE:onafterEngage( 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, @@ -26091,10 +26191,9 @@ end -- -- ![Banner Image](..\Presentations\AI_CAP\Dia1.JPG) -- --- -- === -- --- # 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 +26259,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 +26267,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 +26319,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 +26601,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 +26625,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, @@ -26615,7 +26715,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.** +-- +-- ![Banner Image](..\Presentations\AI_CARGO\CARGO.JPG) -- -- === -- @@ -26629,8 +26732,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 +26772,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 +26810,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 +26842,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 +27747,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 +28040,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 +28292,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: -- @@ -28455,7 +28558,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: -- @@ -28739,7 +28842,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 @@ -28758,7 +28862,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 end @@ -28773,6 +28878,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName ) 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 @@ -29040,15 +29146,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 +29998,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. -- ---------------------------------------------------------------------------------------- @@ -30125,14 +30232,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 +30392,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 +31017,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 +31167,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 +31217,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 +31250,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 +31411,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 +31526,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 +31604,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..c89d1ec84 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: 20170204_1514' ) 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 -- @@ -2876,8 +2876,8 @@ end -- * @{#BASE.EventOnTakeOff}(): Handle the event when a unit takes off from a runway. -- * @{#BASE.EventOnTookControl}(): Handle the event when a player takes control of a unit. -- --- The EventOn() methods provide the @{Core.Event#EVENTDATA} structure to the event handling function. --- The @{Core.Event#EVENTDATA} structure contains an enriched data set of information about the event being handled. +-- The EventOn() methods provide the @{Event#EVENTDATA} structure to the event handling function. +-- The @{Event#EVENTDATA} structure contains an enriched data set of information about the event being handled. -- -- Find below an example of the prototype how to write an event handling function: -- @@ -2897,7 +2897,7 @@ 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. +-- * EventData = the @{Event#EVENTDATA} structure, containing more information of the Event. -- -- ## 1.4) Class identification methods -- @@ -2973,6 +2973,7 @@ local _ClassID = 0 BASE = { ClassName = "BASE", ClassID = 0, + _Private = {}, Events = {}, States = {} } @@ -3079,6 +3080,26 @@ function BASE:GetClassID() return self.ClassID end +--- 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 + +--- 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 + + --- Set a new listener for the class. -- @param self -- @param Dcs.DCSTypes#Event Event @@ -3817,29 +3838,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. -- -- === -- @@ -4002,7 +4023,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. -- -- === @@ -4240,6 +4261,33 @@ local _EVENTCODES = { "S_EVENT_MAX", } +local _EVENTORDER = { + [world.event.S_EVENT_SHOT] = 1, + [world.event.S_EVENT_HIT] = 1, + [world.event.S_EVENT_TAKEOFF] = 1, + [world.event.S_EVENT_LAND] = 1, + [world.event.S_EVENT_CRASH] = -1, + [world.event.S_EVENT_EJECTION] = -1, + [world.event.S_EVENT_REFUELING] = 1, + [world.event.S_EVENT_DEAD] = -1, + [world.event.S_EVENT_PILOT_DEAD] = -1, + [world.event.S_EVENT_BASE_CAPTURED] = 1, + [world.event.S_EVENT_MISSION_START] = 1, + [world.event.S_EVENT_MISSION_END] = -1, + [world.event.S_EVENT_TOOK_CONTROL] = 1, + [world.event.S_EVENT_REFUELING_STOP] = 1, + [world.event.S_EVENT_BIRTH] = 1, + [world.event.S_EVENT_HUMAN_FAILURE] = 1, + [world.event.S_EVENT_ENGINE_STARTUP] = 1, + [world.event.S_EVENT_ENGINE_SHUTDOWN] = 1, + [world.event.S_EVENT_PLAYER_ENTER_UNIT] = 1, + [world.event.S_EVENT_PLAYER_LEAVE_UNIT] = -1, + [world.event.S_EVENT_PLAYER_COMMENT] = 1, + [world.event.S_EVENT_SHOOTING_START] = 1, + [world.event.S_EVENT_SHOOTING_END] = 1, + [world.event.S_EVENT_MAX] = 1, +} + --- The Event structure -- @type EVENTDATA -- @field id @@ -4284,6 +4332,7 @@ end --- Initializes the Events structure for the event -- @param #EVENT self -- @param Dcs.DCSWorld#world.event EventID +-- @param #number EventPriority The priority of the EventClass. -- @param Core.Base#BASE EventClass -- @return #EVENT.Events function EVENT:Init( EventID, EventClass ) @@ -4292,8 +4341,13 @@ function EVENT:Init( EventID, 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" } ) @@ -4310,18 +4364,20 @@ function EVENT:Remove( EventClass, EventID ) self:F3( { EventClass, _EVENTCODES[EventID] } ) 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. +--- 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 +4411,7 @@ function EVENT:OnEventGeneric( EventFunction, EventClass, EventID ) local Event = self:Init( EventID, EventClass ) Event.EventFunction = EventFunction Event.EventClass = EventClass + return self end @@ -4931,6 +4988,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 @@ -4953,21 +5012,33 @@ function EVENT:onEvent( Event ) 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 Order = _EVENTORDER[Event.id] + self:E( { Order = Order } ) + + for EventPriority = Order == -1 and 5 or 1, Order == -1 and 1 or 5, Order 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 + self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName } ) + Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName ) + 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:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID() } ) + Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName ) + local Result, Value = xpcall( function() return EventData.EventFunction( EventData.EventClass, Event ) end, ErrorHandler ) + --EventData.EventFunction( EventData.EventClass, Event ) + end + end end end end @@ -4979,8 +5050,6 @@ 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 +5063,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 +5085,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 +5101,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 +5119,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 +5137,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 +5155,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 +5670,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 +5682,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 +5694,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 +5704,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 +5940,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 +5949,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 +5957,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 +5974,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 +5987,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 +6001,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 +6017,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 +6146,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 +6154,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 +6316,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 +6327,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 +6341,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 +6443,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 +6468,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 +6509,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 +6535,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 +6586,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 +6598,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 +6699,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 +6751,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 +6778,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: -- @@ -6806,6 +6876,8 @@ function DATABASE:New() self:_RegisterPlayers() self:_RegisterAirbases() + self:SetEventPriority( 1 ) + return self end @@ -6934,6 +7006,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 +7348,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 ) @@ -7487,9 +7562,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 +7572,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 +7598,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 +7617,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 +7632,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 +7650,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 +7670,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 +7690,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 +7708,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 +7728,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 +7740,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 +7754,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 +7824,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 +7849,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 +7875,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 +7890,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 +7929,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 +7944,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() @@ -7960,9 +8037,9 @@ function SET_BASE:FilterStop() 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 +9786,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 +9843,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 +9854,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 +10515,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 +10556,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 +10564,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 +10839,8 @@ end -- -- ![Banner Image](..\Presentations\FSM\Dia1.JPG) -- +-- === +-- -- 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 +10884,7 @@ end -- -- === -- --- # 1) @{Core.Fsm#FSM} class, extends @{Core.Base#BASE} +-- # 1) @{#FSM} class, extends @{Base#BASE} -- -- ![Transition Rules and Transition Handlers and Event Triggers](..\Presentations\FSM\Dia3.JPG) -- @@ -11789,9 +11868,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 +11880,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 +11956,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 +12182,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 +12194,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,7 +12231,7 @@ 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. @@ -12170,7 +12249,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 +12315,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 +12339,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 +12620,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 +12638,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 +12664,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 +12964,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 +13449,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. @@ -14179,11 +14258,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 +14382,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 +14807,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 +14907,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 +14943,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 +14962,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 +15020,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 +15063,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 +15204,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 +15356,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 +15375,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 +15392,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 +15609,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 +15711,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 +15808,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 +15841,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 +15868,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 +15905,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 +16392,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 +16409,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 } ) @@ -16566,11 +16648,11 @@ 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 +16683,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 +16873,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 +17046,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 +17080,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 +17121,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 +17204,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 +17235,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 @@ -18120,7 +18201,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 +18338,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 +18457,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.** +-- +-- ![Banner Image](..\Presentations\SPAWN\SPAWN.JPG) -- --- # 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 +18506,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 +18576,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. @@ -19024,6 +19112,10 @@ 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 + SpawnTemplate.uncontrolled = self.SpawnUnControlled + end end _EVENTDISPATCHER:OnBirthForTemplate( SpawnTemplate, self._OnBirth, self ) @@ -19112,7 +19204,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 +19344,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 +19367,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 +19700,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 +20404,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 +21607,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 +22314,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 +22324,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 +22351,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 +22494,7 @@ 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() Client:SetState( self, "Speeding", false ) Client:SetState( self, "Warnings", 0 ) end @@ -23417,14 +23509,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 +23527,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 +23752,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 +23815,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 +23940,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 +23994,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 +24008,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 +24495,16 @@ end -- even when there are hardly any players in the mission.** -- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) --- --- +-- -- === -- --- # 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 +24546,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 +24643,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 +24654,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 +24793,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.** -- -- ![Banner Image](..\Presentations\AI_PATROL\Dia1.JPG) -- --- -- === -- --- # 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}. -- @@ -25228,11 +25319,11 @@ 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() @@ -25579,16 +25670,16 @@ function AI_PATROL_ZONE:OnPilotDead( 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.** -- -- ![Banner Image](..\Presentations\AI_CAS\Dia1.JPG) -- --- -- === -- --- # 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. @@ -26100,10 +26191,9 @@ end -- -- ![Banner Image](..\Presentations\AI_CAP\Dia1.JPG) -- --- -- === -- --- # 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 +26259,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 +26267,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. -- -- ==== -- @@ -26625,7 +26715,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.** +-- +-- ![Banner Image](..\Presentations\AI_CARGO\CARGO.JPG) -- -- === -- @@ -26639,8 +26732,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 +26772,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 +26810,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 +26842,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 +27747,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 +28040,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 +28292,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: -- @@ -28465,7 +28558,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: -- @@ -28749,7 +28842,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 @@ -28768,7 +28862,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 end @@ -28783,6 +28878,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName ) 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 @@ -29050,15 +29146,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 +29998,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. -- ---------------------------------------------------------------------------------------- @@ -30135,14 +30232,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 +30392,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 +31021,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 +31167,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 +31217,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 +31250,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 +31411,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 +31526,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 +31604,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/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..a03c8d2db 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/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/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..fce1dfa48 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..07f06daa6 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/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..13bde46ac 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/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..6f1e31978 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..8d8a88867 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/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.

    Banner Image

    -
    -

    1) AI.AIBalancer#AIBALANCER class, extends Core.Fsm#FSM_SET

    +

    1) AIBalancer#AIBALANCER class, extends Fsm#FSM_SET

    -

    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 @@

    Banner Image

    -
    -

    1) #AICAPZONE class, extends AI.AICAP#AIPATROL_ZONE

    +

    1) #AICAPZONE class, extends AICAP#AIPATROL_ZONE

    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..bae974427 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.

    Banner Image

    -
    -

    1) #AICASZONE class, extends AI.AIPatrol#AIPATROL_ZONE

    +

    1) #AICASZONE class, extends AIPatrol#AIPATROL_ZONE

    -

    #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.

    @@ -276,7 +277,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

    @@ -601,7 +602,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 +643,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 :

  • diff --git a/docs/Documentation/AI_Patrol.html b/docs/Documentation/AI_Patrol.html index 36cd59344..9510146aa 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.

    Banner Image

    -
    -

    1) #AIPATROLZONE class, extends Core.Fsm#FSM_CONTROLLABLE

    +

    1) #AIPATROLZONE class, extends Fsm#FSM_CONTROLLABLE

    The #AIPATROLZONE class implements the core functions to patrol a Zone by an AI Controllable or Group.

    @@ -317,7 +318,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 +334,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 +451,12 @@ Use the method AIPATROLZONE.M AI_PATROL_ZONE:OnPilotDead(EventData) + + + + AI_PATROL_ZONE.PatrolAltType + + @@ -868,7 +875,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 +884,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 +964,7 @@ self

    -AI_PATROL_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed) +AI_PATROL_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType)
    @@ -995,6 +1002,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 +1764,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 FSM class, extends Core.Fsm#FSM_PROCESS

    +

    #ACT_ACCOUNT FSM class, extends Fsm#FSM_PROCESS

    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 @@
    -

    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:

    -

    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.

    +

    The EventOn() methods provide the Event#EVENTDATA structure to the event handling function. +The Event#EVENTDATA structure contains an enriched data set of information about the event being handled.

    Find below an example of the prototype how to write an event handling function:

    @@ -189,7 +190,7 @@ The Core.Event#EVENTDATA structure co
    • self = the object that is handling the EventOnPlayerEnterUnit.
    • -
    • EventData = the Core.Event#EVENTDATA structure, containing more information of the Event.
    • +
    • EventData = the Event#EVENTDATA structure, containing more information of the Event.

    1.4) Class identification methods

    @@ -524,6 +525,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.

    @@ -554,6 +561,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    BASE:New() + + + + BASE:SetEventPriority(EventPriority) + +

    Set the Class Event processing Priority.

    @@ -628,6 +641,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 + + @@ -1731,6 +1750,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) @@ -1867,6 +1908,37 @@ Child

    + +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

    +
      +
    • + +

      #number EventPriority : +The Event processing Priority.

      + +
    • +
    +

    Return value

    + + +

    self

    + +
    +
    +
    +
    + BASE:SetState(Object, Key, Value) @@ -2176,6 +2248,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.

    - +

    Banner Image


    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.
    -

    1) AI.AICargo#AICARGO class, extends Core.Fsm#FSM_PROCESS

    + +

    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.
    • +
    + +

    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.

    @@ -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/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..c2a5442eb 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 @@ -

    1) Wrapper.Controllable#CONTROLLABLE class, extends Wrapper.Positionable#POSITIONABLE

    -

    The Wrapper.Controllable#CONTROLLABLE class is a wrapper class to handle the DCS Controllable objects:

    +

    1) Controllable#CONTROLLABLE class, extends Positionable#POSITIONABLE

    +

    The Controllable#CONTROLLABLE class is a wrapper class to handle the DCS Controllable objects:

    +
    +
    + + + +EVENTDATA.IniGroup + +
    +
    + + +
    diff --git a/docs/Documentation/Fsm.html b/docs/Documentation/Fsm.html index e509e364b..712e2566e 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 @@

    Banner Image

    +
    +

    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


    -

    1) Core.Fsm#FSM class, extends Core.Base#BASE

    +

    1) #FSM class, extends Base#BASE

    Transition Rules and Transition Handlers and Event Triggers

    @@ -1482,7 +1485,7 @@ A string defining the start state.

    - #string + FSM._StartState @@ -1776,6 +1779,7 @@ A string defining the start state.

    + FSM.current 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 @@ -

    1) Wrapper.Group#GROUP class, extends Wrapper.Controllable#CONTROLLABLE

    -

    The Wrapper.Group#GROUP class is a wrapper class to handle the DCS Group objects:

    +

    1) Group#GROUP class, extends Controllable#CONTROLLABLE

    +

    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 @@ -

    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: