mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
New File Structure Updates
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
--
|
||||
-- 1.1) BASE constructor
|
||||
-- ---------------------
|
||||
-- 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.
|
||||
-- Any class derived from BASE, must use the @{Core.Base#BASE.New) constructor within the @{Core.Base#BASE.Inherit) method.
|
||||
-- See an example at the @{Core.Base#BASE.New} method how this is done.
|
||||
--
|
||||
-- 1.2) BASE Trace functionality
|
||||
-- -----------------------------
|
||||
@@ -199,7 +199,7 @@ end
|
||||
|
||||
--- Set a new listener for the class.
|
||||
-- @param self
|
||||
-- @param DCSTypes#Event Event
|
||||
-- @param Dcs.DCSTypes#Event Event
|
||||
-- @param #function EventFunction
|
||||
-- @return #BASE
|
||||
function BASE:AddEvent( Event, EventFunction )
|
||||
@@ -215,7 +215,7 @@ end
|
||||
|
||||
--- Returns the event dispatcher
|
||||
-- @param #BASE self
|
||||
-- @return Event#EVENT
|
||||
-- @return Core.Event#EVENT
|
||||
function BASE:Event()
|
||||
|
||||
return _EVENTDISPATCHER
|
||||
@@ -563,8 +563,8 @@ local BaseEventCodes = {
|
||||
|
||||
--- Creation of a Birth Event.
|
||||
-- @param #BASE self
|
||||
-- @param DCSTypes#Time EventTime The time stamp of the event.
|
||||
-- @param DCSObject#Object Initiator The initiating object of the event.
|
||||
-- @param Dcs.DCSTypes#Time EventTime The time stamp of the event.
|
||||
-- @param Dcs.DCSWrapper.Object#Object Initiator The initiating object of the event.
|
||||
-- @param #string IniUnitName The initiating unit name.
|
||||
-- @param place
|
||||
-- @param subplace
|
||||
@@ -585,8 +585,8 @@ end
|
||||
|
||||
--- Creation of a Crash Event.
|
||||
-- @param #BASE self
|
||||
-- @param DCSTypes#Time EventTime The time stamp of the event.
|
||||
-- @param DCSObject#Object Initiator The initiating object of the event.
|
||||
-- @param Dcs.DCSTypes#Time EventTime The time stamp of the event.
|
||||
-- @param Dcs.DCSWrapper.Object#Object Initiator The initiating object of the event.
|
||||
function BASE:CreateEventCrash( EventTime, Initiator )
|
||||
self:F( { EventTime, Initiator } )
|
||||
|
||||
@@ -599,10 +599,10 @@ function BASE:CreateEventCrash( EventTime, Initiator )
|
||||
world.onEvent( Event )
|
||||
end
|
||||
|
||||
-- TODO: Complete DCSTypes#Event structure.
|
||||
-- TODO: Complete Dcs.DCSTypes#Event structure.
|
||||
--- The main event handling function... This function captures all events generated for the class.
|
||||
-- @param #BASE self
|
||||
-- @param DCSTypes#Event event
|
||||
-- @param Dcs.DCSTypes#Event event
|
||||
function BASE:onEvent(event)
|
||||
--self:F( { BaseEventCodes[event.id], event } )
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- 1) @{Database#DATABASE} class, extends @{Base#BASE}
|
||||
-- 1) @{Core.Database#DATABASE} class, extends @{Core.Base#BASE}
|
||||
-- ===================================================
|
||||
-- Mission designers can use the DATABASE class to refer to:
|
||||
--
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
--- DATABASE class
|
||||
-- @type DATABASE
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Base#BASE
|
||||
DATABASE = {
|
||||
ClassName = "DATABASE",
|
||||
Templates = {
|
||||
@@ -106,7 +106,7 @@ end
|
||||
--- Finds a Unit based on the Unit Name.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string UnitName
|
||||
-- @return Unit#UNIT The found Unit.
|
||||
-- @return Wrapper.Unit#UNIT The found Unit.
|
||||
function DATABASE:FindUnit( UnitName )
|
||||
|
||||
local UnitFound = self.UNITS[UnitName]
|
||||
@@ -154,7 +154,7 @@ end
|
||||
--- Finds a STATIC based on the StaticName.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string StaticName
|
||||
-- @return Static#STATIC The found STATIC.
|
||||
-- @return Wrapper.Static#STATIC The found STATIC.
|
||||
function DATABASE:FindStatic( StaticName )
|
||||
|
||||
local StaticFound = self.STATICS[StaticName]
|
||||
@@ -181,7 +181,7 @@ end
|
||||
--- Finds a AIRBASE based on the AirbaseName.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string AirbaseName
|
||||
-- @return Airbase#AIRBASE The found AIRBASE.
|
||||
-- @return Wrapper.Airbase#AIRBASE The found AIRBASE.
|
||||
function DATABASE:FindAirbase( AirbaseName )
|
||||
|
||||
local AirbaseFound = self.AIRBASES[AirbaseName]
|
||||
@@ -192,7 +192,7 @@ end
|
||||
--- Finds a CLIENT based on the ClientName.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string ClientName
|
||||
-- @return Client#CLIENT The found CLIENT.
|
||||
-- @return Wrapper.Client#CLIENT The found CLIENT.
|
||||
function DATABASE:FindClient( ClientName )
|
||||
|
||||
local ClientFound = self.CLIENTS[ClientName]
|
||||
@@ -215,7 +215,7 @@ end
|
||||
--- Finds a GROUP based on the GroupName.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string GroupName
|
||||
-- @return Group#GROUP The found GROUP.
|
||||
-- @return Wrapper.Group#GROUP The found GROUP.
|
||||
function DATABASE:FindGroup( GroupName )
|
||||
|
||||
local GroupFound = self.GROUPS[GroupName]
|
||||
@@ -535,7 +535,7 @@ end
|
||||
|
||||
--- Handles the OnBirth event for the alive units set.
|
||||
-- @param #DATABASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
function DATABASE:_EventOnBirth( Event )
|
||||
self:F2( { Event } )
|
||||
|
||||
@@ -549,7 +549,7 @@ end
|
||||
|
||||
--- Handles the OnDead or OnCrash event for alive units set.
|
||||
-- @param #DATABASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
function DATABASE:_EventOnDeadOrCrash( Event )
|
||||
self:F2( { Event } )
|
||||
|
||||
@@ -564,7 +564,7 @@ end
|
||||
|
||||
--- Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied).
|
||||
-- @param #DATABASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
function DATABASE:_EventOnPlayerEnterUnit( Event )
|
||||
self:F2( { Event } )
|
||||
|
||||
@@ -579,7 +579,7 @@ end
|
||||
|
||||
--- Handles the OnPlayerLeaveUnit event to clean the active players table.
|
||||
-- @param #DATABASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
function DATABASE:_EventOnPlayerLeaveUnit( Event )
|
||||
self:F2( { Event } )
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ end
|
||||
|
||||
--- Initializes the Events structure for the event
|
||||
-- @param #EVENT self
|
||||
-- @param DCSWorld#world.event EventID
|
||||
-- @param Dcs.DCSWorld#world.event EventID
|
||||
-- @param Core.Base#BASE EventClass
|
||||
-- @return #EVENT.Events
|
||||
function EVENT:Init( EventID, EventClass )
|
||||
@@ -104,7 +104,7 @@ end
|
||||
--- Removes an Events entry
|
||||
-- @param #EVENT self
|
||||
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
|
||||
-- @param DCSWorld#world.event EventID
|
||||
-- @param Dcs.DCSWorld#world.event EventID
|
||||
-- @return #EVENT.Events
|
||||
function EVENT:Remove( EventClass, EventID )
|
||||
self:F3( { EventClass, _EVENTCODES[EventID] } )
|
||||
@@ -146,7 +146,7 @@ end
|
||||
--- Set a new listener for an S_EVENT_X event independent from a unit or a weapon.
|
||||
-- @param #EVENT self
|
||||
-- @param #function EventFunction The function to be called when the event occurs for the unit.
|
||||
-- @param Base#BASE EventClass The self instance of the class for which the event is captured. When the event happens, the event process will be called in this class provided.
|
||||
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is captured. When the event happens, the event process will be called in this class provided.
|
||||
-- @param EventID
|
||||
-- @return #EVENT
|
||||
function EVENT:OnEventGeneric( EventFunction, EventClass, EventID )
|
||||
@@ -163,7 +163,7 @@ end
|
||||
-- @param #EVENT self
|
||||
-- @param #string EventDCSUnitName
|
||||
-- @param #function EventFunction The function to be called when the event occurs for the unit.
|
||||
-- @param Base#BASE EventClass The self instance of the class for which the event is.
|
||||
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
|
||||
-- @param EventID
|
||||
-- @return #EVENT
|
||||
function EVENT:OnEventForUnit( EventDCSUnitName, EventFunction, EventClass, EventID )
|
||||
@@ -183,7 +183,7 @@ do -- OnBirth
|
||||
|
||||
--- Create an OnBirth event handler for a group
|
||||
-- @param #EVENT self
|
||||
-- @param Group#GROUP EventGroup
|
||||
-- @param Wrapper.Group#GROUP EventGroup
|
||||
-- @param #function EventFunction The function to be called when the event occurs for the unit.
|
||||
-- @param EventClass The self instance of the class for which the event is.
|
||||
-- @return #EVENT
|
||||
@@ -241,7 +241,7 @@ do -- OnCrash
|
||||
|
||||
--- Create an OnCrash event handler for a group
|
||||
-- @param #EVENT self
|
||||
-- @param Group#GROUP EventGroup
|
||||
-- @param Wrapper.Group#GROUP EventGroup
|
||||
-- @param #function EventFunction The function to be called when the event occurs for the unit.
|
||||
-- @param EventClass The self instance of the class for which the event is.
|
||||
-- @return #EVENT
|
||||
@@ -298,7 +298,7 @@ do -- OnDead
|
||||
|
||||
--- Create an OnDead event handler for a group
|
||||
-- @param #EVENT self
|
||||
-- @param Group#GROUP EventGroup
|
||||
-- @param Wrapper.Group#GROUP EventGroup
|
||||
-- @param #function EventFunction The function to be called when the event occurs for the unit.
|
||||
-- @param EventClass The self instance of the class for which the event is.
|
||||
-- @return #EVENT
|
||||
|
||||
@@ -15,17 +15,17 @@
|
||||
--
|
||||
-- ### To manage **main menus**, the classes begin with **MENU_**:
|
||||
--
|
||||
-- * @{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".
|
||||
-- * @{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".
|
||||
--
|
||||
-- ### To manage **command menus**, which are menus that allow the player to issue **functions**, the classes begin with **MENU_COMMAND_**:
|
||||
--
|
||||
-- * @{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".
|
||||
-- * @{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".
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -37,11 +37,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) @{Menu#MENU_BASE} class, extends @{Base#BASE}
|
||||
-- 1.1) @{Core.Menu#MENU_BASE} class, extends @{Core.Base#BASE}
|
||||
-- --------------------------------------------------
|
||||
-- The @{#MENU_BASE} class defines the main MENU class where other MENU classes are derived from.
|
||||
--
|
||||
-- 1.2) @{Menu#MENU_COMMAND_BASE} class, extends @{Base#BASE}
|
||||
-- 1.2) @{Core.Menu#MENU_COMMAND_BASE} class, extends @{Core.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 +53,15 @@
|
||||
-- ======================
|
||||
-- The underlying classes manage the menus for a complete mission file.
|
||||
--
|
||||
-- 2.1) @{Menu#MENU_MISSION} class, extends @{Menu#MENU_BASE}
|
||||
-- 2.1) @{Menu#MENU_MISSION} class, extends @{Core.Menu#MENU_BASE}
|
||||
-- ---------------------------------------------------------
|
||||
-- The @{Menu#MENU_MISSION} class manages the main menus for a complete mission.
|
||||
-- The @{Core.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 @{Menu#MENU_COMMAND_BASE}
|
||||
-- 2.2) @{Menu#MENU_MISSION_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
|
||||
-- -------------------------------------------------------------------------
|
||||
-- The @{Menu#MENU_MISSION_COMMAND} class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
|
||||
-- The @{Core.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 +71,15 @@
|
||||
-- =========================
|
||||
-- The underlying classes manage the menus for whole coalitions.
|
||||
--
|
||||
-- 3.1) @{Menu#MENU_COALITION} class, extends @{Menu#MENU_BASE}
|
||||
-- 3.1) @{Menu#MENU_COALITION} class, extends @{Core.Menu#MENU_BASE}
|
||||
-- ------------------------------------------------------------
|
||||
-- The @{Menu#MENU_COALITION} class manages the main menus for coalitions.
|
||||
-- The @{Core.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 @{Menu#MENU_COMMAND_BASE}
|
||||
-- 3.2) @{Menu#MENU_COALITION_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
|
||||
-- ----------------------------------------------------------------------------
|
||||
-- The @{Menu#MENU_COALITION_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||
-- The @{Core.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 +89,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 @{Menu#MENU_BASE}
|
||||
-- 4.1) @{Menu#MENU_GROUP} class, extends @{Core.Menu#MENU_BASE}
|
||||
-- --------------------------------------------------------
|
||||
-- The @{Menu#MENU_GROUP} class manages the main menus for coalitions.
|
||||
-- The @{Core.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 @{Menu#MENU_COMMAND_BASE}
|
||||
-- 4.2) @{Menu#MENU_GROUP_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
|
||||
-- ------------------------------------------------------------------------
|
||||
-- The @{Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||
-- The @{Core.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 +107,15 @@
|
||||
-- ======================
|
||||
-- The underlying classes manage the menus for units with skill level client or player.
|
||||
--
|
||||
-- 5.1) @{Menu#MENU_CLIENT} class, extends @{Menu#MENU_BASE}
|
||||
-- 5.1) @{Menu#MENU_CLIENT} class, extends @{Core.Menu#MENU_BASE}
|
||||
-- ---------------------------------------------------------
|
||||
-- The @{Menu#MENU_CLIENT} class manages the main menus for coalitions.
|
||||
-- The @{Core.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 @{Menu#MENU_COMMAND_BASE}
|
||||
-- 5.2) @{Menu#MENU_CLIENT_COMMAND} class, extends @{Core.Menu#MENU_COMMAND_BASE}
|
||||
-- -------------------------------------------------------------------------
|
||||
-- The @{Menu#MENU_CLIENT_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||
-- The @{Core.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}.
|
||||
--
|
||||
@@ -351,7 +351,7 @@ do -- MENU_COALITION
|
||||
|
||||
--- MENU_COALITION constructor. Creates a new MENU_COALITION object and creates the menu for a complete coalition.
|
||||
-- @param #MENU_COALITION self
|
||||
-- @param DCSCoalition#coalition.side Coalition The coalition owning the menu.
|
||||
-- @param Dcs.DCSCoalition#coalition.side Coalition The coalition owning the menu.
|
||||
-- @param #string MenuText The text for the menu.
|
||||
-- @param #table ParentMenu The parent menu. This parameter can be ignored if you want the menu to be located at the perent menu of DCS world (under F10 other).
|
||||
-- @return #MENU_COALITION self
|
||||
@@ -420,7 +420,7 @@ do -- MENU_COALITION_COMMAND
|
||||
|
||||
--- MENU_COALITION constructor. Creates a new radio command item for a coalition, which can invoke a function with parameters.
|
||||
-- @param #MENU_COALITION_COMMAND self
|
||||
-- @param DCSCoalition#coalition.side Coalition The coalition owning the menu.
|
||||
-- @param Dcs.DCSCoalition#coalition.side Coalition The coalition owning the menu.
|
||||
-- @param #string MenuText The text for the menu.
|
||||
-- @param Menu#MENU_COALITION ParentMenu The parent menu.
|
||||
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
|
||||
@@ -493,7 +493,7 @@ do -- MENU_CLIENT
|
||||
-- MenuStatus[MenuClientName]:Remove()
|
||||
-- end
|
||||
--
|
||||
-- --- @param Client#CLIENT MenuClient
|
||||
-- --- @param Wrapper.Client#CLIENT MenuClient
|
||||
-- local function AddStatusMenu( MenuClient )
|
||||
-- local MenuClientName = MenuClient:GetName()
|
||||
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||
@@ -526,7 +526,7 @@ do -- MENU_CLIENT
|
||||
|
||||
--- MENU_CLIENT constructor. Creates a new radio menu item for a client.
|
||||
-- @param #MENU_CLIENT self
|
||||
-- @param Client#CLIENT Client The Client owning the menu.
|
||||
-- @param Wrapper.Client#CLIENT Client The Client owning the menu.
|
||||
-- @param #string MenuText The text for the menu.
|
||||
-- @param #table ParentMenu The parent menu.
|
||||
-- @return #MENU_CLIENT self
|
||||
@@ -618,7 +618,7 @@ do -- MENU_CLIENT
|
||||
|
||||
--- MENU_CLIENT_COMMAND constructor. Creates a new radio command item for a client, which can invoke a function with parameters.
|
||||
-- @param #MENU_CLIENT_COMMAND self
|
||||
-- @param Client#CLIENT Client The Client owning the menu.
|
||||
-- @param Wrapper.Client#CLIENT Client The Client owning the menu.
|
||||
-- @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.
|
||||
@@ -719,7 +719,7 @@ do
|
||||
-- MenuStatus[MenuGroupName]:Remove()
|
||||
-- end
|
||||
--
|
||||
-- --- @param Group#GROUP MenuGroup
|
||||
-- --- @param Wrapper.Group#GROUP MenuGroup
|
||||
-- local function AddStatusMenu( MenuGroup )
|
||||
-- local MenuGroupName = MenuGroup:GetName()
|
||||
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||
@@ -753,7 +753,7 @@ do
|
||||
|
||||
--- MENU_GROUP constructor. Creates a new radio menu item for a group.
|
||||
-- @param #MENU_GROUP self
|
||||
-- @param Group#GROUP MenuGroup The Group owning the menu.
|
||||
-- @param Wrapper.Group#GROUP MenuGroup The Group owning the menu.
|
||||
-- @param #string MenuText The text for the menu.
|
||||
-- @param #table ParentMenu The parent menu.
|
||||
-- @return #MENU_GROUP self
|
||||
@@ -835,7 +835,7 @@ do
|
||||
|
||||
--- Creates a new radio command item for a group
|
||||
-- @param #MENU_GROUP_COMMAND self
|
||||
-- @param Group#GROUP MenuGroup The Group owning the menu.
|
||||
-- @param Wrapper.Group#GROUP MenuGroup The Group owning the menu.
|
||||
-- @param MenuText The text for the menu.
|
||||
-- @param ParentMenu The parent menu.
|
||||
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- This module contains the MESSAGE class.
|
||||
--
|
||||
-- 1) @{Message#MESSAGE} class, extends @{Base#BASE}
|
||||
-- 1) @{Core.Message#MESSAGE} class, extends @{Core.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,23 +8,23 @@
|
||||
--
|
||||
-- 1.1) MESSAGE construction methods
|
||||
-- ---------------------------------
|
||||
-- Messages are created with @{Message#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet.
|
||||
-- Messages are created with @{Core.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 @{Message#MESSAGE.ToClient}.
|
||||
-- * Coalitions with @{Message#MESSAGE.ToCoalition}.
|
||||
-- * All Players with @{Message#MESSAGE.ToAll}.
|
||||
-- * Clients with @{Core.Message#MESSAGE.ToClient}.
|
||||
-- * Coalitions with @{Core.Message#MESSAGE.ToCoalition}.
|
||||
-- * All Players with @{Core.Message#MESSAGE.ToAll}.
|
||||
--
|
||||
-- @module Message
|
||||
-- @author FlightControl
|
||||
|
||||
--- The MESSAGE class
|
||||
-- @type MESSAGE
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Base#BASE
|
||||
MESSAGE = {
|
||||
ClassName = "MESSAGE",
|
||||
MessageCategory = 0,
|
||||
@@ -76,7 +76,7 @@ end
|
||||
|
||||
--- Sends a MESSAGE to a Client Group. Note that the Group needs to be defined within the ME with the skillset "Client" or "Player".
|
||||
-- @param #MESSAGE self
|
||||
-- @param Client#CLIENT Client is the Group of the Client.
|
||||
-- @param Wrapper.Client#CLIENT Client is the Group of the Client.
|
||||
-- @return #MESSAGE
|
||||
-- @usage
|
||||
-- -- Send the 2 messages created with the @{New} method to the Client Group.
|
||||
@@ -108,7 +108,7 @@ end
|
||||
|
||||
--- Sends a MESSAGE to a Group.
|
||||
-- @param #MESSAGE self
|
||||
-- @param Group#GROUP Group is the Group.
|
||||
-- @param Wrapper.Group#GROUP Group is the Group.
|
||||
-- @return #MESSAGE
|
||||
function MESSAGE:ToGroup( Group )
|
||||
self:F( Group.GroupName )
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- This module contains the POINT classes.
|
||||
--
|
||||
-- 1) @{Point#POINT_VEC3} class, extends @{Base#BASE}
|
||||
-- 1) @{Core.Point#POINT_VEC3} class, extends @{Core.Base#BASE}
|
||||
-- ==================================================
|
||||
-- The @{Point#POINT_VEC3} class defines a 3D point in the simulator.
|
||||
-- The @{Core.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.
|
||||
@@ -12,19 +12,19 @@
|
||||
-- A new POINT_VEC3 instance can be created with:
|
||||
--
|
||||
-- * @{#POINT_VEC3.New}(): a 3D point.
|
||||
-- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
|
||||
-- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{Dcs.DCSTypes#Vec3}.
|
||||
--
|
||||
--
|
||||
-- 2) @{Point#POINT_VEC2} class, extends @{Point#POINT_VEC3}
|
||||
-- 2) @{Core.Point#POINT_VEC2} class, extends @{Core.Point#POINT_VEC3}
|
||||
-- =========================================================
|
||||
-- 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.
|
||||
-- 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.
|
||||
--
|
||||
-- 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 @{DCSTypes#Vec2}.
|
||||
-- * @{#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{Dcs.DCSTypes#Vec2}.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -58,12 +58,12 @@
|
||||
|
||||
--- The POINT_VEC3 class
|
||||
-- @type POINT_VEC3
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Base#BASE
|
||||
-- @field #number x The x coordinate in 3D space.
|
||||
-- @field #number y The y coordinate in 3D space.
|
||||
-- @field #number z The z coordiante in 3D space.
|
||||
-- @field #POINT_VEC3.SmokeColor SmokeColor
|
||||
-- @field Utils#FLARECOLOR FlareColor
|
||||
-- @field Utilities.Utils#FLARECOLOR FlareColor
|
||||
-- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
|
||||
-- @field #POINT_VEC3.RoutePointType RoutePointType
|
||||
-- @field #POINT_VEC3.RoutePointAction RoutePointAction
|
||||
@@ -84,8 +84,8 @@ POINT_VEC3 = {
|
||||
--- The POINT_VEC2 class
|
||||
-- @type POINT_VEC2
|
||||
-- @extends #POINT_VEC3
|
||||
-- @field DCSTypes#Distance x The x coordinate in meters.
|
||||
-- @field DCSTypes#Distance y the y coordinate in meters.
|
||||
-- @field Dcs.DCSTypes#Distance x The x coordinate in meters.
|
||||
-- @field Dcs.DCSTypes#Distance y the y coordinate in meters.
|
||||
POINT_VEC2 = {
|
||||
ClassName = "POINT_VEC2",
|
||||
}
|
||||
@@ -109,10 +109,10 @@ do -- POINT_VEC3
|
||||
|
||||
--- Create a new POINT_VEC3 object.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Distance x The x coordinate of the Vec3 point, pointing to the North.
|
||||
-- @param DCSTypes#Distance y The y coordinate of the Vec3 point, pointing Upwards.
|
||||
-- @param DCSTypes#Distance z The z coordinate of the Vec3 point, pointing to the Right.
|
||||
-- @return Point#POINT_VEC3 self
|
||||
-- @param Dcs.DCSTypes#Distance x The x coordinate of the Vec3 point, pointing to the North.
|
||||
-- @param Dcs.DCSTypes#Distance y The y coordinate of the Vec3 point, pointing Upwards.
|
||||
-- @param Dcs.DCSTypes#Distance z The z coordinate of the Vec3 point, pointing to the Right.
|
||||
-- @return Core.Point#POINT_VEC3 self
|
||||
function POINT_VEC3:New( x, y, z )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
@@ -125,8 +125,8 @@ end
|
||||
|
||||
--- Create a new POINT_VEC3 object from Vec3 coordinates.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Vec3 Vec3 The Vec3 point.
|
||||
-- @return Point#POINT_VEC3 self
|
||||
-- @param Dcs.DCSTypes#Vec3 Vec3 The Vec3 point.
|
||||
-- @return Core.Point#POINT_VEC3 self
|
||||
function POINT_VEC3:NewFromVec3( Vec3 )
|
||||
|
||||
self = self:New( Vec3.x, Vec3.y, Vec3.z )
|
||||
@@ -137,14 +137,14 @@ end
|
||||
|
||||
--- Return the coordinates of the POINT_VEC3 in Vec3 format.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @return DCSTypes#Vec3 The Vec3 coodinate.
|
||||
-- @return Dcs.DCSTypes#Vec3 The Vec3 coodinate.
|
||||
function POINT_VEC3:GetVec3()
|
||||
return { x = self.x, y = self.y, z = self.z }
|
||||
end
|
||||
|
||||
--- Return the coordinates of the POINT_VEC3 in Vec2 format.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @return DCSTypes#Vec2 The Vec2 coodinate.
|
||||
-- @return Dcs.DCSTypes#Vec2 The Vec2 coodinate.
|
||||
function POINT_VEC3:GetVec2()
|
||||
return { x = self.x, y = self.z }
|
||||
end
|
||||
@@ -191,9 +191,9 @@ end
|
||||
|
||||
--- Return a random Vec2 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Distance OuterRadius
|
||||
-- @param DCSTypes#Distance InnerRadius
|
||||
-- @return DCSTypes#Vec2 Vec2
|
||||
-- @param Dcs.DCSTypes#Distance OuterRadius
|
||||
-- @param Dcs.DCSTypes#Distance InnerRadius
|
||||
-- @return Dcs.DCSTypes#Vec2 Vec2
|
||||
function POINT_VEC3:GetRandomVec2InRadius( OuterRadius, InnerRadius )
|
||||
self:F2( { OuterRadius, InnerRadius } )
|
||||
|
||||
@@ -222,8 +222,8 @@ end
|
||||
|
||||
--- Return a random POINT_VEC2 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Distance OuterRadius
|
||||
-- @param DCSTypes#Distance InnerRadius
|
||||
-- @param Dcs.DCSTypes#Distance OuterRadius
|
||||
-- @param Dcs.DCSTypes#Distance InnerRadius
|
||||
-- @return #POINT_VEC2
|
||||
function POINT_VEC3:GetRandomPointVec2InRadius( OuterRadius, InnerRadius )
|
||||
self:F2( { OuterRadius, InnerRadius } )
|
||||
@@ -233,9 +233,9 @@ end
|
||||
|
||||
--- Return a random Vec3 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Distance OuterRadius
|
||||
-- @param DCSTypes#Distance InnerRadius
|
||||
-- @return DCSTypes#Vec3 Vec3
|
||||
-- @param Dcs.DCSTypes#Distance OuterRadius
|
||||
-- @param Dcs.DCSTypes#Distance InnerRadius
|
||||
-- @return Dcs.DCSTypes#Vec3 Vec3
|
||||
function POINT_VEC3:GetRandomVec3InRadius( OuterRadius, InnerRadius )
|
||||
|
||||
local RandomVec2 = self:GetRandomVec2InRadius( OuterRadius, InnerRadius )
|
||||
@@ -247,8 +247,8 @@ end
|
||||
|
||||
--- Return a random POINT_VEC3 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Distance OuterRadius
|
||||
-- @param DCSTypes#Distance InnerRadius
|
||||
-- @param Dcs.DCSTypes#Distance OuterRadius
|
||||
-- @param Dcs.DCSTypes#Distance InnerRadius
|
||||
-- @return #POINT_VEC3
|
||||
function POINT_VEC3:GetRandomPointVec3InRadius( OuterRadius, InnerRadius )
|
||||
|
||||
@@ -259,7 +259,7 @@ end
|
||||
--- Return a direction vector Vec3 from POINT_VEC3 to the POINT_VEC3.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param #POINT_VEC3 TargetPointVec3 The target POINT_VEC3.
|
||||
-- @return DCSTypes#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
||||
-- @return Dcs.DCSTypes#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
||||
function POINT_VEC3:GetDirectionVec3( TargetPointVec3 )
|
||||
return { x = TargetPointVec3:GetX() - self:GetX(), y = TargetPointVec3:GetY() - self:GetY(), z = TargetPointVec3:GetZ() - self:GetZ() }
|
||||
end
|
||||
@@ -277,7 +277,7 @@ end
|
||||
|
||||
--- Return a direction in radians from the POINT_VEC3 using a direction vector in Vec3 format.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
||||
-- @param Dcs.DCSTypes#Vec3 DirectionVec3 The direction vector in Vec3 format.
|
||||
-- @return #number DirectionRadians The direction in radians.
|
||||
function POINT_VEC3:GetDirectionRadians( DirectionVec3 )
|
||||
local DirectionRadians = math.atan2( DirectionVec3.z, DirectionVec3.x )
|
||||
@@ -291,7 +291,7 @@ end
|
||||
--- Return the 2D distance in meters between the target POINT_VEC3 and the POINT_VEC3.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param #POINT_VEC3 TargetPointVec3 The target POINT_VEC3.
|
||||
-- @return DCSTypes#Distance Distance The distance in meters.
|
||||
-- @return Dcs.DCSTypes#Distance Distance The distance in meters.
|
||||
function POINT_VEC3:Get2DDistance( TargetPointVec3 )
|
||||
local TargetVec3 = TargetPointVec3:GetVec3()
|
||||
local SourceVec3 = self:GetVec3()
|
||||
@@ -301,7 +301,7 @@ end
|
||||
--- Return the 3D distance in meters between the target POINT_VEC3 and the POINT_VEC3.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param #POINT_VEC3 TargetPointVec3 The target POINT_VEC3.
|
||||
-- @return DCSTypes#Distance Distance The distance in meters.
|
||||
-- @return Dcs.DCSTypes#Distance Distance The distance in meters.
|
||||
function POINT_VEC3:Get3DDistance( TargetPointVec3 )
|
||||
local TargetVec3 = TargetPointVec3:GetVec3()
|
||||
local SourceVec3 = self:GetVec3()
|
||||
@@ -379,8 +379,8 @@ end
|
||||
|
||||
--- Add a Distance in meters from the POINT_VEC3 horizontal plane, with the given angle, and calculate the new POINT_VEC3.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Distance Distance The Distance to be added in meters.
|
||||
-- @param DCSTypes#Angle Angle The Angle in degrees.
|
||||
-- @param Dcs.DCSTypes#Distance Distance The Distance to be added in meters.
|
||||
-- @param Dcs.DCSTypes#Angle Angle The Angle in degrees.
|
||||
-- @return #POINT_VEC3 The new calculated POINT_VEC3.
|
||||
function POINT_VEC3:Translate( Distance, Angle )
|
||||
local SX = self:GetX()
|
||||
@@ -399,7 +399,7 @@ end
|
||||
-- @param #POINT_VEC3.RoutePointAltType AltType The altitude type.
|
||||
-- @param #POINT_VEC3.RoutePointType Type The route point type.
|
||||
-- @param #POINT_VEC3.RoutePointAction Action The route point action.
|
||||
-- @param DCSTypes#Speed Speed Airspeed in km/h.
|
||||
-- @param Dcs.DCSTypes#Speed Speed Airspeed in km/h.
|
||||
-- @param #boolean SpeedLocked true means the speed is locked.
|
||||
-- @return #table The route point.
|
||||
function POINT_VEC3:RoutePointAir( AltType, Type, Action, Speed, SpeedLocked )
|
||||
@@ -440,7 +440,7 @@ end
|
||||
|
||||
--- Build an ground type route point.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Speed Speed Speed in km/h.
|
||||
-- @param Dcs.DCSTypes#Speed Speed Speed in km/h.
|
||||
-- @param #POINT_VEC3.RoutePointAction Formation The route point Formation.
|
||||
-- @return #table The route point.
|
||||
function POINT_VEC3:RoutePointGround( Speed, Formation )
|
||||
@@ -480,7 +480,7 @@ end
|
||||
|
||||
--- Smokes the point in a color.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param Utils#SMOKECOLOR SmokeColor
|
||||
-- @param Utilities.Utils#SMOKECOLOR SmokeColor
|
||||
function POINT_VEC3:Smoke( SmokeColor )
|
||||
self:F2( { SmokeColor } )
|
||||
trigger.action.smoke( self:GetVec3(), SmokeColor )
|
||||
@@ -523,8 +523,8 @@ end
|
||||
|
||||
--- Flares the point in a color.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param Utils#FLARECOLOR FlareColor
|
||||
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
-- @param Utilities.Utils#FLARECOLOR FlareColor
|
||||
-- @param Dcs.DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
function POINT_VEC3:Flare( FlareColor, Azimuth )
|
||||
self:F2( { FlareColor } )
|
||||
trigger.action.signalFlare( self:GetVec3(), FlareColor, Azimuth and Azimuth or 0 )
|
||||
@@ -532,7 +532,7 @@ end
|
||||
|
||||
--- Flare the POINT_VEC3 White.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
-- @param Dcs.DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
function POINT_VEC3:FlareWhite( Azimuth )
|
||||
self:F2( Azimuth )
|
||||
self:Flare( FLARECOLOR.White, Azimuth )
|
||||
@@ -540,7 +540,7 @@ end
|
||||
|
||||
--- Flare the POINT_VEC3 Yellow.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
-- @param Dcs.DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
function POINT_VEC3:FlareYellow( Azimuth )
|
||||
self:F2( Azimuth )
|
||||
self:Flare( FLARECOLOR.Yellow, Azimuth )
|
||||
@@ -548,7 +548,7 @@ end
|
||||
|
||||
--- Flare the POINT_VEC3 Green.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
-- @param Dcs.DCSTypes#Azimuth (optional) Azimuth The azimuth of the flare direction. The default azimuth is 0.
|
||||
function POINT_VEC3:FlareGreen( Azimuth )
|
||||
self:F2( Azimuth )
|
||||
self:Flare( FLARECOLOR.Green, Azimuth )
|
||||
@@ -569,10 +569,10 @@ do -- POINT_VEC2
|
||||
|
||||
--- POINT_VEC2 constructor.
|
||||
-- @param #POINT_VEC2 self
|
||||
-- @param DCSTypes#Distance x The x coordinate of the Vec3 point, pointing to the North.
|
||||
-- @param DCSTypes#Distance y The y coordinate of the Vec3 point, pointing to the Right.
|
||||
-- @param DCSTypes#Distance LandHeightAdd (optional) The default height if required to be evaluated will be the land height of the x, y coordinate. You can specify an extra height to be added to the land height.
|
||||
-- @return Point#POINT_VEC2
|
||||
-- @param Dcs.DCSTypes#Distance x The x coordinate of the Vec3 point, pointing to the North.
|
||||
-- @param Dcs.DCSTypes#Distance y The y coordinate of the Vec3 point, pointing to the Right.
|
||||
-- @param Dcs.DCSTypes#Distance LandHeightAdd (optional) The default height if required to be evaluated will be the land height of the x, y coordinate. You can specify an extra height to be added to the land height.
|
||||
-- @return Core.Point#POINT_VEC2
|
||||
function POINT_VEC2:New( x, y, LandHeightAdd )
|
||||
|
||||
local LandHeight = land.getHeight( { ["x"] = x, ["y"] = y } )
|
||||
@@ -588,8 +588,8 @@ end
|
||||
|
||||
--- Create a new POINT_VEC2 object from Vec2 coordinates.
|
||||
-- @param #POINT_VEC2 self
|
||||
-- @param DCSTypes#Vec2 Vec2 The Vec2 point.
|
||||
-- @return Point#POINT_VEC2 self
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The Vec2 point.
|
||||
-- @return Core.Point#POINT_VEC2 self
|
||||
function POINT_VEC2:NewFromVec2( Vec2, LandHeightAdd )
|
||||
|
||||
local LandHeight = land.getHeight( Vec2 )
|
||||
@@ -605,8 +605,8 @@ end
|
||||
|
||||
--- Create a new POINT_VEC2 object from Vec3 coordinates.
|
||||
-- @param #POINT_VEC2 self
|
||||
-- @param DCSTypes#Vec3 Vec3 The Vec3 point.
|
||||
-- @return Point#POINT_VEC2 self
|
||||
-- @param Dcs.DCSTypes#Vec3 Vec3 The Vec3 point.
|
||||
-- @return Core.Point#POINT_VEC2 self
|
||||
function POINT_VEC2:NewFromVec3( Vec3 )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
@@ -658,7 +658,7 @@ end
|
||||
--- Calculate the distance from a reference @{#POINT_VEC2}.
|
||||
-- @param #POINT_VEC2 self
|
||||
-- @param #POINT_VEC2 PointVec2Reference The reference @{#POINT_VEC2}.
|
||||
-- @return DCSTypes#Distance The distance from the reference @{#POINT_VEC2} in meters.
|
||||
-- @return Dcs.DCSTypes#Distance The distance from the reference @{#POINT_VEC2} in meters.
|
||||
function POINT_VEC2:DistanceFromPointVec2( PointVec2Reference )
|
||||
self:F2( PointVec2Reference )
|
||||
|
||||
@@ -668,10 +668,10 @@ function POINT_VEC2:DistanceFromPointVec2( PointVec2Reference )
|
||||
return Distance
|
||||
end
|
||||
|
||||
--- Calculate the distance from a reference @{DCSTypes#Vec2}.
|
||||
--- Calculate the distance from a reference @{Dcs.DCSTypes#Vec2}.
|
||||
-- @param #POINT_VEC2 self
|
||||
-- @param DCSTypes#Vec2 Vec2Reference The reference @{DCSTypes#Vec2}.
|
||||
-- @return DCSTypes#Distance The distance from the reference @{DCSTypes#Vec2} in meters.
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{Dcs.DCSTypes#Vec2}.
|
||||
-- @return Dcs.DCSTypes#Distance The distance from the reference @{Dcs.DCSTypes#Vec2} in meters.
|
||||
function POINT_VEC2:DistanceFromVec2( Vec2Reference )
|
||||
self:F2( Vec2Reference )
|
||||
|
||||
@@ -691,8 +691,8 @@ end
|
||||
|
||||
--- Add a Distance in meters from the POINT_VEC2 orthonormal plane, with the given angle, and calculate the new POINT_VEC2.
|
||||
-- @param #POINT_VEC2 self
|
||||
-- @param DCSTypes#Distance Distance The Distance to be added in meters.
|
||||
-- @param DCSTypes#Angle Angle The Angle in degrees.
|
||||
-- @param Dcs.DCSTypes#Distance Distance The Distance to be added in meters.
|
||||
-- @param Dcs.DCSTypes#Angle Angle The Angle in degrees.
|
||||
-- @return #POINT_VEC2 The new calculated POINT_VEC2.
|
||||
function POINT_VEC2:Translate( Distance, Angle )
|
||||
local SX = self:GetX()
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
--- This module contains the SCHEDULER class.
|
||||
--
|
||||
-- 1) @{Scheduler#SCHEDULER} class, extends @{Base#BASE}
|
||||
-- 1) @{Core.Scheduler#SCHEDULER} class, extends @{Core.Base#BASE}
|
||||
-- =====================================================
|
||||
-- The @{Scheduler#SCHEDULER} class models time events calling given event handling functions.
|
||||
-- The @{Core.Scheduler#SCHEDULER} class models time events calling given event handling functions.
|
||||
--
|
||||
-- 1.1) SCHEDULER constructor
|
||||
-- --------------------------
|
||||
-- The SCHEDULER class is quite easy to use:
|
||||
--
|
||||
-- * @{Scheduler#SCHEDULER.New}: Setup a new scheduler and start it with the specified parameters.
|
||||
-- * @{Core.Scheduler#SCHEDULER.New}: Setup a new scheduler and start it with the specified parameters.
|
||||
--
|
||||
-- 1.2) SCHEDULER timer stop and start
|
||||
-- -----------------------------------
|
||||
-- The SCHEDULER can be stopped and restarted with the following methods:
|
||||
--
|
||||
-- * @{Scheduler#SCHEDULER.Start}: (Re-)Start the scheduler.
|
||||
-- * @{Scheduler#SCHEDULER.Stop}: Stop the scheduler.
|
||||
-- * @{Core.Scheduler#SCHEDULER.Start}: (Re-)Start the scheduler.
|
||||
-- * @{Core.Scheduler#SCHEDULER.Stop}: Stop the scheduler.
|
||||
--
|
||||
-- 1.3) Reschedule new time event
|
||||
-- ------------------------------
|
||||
-- With @{Scheduler#SCHEDULER.Schedule} a new time event can be scheduled.
|
||||
-- With @{Core.Scheduler#SCHEDULER.Schedule} a new time event can be scheduled.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -39,7 +39,7 @@
|
||||
--- The SCHEDULER class
|
||||
-- @type SCHEDULER
|
||||
-- @field #number ScheduleID the ID of the scheduler.
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Base#BASE
|
||||
SCHEDULER = {
|
||||
ClassName = "SCHEDULER",
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 1) @{Set#SET_BASE} class, extends @{Base#BASE}
|
||||
-- 1) @{Core.Set#SET_BASE} class, extends @{Core.Base#BASE}
|
||||
-- ==============================================
|
||||
-- The @{Set#SET_BASE} class defines the core functions that define a collection of objects.
|
||||
-- The @{Core.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 @{Set#SET_BASE.Add} and @{Set#SET_BASE.Remove} to add or remove objects from the SET in your logic.
|
||||
-- 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.
|
||||
--
|
||||
-- 1.2) Define the SET iterator **"yield interval"** and the **"time interval"**
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- Modify the iterator intervals with the @{Set#SET_BASE.SetInteratorIntervals} method.
|
||||
-- Modify the iterator intervals with the @{Core.Set#SET_BASE.SetInteratorIntervals} method.
|
||||
-- You can set the **"yield interval"**, and the **"time interval"**. (See above).
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 2) @{Set#SET_GROUP} class, extends @{Set#SET_BASE}
|
||||
-- 2) @{Core.Set#SET_GROUP} class, extends @{Core.Set#SET_BASE}
|
||||
-- ==================================================
|
||||
-- Mission designers can use the @{Set#SET_GROUP} class to build sets of groups belonging to certain:
|
||||
-- Mission designers can use the @{Core.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 @{Set#SET_GROUP.AddGroupsByName} and @{Set#SET_GROUP.RemoveGroupsByName} respectively.
|
||||
-- GROUPS can be added and removed using the @{Core.Set#SET_GROUP.AddGroupsByName} and @{Core.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 @{Zone#ZONE}.
|
||||
-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Core.Zone#ZONE}.
|
||||
--
|
||||
-- 2.4) SET_GROUP iterators:
|
||||
-- -------------------------
|
||||
@@ -72,9 +72,9 @@
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- 3) @{Set#SET_UNIT} class, extends @{Set#SET_BASE}
|
||||
-- 3) @{Core.Set#SET_UNIT} class, extends @{Core.Set#SET_BASE}
|
||||
-- ===================================================
|
||||
-- Mission designers can use the @{Set#SET_UNIT} class to build sets of units belonging to certain:
|
||||
-- Mission designers can use the @{Core.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 @{Set#SET_UNIT.AddUnitsByName} and @{Set#SET_UNIT.RemoveUnitsByName} respectively.
|
||||
-- UNITs can be added and removed using the @{Core.Set#SET_UNIT.AddUnitsByName} and @{Core.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 @{Zone#ZONE}.
|
||||
-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Core.Zone#ZONE}.
|
||||
--
|
||||
-- 3.4) SET_UNIT iterators:
|
||||
-- ------------------------
|
||||
@@ -130,9 +130,9 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 4) @{Set#SET_CLIENT} class, extends @{Set#SET_BASE}
|
||||
-- 4) @{Core.Set#SET_CLIENT} class, extends @{Core.Set#SET_BASE}
|
||||
-- ===================================================
|
||||
-- Mission designers can use the @{Set#SET_CLIENT} class to build sets of units belonging to certain:
|
||||
-- Mission designers can use the @{Core.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 @{Set#SET_CLIENT.AddClientsByName} and @{Set#SET_CLIENT.RemoveClientsByName} respectively.
|
||||
-- CLIENTs can be added and removed using the @{Core.Set#SET_CLIENT.AddClientsByName} and @{Core.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 @{Zone#ZONE}.
|
||||
-- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Core.Zone#ZONE}.
|
||||
--
|
||||
-- 4.4) SET_CLIENT iterators:
|
||||
-- ------------------------
|
||||
@@ -180,9 +180,9 @@
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- 5) @{Set#SET_AIRBASE} class, extends @{Set#SET_BASE}
|
||||
-- 5) @{Core.Set#SET_AIRBASE} class, extends @{Core.Set#SET_BASE}
|
||||
-- ====================================================
|
||||
-- Mission designers can use the @{Set#SET_AIRBASE} class to build sets of airbases optionally belonging to certain:
|
||||
-- Mission designers can use the @{Core.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 @{Set#SET_AIRBASE.AddAirbasesByName} and @{Set#SET_AIRBASE.RemoveAirbasesByName} respectively.
|
||||
-- AIRBASEs can be added and removed using the @{Core.Set#SET_AIRBASE.AddAirbasesByName} and @{Core.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
|
||||
@@ -233,7 +233,7 @@
|
||||
-- @field #table Filter
|
||||
-- @field #table Set
|
||||
-- @field #table List
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Base#BASE
|
||||
SET_BASE = {
|
||||
ClassName = "SET_BASE",
|
||||
Filter = {},
|
||||
@@ -264,10 +264,10 @@ function SET_BASE:New( Database )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Finds an @{Base#BASE} object based on the object Name.
|
||||
--- Finds an @{Core.Base#BASE} object based on the object Name.
|
||||
-- @param #SET_BASE self
|
||||
-- @param #string ObjectName
|
||||
-- @return Base#BASE The Object found.
|
||||
-- @return Core.Base#BASE The Object found.
|
||||
function SET_BASE:_Find( ObjectName )
|
||||
|
||||
local ObjectFound = self.Set[ObjectName]
|
||||
@@ -284,11 +284,11 @@ function SET_BASE:GetSet()
|
||||
return self.Set
|
||||
end
|
||||
|
||||
--- Adds a @{Base#BASE} object in the @{Set#SET_BASE}, using a given ObjectName as the index.
|
||||
--- Adds a @{Core.Base#BASE} object in the @{Core.Set#SET_BASE}, using a given ObjectName as the index.
|
||||
-- @param #SET_BASE self
|
||||
-- @param #string ObjectName
|
||||
-- @param Base#BASE Object
|
||||
-- @return Base#BASE The added BASE Object.
|
||||
-- @param Core.Base#BASE Object
|
||||
-- @return Core.Base#BASE The added BASE Object.
|
||||
function SET_BASE:Add( ObjectName, Object )
|
||||
self:F2( ObjectName )
|
||||
|
||||
@@ -310,10 +310,10 @@ function SET_BASE:Add( ObjectName, Object )
|
||||
|
||||
end
|
||||
|
||||
--- Adds a @{Base#BASE} object in the @{Set#SET_BASE}, using the Object Name as the index.
|
||||
--- Adds a @{Core.Base#BASE} object in the @{Core.Set#SET_BASE}, using the Object Name as the index.
|
||||
-- @param #SET_BASE self
|
||||
-- @param Object#OBJECT Object
|
||||
-- @return Base#BASE The added BASE Object.
|
||||
-- @param Wrapper.Object#OBJECT Object
|
||||
-- @return Core.Base#BASE The added BASE Object.
|
||||
function SET_BASE:AddObject( Object )
|
||||
self:F2( Object.ObjectName )
|
||||
|
||||
@@ -325,7 +325,7 @@ end
|
||||
|
||||
|
||||
|
||||
--- Removes a @{Base#BASE} object from the @{Set#SET_BASE} and derived classes, based on the Object Name.
|
||||
--- Removes a @{Core.Base#BASE} object from the @{Core.Set#SET_BASE} and derived classes, based on the Object Name.
|
||||
-- @param #SET_BASE self
|
||||
-- @param #string ObjectName
|
||||
function SET_BASE:Remove( ObjectName )
|
||||
@@ -364,10 +364,10 @@ function SET_BASE:Remove( ObjectName )
|
||||
|
||||
end
|
||||
|
||||
--- Gets a @{Base#BASE} object from the @{Set#SET_BASE} and derived classes, based on the Object Name.
|
||||
--- Gets a @{Core.Base#BASE} object from the @{Core.Set#SET_BASE} and derived classes, based on the Object Name.
|
||||
-- @param #SET_BASE self
|
||||
-- @param #string ObjectName
|
||||
-- @return Base#BASE
|
||||
-- @return Core.Base#BASE
|
||||
function SET_BASE:Get( ObjectName )
|
||||
self:F( ObjectName )
|
||||
|
||||
@@ -379,7 +379,7 @@ function SET_BASE:Get( ObjectName )
|
||||
|
||||
end
|
||||
|
||||
--- Retrieves the amount of objects in the @{Set#SET_BASE} and derived classes.
|
||||
--- Retrieves the amount of objects in the @{Core.Set#SET_BASE} and derived classes.
|
||||
-- @param #SET_BASE self
|
||||
-- @return #number Count
|
||||
function SET_BASE:Count()
|
||||
@@ -472,10 +472,10 @@ function SET_BASE:FilterStop()
|
||||
return self
|
||||
end
|
||||
|
||||
--- Iterate the SET_BASE while identifying the nearest object from a @{Point#POINT_VEC2}.
|
||||
--- Iterate the SET_BASE while identifying the nearest object from a @{Core.Point#POINT_VEC2}.
|
||||
-- @param #SET_BASE self
|
||||
-- @param Point#POINT_VEC2 PointVec2 A @{Point#POINT_VEC2} object from where to evaluate the closest object in the set.
|
||||
-- @return Base#BASE The closest object.
|
||||
-- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.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 )
|
||||
|
||||
@@ -526,7 +526,7 @@ end
|
||||
|
||||
--- Handles the OnBirth event for the Set.
|
||||
-- @param #SET_BASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
function SET_BASE:_EventOnBirth( Event )
|
||||
self:F3( { Event } )
|
||||
|
||||
@@ -542,7 +542,7 @@ end
|
||||
|
||||
--- Handles the OnDead or OnCrash event for alive units set.
|
||||
-- @param #SET_BASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
function SET_BASE:_EventOnDeadOrCrash( Event )
|
||||
self:F3( { Event } )
|
||||
|
||||
@@ -556,7 +556,7 @@ end
|
||||
|
||||
--- Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied).
|
||||
-- @param #SET_BASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
function SET_BASE:_EventOnPlayerEnterUnit( Event )
|
||||
self:F3( { Event } )
|
||||
|
||||
@@ -572,7 +572,7 @@ end
|
||||
|
||||
--- Handles the OnPlayerLeaveUnit event to clean the active players table.
|
||||
-- @param #SET_BASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
function SET_BASE:_EventOnPlayerLeaveUnit( Event )
|
||||
self:F3( { Event } )
|
||||
|
||||
@@ -761,7 +761,7 @@ function SET_GROUP:New()
|
||||
end
|
||||
|
||||
--- Add GROUP(s) to SET_GROUP.
|
||||
-- @param Set#SET_GROUP self
|
||||
-- @param Core.Set#SET_GROUP self
|
||||
-- @param #string AddGroupNames A single name or an array of GROUP names.
|
||||
-- @return self
|
||||
function SET_GROUP:AddGroupsByName( AddGroupNames )
|
||||
@@ -776,8 +776,8 @@ function SET_GROUP:AddGroupsByName( AddGroupNames )
|
||||
end
|
||||
|
||||
--- Remove GROUP(s) from SET_GROUP.
|
||||
-- @param Set#SET_GROUP self
|
||||
-- @param Group#GROUP RemoveGroupNames A single name or an array of GROUP names.
|
||||
-- @param Core.Set#SET_GROUP self
|
||||
-- @param Wrapper.Group#GROUP RemoveGroupNames A single name or an array of GROUP names.
|
||||
-- @return self
|
||||
function SET_GROUP:RemoveGroupsByName( RemoveGroupNames )
|
||||
|
||||
@@ -796,7 +796,7 @@ end
|
||||
--- Finds a Group based on the Group Name.
|
||||
-- @param #SET_GROUP self
|
||||
-- @param #string GroupName
|
||||
-- @return Group#GROUP The found Group.
|
||||
-- @return Wrapper.Group#GROUP The found Group.
|
||||
function SET_GROUP:FindGroup( GroupName )
|
||||
|
||||
local GroupFound = self.Set[GroupName]
|
||||
@@ -897,7 +897,7 @@ end
|
||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||
-- @param #SET_GROUP self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the GROUP
|
||||
-- @return #table The GROUP
|
||||
function SET_GROUP:AddInDatabase( Event )
|
||||
@@ -914,7 +914,7 @@ end
|
||||
--- Handles the Database to check on any event that Object exists in the Database.
|
||||
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
||||
-- @param #SET_GROUP self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the GROUP
|
||||
-- @return #table The GROUP
|
||||
function SET_GROUP:FindInDatabase( Event )
|
||||
@@ -937,7 +937,7 @@ end
|
||||
|
||||
--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence completely in a @{Zone}, providing the GROUP and optional parameters to the called function.
|
||||
-- @param #SET_GROUP self
|
||||
-- @param Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter.
|
||||
-- @return #SET_GROUP self
|
||||
function SET_GROUP:ForEachGroupCompletelyInZone( ZoneObject, IteratorFunction, ... )
|
||||
@@ -945,7 +945,7 @@ function SET_GROUP:ForEachGroupCompletelyInZone( ZoneObject, IteratorFunction, .
|
||||
|
||||
self:ForEach( IteratorFunction, arg, self.Set,
|
||||
--- @param Zone#ZONE_BASE ZoneObject
|
||||
-- @param Group#GROUP GroupObject
|
||||
-- @param Wrapper.Group#GROUP GroupObject
|
||||
function( ZoneObject, GroupObject )
|
||||
if GroupObject:IsCompletelyInZone( ZoneObject ) then
|
||||
return true
|
||||
@@ -959,7 +959,7 @@ end
|
||||
|
||||
--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence partly in a @{Zone}, providing the GROUP and optional parameters to the called function.
|
||||
-- @param #SET_GROUP self
|
||||
-- @param Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter.
|
||||
-- @return #SET_GROUP self
|
||||
function SET_GROUP:ForEachGroupPartlyInZone( ZoneObject, IteratorFunction, ... )
|
||||
@@ -967,7 +967,7 @@ function SET_GROUP:ForEachGroupPartlyInZone( ZoneObject, IteratorFunction, ... )
|
||||
|
||||
self:ForEach( IteratorFunction, arg, self.Set,
|
||||
--- @param Zone#ZONE_BASE ZoneObject
|
||||
-- @param Group#GROUP GroupObject
|
||||
-- @param Wrapper.Group#GROUP GroupObject
|
||||
function( ZoneObject, GroupObject )
|
||||
if GroupObject:IsPartlyInZone( ZoneObject ) then
|
||||
return true
|
||||
@@ -981,7 +981,7 @@ end
|
||||
|
||||
--- Iterate the SET_GROUP and call an iterator function for each **alive** GROUP presence not in a @{Zone}, providing the GROUP and optional parameters to the called function.
|
||||
-- @param #SET_GROUP self
|
||||
-- @param Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param #function IteratorFunction The function that will be called when there is an alive GROUP in the SET_GROUP. The function needs to accept a GROUP parameter.
|
||||
-- @return #SET_GROUP self
|
||||
function SET_GROUP:ForEachGroupNotInZone( ZoneObject, IteratorFunction, ... )
|
||||
@@ -989,7 +989,7 @@ function SET_GROUP:ForEachGroupNotInZone( ZoneObject, IteratorFunction, ... )
|
||||
|
||||
self:ForEach( IteratorFunction, arg, self.Set,
|
||||
--- @param Zone#ZONE_BASE ZoneObject
|
||||
-- @param Group#GROUP GroupObject
|
||||
-- @param Wrapper.Group#GROUP GroupObject
|
||||
function( ZoneObject, GroupObject )
|
||||
if GroupObject:IsNotInZone( ZoneObject ) then
|
||||
return true
|
||||
@@ -1030,7 +1030,7 @@ end
|
||||
|
||||
---
|
||||
-- @param #SET_GROUP self
|
||||
-- @param Group#GROUP MooseGroup
|
||||
-- @param Wrapper.Group#GROUP MooseGroup
|
||||
-- @return #SET_GROUP self
|
||||
function SET_GROUP:IsIncludeObject( MooseGroup )
|
||||
self:F2( MooseGroup )
|
||||
@@ -1086,7 +1086,7 @@ end
|
||||
|
||||
--- SET_UNIT class
|
||||
-- @type SET_UNIT
|
||||
-- @extends Set#SET_BASE
|
||||
-- @extends Core.Set#SET_BASE
|
||||
SET_UNIT = {
|
||||
ClassName = "SET_UNIT",
|
||||
Units = {},
|
||||
@@ -1158,8 +1158,8 @@ function SET_UNIT:AddUnitsByName( AddUnitNames )
|
||||
end
|
||||
|
||||
--- Remove UNIT(s) from SET_UNIT.
|
||||
-- @param Set#SET_UNIT self
|
||||
-- @param Unit#UNIT RemoveUnitNames A single name or an array of UNIT names.
|
||||
-- @param Core.Set#SET_UNIT self
|
||||
-- @param Wrapper.Unit#UNIT RemoveUnitNames A single name or an array of UNIT names.
|
||||
-- @return self
|
||||
function SET_UNIT:RemoveUnitsByName( RemoveUnitNames )
|
||||
|
||||
@@ -1176,7 +1176,7 @@ end
|
||||
--- Finds a Unit based on the Unit Name.
|
||||
-- @param #SET_UNIT self
|
||||
-- @param #string UnitName
|
||||
-- @return Unit#UNIT The found Unit.
|
||||
-- @return Wrapper.Unit#UNIT The found Unit.
|
||||
function SET_UNIT:FindUnit( UnitName )
|
||||
|
||||
local UnitFound = self.Set[UnitName]
|
||||
@@ -1322,7 +1322,7 @@ end
|
||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||
-- @param #SET_UNIT self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the UNIT
|
||||
-- @return #table The UNIT
|
||||
function SET_UNIT:AddInDatabase( Event )
|
||||
@@ -1339,7 +1339,7 @@ end
|
||||
--- Handles the Database to check on any event that Object exists in the Database.
|
||||
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
||||
-- @param #SET_UNIT self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the UNIT
|
||||
-- @return #table The UNIT
|
||||
function SET_UNIT:FindInDatabase( Event )
|
||||
@@ -1363,7 +1363,7 @@ end
|
||||
|
||||
--- Iterate the SET_UNIT and call an iterator function for each **alive** UNIT presence completely in a @{Zone}, providing the UNIT and optional parameters to the called function.
|
||||
-- @param #SET_UNIT self
|
||||
-- @param Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param #function IteratorFunction The function that will be called when there is an alive UNIT in the SET_UNIT. The function needs to accept a UNIT parameter.
|
||||
-- @return #SET_UNIT self
|
||||
function SET_UNIT:ForEachUnitCompletelyInZone( ZoneObject, IteratorFunction, ... )
|
||||
@@ -1371,7 +1371,7 @@ function SET_UNIT:ForEachUnitCompletelyInZone( ZoneObject, IteratorFunction, ...
|
||||
|
||||
self:ForEach( IteratorFunction, arg, self.Set,
|
||||
--- @param Zone#ZONE_BASE ZoneObject
|
||||
-- @param Unit#UNIT UnitObject
|
||||
-- @param Wrapper.Unit#UNIT UnitObject
|
||||
function( ZoneObject, UnitObject )
|
||||
if UnitObject:IsCompletelyInZone( ZoneObject ) then
|
||||
return true
|
||||
@@ -1385,7 +1385,7 @@ end
|
||||
|
||||
--- Iterate the SET_UNIT and call an iterator function for each **alive** UNIT presence not in a @{Zone}, providing the UNIT and optional parameters to the called function.
|
||||
-- @param #SET_UNIT self
|
||||
-- @param Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param #function IteratorFunction The function that will be called when there is an alive UNIT in the SET_UNIT. The function needs to accept a UNIT parameter.
|
||||
-- @return #SET_UNIT self
|
||||
function SET_UNIT:ForEachUnitNotInZone( ZoneObject, IteratorFunction, ... )
|
||||
@@ -1393,7 +1393,7 @@ function SET_UNIT:ForEachUnitNotInZone( ZoneObject, IteratorFunction, ... )
|
||||
|
||||
self:ForEach( IteratorFunction, arg, self.Set,
|
||||
--- @param Zone#ZONE_BASE ZoneObject
|
||||
-- @param Unit#UNIT UnitObject
|
||||
-- @param Wrapper.Unit#UNIT UnitObject
|
||||
function( ZoneObject, UnitObject )
|
||||
if UnitObject:IsNotInZone( ZoneObject ) then
|
||||
return true
|
||||
@@ -1415,7 +1415,7 @@ function SET_UNIT:GetUnitTypes()
|
||||
local UnitTypes = {}
|
||||
|
||||
for UnitID, UnitData in pairs( self:GetSet() ) do
|
||||
local TextUnit = UnitData -- Unit#UNIT
|
||||
local TextUnit = UnitData -- Wrapper.Unit#UNIT
|
||||
if TextUnit:IsAlive() then
|
||||
local UnitType = TextUnit:GetTypeName()
|
||||
|
||||
@@ -1460,7 +1460,7 @@ function SET_UNIT:GetUnitThreatLevels()
|
||||
local UnitThreatLevels = {}
|
||||
|
||||
for UnitID, UnitData in pairs( self:GetSet() ) do
|
||||
local ThreatUnit = UnitData -- Unit#UNIT
|
||||
local ThreatUnit = UnitData -- Wrapper.Unit#UNIT
|
||||
if ThreatUnit:IsAlive() then
|
||||
local UnitThreatLevel, UnitThreatLevelText = ThreatUnit:GetThreatLevel()
|
||||
local ThreatUnitName = ThreatUnit:GetName()
|
||||
@@ -1477,14 +1477,14 @@ end
|
||||
|
||||
--- Returns if the @{Set} has targets having a radar (of a given type).
|
||||
-- @param #SET_UNIT self
|
||||
-- @param DCSUnit#Unit.RadarType RadarType
|
||||
-- @param Dcs.DCSWrapper.Unit#Unit.RadarType RadarType
|
||||
-- @return #number The amount of radars in the Set with the given type
|
||||
function SET_UNIT:HasRadar( RadarType )
|
||||
self:F2( RadarType )
|
||||
|
||||
local RadarCount = 0
|
||||
for UnitID, UnitData in pairs( self:GetSet()) do
|
||||
local UnitSensorTest = UnitData -- Unit#UNIT
|
||||
local UnitSensorTest = UnitData -- Wrapper.Unit#UNIT
|
||||
local HasSensors
|
||||
if RadarType then
|
||||
HasSensors = UnitSensorTest:HasSensors( Unit.SensorType.RADAR, RadarType )
|
||||
@@ -1508,7 +1508,7 @@ function SET_UNIT:HasSEAD()
|
||||
|
||||
local SEADCount = 0
|
||||
for UnitID, UnitData in pairs( self:GetSet()) do
|
||||
local UnitSEAD = UnitData -- Unit#UNIT
|
||||
local UnitSEAD = UnitData -- Wrapper.Unit#UNIT
|
||||
if UnitSEAD:IsAlive() then
|
||||
local UnitSEADAttributes = UnitSEAD:GetDesc().attributes
|
||||
|
||||
@@ -1532,7 +1532,7 @@ function SET_UNIT:HasGroundUnits()
|
||||
|
||||
local GroundUnitCount = 0
|
||||
for UnitID, UnitData in pairs( self:GetSet()) do
|
||||
local UnitTest = UnitData -- Unit#UNIT
|
||||
local UnitTest = UnitData -- Wrapper.Unit#UNIT
|
||||
if UnitTest:IsGround() then
|
||||
GroundUnitCount = GroundUnitCount + 1
|
||||
end
|
||||
@@ -1549,7 +1549,7 @@ function SET_UNIT:HasFriendlyUnits( FriendlyCoalition )
|
||||
|
||||
local FriendlyUnitCount = 0
|
||||
for UnitID, UnitData in pairs( self:GetSet()) do
|
||||
local UnitTest = UnitData -- Unit#UNIT
|
||||
local UnitTest = UnitData -- Wrapper.Unit#UNIT
|
||||
if UnitTest:IsFriendly( FriendlyCoalition ) then
|
||||
FriendlyUnitCount = FriendlyUnitCount + 1
|
||||
end
|
||||
@@ -1588,7 +1588,7 @@ end
|
||||
|
||||
---
|
||||
-- @param #SET_UNIT self
|
||||
-- @param Unit#UNIT MUnit
|
||||
-- @param Wrapper.Unit#UNIT MUnit
|
||||
-- @return #SET_UNIT self
|
||||
function SET_UNIT:IsIncludeObject( MUnit )
|
||||
self:F2( MUnit )
|
||||
@@ -1681,7 +1681,7 @@ end
|
||||
|
||||
--- SET_CLIENT class
|
||||
-- @type SET_CLIENT
|
||||
-- @extends Set#SET_BASE
|
||||
-- @extends Core.Set#SET_BASE
|
||||
SET_CLIENT = {
|
||||
ClassName = "SET_CLIENT",
|
||||
Clients = {},
|
||||
@@ -1723,7 +1723,7 @@ function SET_CLIENT:New()
|
||||
end
|
||||
|
||||
--- Add CLIENT(s) to SET_CLIENT.
|
||||
-- @param Set#SET_CLIENT self
|
||||
-- @param Core.Set#SET_CLIENT self
|
||||
-- @param #string AddClientNames A single name or an array of CLIENT names.
|
||||
-- @return self
|
||||
function SET_CLIENT:AddClientsByName( AddClientNames )
|
||||
@@ -1738,8 +1738,8 @@ function SET_CLIENT:AddClientsByName( AddClientNames )
|
||||
end
|
||||
|
||||
--- Remove CLIENT(s) from SET_CLIENT.
|
||||
-- @param Set#SET_CLIENT self
|
||||
-- @param Client#CLIENT RemoveClientNames A single name or an array of CLIENT names.
|
||||
-- @param Core.Set#SET_CLIENT self
|
||||
-- @param Wrapper.Client#CLIENT RemoveClientNames A single name or an array of CLIENT names.
|
||||
-- @return self
|
||||
function SET_CLIENT:RemoveClientsByName( RemoveClientNames )
|
||||
|
||||
@@ -1756,7 +1756,7 @@ end
|
||||
--- Finds a Client based on the Client Name.
|
||||
-- @param #SET_CLIENT self
|
||||
-- @param #string ClientName
|
||||
-- @return Client#CLIENT The found Client.
|
||||
-- @return Wrapper.Client#CLIENT The found Client.
|
||||
function SET_CLIENT:FindClient( ClientName )
|
||||
|
||||
local ClientFound = self.Set[ClientName]
|
||||
@@ -1877,7 +1877,7 @@ end
|
||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||
-- @param #SET_CLIENT self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the CLIENT
|
||||
-- @return #table The CLIENT
|
||||
function SET_CLIENT:AddInDatabase( Event )
|
||||
@@ -1889,7 +1889,7 @@ end
|
||||
--- Handles the Database to check on any event that Object exists in the Database.
|
||||
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
||||
-- @param #SET_CLIENT self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the CLIENT
|
||||
-- @return #table The CLIENT
|
||||
function SET_CLIENT:FindInDatabase( Event )
|
||||
@@ -1912,7 +1912,7 @@ end
|
||||
|
||||
--- Iterate the SET_CLIENT and call an iterator function for each **alive** CLIENT presence completely in a @{Zone}, providing the CLIENT and optional parameters to the called function.
|
||||
-- @param #SET_CLIENT self
|
||||
-- @param Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param #function IteratorFunction The function that will be called when there is an alive CLIENT in the SET_CLIENT. The function needs to accept a CLIENT parameter.
|
||||
-- @return #SET_CLIENT self
|
||||
function SET_CLIENT:ForEachClientInZone( ZoneObject, IteratorFunction, ... )
|
||||
@@ -1920,7 +1920,7 @@ function SET_CLIENT:ForEachClientInZone( ZoneObject, IteratorFunction, ... )
|
||||
|
||||
self:ForEach( IteratorFunction, arg, self.Set,
|
||||
--- @param Zone#ZONE_BASE ZoneObject
|
||||
-- @param Client#CLIENT ClientObject
|
||||
-- @param Wrapper.Client#CLIENT ClientObject
|
||||
function( ZoneObject, ClientObject )
|
||||
if ClientObject:IsInZone( ZoneObject ) then
|
||||
return true
|
||||
@@ -1934,7 +1934,7 @@ end
|
||||
|
||||
--- Iterate the SET_CLIENT and call an iterator function for each **alive** CLIENT presence not in a @{Zone}, providing the CLIENT and optional parameters to the called function.
|
||||
-- @param #SET_CLIENT self
|
||||
-- @param Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param Core.Zone#ZONE ZoneObject The Zone to be tested for.
|
||||
-- @param #function IteratorFunction The function that will be called when there is an alive CLIENT in the SET_CLIENT. The function needs to accept a CLIENT parameter.
|
||||
-- @return #SET_CLIENT self
|
||||
function SET_CLIENT:ForEachClientNotInZone( ZoneObject, IteratorFunction, ... )
|
||||
@@ -1942,7 +1942,7 @@ function SET_CLIENT:ForEachClientNotInZone( ZoneObject, IteratorFunction, ... )
|
||||
|
||||
self:ForEach( IteratorFunction, arg, self.Set,
|
||||
--- @param Zone#ZONE_BASE ZoneObject
|
||||
-- @param Client#CLIENT ClientObject
|
||||
-- @param Wrapper.Client#CLIENT ClientObject
|
||||
function( ZoneObject, ClientObject )
|
||||
if ClientObject:IsNotInZone( ZoneObject ) then
|
||||
return true
|
||||
@@ -1956,7 +1956,7 @@ end
|
||||
|
||||
---
|
||||
-- @param #SET_CLIENT self
|
||||
-- @param Client#CLIENT MClient
|
||||
-- @param Wrapper.Client#CLIENT MClient
|
||||
-- @return #SET_CLIENT self
|
||||
function SET_CLIENT:IsIncludeObject( MClient )
|
||||
self:F2( MClient )
|
||||
@@ -2038,7 +2038,7 @@ end
|
||||
|
||||
--- SET_AIRBASE class
|
||||
-- @type SET_AIRBASE
|
||||
-- @extends Set#SET_BASE
|
||||
-- @extends Core.Set#SET_BASE
|
||||
SET_AIRBASE = {
|
||||
ClassName = "SET_AIRBASE",
|
||||
Airbases = {},
|
||||
@@ -2074,7 +2074,7 @@ function SET_AIRBASE:New()
|
||||
end
|
||||
|
||||
--- Add AIRBASEs to SET_AIRBASE.
|
||||
-- @param Set#SET_AIRBASE self
|
||||
-- @param Core.Set#SET_AIRBASE self
|
||||
-- @param #string AddAirbaseNames A single name or an array of AIRBASE names.
|
||||
-- @return self
|
||||
function SET_AIRBASE:AddAirbasesByName( AddAirbaseNames )
|
||||
@@ -2089,8 +2089,8 @@ function SET_AIRBASE:AddAirbasesByName( AddAirbaseNames )
|
||||
end
|
||||
|
||||
--- Remove AIRBASEs from SET_AIRBASE.
|
||||
-- @param Set#SET_AIRBASE self
|
||||
-- @param Airbase#AIRBASE RemoveAirbaseNames A single name or an array of AIRBASE names.
|
||||
-- @param Core.Set#SET_AIRBASE self
|
||||
-- @param Wrapper.Airbase#AIRBASE RemoveAirbaseNames A single name or an array of AIRBASE names.
|
||||
-- @return self
|
||||
function SET_AIRBASE:RemoveAirbasesByName( RemoveAirbaseNames )
|
||||
|
||||
@@ -2107,7 +2107,7 @@ end
|
||||
--- Finds a Airbase based on the Airbase Name.
|
||||
-- @param #SET_AIRBASE self
|
||||
-- @param #string AirbaseName
|
||||
-- @return Airbase#AIRBASE The found Airbase.
|
||||
-- @return Wrapper.Airbase#AIRBASE The found Airbase.
|
||||
function SET_AIRBASE:FindAirbase( AirbaseName )
|
||||
|
||||
local AirbaseFound = self.Set[AirbaseName]
|
||||
@@ -2169,7 +2169,7 @@ end
|
||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||
-- @param #SET_AIRBASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the AIRBASE
|
||||
-- @return #table The AIRBASE
|
||||
function SET_AIRBASE:AddInDatabase( Event )
|
||||
@@ -2181,7 +2181,7 @@ end
|
||||
--- Handles the Database to check on any event that Object exists in the Database.
|
||||
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
||||
-- @param #SET_AIRBASE self
|
||||
-- @param Event#EVENTDATA Event
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the AIRBASE
|
||||
-- @return #table The AIRBASE
|
||||
function SET_AIRBASE:FindInDatabase( Event )
|
||||
@@ -2202,10 +2202,10 @@ function SET_AIRBASE:ForEachAirbase( IteratorFunction, ... )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Iterate the SET_AIRBASE while identifying the nearest @{Airbase#AIRBASE} from a @{Point#POINT_VEC2}.
|
||||
--- Iterate the SET_AIRBASE while identifying the nearest @{Wrapper.Airbase#AIRBASE} from a @{Core.Point#POINT_VEC2}.
|
||||
-- @param #SET_AIRBASE self
|
||||
-- @param Point#POINT_VEC2 PointVec2 A @{Point#POINT_VEC2} object from where to evaluate the closest @{Airbase#AIRBASE}.
|
||||
-- @return Airbase#AIRBASE The closest @{Airbase#AIRBASE}.
|
||||
-- @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}.
|
||||
function SET_AIRBASE:FindNearestAirbaseFromPointVec2( PointVec2 )
|
||||
self:F2( PointVec2 )
|
||||
|
||||
@@ -2217,7 +2217,7 @@ end
|
||||
|
||||
---
|
||||
-- @param #SET_AIRBASE self
|
||||
-- @param Airbase#AIRBASE MAirbase
|
||||
-- @param Wrapper.Airbase#AIRBASE MAirbase
|
||||
-- @return #SET_AIRBASE self
|
||||
function SET_AIRBASE:IsIncludeObject( MAirbase )
|
||||
self:F2( MAirbase )
|
||||
|
||||
@@ -1,759 +0,0 @@
|
||||
--- This module contains the STATEMACHINE class.
|
||||
-- This development is based on a state machine implementation made by Conroy Kyle.
|
||||
-- The state machine can be found here: https://github.com/kyleconroy/lua-state-machine
|
||||
--
|
||||
-- I've taken the development and enhanced it to make the state machine hierarchical...
|
||||
-- It is a fantastic development, this module.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 1) @{Workflow#STATEMACHINE} class, extends @{Base#BASE}
|
||||
-- ==============================================
|
||||
--
|
||||
-- 1.1) Add or remove objects from the STATEMACHINE
|
||||
-- --------------------------------------------
|
||||
-- @module StateMachine
|
||||
-- @author FlightControl
|
||||
|
||||
|
||||
--- STATEMACHINE class
|
||||
-- @type STATEMACHINE
|
||||
-- @extends Core.Base#BASE
|
||||
STATEMACHINE = {
|
||||
ClassName = "STATEMACHINE",
|
||||
}
|
||||
|
||||
--- Creates a new STATEMACHINE object.
|
||||
-- @param #STATEMACHINE self
|
||||
-- @return #STATEMACHINE
|
||||
function STATEMACHINE:New( FsmT )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
|
||||
|
||||
--local self = routines.utils.deepCopy( self ) -- Create a new self instance
|
||||
|
||||
--assert(options.events)
|
||||
|
||||
--local MT = {}
|
||||
--setmetatable( self, MT )
|
||||
--self.__index = self
|
||||
|
||||
self.options = options or {}
|
||||
self.options.subs = self.options.subs or {}
|
||||
self.current = self.options.initial or 'none'
|
||||
self.events = {}
|
||||
self.subs = {}
|
||||
self.endstates = {}
|
||||
|
||||
self.Scores = {}
|
||||
|
||||
FsmT = FsmT or STATEMACHINE_TEMPLATE:New( "" )
|
||||
|
||||
self:SetStartState( FsmT:GetStartState() )
|
||||
|
||||
for TransitionID, Transition in pairs( FsmT:GetTransitions() ) do
|
||||
self:AddTransition( Transition.From, Transition.Event, Transition.To )
|
||||
end
|
||||
|
||||
self:CopyCallHandlers( FsmT )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
function STATEMACHINE:AddTransition( From, Event, To )
|
||||
|
||||
local event = {}
|
||||
event.from = From
|
||||
event.name = Event
|
||||
event.to = To
|
||||
|
||||
self:E( event )
|
||||
|
||||
self:_eventmap( self.events, event )
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--- Set the default @{Process} template with key ProcessName providing the ProcessClass and the process object when it is assigned to a @{Controllable} by the task.
|
||||
-- @return Process#PROCESS
|
||||
function STATEMACHINE:AddProcess( From, Event, Process, ReturnEvents )
|
||||
|
||||
local sub = {}
|
||||
sub.FromParent = From
|
||||
sub.EventParent = Event
|
||||
sub.fsm = Process
|
||||
sub.event = "Start"
|
||||
sub.ReturnEvents = ReturnEvents
|
||||
|
||||
self:_submap( self.subs, sub, nil )
|
||||
|
||||
self:AddTransition( From, Event, From )
|
||||
|
||||
return Process
|
||||
end
|
||||
|
||||
function STATEMACHINE:AddEndState( State )
|
||||
self.endstates[State] = State
|
||||
end
|
||||
|
||||
function STATEMACHINE:SetStartState( State )
|
||||
self.current = State
|
||||
end
|
||||
|
||||
function STATEMACHINE:GetSubs()
|
||||
|
||||
return self.options.subs
|
||||
end
|
||||
|
||||
|
||||
function STATEMACHINE:LoadCallBacks( CallBackTable )
|
||||
|
||||
for name, callback in pairs( CallBackTable or {} ) do
|
||||
self[name] = callback
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function STATEMACHINE:_eventmap( events, event )
|
||||
|
||||
local name = event.name
|
||||
local __name = "__" .. event.name
|
||||
self[name] = self[name] or self:_create_transition(name)
|
||||
self[__name] = self[__name] or self:_delayed_transition(name)
|
||||
self:T( "Added methods: " .. name .. ", " .. __name )
|
||||
events[name] = self.events[name] or { map = {} }
|
||||
self:_add_to_map( events[name].map, event )
|
||||
|
||||
end
|
||||
|
||||
function STATEMACHINE:_submap( subs, sub, name )
|
||||
self:F( { sub = sub, name = name } )
|
||||
subs[sub.FromParent] = subs[sub.FromParent] or {}
|
||||
subs[sub.FromParent][sub.EventParent] = subs[sub.FromParent][sub.EventParent] or {}
|
||||
|
||||
-- Make the reference table weak.
|
||||
-- setmetatable( subs[sub.FromParent][sub.EventParent], { __mode = "k" } )
|
||||
|
||||
subs[sub.FromParent][sub.EventParent][sub] = {}
|
||||
subs[sub.FromParent][sub.EventParent][sub].fsm = sub.fsm
|
||||
subs[sub.FromParent][sub.EventParent][sub].event = sub.event
|
||||
subs[sub.FromParent][sub.EventParent][sub].ReturnEvents = sub.ReturnEvents or {} -- these events need to be given to find the correct continue event ... if none given, the processing will stop.
|
||||
subs[sub.FromParent][sub.EventParent][sub].name = name
|
||||
subs[sub.FromParent][sub.EventParent][sub].fsmparent = self
|
||||
end
|
||||
|
||||
|
||||
function STATEMACHINE:_call_handler(handler, params)
|
||||
if self[handler] then
|
||||
self:E( "Calling " .. handler )
|
||||
return self[handler]( self, unpack(params) )
|
||||
end
|
||||
end
|
||||
|
||||
function STATEMACHINE._handler( self, EventName, ... )
|
||||
|
||||
self:E( { EventName, ... } )
|
||||
|
||||
local can, to = self:can( EventName )
|
||||
self:E( { EventName, self.current, can, to } )
|
||||
|
||||
local ReturnValues = nil
|
||||
|
||||
if can then
|
||||
local from = self.current
|
||||
local params = { EventName, from, to, ... }
|
||||
|
||||
if self:_call_handler("onbefore" .. EventName, params) == false
|
||||
or self:_call_handler("onleave" .. from, params) == false then
|
||||
return false
|
||||
end
|
||||
|
||||
self.current = to
|
||||
|
||||
local execute = true
|
||||
|
||||
local subtable = self:_gosub( from, EventName )
|
||||
for _, sub in pairs( subtable ) do
|
||||
--if sub.nextevent then
|
||||
-- self:F2( "nextevent = " .. sub.nextevent )
|
||||
-- self[sub.nextevent]( self )
|
||||
--end
|
||||
self:E( "calling sub event: " .. sub.event )
|
||||
sub.fsm.fsmparent = self
|
||||
sub.fsm.ReturnEvents = sub.ReturnEvents
|
||||
sub.fsm[sub.event]( sub.fsm )
|
||||
execute = true
|
||||
end
|
||||
|
||||
local fsmparent, event = self:_isendstate( to )
|
||||
if fsmparent and event then
|
||||
self:F2( { "end state: ", fsmparent, event } )
|
||||
self:_call_handler("onenter" .. to, params)
|
||||
self:_call_handler("onafter" .. EventName, params)
|
||||
self:_call_handler("onstatechange", params)
|
||||
fsmparent[event]( fsmparent )
|
||||
execute = false
|
||||
end
|
||||
|
||||
if execute then
|
||||
-- only execute the call if the From state is not equal to the To state! Otherwise this function should never execute!
|
||||
if from ~= to then
|
||||
self:T3( { onenter = "onenter" .. to, callback = self["onenter" .. to] } )
|
||||
self:_call_handler("onenter" .. to, params)
|
||||
end
|
||||
|
||||
self:T3( { On = "OnBefore" .. to, callback = self["OnBefore" .. to] } )
|
||||
if ( self:_call_handler("OnBefore" .. to, params ) ~= false ) then
|
||||
|
||||
self:T3( { onafter = "onafter" .. EventName, callback = self["onafter" .. EventName] } )
|
||||
self:_call_handler("onafter" .. EventName, params)
|
||||
|
||||
self:T3( { On = "OnAfter" .. to, callback = self["OnAfter" .. to] } )
|
||||
ReturnValues = self:_call_handler("OnAfter" .. to, params )
|
||||
end
|
||||
|
||||
self:_call_handler("onstatechange", params)
|
||||
end
|
||||
|
||||
return ReturnValues
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
function STATEMACHINE:_delayed_transition( EventName )
|
||||
self:E( { EventName = EventName } )
|
||||
return function( self, DelaySeconds, ... )
|
||||
self:T( "Delayed Event: " .. EventName )
|
||||
SCHEDULER:New( self, self._handler, { EventName, ... }, DelaySeconds )
|
||||
end
|
||||
end
|
||||
|
||||
function STATEMACHINE:_create_transition( EventName )
|
||||
self:E( { Event = EventName } )
|
||||
return function( self, ... ) return self._handler( self, EventName , ... ) end
|
||||
end
|
||||
|
||||
function STATEMACHINE:_gosub( ParentFrom, ParentEvent )
|
||||
local fsmtable = {}
|
||||
if self.subs[ParentFrom] and self.subs[ParentFrom][ParentEvent] then
|
||||
self:E( { ParentFrom, ParentEvent, self.subs[ParentFrom], self.subs[ParentFrom][ParentEvent] } )
|
||||
return self.subs[ParentFrom][ParentEvent]
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
function STATEMACHINE:_isendstate( Current )
|
||||
local FSMParent = self.fsmparent
|
||||
if FSMParent and self.endstates[Current] then
|
||||
self:E( { state = Current, endstates = self.endstates, endstate = self.endstates[Current] } )
|
||||
FSMParent.current = Current
|
||||
local ParentFrom = FSMParent.current
|
||||
self:E( ParentFrom )
|
||||
self:E( self.ReturnEvents )
|
||||
local Event = self.ReturnEvents[Current]
|
||||
self:E( { ParentFrom, Event, self.ReturnEvents } )
|
||||
if Event then
|
||||
return FSMParent, Event
|
||||
else
|
||||
self:E( { "Could not find parent event name for state ", ParentFrom } )
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
function STATEMACHINE:_add_to_map(map, event)
|
||||
self:F3( { map, event } )
|
||||
if type(event.from) == 'string' then
|
||||
map[event.from] = event.to
|
||||
else
|
||||
for _, from in ipairs(event.from) do
|
||||
map[from] = event.to
|
||||
end
|
||||
end
|
||||
self:T3( { map, event } )
|
||||
end
|
||||
|
||||
function STATEMACHINE:GetState()
|
||||
return self.current
|
||||
end
|
||||
|
||||
|
||||
function STATEMACHINE:Is( State )
|
||||
return self.current == State
|
||||
end
|
||||
|
||||
function STATEMACHINE:is(state)
|
||||
return self.current == state
|
||||
end
|
||||
|
||||
function STATEMACHINE:can(e)
|
||||
local event = self.events[e]
|
||||
self:F3( { self.current, event } )
|
||||
local to = event and event.map[self.current] or event.map['*']
|
||||
return to ~= nil, to
|
||||
end
|
||||
|
||||
function STATEMACHINE:cannot(e)
|
||||
return not self:can(e)
|
||||
end
|
||||
|
||||
function STATEMACHINE:CopyCallHandlers( FsmT )
|
||||
|
||||
local Parent = BASE:GetParent( FsmT )
|
||||
if Parent then
|
||||
self:CopyCallHandlers( Parent )
|
||||
end
|
||||
for ElementID, Element in pairs( FsmT ) do
|
||||
self:E( { ElementID = ElementID } )
|
||||
if type( Element ) == "function" then
|
||||
if ElementID.find( ElementID, "^onbefore" ) or
|
||||
ElementID.find( ElementID, "^onafter" ) or
|
||||
ElementID.find( ElementID, "^onenter" ) or
|
||||
ElementID.find( ElementID, "^onleave" ) or
|
||||
ElementID.find( ElementID, "^onfunc" ) then
|
||||
self[ ElementID ] = Element
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function STATEMACHINE:todot(filename)
|
||||
local dotfile = io.open(filename,'w')
|
||||
dotfile:write('digraph {\n')
|
||||
local transition = function(event,from,to)
|
||||
dotfile:write(string.format('%s -> %s [label=%s];\n',from,to,event))
|
||||
end
|
||||
for _, event in pairs(self.options.events) do
|
||||
if type(event.from) == 'table' then
|
||||
for _, from in ipairs(event.from) do
|
||||
transition(event.name,from,event.to)
|
||||
end
|
||||
else
|
||||
transition(event.name,event.from,event.to)
|
||||
end
|
||||
end
|
||||
dotfile:write('}\n')
|
||||
dotfile:close()
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- STATEMACHINE_CONTROLLABLE class
|
||||
-- @type STATEMACHINE_CONTROLLABLE
|
||||
-- @field Controllable#CONTROLLABLE Controllable
|
||||
-- @extends Core.StateMachine#STATEMACHINE
|
||||
STATEMACHINE_CONTROLLABLE = {
|
||||
ClassName = "STATEMACHINE_CONTROLLABLE",
|
||||
}
|
||||
|
||||
--- Creates a new STATEMACHINE_CONTROLLABLE object.
|
||||
-- @param #STATEMACHINE_CONTROLLABLE self
|
||||
-- @param #table FSMT Finite State Machine Table
|
||||
-- @param Controllable#CONTROLLABLE Controllable (optional) The CONTROLLABLE object that the STATEMACHINE_CONTROLLABLE governs.
|
||||
-- @return #STATEMACHINE_CONTROLLABLE
|
||||
function STATEMACHINE_CONTROLLABLE:New( FSMT, Controllable )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, STATEMACHINE:New( FSMT ) ) -- StateMachine#STATEMACHINE_CONTROLLABLE
|
||||
|
||||
if Controllable then
|
||||
self:SetControllable( Controllable )
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Sets the CONTROLLABLE object that the STATEMACHINE_CONTROLLABLE governs.
|
||||
-- @param #STATEMACHINE_CONTROLLABLE self
|
||||
-- @param Controllable#CONTROLLABLE FSMControllable
|
||||
-- @return #STATEMACHINE_CONTROLLABLE
|
||||
function STATEMACHINE_CONTROLLABLE:SetControllable( FSMControllable )
|
||||
self:F( FSMControllable )
|
||||
self.Controllable = FSMControllable
|
||||
end
|
||||
|
||||
--- Gets the CONTROLLABLE object that the STATEMACHINE_CONTROLLABLE governs.
|
||||
-- @param #STATEMACHINE_CONTROLLABLE self
|
||||
-- @return Controllable#CONTROLLABLE
|
||||
function STATEMACHINE_CONTROLLABLE:GetControllable()
|
||||
return self.Controllable
|
||||
end
|
||||
|
||||
function STATEMACHINE_CONTROLLABLE:_call_handler( handler, params )
|
||||
|
||||
local ErrorHandler = function( errmsg )
|
||||
|
||||
env.info( "Error in SCHEDULER function:" .. errmsg )
|
||||
if debug ~= nil then
|
||||
env.info( debug.traceback() )
|
||||
end
|
||||
|
||||
return errmsg
|
||||
end
|
||||
|
||||
if self[handler] then
|
||||
self:E( "Calling " .. handler )
|
||||
return xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler )
|
||||
--return self[handler]( self, self.Controllable, unpack( params ) )
|
||||
end
|
||||
end
|
||||
|
||||
--- STATEMACHINE_PROCESS class
|
||||
-- @type STATEMACHINE_PROCESS
|
||||
-- @field Process#PROCESS Process
|
||||
-- @field Tasking.Task#TASK_BASE Task
|
||||
-- @extends Core.StateMachine#STATEMACHINE_CONTROLLABLE
|
||||
STATEMACHINE_PROCESS = {
|
||||
ClassName = "STATEMACHINE_PROCESS",
|
||||
}
|
||||
|
||||
--- Creates a new STATEMACHINE_PROCESS object.
|
||||
-- @param #STATEMACHINE_PROCESS self
|
||||
-- @return #STATEMACHINE_PROCESS
|
||||
function STATEMACHINE_PROCESS:New( FsmT, Controllable, Task )
|
||||
|
||||
local self = BASE:Inherit( self, STATEMACHINE_CONTROLLABLE:New( FsmT ) ) -- StateMachine#STATEMACHINE_PROCESS
|
||||
|
||||
self:Assign( Controllable, Task )
|
||||
self.ClassName = FsmT._Name
|
||||
|
||||
for ParameterID, Parameter in pairs( FsmT:GetParameters() ) do
|
||||
self[ ParameterID ] = Parameter
|
||||
end
|
||||
|
||||
for ProcessID, Process in pairs( FsmT:GetProcesses() ) do
|
||||
self:E( Process )
|
||||
local FsmProcess = self:AddProcess(Process.From, Process.Event, STATEMACHINE_PROCESS:New( Process.Process, Controllable, Task ), Process.ReturnEvents )
|
||||
end
|
||||
|
||||
for EndStateID, EndState in pairs( FsmT:GetEndStates() ) do
|
||||
self:E( EndState )
|
||||
self:AddEndState( EndState )
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Sets the task of the process.
|
||||
-- @param #PROCESS self
|
||||
-- @param Tasking.Task#TASK_BASE Task
|
||||
-- @return #PROCESS
|
||||
function STATEMACHINE_PROCESS:SetTask( Task )
|
||||
|
||||
self.Task = Task
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets the task of the process.
|
||||
-- @param #PROCESS self
|
||||
-- @return Task#TASK_BASE
|
||||
function STATEMACHINE_PROCESS:GetTask()
|
||||
|
||||
return self.Task
|
||||
end
|
||||
|
||||
--- Gets the mission of the process.
|
||||
-- @param #PROCESS self
|
||||
-- @return Mission#MISSION
|
||||
function STATEMACHINE_PROCESS:GetMission()
|
||||
|
||||
return self.Task.Mission
|
||||
end
|
||||
|
||||
|
||||
--- Assign the process to a @{Unit} and activate the process.
|
||||
-- @param #STATEMACHINE_PROCESS self
|
||||
-- @param Task.Tasking#TASK_BASE Task
|
||||
-- @param Wrapper.Unit#UNIT ProcessUnit
|
||||
-- @return #STATEMACHINE_PROCESS self
|
||||
function STATEMACHINE_PROCESS:Assign( ProcessUnit, Task )
|
||||
self:E( { Task, ProcessUnit } )
|
||||
|
||||
self:SetControllable( ProcessUnit )
|
||||
self:SetTask( Task )
|
||||
|
||||
--self.ProcessGroup = ProcessUnit:GetGroup()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function STATEMACHINE_PROCESS:onenterAssigned( ProcessUnit )
|
||||
self:E( "Assign" )
|
||||
|
||||
self.Task:Assign()
|
||||
end
|
||||
|
||||
function STATEMACHINE_PROCESS:onenterFailed( ProcessUnit )
|
||||
self:E( "Failed" )
|
||||
|
||||
self.Task:Fail()
|
||||
end
|
||||
|
||||
function STATEMACHINE_PROCESS:onenterSuccess( ProcessUnit )
|
||||
self:E( "Success" )
|
||||
|
||||
self.Task:Success()
|
||||
end
|
||||
|
||||
--- StateMachine callback function for a STATEMACHINE_PROCESS
|
||||
-- @param #STATEMACHINE_PROCESS self
|
||||
-- @param Controllable#CONTROLLABLE ProcessUnit
|
||||
-- @param #string Event
|
||||
-- @param #string From
|
||||
-- @param #string To
|
||||
function STATEMACHINE_PROCESS:onstatechange( ProcessUnit, Event, From, To, Dummy )
|
||||
self:E( { ProcessUnit, Event, From, To, Dummy, self:IsTrace() } )
|
||||
|
||||
if self:IsTrace() then
|
||||
MESSAGE:New( "Process " .. self.ProcessName .. " : " .. Event .. " changed to state " .. To, 15 ):ToAll()
|
||||
end
|
||||
|
||||
self:E( self.Scores[To] )
|
||||
-- TODO: This needs to be reworked with a callback functions allocated within Task, and set within the mission script from the Task Objects...
|
||||
if self.Scores[To] then
|
||||
|
||||
local Task = self.Task
|
||||
local Scoring = Task:GetScoring()
|
||||
if Scoring then
|
||||
Scoring:_AddMissionTaskScore( Task.Mission, ProcessUnit, self.Scores[To].ScoreText, self.Scores[To].Score )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- STATEMACHINE_TASK class
|
||||
-- @type STATEMACHINE_TASK
|
||||
-- @field Task#TASK_BASE Task
|
||||
-- @extends Core.StateMachine#STATEMACHINE
|
||||
STATEMACHINE_TASK = {
|
||||
ClassName = "STATEMACHINE_TASK",
|
||||
}
|
||||
|
||||
--- Creates a new STATEMACHINE_TASK object.
|
||||
-- @param #STATEMACHINE_TASK self
|
||||
-- @param #table FSMT
|
||||
-- @param Task#TASK_BASE Task
|
||||
-- @param Unit#UNIT TaskUnit
|
||||
-- @return #STATEMACHINE_TASK
|
||||
function STATEMACHINE_TASK:New( FSMT )
|
||||
|
||||
local self = BASE:Inherit( self, STATEMACHINE_CONTROLLABLE:New( FSMT ) ) -- Core.StateMachine#STATEMACHINE_TASK
|
||||
|
||||
self["onstatechange"] = self.OnStateChange
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function STATEMACHINE_TASK:_call_handler( handler, params )
|
||||
if self[handler] then
|
||||
self:E( "Calling " .. handler )
|
||||
return self[handler]( self, unpack( params ) )
|
||||
end
|
||||
end
|
||||
|
||||
do -- STATEMACHINE_SET
|
||||
|
||||
--- STATEMACHINE_SET class
|
||||
-- @type STATEMACHINE_SET
|
||||
-- @field Set#SET_BASE Set
|
||||
-- @extends StateMachine#STATEMACHINE
|
||||
STATEMACHINE_SET = {
|
||||
ClassName = "STATEMACHINE_SET",
|
||||
}
|
||||
|
||||
--- Creates a new STATEMACHINE_SET object.
|
||||
-- @param #STATEMACHINE_SET self
|
||||
-- @param #table FSMT Finite State Machine Table
|
||||
-- @param Set_SET_BASE FSMSet (optional) The Set object that the STATEMACHINE_SET governs.
|
||||
-- @return #STATEMACHINE_SET
|
||||
function STATEMACHINE_SET:New( FSMT, FSMSet )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, STATEMACHINE:New( FSMT ) ) -- StateMachine#STATEMACHINE_SET
|
||||
|
||||
if FSMSet then
|
||||
self:Set( FSMSet )
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Sets the SET_BASE object that the STATEMACHINE_SET governs.
|
||||
-- @param #STATEMACHINE_SET self
|
||||
-- @param Set#SET_BASE FSMSet
|
||||
-- @return #STATEMACHINE_SET
|
||||
function STATEMACHINE_SET:Set( FSMSet )
|
||||
self:F( FSMSet )
|
||||
self.Set = FSMSet
|
||||
end
|
||||
|
||||
--- Gets the SET_BASE object that the STATEMACHINE_SET governs.
|
||||
-- @param #STATEMACHINE_SET self
|
||||
-- @return Set#SET_BASE
|
||||
function STATEMACHINE_SET:Get()
|
||||
return self.Controllable
|
||||
end
|
||||
|
||||
function STATEMACHINE_SET:_call_handler( handler, params )
|
||||
if self[handler] then
|
||||
self:E( "Calling " .. handler )
|
||||
return self[handler]( self, self.Set, unpack( params ) )
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--- STATEMACHINE_TEMPLATE class
|
||||
-- @type STATEMACHINE_TEMPLATE
|
||||
-- @extends Core.Base#BASE
|
||||
STATEMACHINE_TEMPLATE = {
|
||||
ClassName = "STATEMACHINE_TEMPLATE",
|
||||
}
|
||||
|
||||
--- Creates a new STATEMACHINE_TEMPLATE object.
|
||||
-- @param #STATEMACHINE_TEMPLATE self
|
||||
-- @return #STATEMACHINE_TEMPLATE
|
||||
function STATEMACHINE_TEMPLATE:New( Name )
|
||||
|
||||
-- Inherits from BASE
|
||||
local self = BASE:Inherit( self, BASE:New() ) -- #STATEMACHINE_TEMPLATE
|
||||
|
||||
self._StartState = "none"
|
||||
self._Transitions = {}
|
||||
self._Processes = {}
|
||||
self._EndStates = {}
|
||||
self._Scores = {}
|
||||
|
||||
self._Name = Name or ""
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function STATEMACHINE_TEMPLATE:AddTransition( From, Event, To )
|
||||
|
||||
local Transition = {}
|
||||
Transition.From = From
|
||||
Transition.Event = Event
|
||||
Transition.To = To
|
||||
|
||||
self._Transitions[Transition] = Transition
|
||||
end
|
||||
|
||||
function STATEMACHINE_TEMPLATE:GetTransitions()
|
||||
|
||||
return self._Transitions or {}
|
||||
end
|
||||
|
||||
--- Set the default @{Process} template with key ProcessName providing the ProcessClass and the process object when it is assigned to a @{Controllable} by the task.
|
||||
-- @return Process#PROCESS
|
||||
function STATEMACHINE_TEMPLATE:AddProcess( From, Event, ProcessTemplate, ReturnEvents )
|
||||
|
||||
self:E( { ProcessTemplate = ProcessTemplate } )
|
||||
|
||||
local Process = {}
|
||||
Process.From = From
|
||||
Process.Event = Event
|
||||
Process.Process = ProcessTemplate
|
||||
Process.Parameters = ProcessTemplate:GetParameters()
|
||||
Process.ReturnEvents = ReturnEvents
|
||||
|
||||
self:E( { From = Process.From, Event = Process.Event, Process = Process.Process._Name, Parameters = Process.Parameters, ReturnEvents = Process.ReturnEvents } )
|
||||
|
||||
-- Make the reference table weak.
|
||||
-- setmetatable( self.options.subs, { __mode = "v" } )
|
||||
self._Processes[Process] = Process
|
||||
|
||||
return ProcessTemplate
|
||||
end
|
||||
|
||||
function STATEMACHINE_TEMPLATE:GetProcesses()
|
||||
|
||||
return self._Processes or {}
|
||||
end
|
||||
|
||||
function STATEMACHINE_TEMPLATE:GetProcess( From, Event )
|
||||
|
||||
for ProcessID, Process in pairs( self:GetProcesses() ) do
|
||||
if Process.From == From and Process.Event == Event then
|
||||
self:E( Process )
|
||||
return Process.Process
|
||||
end
|
||||
end
|
||||
|
||||
error( "Sub-Process from state " .. From .. " with event " .. Event .. " not found!" )
|
||||
end
|
||||
|
||||
function STATEMACHINE_TEMPLATE:SetParameters( Parameters )
|
||||
self._Parameters = Parameters
|
||||
end
|
||||
|
||||
function STATEMACHINE_TEMPLATE:GetParameters()
|
||||
return self._Parameters or {}
|
||||
end
|
||||
|
||||
|
||||
function STATEMACHINE_TEMPLATE:AddEndState( State )
|
||||
|
||||
self._EndStates[State] = State
|
||||
end
|
||||
|
||||
function STATEMACHINE_TEMPLATE:GetEndStates()
|
||||
|
||||
return self._EndStates or {}
|
||||
end
|
||||
|
||||
function STATEMACHINE_TEMPLATE:SetStartState( State )
|
||||
|
||||
self._StartState = State
|
||||
end
|
||||
|
||||
function STATEMACHINE_TEMPLATE:GetStartState()
|
||||
|
||||
return self._StartState or {}
|
||||
end
|
||||
|
||||
--- Adds a score for the STATEMACHINE_PROCESS to be achieved.
|
||||
-- @param #STATEMACHINE_TEMPLATE self
|
||||
-- @param #string State is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
|
||||
-- @param #string ScoreText is a text describing the score that is given according the status.
|
||||
-- @param #number Score is a number providing the score of the status.
|
||||
-- @return #STATEMACHINE_TEMPLATE self
|
||||
function STATEMACHINE_TEMPLATE:AddScore( State, ScoreText, Score )
|
||||
self:F2( { State, ScoreText, Score } )
|
||||
|
||||
self._Scores[State] = self._Scores[State] or {}
|
||||
self._Scores[State].ScoreText = ScoreText
|
||||
self._Scores[State].Score = Score
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Adds a score for the STATEMACHINE_PROCESS to be achieved.
|
||||
-- @param #STATEMACHINE_TEMPLATE self
|
||||
-- @param #string From is the From State of the main process.
|
||||
-- @param #string Event is the Event of the main process.
|
||||
-- @param #string State is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
|
||||
-- @param #string ScoreText is a text describing the score that is given according the status.
|
||||
-- @param #number Score is a number providing the score of the status.
|
||||
-- @return #STATEMACHINE_TEMPLATE self
|
||||
function STATEMACHINE_TEMPLATE:AddScoreProcess( From, Event, State, ScoreText, Score )
|
||||
self:F2( { Event, State, ScoreText, Score } )
|
||||
|
||||
local Process = self:GetProcess( From, Event )
|
||||
|
||||
self:E( { Process = Process._Name, Scores = Process._Scores, State = State, ScoreText = ScoreText, Score = Score } )
|
||||
Process._Scores[State] = Process._Scores[State] or {}
|
||||
Process._Scores[State].ScoreText = ScoreText
|
||||
Process._Scores[State].Score = Score
|
||||
|
||||
return Process
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- This module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
|
||||
--- This module contains the ZONE classes, inherited from @{Core.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 @{Group#GROUP} objects).
|
||||
-- * Test if partly within the zone (for @{Wrapper.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:
|
||||
--
|
||||
-- * @{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.
|
||||
-- * @{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.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE}
|
||||
-- 1) @{Core.Zone#ZONE_BASE} class, extends @{Core.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 @{Zone#ZONE_BASE}:
|
||||
-- ### 1.2) Each zone implements two polymorphic functions defined in @{Core.Zone#ZONE_BASE}:
|
||||
--
|
||||
-- * @{#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.
|
||||
-- * @{#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.
|
||||
--
|
||||
-- ### 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 @{DCSTypes#Vec2} coordinate of the zone.
|
||||
-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{DCSTypes#Vec2} within the zone.
|
||||
-- * @{#ZONE_BASE.GetVec2}(): Returns the @{Dcs.DCSTypes#Vec2} coordinate of the zone.
|
||||
-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{Dcs.DCSTypes#Vec2} within the zone.
|
||||
--
|
||||
-- ### 1.5) A zone has a bounding square:
|
||||
--
|
||||
@@ -59,12 +59,12 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE}
|
||||
-- 2) @{Core.Zone#ZONE_RADIUS} class, extends @{Core.Zone#ZONE_BASE}
|
||||
-- =======================================================
|
||||
-- The ZONE_RADIUS class defined by a zone name, a location and a radius.
|
||||
-- This class implements the inherited functions from Zone#ZONE_BASE taking into account the own zone format and properties.
|
||||
-- This class implements the inherited functions from Core.Zone#ZONE_BASE taking into account the own zone format and properties.
|
||||
--
|
||||
-- ### 2.1) @{Zone#ZONE_RADIUS} constructor:
|
||||
-- ### 2.1) @{Core.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 @{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.
|
||||
-- * @{#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.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS}
|
||||
-- 3) @{Core.Zone#ZONE} class, extends @{Core.Zone#ZONE_RADIUS}
|
||||
-- ==========================================
|
||||
-- The ZONE class, defined by the zone name as defined within the Mission Editor.
|
||||
-- This class implements the inherited functions from {Zone#ZONE_RADIUS} taking into account the own zone format and properties.
|
||||
-- This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS}
|
||||
-- 4) @{Core.Zone#ZONE_UNIT} class, extends @{Core.Zone#ZONE_RADIUS}
|
||||
-- =======================================================
|
||||
-- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
|
||||
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
|
||||
-- The ZONE_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.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS}
|
||||
-- 5) @{Core.Zone#ZONE_GROUP} class, extends @{Core.Zone#ZONE_RADIUS}
|
||||
-- =======================================================
|
||||
-- The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius. The current leader of the group defines the center of the zone.
|
||||
-- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties.
|
||||
-- The 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.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE}
|
||||
-- 6) @{Core.Zone#ZONE_POLYGON_BASE} class, extends @{Core.Zone#ZONE_BASE}
|
||||
-- ========================================================
|
||||
-- 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.
|
||||
-- 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.
|
||||
-- This class is an abstract BASE class for derived classes, and is not meant to be instantiated.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE}
|
||||
-- 7) @{Core.Zone#ZONE_POLYGON} class, extends @{Core.Zone#ZONE_POLYGON_BASE}
|
||||
-- ================================================================
|
||||
-- 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.
|
||||
-- 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.
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
@@ -145,7 +145,7 @@
|
||||
-- @type ZONE_BASE
|
||||
-- @field #string ZoneName Name of the zone.
|
||||
-- @field #number ZoneProbability A value between 0 and 1. 0 = 0% and 1 = 100% probability.
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Base#BASE
|
||||
ZONE_BASE = {
|
||||
ClassName = "ZONE_BASE",
|
||||
ZoneName = "",
|
||||
@@ -155,10 +155,10 @@ ZONE_BASE = {
|
||||
|
||||
--- The ZONE_BASE.BoundingSquare
|
||||
-- @type ZONE_BASE.BoundingSquare
|
||||
-- @field DCSTypes#Distance x1 The lower x coordinate (left down)
|
||||
-- @field DCSTypes#Distance y1 The lower y coordinate (left down)
|
||||
-- @field DCSTypes#Distance x2 The higher x coordinate (right up)
|
||||
-- @field DCSTypes#Distance y2 The higher y coordinate (right up)
|
||||
-- @field Dcs.DCSTypes#Distance x1 The lower x coordinate (left down)
|
||||
-- @field Dcs.DCSTypes#Distance y1 The lower y coordinate (left down)
|
||||
-- @field Dcs.DCSTypes#Distance x2 The higher x coordinate (right up)
|
||||
-- @field Dcs.DCSTypes#Distance y2 The higher y coordinate (right up)
|
||||
|
||||
|
||||
--- ZONE_BASE constructor
|
||||
@@ -184,7 +184,7 @@ function ZONE_BASE:GetName()
|
||||
end
|
||||
--- Returns if a location is within the zone.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @param DCSTypes#Vec2 Vec2 The location to test.
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The location to test.
|
||||
-- @return #boolean true if the location is within the zone.
|
||||
function ZONE_BASE:IsPointVec2InZone( Vec2 )
|
||||
self:F2( Vec2 )
|
||||
@@ -194,7 +194,7 @@ end
|
||||
|
||||
--- Returns if a point is within the zone.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @param DCSTypes#Vec3 Vec3 The point to test.
|
||||
-- @param Dcs.DCSTypes#Vec3 Vec3 The point to test.
|
||||
-- @return #boolean true if the point is within the zone.
|
||||
function ZONE_BASE:IsPointVec3InZone( Vec3 )
|
||||
self:F2( Vec3 )
|
||||
@@ -204,7 +204,7 @@ function ZONE_BASE:IsPointVec3InZone( Vec3 )
|
||||
return InZone
|
||||
end
|
||||
|
||||
--- Returns the @{DCSTypes#Vec2} coordinate of the zone.
|
||||
--- Returns the @{Dcs.DCSTypes#Vec2} coordinate of the zone.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @return #nil.
|
||||
function ZONE_BASE:GetVec2()
|
||||
@@ -212,9 +212,9 @@ function ZONE_BASE:GetVec2()
|
||||
|
||||
return nil
|
||||
end
|
||||
--- Define a random @{DCSTypes#Vec2} within the zone.
|
||||
--- Define a random @{Dcs.DCSTypes#Vec2} within the zone.
|
||||
-- @param #ZONE_BASE self
|
||||
-- @return DCSTypes#Vec2 The Vec2 coordinates.
|
||||
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinates.
|
||||
function ZONE_BASE:GetRandomVec2()
|
||||
return nil
|
||||
end
|
||||
@@ -273,9 +273,9 @@ end
|
||||
|
||||
--- The ZONE_RADIUS class, defined by a zone name, a location and a radius.
|
||||
-- @type ZONE_RADIUS
|
||||
-- @field DCSTypes#Vec2 Vec2 The current location of the zone.
|
||||
-- @field DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @extends Zone#ZONE_BASE
|
||||
-- @field Dcs.DCSTypes#Vec2 Vec2 The current location of the zone.
|
||||
-- @field Dcs.DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @extends Core.Zone#ZONE_BASE
|
||||
ZONE_RADIUS = {
|
||||
ClassName="ZONE_RADIUS",
|
||||
}
|
||||
@@ -283,8 +283,8 @@ ZONE_RADIUS = {
|
||||
--- Constructor of @{#ZONE_RADIUS}, taking the zone name, the zone location and a radius.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param #string ZoneName Name of the zone.
|
||||
-- @param DCSTypes#Vec2 Vec2 The location of the zone.
|
||||
-- @param DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The location of the zone.
|
||||
-- @param Dcs.DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @return #ZONE_RADIUS self
|
||||
function ZONE_RADIUS:New( ZoneName, Vec2, Radius )
|
||||
local self = BASE:Inherit( self, ZONE_BASE:New( ZoneName ) )
|
||||
@@ -325,9 +325,9 @@ end
|
||||
|
||||
--- Flares the zone boundaries in a color.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param Utils#FLARECOLOR FlareColor The flare color.
|
||||
-- @param Utilities.Utils#FLARECOLOR FlareColor The flare color.
|
||||
-- @param #number Points (optional) The amount of points in the circle.
|
||||
-- @param DCSTypes#Azimuth Azimuth (optional) Azimuth The azimuth of the flare.
|
||||
-- @param Dcs.DCSTypes#Azimuth Azimuth (optional) Azimuth The azimuth of the flare.
|
||||
-- @return #ZONE_RADIUS self
|
||||
function ZONE_RADIUS:FlareZone( FlareColor, Points, Azimuth )
|
||||
self:F2( { FlareColor, Azimuth } )
|
||||
@@ -352,7 +352,7 @@ end
|
||||
|
||||
--- Returns the radius of the zone.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @return DCSTypes#Distance The radius of the zone.
|
||||
-- @return Dcs.DCSTypes#Distance The radius of the zone.
|
||||
function ZONE_RADIUS:GetRadius()
|
||||
self:F2( self.ZoneName )
|
||||
|
||||
@@ -363,8 +363,8 @@ end
|
||||
|
||||
--- Sets the radius of the zone.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @return DCSTypes#Distance The radius of the zone.
|
||||
-- @param Dcs.DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @return Dcs.DCSTypes#Distance The radius of the zone.
|
||||
function ZONE_RADIUS:SetRadius( Radius )
|
||||
self:F2( self.ZoneName )
|
||||
|
||||
@@ -374,9 +374,9 @@ function ZONE_RADIUS:SetRadius( Radius )
|
||||
return self.Radius
|
||||
end
|
||||
|
||||
--- Returns the @{DCSTypes#Vec2} of the zone.
|
||||
--- Returns the @{Dcs.DCSTypes#Vec2} of the zone.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @return DCSTypes#Vec2 The location of the zone.
|
||||
-- @return Dcs.DCSTypes#Vec2 The location of the zone.
|
||||
function ZONE_RADIUS:GetVec2()
|
||||
self:F2( self.ZoneName )
|
||||
|
||||
@@ -385,10 +385,10 @@ function ZONE_RADIUS:GetVec2()
|
||||
return self.Vec2
|
||||
end
|
||||
|
||||
--- Sets the @{DCSTypes#Vec2} of the zone.
|
||||
--- Sets the @{Dcs.DCSTypes#Vec2} of the zone.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param DCSTypes#Vec2 Vec2 The new location of the zone.
|
||||
-- @return DCSTypes#Vec2 The new location of the zone.
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The new location of the zone.
|
||||
-- @return Dcs.DCSTypes#Vec2 The new location of the zone.
|
||||
function ZONE_RADIUS:SetVec2( Vec2 )
|
||||
self:F2( self.ZoneName )
|
||||
|
||||
@@ -399,10 +399,10 @@ function ZONE_RADIUS:SetVec2( Vec2 )
|
||||
return self.Vec2
|
||||
end
|
||||
|
||||
--- Returns the @{DCSTypes#Vec3} of the ZONE_RADIUS.
|
||||
--- Returns the @{Dcs.DCSTypes#Vec3} of the ZONE_RADIUS.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
|
||||
-- @return DCSTypes#Vec3 The point of the zone.
|
||||
-- @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.
|
||||
function ZONE_RADIUS:GetVec3( Height )
|
||||
self:F2( { self.ZoneName, Height } )
|
||||
|
||||
@@ -419,7 +419,7 @@ end
|
||||
|
||||
--- Returns if a location is within the zone.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param DCSTypes#Vec2 Vec2 The location to test.
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The location to test.
|
||||
-- @return #boolean true if the location is within the zone.
|
||||
function ZONE_RADIUS:IsPointVec2InZone( Vec2 )
|
||||
self:F2( Vec2 )
|
||||
@@ -437,7 +437,7 @@ end
|
||||
|
||||
--- Returns if a point is within the zone.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param DCSTypes#Vec3 Vec3 The point to test.
|
||||
-- @param Dcs.DCSTypes#Vec3 Vec3 The point to test.
|
||||
-- @return #boolean true if the point is within the zone.
|
||||
function ZONE_RADIUS:IsPointVec3InZone( Vec3 )
|
||||
self:F2( Vec3 )
|
||||
@@ -449,7 +449,7 @@ end
|
||||
|
||||
--- Returns a random location within the zone.
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @return DCSTypes#Vec2 The random location within the zone.
|
||||
-- @return Dcs.DCSTypes#Vec2 The random location within the zone.
|
||||
function ZONE_RADIUS:GetRandomVec2()
|
||||
self:F( self.ZoneName )
|
||||
|
||||
@@ -469,7 +469,7 @@ end
|
||||
|
||||
--- The ZONE class, defined by the zone name as defined within the Mission Editor. The location and the radius are automatically collected from the mission settings.
|
||||
-- @type ZONE
|
||||
-- @extends Zone#ZONE_RADIUS
|
||||
-- @extends Core.Zone#ZONE_RADIUS
|
||||
ZONE = {
|
||||
ClassName="ZONE",
|
||||
}
|
||||
@@ -497,10 +497,10 @@ function ZONE:New( ZoneName )
|
||||
end
|
||||
|
||||
|
||||
--- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius.
|
||||
--- The ZONE_UNIT class defined by a zone around a @{Wrapper.Unit#UNIT} with a radius.
|
||||
-- @type ZONE_UNIT
|
||||
-- @field Unit#UNIT ZoneUNIT
|
||||
-- @extends Zone#ZONE_RADIUS
|
||||
-- @field Wrapper.Unit#UNIT ZoneUNIT
|
||||
-- @extends Core.Zone#ZONE_RADIUS
|
||||
ZONE_UNIT = {
|
||||
ClassName="ZONE_UNIT",
|
||||
}
|
||||
@@ -508,8 +508,8 @@ ZONE_UNIT = {
|
||||
--- Constructor to create a ZONE_UNIT instance, taking the zone name, a zone unit and a radius.
|
||||
-- @param #ZONE_UNIT self
|
||||
-- @param #string ZoneName Name of the zone.
|
||||
-- @param Unit#UNIT ZoneUNIT The unit as the center of the zone.
|
||||
-- @param DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @param Wrapper.Unit#UNIT ZoneUNIT The unit as the center of the zone.
|
||||
-- @param Dcs.DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @return #ZONE_UNIT self
|
||||
function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius )
|
||||
local self = BASE:Inherit( self, ZONE_RADIUS:New( ZoneName, ZoneUNIT:GetVec2(), Radius ) )
|
||||
@@ -522,9 +522,9 @@ function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius )
|
||||
end
|
||||
|
||||
|
||||
--- Returns the current location of the @{Unit#UNIT}.
|
||||
--- Returns the current location of the @{Wrapper.Unit#UNIT}.
|
||||
-- @param #ZONE_UNIT self
|
||||
-- @return DCSTypes#Vec2 The location of the zone based on the @{Unit#UNIT}location.
|
||||
-- @return Dcs.DCSTypes#Vec2 The location of the zone based on the @{Wrapper.Unit#UNIT}location.
|
||||
function ZONE_UNIT:GetVec2()
|
||||
self:F( self.ZoneName )
|
||||
|
||||
@@ -543,7 +543,7 @@ end
|
||||
|
||||
--- Returns a random location within the zone.
|
||||
-- @param #ZONE_UNIT self
|
||||
-- @return DCSTypes#Vec2 The random location within the zone.
|
||||
-- @return Dcs.DCSTypes#Vec2 The random location within the zone.
|
||||
function ZONE_UNIT:GetRandomVec2()
|
||||
self:F( self.ZoneName )
|
||||
|
||||
@@ -563,10 +563,10 @@ function ZONE_UNIT:GetRandomVec2()
|
||||
return RandomVec2
|
||||
end
|
||||
|
||||
--- Returns the @{DCSTypes#Vec3} of the ZONE_UNIT.
|
||||
--- Returns the @{Dcs.DCSTypes#Vec3} of the ZONE_UNIT.
|
||||
-- @param #ZONE_UNIT self
|
||||
-- @param DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
|
||||
-- @return DCSTypes#Vec3 The point of the zone.
|
||||
-- @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.
|
||||
function ZONE_UNIT:GetVec3( Height )
|
||||
self:F2( self.ZoneName )
|
||||
|
||||
@@ -583,17 +583,17 @@ end
|
||||
|
||||
--- The ZONE_GROUP class defined by a zone around a @{Group}, taking the average center point of all the units within the Group, with a radius.
|
||||
-- @type ZONE_GROUP
|
||||
-- @field Group#GROUP ZoneGROUP
|
||||
-- @extends Zone#ZONE_RADIUS
|
||||
-- @field Wrapper.Group#GROUP ZoneGROUP
|
||||
-- @extends Core.Zone#ZONE_RADIUS
|
||||
ZONE_GROUP = {
|
||||
ClassName="ZONE_GROUP",
|
||||
}
|
||||
|
||||
--- Constructor to create a ZONE_GROUP instance, taking the zone name, a zone @{Group#GROUP} and a radius.
|
||||
--- Constructor to create a ZONE_GROUP instance, taking the zone name, a zone @{Wrapper.Group#GROUP} and a radius.
|
||||
-- @param #ZONE_GROUP self
|
||||
-- @param #string ZoneName Name of the zone.
|
||||
-- @param Group#GROUP ZoneGROUP The @{Group} as the center of the zone.
|
||||
-- @param DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @param Wrapper.Group#GROUP ZoneGROUP The @{Group} as the center of the zone.
|
||||
-- @param Dcs.DCSTypes#Distance Radius The radius of the zone.
|
||||
-- @return #ZONE_GROUP self
|
||||
function ZONE_GROUP:New( ZoneName, ZoneGROUP, Radius )
|
||||
local self = BASE:Inherit( self, ZONE_RADIUS:New( ZoneName, ZoneGROUP:GetVec2(), Radius ) )
|
||||
@@ -607,7 +607,7 @@ end
|
||||
|
||||
--- Returns the current location of the @{Group}.
|
||||
-- @param #ZONE_GROUP self
|
||||
-- @return DCSTypes#Vec2 The location of the zone based on the @{Group} location.
|
||||
-- @return Dcs.DCSTypes#Vec2 The location of the zone based on the @{Group} location.
|
||||
function ZONE_GROUP:GetVec2()
|
||||
self:F( self.ZoneName )
|
||||
|
||||
@@ -620,7 +620,7 @@ end
|
||||
|
||||
--- Returns a random location within the zone of the @{Group}.
|
||||
-- @param #ZONE_GROUP self
|
||||
-- @return DCSTypes#Vec2 The random location of the zone based on the @{Group} location.
|
||||
-- @return Dcs.DCSTypes#Vec2 The random location of the zone based on the @{Group} location.
|
||||
function ZONE_GROUP:GetRandomVec2()
|
||||
self:F( self.ZoneName )
|
||||
|
||||
@@ -640,23 +640,23 @@ end
|
||||
|
||||
-- Polygons
|
||||
|
||||
--- The ZONE_POLYGON_BASE class defined by an array of @{DCSTypes#Vec2}, forming a polygon.
|
||||
--- The ZONE_POLYGON_BASE class defined by an array of @{Dcs.DCSTypes#Vec2}, forming a polygon.
|
||||
-- @type ZONE_POLYGON_BASE
|
||||
-- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{DCSTypes#Vec2}.
|
||||
-- @extends Zone#ZONE_BASE
|
||||
-- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{Dcs.DCSTypes#Vec2}.
|
||||
-- @extends Core.Zone#ZONE_BASE
|
||||
ZONE_POLYGON_BASE = {
|
||||
ClassName="ZONE_POLYGON_BASE",
|
||||
}
|
||||
|
||||
--- A points array.
|
||||
-- @type ZONE_POLYGON_BASE.ListVec2
|
||||
-- @list <DCSTypes#Vec2>
|
||||
-- @list <Dcs.DCSTypes#Vec2>
|
||||
|
||||
--- 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.
|
||||
--- 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.
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @param #string ZoneName Name of the zone.
|
||||
-- @param #ZONE_POLYGON_BASE.ListVec2 PointsArray An array of @{DCSTypes#Vec2}, forming a polygon..
|
||||
-- @param #ZONE_POLYGON_BASE.ListVec2 PointsArray An array of @{Dcs.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 ) )
|
||||
@@ -725,7 +725,7 @@ end
|
||||
--- Returns if a location is within the zone.
|
||||
-- Source learned and taken from: https://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @param DCSTypes#Vec2 Vec2 The location to test.
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The location to test.
|
||||
-- @return #boolean true if the location is within the zone.
|
||||
function ZONE_POLYGON_BASE:IsPointVec2InZone( Vec2 )
|
||||
self:F2( Vec2 )
|
||||
@@ -753,9 +753,9 @@ function ZONE_POLYGON_BASE:IsPointVec2InZone( Vec2 )
|
||||
return InPolygon
|
||||
end
|
||||
|
||||
--- Define a random @{DCSTypes#Vec2} within the zone.
|
||||
--- Define a random @{Dcs.DCSTypes#Vec2} within the zone.
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @return DCSTypes#Vec2 The Vec2 coordinate.
|
||||
-- @return Dcs.DCSTypes#Vec2 The Vec2 coordinate.
|
||||
function ZONE_POLYGON_BASE:GetRandomVec2()
|
||||
self:F2()
|
||||
|
||||
@@ -805,18 +805,18 @@ end
|
||||
|
||||
|
||||
|
||||
--- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon.
|
||||
--- The ZONE_POLYGON class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
|
||||
-- @type ZONE_POLYGON
|
||||
-- @extends Zone#ZONE_POLYGON_BASE
|
||||
-- @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 @{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.
|
||||
--- 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.
|
||||
-- @param #ZONE_POLYGON self
|
||||
-- @param #string ZoneName Name of the zone.
|
||||
-- @param Group#GROUP ZoneGroup The GROUP waypoints as defined within the Mission Editor define the polygon shape.
|
||||
-- @param Wrapper.Group#GROUP ZoneGroup The GROUP waypoints as defined within the Mission Editor define the polygon shape.
|
||||
-- @return #ZONE_POLYGON self
|
||||
function ZONE_POLYGON:New( ZoneName, ZoneGroup )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user