diff --git a/Moose Development/Moose/AI/AI_Balancer.lua b/Moose Development/Moose/AI/AI_Balancer.lua index 8b6b51cba..7a06f54c2 100644 --- a/Moose Development/Moose/AI/AI_Balancer.lua +++ b/Moose Development/Moose/AI/AI_Balancer.lua @@ -4,62 +4,22 @@ -- --  -- --- === +-- ==== -- --- # 1) @{AI_Balancer#AI_BALANCER} class, extends @{Fsm#FSM_SET} +-- # Demo Missions -- --- The @{AI_Balancer#AI_BALANCER} class monitors and manages as many replacement AI groups as there are --- CLIENTS in a SET_CLIENT collection, which are not occupied by human players. --- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions. +-- ### [AI_BALANCER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/AIB%20-%20AI%20Balancing) -- --- The parent class @{Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM). --- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods. --- An explanation about state and event transition methods can be found in the @{FSM} module documentation. +-- ### [AI_BALANCER Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AIB%20-%20AI%20Balancing) +-- +-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases) -- --- The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following: +-- ==== -- --- * **@{#AI_BALANCER.OnAfterSpawned}**( AISet, From, Event, To, AIGroup ): Define to add extra logic when an AI is spawned. +-- # YouTube Channel -- --- ## 1.1) AI_BALANCER construction +-- ### [AI_BALANCER YouTube Channel](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl2CJVIrL1TdAumuVS8n64B7) -- --- Create a new AI_BALANCER object with the @{#AI_BALANCER.New}() method: --- --- ## 1.2) AI_BALANCER is a FSM --- ---  --- --- ### 1.2.1) AI_BALANCER States --- --- * **Monitoring** ( Set ): Monitoring the Set if all AI is spawned for the Clients. --- * **Spawning** ( Set, ClientName ): There is a new AI group spawned with ClientName as the name of reference. --- * **Spawned** ( Set, AIGroup ): A new AI has been spawned. You can handle this event to customize the AI behaviour with other AI FSMs or own processes. --- * **Destroying** ( Set, AIGroup ): The AI is being destroyed. --- * **Returning** ( Set, AIGroup ): The AI is returning to the airbase specified by the ReturnToAirbase methods. Handle this state to customize the return behaviour of the AI, if any. --- --- ### 1.2.2) AI_BALANCER Events --- --- * **Monitor** ( Set ): Every 10 seconds, the Monitor event is triggered to monitor the Set. --- * **Spawn** ( Set, ClientName ): Triggers when there is a new AI group to be spawned with ClientName as the name of reference. --- * **Spawned** ( Set, AIGroup ): Triggers when a new AI has been spawned. You can handle this event to customize the AI behaviour with other AI FSMs or own processes. --- * **Destroy** ( Set, AIGroup ): The AI is being destroyed. --- * **Return** ( Set, AIGroup ): The AI is returning to the airbase specified by the ReturnToAirbase methods. --- --- ## 1.3) AI_BALANCER spawn interval for replacement AI --- --- Use the method @{#AI_BALANCER.InitSpawnInterval}() to set the earliest and latest interval in seconds that is waited until a new replacement AI is spawned. --- --- ## 1.4) AI_BALANCER returns AI to Airbases --- --- By default, When a human player joins a slot that is AI_BALANCED, the AI group will be destroyed by default. --- However, there are 2 additional options that you can use to customize the destroy behaviour. --- When a human player joins a slot, you can configure to let the AI return to: --- --- * @{#AI_BALANCER.ReturnToHomeAirbase}: Returns the AI to the **home** @{Airbase#AIRBASE}. --- * @{#AI_BALANCER.ReturnToNearestAirbases}: Returns the AI to the **nearest friendly** @{Airbase#AIRBASE}. --- --- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return, --- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed. --- -- === -- -- # **API CHANGE HISTORY** @@ -90,12 +50,68 @@ -- -- @module AI_Balancer ---- AI_BALANCER class --- @type AI_BALANCER +--- @type AI_BALANCER -- @field Core.Set#SET_CLIENT SetClient -- @field Functional.Spawn#SPAWN SpawnAI -- @field Wrapper.Group#GROUP Test -- @extends Core.Fsm#FSM_SET + + +--- # AI_BALANCER class, extends @{Fsm#FSM_SET} +-- +-- The AI_BALANCER class monitors and manages as many replacement AI groups as there are +-- CLIENTS in a SET_CLIENT collection, which are not occupied by human players. +-- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions. +-- +-- The parent class @{Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM). +-- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods. +-- An explanation about state and event transition methods can be found in the @{FSM} module documentation. +-- +-- The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following: +-- +-- * @{#AI_BALANCER.OnAfterSpawned}( AISet, From, Event, To, AIGroup ): Define to add extra logic when an AI is spawned. +-- +-- ## 1. AI_BALANCER construction +-- +-- Create a new AI_BALANCER object with the @{#AI_BALANCER.New}() method: +-- +-- ## 2. AI_BALANCER is a FSM +-- +--  +-- +-- ### 2.1. AI_BALANCER States +-- +-- * **Monitoring** ( Set ): Monitoring the Set if all AI is spawned for the Clients. +-- * **Spawning** ( Set, ClientName ): There is a new AI group spawned with ClientName as the name of reference. +-- * **Spawned** ( Set, AIGroup ): A new AI has been spawned. You can handle this event to customize the AI behaviour with other AI FSMs or own processes. +-- * **Destroying** ( Set, AIGroup ): The AI is being destroyed. +-- * **Returning** ( Set, AIGroup ): The AI is returning to the airbase specified by the ReturnToAirbase methods. Handle this state to customize the return behaviour of the AI, if any. +-- +-- ### 2.2. AI_BALANCER Events +-- +-- * **Monitor** ( Set ): Every 10 seconds, the Monitor event is triggered to monitor the Set. +-- * **Spawn** ( Set, ClientName ): Triggers when there is a new AI group to be spawned with ClientName as the name of reference. +-- * **Spawned** ( Set, AIGroup ): Triggers when a new AI has been spawned. You can handle this event to customize the AI behaviour with other AI FSMs or own processes. +-- * **Destroy** ( Set, AIGroup ): The AI is being destroyed. +-- * **Return** ( Set, AIGroup ): The AI is returning to the airbase specified by the ReturnToAirbase methods. +-- +-- ## 3. AI_BALANCER spawn interval for replacement AI +-- +-- Use the method @{#AI_BALANCER.InitSpawnInterval}() to set the earliest and latest interval in seconds that is waited until a new replacement AI is spawned. +-- +-- ## 4. AI_BALANCER returns AI to Airbases +-- +-- By default, When a human player joins a slot that is AI_BALANCED, the AI group will be destroyed by default. +-- However, there are 2 additional options that you can use to customize the destroy behaviour. +-- When a human player joins a slot, you can configure to let the AI return to: +-- +-- * @{#AI_BALANCER.ReturnToHomeAirbase}: Returns the AI to the **home** @{Airbase#AIRBASE}. +-- * @{#AI_BALANCER.ReturnToNearestAirbases}: Returns the AI to the **nearest friendly** @{Airbase#AIRBASE}. +-- +-- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return, +-- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed. +-- +-- @field #AI_BALANCER AI_BALANCER = { ClassName = "AI_BALANCER", PatrolZones = {}, diff --git a/Moose Development/Moose/AI/AI_CAP.lua b/Moose Development/Moose/AI/AI_CAP.lua index 1b7dcbe22..ad9a242b1 100644 --- a/Moose Development/Moose/AI/AI_CAP.lua +++ b/Moose Development/Moose/AI/AI_CAP.lua @@ -11,6 +11,22 @@ -- * @{#AI_CAP_ZONE}: Perform a CAP in a zone. -- -- ==== +-- +-- # Demo Missions +-- +-- ### [AI_CAP Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/CAP%20-%20Combat%20Air%20Patrol) +-- +-- ### [AI_CAP Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAP%20-%20Combat%20Air%20Patrol) +-- +-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases) +-- +-- ==== +-- +-- # YouTube Channel +-- +-- ### [AI_CAP YouTube Channel](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl1YCyPxJgoZn-CfhwyeW65L) +-- +-- ==== -- -- # **API CHANGE HISTORY** -- @@ -48,9 +64,9 @@ -- @extends AI.AI_Patrol#AI_PATROL_ZONE ---- # 1) @{#AI_CAP_ZONE} class, extends @{AI_CAP#AI_PATROL_ZONE} +--- # AI_CAP_ZONE class, extends @{AI_CAP#AI_PATROL_ZONE} -- --- The @{#AI_CAP_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group} +-- The AI_CAP_ZONE class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group} -- and automatically engage any airborne enemies that are within a certain range or within a certain zone. -- --  @@ -81,22 +97,22 @@ -- --  -- --- ## 1.1) AI_CAP_ZONE constructor +-- ## 1. AI_CAP_ZONE constructor -- -- * @{#AI_CAP_ZONE.New}(): Creates a new AI_CAP_ZONE object. -- --- ## 1.2) AI_CAP_ZONE is a FSM +-- ## 2. AI_CAP_ZONE is a FSM -- --  -- --- ### 1.2.1) AI_CAP_ZONE States +-- ### 2.1 AI_CAP_ZONE States -- -- * **None** ( Group ): The process is not started yet. -- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. -- * **Engaging** ( Group ): The AI is engaging the bogeys. -- * **Returning** ( Group ): The AI is returning to Base.. -- --- ### 1.2.2) AI_CAP_ZONE Events +-- ### 2.2 AI_CAP_ZONE Events -- -- * **@{AI_Patrol#AI_PATROL_ZONE.Start}**: Start the process. -- * **@{AI_Patrol#AI_PATROL_ZONE.Route}**: Route the AI to a new random 3D point within the Patrol Zone. @@ -109,7 +125,7 @@ -- * **@{#AI_CAP_ZONE.Destroyed}**: The AI has destroyed all bogeys @{Unit}s assigned in the CAS task. -- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. -- --- ## 1.3) Set the Range of Engagement +-- ## 3. Set the Range of Engagement -- --  -- @@ -119,7 +135,7 @@ -- The range is applied at the position of the AI. -- Use the method @{AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range. -- --- ## 1.4) Set the Zone of Engagement +-- ## 4. Set the Zone of Engagement -- --  -- @@ -129,8 +145,7 @@ -- -- === -- --- @field #AI_CAP_ZONE AI_CAP_ZONE --- +-- @field #AI_CAP_ZONE AI_CAP_ZONE = { ClassName = "AI_CAP_ZONE", } diff --git a/Moose Development/Moose/AI/AI_CAS.lua b/Moose Development/Moose/AI/AI_CAS.lua index 49ffdbc51..b9f866f0e 100644 --- a/Moose Development/Moose/AI/AI_CAS.lua +++ b/Moose Development/Moose/AI/AI_CAS.lua @@ -10,6 +10,22 @@ -- -- * @{#AI_CAS_ZONE}: Perform a CAS in a zone. -- +-- ==== +-- +-- # Demo Missions +-- +-- ### [AI_CAS Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/CAS%20-%20Close%20Air%20Support) +-- +-- ### [AI_CAS Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAS%20-%20Close%20Air%20Support) +-- +-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases) +-- +-- ==== +-- +-- # YouTube Channel +-- +-- ### [AI_CAS YouTube Channel](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl3JBO1WDqqpyYRRmIkR2ir2) +-- -- === -- -- # **API CHANGE HISTORY** @@ -46,11 +62,11 @@ -- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed. -- @extends AI.AI_Patrol#AI_PATROL_ZONE ---- # 1) @{#AI_CAS_ZONE} class, extends @{AI_Patrol#AI_PATROL_ZONE} +--- # AI_CAS_ZONE class, extends @{AI_Patrol#AI_PATROL_ZONE} -- --- @{#AI_CAS_ZONE} derives from the @{AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour. +-- AI_CAS_ZONE derives from the @{AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour. -- --- The @{#AI_CAS_ZONE} class implements the core functions to provide Close Air Support in an Engage @{Zone} by an AIR @{Controllable} or @{Group}. +-- The AI_CAS_ZONE class implements the core functions to provide Close Air Support in an Engage @{Zone} by an AIR @{Controllable} or @{Group}. -- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone. -- --  @@ -104,22 +120,22 @@ -- --  -- --- # 1.1) AI_CAS_ZONE constructor +-- # 1. AI_CAS_ZONE constructor -- -- * @{#AI_CAS_ZONE.New}(): Creates a new AI_CAS_ZONE object. -- --- ## 1.2) AI_CAS_ZONE is a FSM +-- ## 2. AI_CAS_ZONE is a FSM -- --  -- --- ### 1.2.1) AI_CAS_ZONE States +-- ### 2.1. AI_CAS_ZONE States -- -- * **None** ( Group ): The process is not started yet. -- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. -- * **Engaging** ( Group ): The AI is engaging the targets in the Engage Zone, executing CAS. -- * **Returning** ( Group ): The AI is returning to Base.. -- --- ### 1.2.2) AI_CAS_ZONE Events +-- ### 2.2. AI_CAS_ZONE Events -- -- * **@{AI_Patrol#AI_PATROL_ZONE.Start}**: Start the process. -- * **@{AI_Patrol#AI_PATROL_ZONE.Route}**: Route the AI to a new random 3D point within the Patrol Zone. @@ -134,8 +150,7 @@ -- -- === -- --- @field #AI_CAS_ZONE AI_CAS_ZONE --- +-- @field #AI_CAS_ZONE AI_CAS_ZONE = { ClassName = "AI_CAS_ZONE", } diff --git a/Moose Development/Moose/AI/AI_Patrol.lua b/Moose Development/Moose/AI/AI_Patrol.lua index 404b0d904..2b4f24c55 100644 --- a/Moose Development/Moose/AI/AI_Patrol.lua +++ b/Moose Development/Moose/AI/AI_Patrol.lua @@ -12,6 +12,22 @@ -- -- ==== -- +-- # Demo Missions +-- +-- ### [AI_PATROL Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/PAT%20-%20Patrolling) +-- +-- ### [AI_PATROL Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/PAT%20-%20Patrolling) +-- +-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases) +-- +-- ==== +-- +-- # YouTube Channel +-- +-- ### [AI_PATROL YouTube Channel](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl35HvYZKA6G22WMt7iI3zky) +-- +-- ==== +-- -- # **OPEN ISSUES** -- -- 2017-01-17: When Spawned AI is located at an airbase, it will be routed first back to the airbase after take-off. @@ -64,9 +80,9 @@ -- @field Functional.Spawn#SPAWN CoordTest -- @extends Core.Fsm#FSM_CONTROLLABLE ---- # 1) @{#AI_PATROL_ZONE} class, extends @{Fsm#FSM_CONTROLLABLE} +--- # AI_PATROL_ZONE class, extends @{Fsm#FSM_CONTROLLABLE} -- --- The @{#AI_PATROL_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}. +-- The AI_PATROL_ZONE class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}. -- --  -- @@ -97,15 +113,15 @@ -- --  -- --- ## 1.1) AI_PATROL_ZONE constructor +-- ## 1. AI_PATROL_ZONE constructor -- -- * @{#AI_PATROL_ZONE.New}(): Creates a new AI_PATROL_ZONE object. -- --- ## 1.2) AI_PATROL_ZONE is a FSM +-- ## 2. AI_PATROL_ZONE is a FSM -- --  -- --- ### 1.2.1) AI_PATROL_ZONE States +-- ### 2.1. AI_PATROL_ZONE States -- -- * **None** ( Group ): The process is not started yet. -- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. @@ -113,7 +129,7 @@ -- * **Stopped** ( Group ): The process is stopped. -- * **Crashed** ( Group ): The AI has crashed or is dead. -- --- ### 1.2.2) AI_PATROL_ZONE Events +-- ### 2.2. AI_PATROL_ZONE Events -- -- * **Start** ( Group ): Start the process. -- * **Stop** ( Group ): Stop the process. @@ -123,17 +139,17 @@ -- * **Detected** ( Group ): The AI has detected new targets. -- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. -- --- ## 1.3) Set or Get the AI controllable +-- ## 3. Set or Get the AI controllable -- -- * @{#AI_PATROL_ZONE.SetControllable}(): Set the AIControllable. -- * @{#AI_PATROL_ZONE.GetControllable}(): Get the AIControllable. -- --- ## 1.4) Set the Speed and Altitude boundaries of the AI controllable +-- ## 4. Set the Speed and Altitude boundaries of the AI controllable -- -- * @{#AI_PATROL_ZONE.SetSpeed}(): Set the patrol speed boundaries of the AI, for the next patrol. -- * @{#AI_PATROL_ZONE.SetAltitude}(): Set altitude boundaries of the AI, for the next patrol. -- --- ## 1.5) Manage the detection process of the AI controllable +-- ## 5. Manage the detection process of the AI controllable -- -- The detection process of the AI controllable can be manipulated. -- Detection requires an amount of CPU power, which has an impact on your mission performance. @@ -150,7 +166,7 @@ -- Note that when the zone is too far away, or the AI is not heading towards the zone, or the AI is too high, no targets may be detected -- according the weather conditions. -- --- ## 1.6) Manage the "out of fuel" in the AI_PATROL_ZONE +-- ## 6. Manage the "out of fuel" in the AI_PATROL_ZONE -- -- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. -- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. @@ -159,7 +175,7 @@ -- Once the time is finished, the old AI will return to the base. -- Use the method @{#AI_PATROL_ZONE.ManageFuel}() to have this proces in place. -- --- ## 1.7) Manage "damage" behaviour of the AI in the AI_PATROL_ZONE +-- ## 7. Manage "damage" behaviour of the AI in the AI_PATROL_ZONE -- -- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on. -- Therefore, when the damage treshold is reached, the AI will return immediately to the home base (RTB). @@ -167,8 +183,7 @@ -- -- === -- --- @field #AI_PATROL_ZONE AI_PATROL_ZONE --- +-- @field #AI_PATROL_ZONE AI_PATROL_ZONE = { ClassName = "AI_PATROL_ZONE", } diff --git a/Moose Development/Moose/Core/Fsm.lua b/Moose Development/Moose/Core/Fsm.lua index fb7be648b..972071634 100644 --- a/Moose Development/Moose/Core/Fsm.lua +++ b/Moose Development/Moose/Core/Fsm.lua @@ -5,6 +5,8 @@ -- -- === -- +-- A Finite State Machine (FSM) models a process flow that transitions between various **States** through triggered **Events**. +-- -- A FSM can only be in one of a finite number of states. -- The machine is in only one state at a time; the state it is in at any given time is called the **current state**. -- It can change from one state to another when initiated by an **__internal__ or __external__ triggering event**, which is called a **transition**. @@ -90,8 +92,43 @@ do -- FSM -- @extends Core.Base#BASE - --- # 1) FSM class, extends @{Base#BASE} + --- # FSM class, extends @{Base#BASE} -- + -- A Finite State Machine (FSM) models a process flow that transitions between various **States** through triggered **Events**. + -- + -- A FSM can only be in one of a finite number of states. + -- The machine is in only one state at a time; the state it is in at any given time is called the **current state**. + -- It can change from one state to another when initiated by an **__internal__ or __external__ triggering event**, which is called a **transition**. + -- An **FSM implementation** is defined by **a list of its states**, **its initial state**, and **the triggering events** for **each possible transition**. + -- An FSM implementation is composed out of **two parts**, a set of **state transition rules**, and an implementation set of **state transition handlers**, implementing those transitions. + -- + -- The FSM class supports a **hierarchical implementation of a Finite State Machine**, + -- that is, it allows to **embed existing FSM implementations in a master FSM**. + -- FSM hierarchies allow for efficient FSM re-use, **not having to re-invent the wheel every time again** when designing complex processes. + -- + --  + -- + -- The above diagram shows a graphical representation of a FSM implementation for a **Task**, which guides a Human towards a Zone, + -- orders him to destroy x targets and account the results. + -- Other examples of ready made FSM could be: + -- + -- * route a plane to a zone flown by a human + -- * detect targets by an AI and report to humans + -- * account for destroyed targets by human players + -- * handle AI infantry to deploy from or embark to a helicopter or airplane or vehicle + -- * let an AI patrol a zone + -- + -- The **MOOSE framework** uses extensively the FSM class and derived FSM\_ classes, + -- because **the goal of MOOSE is to simplify mission design complexity for mission building**. + -- By efficiently utilizing the FSM class and derived classes, MOOSE allows mission designers to quickly build processes. + -- **Ready made FSM-based implementations classes** exist within the MOOSE framework that **can easily be re-used, + -- and tailored** by mission designers through **the implementation of Transition Handlers**. + -- Each of these FSM implementation classes start either with: + -- + -- * an acronym **AI\_**, which indicates an FSM implementation directing **AI controlled** @{GROUP} and/or @{UNIT}. These AI\_ classes derive the @{#FSM_CONTROLLABLE} class. + -- * an acronym **TASK\_**, which indicates an FSM implementation executing a @{TASK} executed by Groups of players. These TASK\_ classes derive the @{#FSM_TASK} class. + -- * an acronym **ACT\_**, which indicates an Sub-FSM implementation, directing **Humans actions** that need to be done in a @{TASK}, seated in a @{CLIENT} (slot) or a @{UNIT} (CA join). These ACT\_ classes derive the @{#FSM_PROCESS} class. + -- --  -- -- The FSM class is the base class of all FSM\_ derived classes. It implements the main functionality to define and execute Finite State Machines. @@ -114,13 +151,13 @@ do -- FSM -- As explained above, a FSM supports **Linear State Transitions** and **Hierarchical State Transitions**, and both can be mixed to make a comprehensive FSM implementation. -- The below documentation has a seperate chapter explaining both transition modes, taking into account the **Transition Rules**, **Transition Handlers** and **Event Triggers**. -- - -- ## 1.1) FSM Linear Transitions + -- ## FSM Linear Transitions -- -- Linear Transitions are Transition Rules allowing an FSM to transition from one or multiple possible **From** state(s) towards a **To** state upon a Triggered **Event**. -- The Lineair transition rule evaluation will always be done from the **current state** of the FSM. -- If no valid Transition Rule can be found in the FSM, the FSM will log an error and stop. -- - -- ### 1.1.1) FSM Transition Rules + -- ### FSM Transition Rules -- -- The FSM has transition rules that it follows and validates, as it walks the process. -- These rules define when an FSM can transition from a specific state towards an other specific state upon a triggered event. @@ -145,7 +182,7 @@ do -- FSM -- * It can be switched **Off** by triggering event **SwitchOff**. -- * Note that once the Switch is **On** or **Middle**, it can only be switched **Off**. -- - -- ### Some additional comments: + -- #### Some additional comments: -- -- Note that Linear Transition Rules **can be declared in a few variations**: -- @@ -156,7 +193,7 @@ do -- FSM -- -- FsmSwitch:AddTransition( { "On", "Middle" }, "SwitchOff", "Off" ) -- - -- ### 1.1.2) Transition Handling + -- ### Transition Handling -- --  -- @@ -178,7 +215,7 @@ do -- FSM -- -- On top, each of these methods can have a variable amount of parameters passed. See the example in section [1.1.3](#1.1.3\)-event-triggers). -- - -- ### 1.1.3) Event Triggers + -- ### Event Triggers -- --  -- @@ -216,7 +253,7 @@ do -- FSM -- -- Because ... When Event was asynchronously processed after 5 seconds, Amount was set to 2. So be careful when processing and passing values and objects in asynchronous processing! -- - -- ### 1.1.4) Linear Transition Example + -- ### Linear Transition Example -- -- This example is fully implemented in the MOOSE test mission on GITHUB: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE/blob/master/Moose%20Test%20Missions/FSM%20-%20Finite%20State%20Machine/FSM-100%20-%20Transition%20Explanation/FSM-100%20-%20Transition%20Explanation.lua) -- @@ -298,7 +335,7 @@ do -- FSM -- So... When FsmDemo:Stop() is being triggered, the state of FsmDemo will transition from Red or Green to Stopped. -- And there is no transition handling method defined for that transition, thus, no new event is being triggered causing the FsmDemo process flow to halt. -- - -- ## 1.5) FSM Hierarchical Transitions + -- ## FSM Hierarchical Transitions -- -- Hierarchical Transitions allow to re-use readily available and implemented FSMs. -- This becomes in very useful for mission building, where mission designers build complex processes and workflows, diff --git a/Moose Development/Moose/Core/Menu.lua b/Moose Development/Moose/Core/Menu.lua index 25ea2989e..8e361f41f 100644 --- a/Moose Development/Moose/Core/Menu.lua +++ b/Moose Development/Moose/Core/Menu.lua @@ -27,109 +27,26 @@ -- -- === -- --- The above menus classes **are derived** from 2 main **abstract** classes defined within the MOOSE framework (so don't use these): +-- # **AUTHORS and CONTRIBUTIONS** -- --- 1) MENU_ BASE abstract base classes (don't use them) --- ==================================================== --- The underlying base menu classes are **NOT** to be used within your missions. --- These are simply abstract base classes defining a couple of fields that are used by the --- derived MENU_ classes to manage menus. +-- ### Contributions: -- --- 1.1) @{#MENU_BASE} class, extends @{Base#BASE} --- -------------------------------------------------- --- The @{#MENU_BASE} class defines the main MENU class where other MENU classes are derived from. --- --- 1.2) @{#MENU_COMMAND_BASE} class, extends @{Base#BASE} --- ---------------------------------------------------------- --- The @{#MENU_COMMAND_BASE} class defines the main MENU class where other MENU COMMAND_ classes are derived from, in order to set commands. --- --- === --- --- **The next menus define the MENU classes that you can use within your missions.** --- --- 2) MENU MISSION classes --- ====================== --- The underlying classes manage the menus for a complete mission file. --- --- 2.1) @{#MENU_MISSION} class, extends @{Menu#MENU_BASE} --- --------------------------------------------------------- --- The @{Menu#MENU_MISSION} class manages the main menus for a complete mission. --- You can add menus with the @{#MENU_MISSION.New} method, which constructs a MENU_MISSION object and returns you the object reference. --- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_MISSION.Remove}. --- --- 2.2) @{#MENU_MISSION_COMMAND} class, extends @{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. --- 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}. --- --- === --- --- 3) MENU COALITION classes --- ========================= --- The underlying classes manage the menus for whole coalitions. --- --- 3.1) @{#MENU_COALITION} class, extends @{Menu#MENU_BASE} --- ------------------------------------------------------------ --- The @{Menu#MENU_COALITION} class manages the main menus for coalitions. --- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference. --- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}. --- --- 3.2) @{Menu#MENU_COALITION_COMMAND} class, extends @{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. --- 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}. --- --- === --- --- 4) MENU GROUP classes --- ===================== --- 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} --- -------------------------------------------------------- --- The @{Menu#MENU_GROUP} class manages the main menus for coalitions. --- You can add menus with the @{#MENU_GROUP.New} method, which constructs a MENU_GROUP object and returns you the object reference. --- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP.Remove}. --- --- 4.2) @{Menu#MENU_GROUP_COMMAND} class, extends @{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. --- 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}. --- --- === --- --- 5) MENU CLIENT classes --- ====================== --- The underlying classes manage the menus for units with skill level client or player. --- --- 5.1) @{Menu#MENU_CLIENT} class, extends @{Menu#MENU_BASE} --- --------------------------------------------------------- --- The @{Menu#MENU_CLIENT} class manages the main menus for coalitions. --- You can add menus with the @{#MENU_CLIENT.New} method, which constructs a MENU_CLIENT object and returns you the object reference. --- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_CLIENT.Remove}. --- --- 5.2) @{Menu#MENU_CLIENT_COMMAND} class, extends @{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. --- 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}. --- --- === --- --- ### Contributions: - --- ### Authors: FlightControl : Design & Programming +-- ### Authors: -- +-- * **FlightControl**: Design & Programming +-- -- @module Menu do -- MENU_BASE - --- The MENU_BASE class - -- @type MENU_BASE + --- @type MENU_BASE -- @extends Base#BASE + + --- # MENU_BASE class, extends @{Base#BASE} + -- The MENU_BASE class defines the main MENU class where other MENU classes are derived from. + -- This is an abstract class, so don't use it. + -- @field #MENU_BASE MENU_BASE = { ClassName = "MENU_BASE", MenuPath = nil, @@ -193,10 +110,15 @@ end do -- MENU_COMMAND_BASE - --- The MENU_COMMAND_BASE class - -- @type MENU_COMMAND_BASE + --- @type MENU_COMMAND_BASE -- @field #function MenuCallHandler -- @extends Core.Menu#MENU_BASE + + --- # MENU_COMMAND_BASE class, extends @{Base#BASE} + -- ---------------------------------------------------------- + -- The MENU_COMMAND_BASE class defines the main MENU class where other MENU COMMAND_ + -- classes are derived from, in order to set commands. + -- @field #MENU_COMMAND_BASE MENU_COMMAND_BASE = { ClassName = "MENU_COMMAND_BASE", CommandMenuFunction = nil, @@ -224,9 +146,15 @@ end do -- MENU_MISSION - --- The MENU_MISSION class - -- @type MENU_MISSION + --- @type MENU_MISSION -- @extends Core.Menu#MENU_BASE + + --- # MENU_MISSION class, extends @{Menu#MENU_BASE} + -- + -- The 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}. + -- @field #MENU_MISSION MENU_MISSION = { ClassName = "MENU_MISSION" } @@ -291,9 +219,16 @@ end do -- MENU_MISSION_COMMAND - --- The MENU_MISSION_COMMAND class - -- @type MENU_MISSION_COMMAND + --- @type MENU_MISSION_COMMAND -- @extends Core.Menu#MENU_COMMAND_BASE + + --- # MENU_MISSION_COMMAND class, extends @{Menu#MENU_COMMAND_BASE} + -- + -- The 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}. + -- + -- @field #MENU_MISSION_COMMAND MENU_MISSION_COMMAND = { ClassName = "MENU_MISSION_COMMAND" } @@ -341,9 +276,16 @@ end do -- MENU_COALITION - --- The MENU_COALITION class - -- @type MENU_COALITION + --- @type MENU_COALITION -- @extends Core.Menu#MENU_BASE + + --- # MENU_COALITION class, extends @{Menu#MENU_BASE} + -- + -- The @{Menu#MENU_COALITION} class manages the main menus for coalitions. + -- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference. + -- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}. + -- + -- -- @usage -- -- This demo creates a menu structure for the planes within the red coalition. -- -- To test, join the planes, then look at the other radio menus (Option F10). @@ -380,6 +322,8 @@ do -- MENU_COALITION -- -- local MenuAdd = MENU_COALITION_COMMAND:New( coalition.side.RED, "Add Status Menu", MenuCoalitionRed, AddStatusMenu ) -- local MenuRemove = MENU_COALITION_COMMAND:New( coalition.side.RED, "Remove Status Menu", MenuCoalitionRed, RemoveStatusMenu ) + -- + -- @field #MENU_COALITION MENU_COALITION = { ClassName = "MENU_COALITION" } @@ -446,9 +390,16 @@ end do -- MENU_COALITION_COMMAND - --- The MENU_COALITION_COMMAND class - -- @type MENU_COALITION_COMMAND + --- @type MENU_COALITION_COMMAND -- @extends Core.Menu#MENU_COMMAND_BASE + + --- # MENU_COALITION_COMMAND class, extends @{Menu#MENU_COMMAND_BASE} + -- + -- The 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}. + -- + -- @field #MENU_COALITION_COMMAND MENU_COALITION_COMMAND = { ClassName = "MENU_COALITION_COMMAND" } @@ -506,6 +457,14 @@ do -- MENU_CLIENT --- MENU_COALITION constructor. Creates a new radio command item for a coalition, which can invoke a function with parameters. -- @type MENU_CLIENT -- @extends Core.Menu#MENU_BASE + + + --- # MENU_CLIENT class, extends @{Menu#MENU_BASE} + -- + -- The 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}. + -- -- @usage -- -- This demo creates a menu structure for the two clients of planes. -- -- Each client will receive a different menu structure. @@ -555,6 +514,8 @@ do -- MENU_CLIENT -- MENU_CLIENT_COMMAND:New( PlaneClient, "Remove Status Menu Plane 2", MenuManage, RemoveStatusMenu, PlaneClient ) -- end -- end, {}, 10, 10 ) + -- + -- @field #MENU_CLIENT MENU_CLIENT = { ClassName = "MENU_CLIENT" } @@ -644,9 +605,16 @@ do -- MENU_CLIENT end - --- The MENU_CLIENT_COMMAND class - -- @type MENU_CLIENT_COMMAND + --- @type MENU_CLIENT_COMMAND -- @extends Core.Menu#MENU_COMMAND + + --- # MENU_CLIENT_COMMAND class, extends @{Menu#MENU_COMMAND_BASE} + -- + -- The 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}. + -- + -- @field #MENU_CLIENT_COMMAND MENU_CLIENT_COMMAND = { ClassName = "MENU_CLIENT_COMMAND" } @@ -730,9 +698,16 @@ do -- These menu classes are handling this logic with this variable. local _MENUGROUPS = {} - --- The MENU_GROUP class - -- @type MENU_GROUP + --- @type MENU_GROUP -- @extends Core.Menu#MENU_BASE + + + --- #MENU_GROUP class, extends @{Menu#MENU_BASE} + -- + -- The 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}. + -- -- @usage -- -- This demo creates a menu structure for the two groups of planes. -- -- Each group will receive a different menu structure. @@ -783,6 +758,7 @@ do -- end -- end, {}, 10, 10 ) -- + -- @field #MENU_GROUP MENU_GROUP = { ClassName = "MENU_GROUP" } @@ -876,9 +852,16 @@ do end - --- The MENU_GROUP_COMMAND class - -- @type MENU_GROUP_COMMAND + --- @type MENU_GROUP_COMMAND -- @extends Core.Menu#MENU_BASE + + --- # MENU_GROUP_COMMAND class, extends @{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. + -- 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}. + -- + -- @field #MENU_GROUP_COMMAND MENU_GROUP_COMMAND = { ClassName = "MENU_GROUP_COMMAND" } diff --git a/Moose Development/Moose/Core/Message.lua b/Moose Development/Moose/Core/Message.lua index 711b75585..c9aec93bb 100644 --- a/Moose Development/Moose/Core/Message.lua +++ b/Moose Development/Moose/Core/Message.lua @@ -4,18 +4,24 @@ -- -- === -- --- # 1) @{Message#MESSAGE} class, extends @{Base#BASE} +-- @module Message + +--- The MESSAGE class +-- @type MESSAGE +-- @extends Core.Base#BASE + +--- # MESSAGE class, extends @{Base#BASE} -- -- Message System to display Messages to Clients, Coalitions or All. -- Messages are shown on the display panel for an amount of seconds, and will then disappear. -- Messages can contain a category which is indicating the category of the message. -- --- ## 1.1) MESSAGE construction +-- ## MESSAGE construction -- -- Messages are created with @{Message#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet. -- To send messages, you need to use the To functions. -- --- ## 1.2) Send messages to an audience +-- ## Send messages to an audience -- -- Messages are sent: -- @@ -26,19 +32,14 @@ -- * To the blue coalition using @{Message#MESSAGE.ToBlue}(). -- * To all Players using @{Message#MESSAGE.ToAll}(). -- --- ## 1.3) Send conditionally to an audience +-- ## Send conditionally to an audience -- -- Messages can be sent conditionally to an audience (when a condition is true): -- -- * To all players using @{Message#MESSAGE.ToAllIf}(). -- * To a coalition using @{Message#MESSAGE.ToCoalitionIf}(). -- --- --- @module Message - ---- The MESSAGE class --- @type MESSAGE --- @extends Core.Base#BASE +-- @field #MESSAGE MESSAGE = { ClassName = "MESSAGE", MessageCategory = 0, diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 6b06bfe75..7067dc690 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -1,91 +1,22 @@ --- **Core** - **POINT\_VEC** classes define an **extensive API** to **manage 3D points** in the simulation space. --- --- 1) @{Point#POINT_VEC3} class, extends @{Base#BASE} --- ================================================== --- The @{Point#POINT_VEC3} class defines a 3D point in the simulator. --- --- **Important Note:** Most of the functions in this section were taken from MIST, and reworked to OO concepts. --- In order to keep the credibility of the the author, I want to emphasize that the of the MIST framework was created by Grimes, who you can find on the Eagle Dynamics Forums. --- --- ## 1.1) POINT_VEC3 constructor --- --- A new POINT_VEC3 instance can be created with: --- --- * @{Point#POINT_VEC3.New}(): a 3D point. --- * @{Point#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}. --- --- ## 1.2) Manupulate the X, Y, Z coordinates of the point --- --- A POINT_VEC3 class works in 3D space. It contains internally an X, Y, Z coordinate. --- Methods exist to manupulate these coordinates. --- --- The current X, Y, Z axis can be retrieved with the methods @{#POINT_VEC3.GetX}(), @{#POINT_VEC3.GetY}(), @{#POINT_VEC3.GetZ}() respectively. --- The methods @{#POINT_VEC3.SetX}(), @{#POINT_VEC3.SetY}(), @{#POINT_VEC3.SetZ}() change the respective axis with a new value. --- The current axis values can be changed by using the methods @{#POINT_VEC3.AddX}(), @{#POINT_VEC3.AddY}(), @{#POINT_VEC3.AddZ}() --- to add or substract a value from the current respective axis value. --- Note that the Set and Add methods return the current POINT_VEC3 object, so these manipulation methods can be chained... For example: --- --- local Vec3 = PointVec3:AddX( 100 ):AddZ( 150 ):GetVec3() --- --- ## 1.3) Create waypoints for routes --- --- A POINT_VEC3 can prepare waypoints for Ground, Air and Naval groups to be embedded into a Route. --- --- --- ## 1.5) Smoke, flare, explode, illuminate --- --- At the point a smoke, flare, explosion and illumination bomb can be triggered. Use the following methods: --- --- ### 1.5.1) Smoke --- --- * @{#POINT_VEC3.Smoke}(): To smoke the point in a certain color. --- * @{#POINT_VEC3.SmokeBlue}(): To smoke the point in blue. --- * @{#POINT_VEC3.SmokeRed}(): To smoke the point in red. --- * @{#POINT_VEC3.SmokeOrange}(): To smoke the point in orange. --- * @{#POINT_VEC3.SmokeWhite}(): To smoke the point in white. --- * @{#POINT_VEC3.SmokeGreen}(): To smoke the point in green. --- --- ### 1.5.2) Flare --- --- * @{#POINT_VEC3.Flare}(): To flare the point in a certain color. --- * @{#POINT_VEC3.FlareRed}(): To flare the point in red. --- * @{#POINT_VEC3.FlareYellow}(): To flare the point in yellow. --- * @{#POINT_VEC3.FlareWhite}(): To flare the point in white. --- * @{#POINT_VEC3.FlareGreen}(): To flare the point in green. --- --- ### 1.5.3) Explode --- --- * @{#POINT_VEC3.Explosion}(): To explode the point with a certain intensity. --- --- ### 1.5.4) Illuminate --- --- * @{#POINT_VEC3.IlluminationBomb}(): To illuminate the point. --- -- --- 2) @{Point#POINT_VEC2} class, extends @{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. +--  +-- +-- ==== -- --- 2.1) POINT_VEC2 constructor --- --------------------------- --- A new POINT_VEC2 instance can be created with: +-- # Demo Missions -- --- * @{Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter. --- * @{Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}. +-- ### [POINT_VEC Demo Missions source code]() -- --- ## 1.2) Manupulate the X, Altitude, Y coordinates of the 2D point +-- ### [POINT_VEC Demo Missions, only for beta testers]() +-- +-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases) -- --- A POINT_VEC2 class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate. --- Methods exist to manupulate these coordinates. +-- ==== -- --- The current X, Altitude, Y axis can be retrieved with the methods @{#POINT_VEC2.GetX}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetY}() respectively. --- The methods @{#POINT_VEC2.SetX}(), @{#POINT_VEC2.SetAlt}(), @{#POINT_VEC2.SetY}() change the respective axis with a new value. --- The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods @{#POINT_VEC2.GetLat}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetLon}() respectively. --- The current axis values can be changed by using the methods @{#POINT_VEC2.AddX}(), @{#POINT_VEC2.AddAlt}(), @{#POINT_VEC2.AddY}() --- to add or substract a value from the current respective axis value. --- Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example: +-- # YouTube Channel -- --- local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2() +-- ### [POINT_VEC YouTube Channel]() -- -- === -- @@ -133,6 +64,126 @@ -- @field #POINT_VEC3.RoutePointType RoutePointType -- @field #POINT_VEC3.RoutePointAction RoutePointAction -- @extends Core.Base#BASE + +--- # POINT_VEC3 class, extends @{Base#BASE} +-- +-- POINT_VEC3 defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space. +-- +-- **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 formulas embedded in the MIST framework were created by Grimes or previous authors, +-- who you can find on the Eagle Dynamics Forums. +-- +-- +-- ## POINT_VEC3 constructor +-- +-- A new POINT_VEC3 object can be created with: +-- +-- * @{#POINT_VEC3.New}(): a 3D point. +-- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}. +-- +-- +-- ## Manupulate the X, Y, Z coordinates of the POINT_VEC3 +-- +-- A POINT_VEC3 class works in 3D space. It contains internally an X, Y, Z coordinate. +-- Methods exist to manupulate these coordinates. +-- +-- The current X, Y, Z axis can be retrieved with the methods @{#POINT_VEC3.GetX}(), @{#POINT_VEC3.GetY}(), @{#POINT_VEC3.GetZ}() respectively. +-- The methods @{#POINT_VEC3.SetX}(), @{#POINT_VEC3.SetY}(), @{#POINT_VEC3.SetZ}() change the respective axis with a new value. +-- The current axis values can be changed by using the methods @{#POINT_VEC3.AddX}(), @{#POINT_VEC3.AddY}(), @{#POINT_VEC3.AddZ}() +-- to add or substract a value from the current respective axis value. +-- Note that the Set and Add methods return the current POINT_VEC3 object, so these manipulation methods can be chained... For example: +-- +-- local Vec3 = PointVec3:AddX( 100 ):AddZ( 150 ):GetVec3() +-- +-- +-- ## Create waypoints for routes +-- +-- A POINT_VEC3 can prepare waypoints for Ground and Air groups to be embedded into a Route. +-- +-- * @{#POINT_VEC3.RoutePointAir}(): Build an air route point. +-- * @{#POINT_VEC3.RoutePointGround}(): Build a ground route point. +-- +-- Route points can be used in the Route methods of the @{Group#GROUP} class. +-- +-- +-- ## Smoke, flare, explode, illuminate +-- +-- At the point a smoke, flare, explosion and illumination bomb can be triggered. Use the following methods: +-- +-- ### Smoke +-- +-- * @{#POINT_VEC3.Smoke}(): To smoke the point in a certain color. +-- * @{#POINT_VEC3.SmokeBlue}(): To smoke the point in blue. +-- * @{#POINT_VEC3.SmokeRed}(): To smoke the point in red. +-- * @{#POINT_VEC3.SmokeOrange}(): To smoke the point in orange. +-- * @{#POINT_VEC3.SmokeWhite}(): To smoke the point in white. +-- * @{#POINT_VEC3.SmokeGreen}(): To smoke the point in green. +-- +-- ### Flare +-- +-- * @{#POINT_VEC3.Flare}(): To flare the point in a certain color. +-- * @{#POINT_VEC3.FlareRed}(): To flare the point in red. +-- * @{#POINT_VEC3.FlareYellow}(): To flare the point in yellow. +-- * @{#POINT_VEC3.FlareWhite}(): To flare the point in white. +-- * @{#POINT_VEC3.FlareGreen}(): To flare the point in green. +-- +-- ### Explode +-- +-- * @{#POINT_VEC3.Explosion}(): To explode the point with a certain intensity. +-- +-- ### Illuminate +-- +-- * @{#POINT_VEC3.IlluminationBomb}(): To illuminate the point. +-- +-- +-- ## 3D calculation methods +-- +-- Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method: +-- +-- ### Distance +-- +-- * @{#POINT_VEC3.Get3DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 3D space. +-- * @{#POINT_VEC3.Get2DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 2D space. +-- +-- ### Angle +-- +-- * @{#POINT_VEC3.GetAngleDegrees}(): Obtain the angle in degrees from the current 3D point with the provided 3D direction vector. +-- * @{#POINT_VEC3.GetAngleRadians}(): Obtain the angle in radians from the current 3D point with the provided 3D direction vector. +-- * @{#POINT_VEC3.GetDirectionVec3}(): Obtain the 3D direction vector from the current 3D point to the provided 3D point. +-- +-- ### Translation +-- +-- * @{#POINT_VEC3.Translate}(): Translate the current 3D point towards an other 3D point using the given Distance and Angle. +-- +-- ### Get the North correction of the current location +-- +-- * @{#POINT_VEC3.GetNorthCorrection}(): Obtains the north correction at the current 3D point. +-- +-- +-- ## Point Randomization +-- +-- Various methods exist to calculate random locations around a given 3D point. +-- +-- * @{#POINT_VEC3.GetRandomPointVec2InRadius}(): Provides a random 2D point around the current 3D point, in the given inner to outer band. +-- * @{#POINT_VEC3.GetRandomPointVec3InRadius}(): Provides a random 3D point around the current 3D point, in the given inner to outer band. +-- * @{#POINT_VEC3.GetRandomVec2InRadius}(): Provides a random 2D vector around the current 3D point, in the given inner to outer band. +-- * @{#POINT_VEC3.GetRandomVec3InRadius}(): Provides a random 3D vector around the current 3D point, in the given inner to outer band. +-- +-- +-- ## Metric system +-- +-- * @{#POINT_VEC3.IsMetric}(): Returns if the 3D point is Metric or Nautical Miles. +-- * @{#POINT_VEC3.SetMetric}(): Sets the 3D point to Metric or Nautical Miles. +-- +-- +-- ## Coorinate text generation +-- +-- * @{#POINT_VEC3.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance. +-- * @{#POINT_VEC3.ToStringLL}(): Generates a Latutude & Longutude text. +-- +-- @field #POINT_VEC3 POINT_VEC3 +-- POINT_VEC3 = { ClassName = "POINT_VEC3", Metric = true, @@ -149,11 +200,38 @@ POINT_VEC3 = { }, } ---- The POINT_VEC2 class --- @type POINT_VEC2 +--- @type POINT_VEC2 -- @field Dcs.DCSTypes#Distance x The x coordinate in meters. -- @field Dcs.DCSTypes#Distance y the y coordinate in meters. -- @extends Core.Point#POINT_VEC3 + +--- # POINT_VEC2 class, extends @{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. +-- +-- ## POINT_VEC2 constructor +-- +-- A new POINT_VEC2 instance can be created with: +-- +-- * @{Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter. +-- * @{Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}. +-- +-- ## Manupulate the X, Altitude, Y coordinates of the 2D point +-- +-- A POINT_VEC2 class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate. +-- Methods exist to manupulate these coordinates. +-- +-- The current X, Altitude, Y axis can be retrieved with the methods @{#POINT_VEC2.GetX}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetY}() respectively. +-- The methods @{#POINT_VEC2.SetX}(), @{#POINT_VEC2.SetAlt}(), @{#POINT_VEC2.SetY}() change the respective axis with a new value. +-- The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods @{#POINT_VEC2.GetLat}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetLon}() respectively. +-- The current axis values can be changed by using the methods @{#POINT_VEC2.AddX}(), @{#POINT_VEC2.AddAlt}(), @{#POINT_VEC2.AddY}() +-- to add or substract a value from the current respective axis value. +-- Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example: +-- +-- local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2() +-- +-- @field #POINT_VEC2 POINT_VEC2 +-- POINT_VEC2 = { ClassName = "POINT_VEC2", } diff --git a/Moose Development/Moose/Core/Scheduler.lua b/Moose Development/Moose/Core/Scheduler.lua index 2244d9b1b..cf31ecf8e 100644 --- a/Moose Development/Moose/Core/Scheduler.lua +++ b/Moose Development/Moose/Core/Scheduler.lua @@ -4,31 +4,30 @@ -- -- === -- --- # 1) @{Scheduler#SCHEDULER} class, extends @{Base#BASE} +-- SCHEDULER manages the **scheduling of functions**: -- --- The @{Scheduler#SCHEDULER} class creates schedule. --- --- ## 1.1) SCHEDULER constructor --- --- The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters: --- --- * @{Scheduler#SCHEDULER.New}( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection. --- * @{Scheduler#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection. --- * @{Scheduler#SCHEDULER.New}( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters. --- * @{Scheduler#SCHEDULER.New}( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters. --- --- ## 1.2) SCHEDULER timer stopping and (re-)starting. --- --- The SCHEDULER can be stopped and restarted with the following methods: --- --- * @{Scheduler#SCHEDULER.Start}(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started. --- * @{Scheduler#SCHEDULER.Stop}(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped. --- --- ## 1.3) Create a new schedule --- --- With @{Scheduler#SCHEDULER.Schedule}() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned. +-- * optionally in an optional specified time interval, +-- * optionally **repeating** with a specified time repeat interval, +-- * optionally **randomizing** with a specified time interval randomization factor, +-- * optionally **stop** the repeating after a specified time interval. -- -- === +-- +-- # Demo Missions +-- +-- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/SCH%20-%20Scheduler) +-- +-- ### [SCHEDULER Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler) +-- +-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases) +-- +-- ==== +-- +-- # YouTube Channel +-- +-- ### [SCHEDULER YouTube Channel (none)]() +-- +-- ==== -- -- ### Contributions: -- @@ -38,10 +37,6 @@ -- -- * FlightControl : Design & Programming -- --- ### Test Missions: --- --- * SCH - Scheduler --- -- === -- -- @module Scheduler @@ -51,6 +46,153 @@ -- @type SCHEDULER -- @field #number ScheduleID the ID of the scheduler. -- @extends Core.Base#BASE + + +--- # SCHEDULER class, extends @{Base#BASE} +-- +-- The SCHEDULER class creates schedule. +-- +-- A SCHEDULER can manage **multiple** (repeating) schedules. Each planned or executing schedule has a unique **ScheduleID**. +-- The ScheduleID is returned when the method @{#SCHEDULER.Schedule}() is called. +-- It is recommended to store the ScheduleID in a variable, as it is used in the methods @{SCHEDULER.Start}() and @{SCHEDULER.Stop}(), +-- which can start and stop specific repeating schedules respectively within a SCHEDULER object. +-- +-- ## SCHEDULER constructor +-- +-- The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters: +-- +-- The @{#SCHEDULER.New}() method returns 2 variables: +-- +-- 1. The SCHEDULER object reference. +-- 2. The first schedule planned in the SCHEDULER object. +-- +-- To clarify the different appliances, lets have a look at the following examples: +-- +-- ### Construct a SCHEDULER object without a persistent schedule. +-- +-- * @{#SCHEDULER.New}( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection. +-- +-- SchedulerObject = SCHEDULER:New() +-- SchedulerID = SchedulerObject:Schedule( nil, ScheduleFunction, {} ) +-- +-- The above example creates a new SchedulerObject, but does not schedule anything. +-- A separate schedule is created by using the SchedulerObject using the method :Schedule..., which returns a ScheduleID +-- +-- ### Construct a SCHEDULER object without a volatile schedule, but volatile to the Object existence... +-- +-- * @{#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection. +-- +-- ZoneObject = ZONE:New( "ZoneName" ) +-- SchedulerObject = SCHEDULER:New( ZoneObject ) +-- SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {} ) +-- ... +-- ZoneObject = nil +-- garbagecollect() +-- +-- The above example creates a new SchedulerObject, but does not schedule anything, and is bound to the existence of ZoneObject, which is a ZONE. +-- A separate schedule is created by using the SchedulerObject using the method :Schedule()..., which returns a ScheduleID +-- Later in the logic, the ZoneObject is put to nil, and garbage is collected. +-- As a result, the ScheduleObject will cancel any planned schedule. +-- +-- ### Construct a SCHEDULER object with a persistent schedule. +-- +-- * @{#SCHEDULER.New}( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters. +-- +-- SchedulerObject, SchedulerID = SCHEDULER:New( nil, ScheduleFunction, {} ) +-- +-- The above example creates a new SchedulerObject, and does schedule the first schedule as part of the call. +-- Note that 2 variables are returned here: SchedulerObject, ScheduleID... +-- +-- ### Construct a SCHEDULER object without a schedule, but volatile to the Object existence... +-- +-- * @{#SCHEDULER.New}( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters. +-- +-- ZoneObject = ZONE:New( "ZoneName" ) +-- SchedulerObject, SchedulerID = SCHEDULER:New( ZoneObject, ScheduleFunction, {} ) +-- SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {} ) +-- ... +-- ZoneObject = nil +-- garbagecollect() +-- +-- The above example creates a new SchedulerObject, and schedules a method call (ScheduleFunction), +-- and is bound to the existence of ZoneObject, which is a ZONE object (ZoneObject). +-- Both a ScheduleObject and a SchedulerID variable are returned. +-- Later in the logic, the ZoneObject is put to nil, and garbage is collected. +-- As a result, the ScheduleObject will cancel the planned schedule. +-- +-- ## SCHEDULER timer stopping and (re-)starting. +-- +-- The SCHEDULER can be stopped and restarted with the following methods: +-- +-- * @{#SCHEDULER.Start}(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started. +-- * @{#SCHEDULER.Stop}(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped. +-- +-- ZoneObject = ZONE:New( "ZoneName" ) +-- SchedulerObject, SchedulerID = SCHEDULER:New( ZoneObject, ScheduleFunction, {} ) +-- SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 10 ) +-- ... +-- SchedulerObject:Stop( SchedulerID ) +-- ... +-- SchedulerObject:Start( SchedulerID ) +-- +-- The above example creates a new SchedulerObject, and does schedule the first schedule as part of the call. +-- Note that 2 variables are returned here: SchedulerObject, ScheduleID... +-- Later in the logic, the repeating schedule with SchedulerID is stopped. +-- A bit later, the repeating schedule with SchedulerId is (re)-started. +-- +-- ## Create a new schedule +-- +-- With the method @{#SCHEDULER.Schedule}() a new time event can be scheduled. +-- This method is used by the :New() constructor when a new schedule is planned. +-- +-- Consider the following code fragment of the SCHEDULER object creation. +-- +-- ZoneObject = ZONE:New( "ZoneName" ) +-- SchedulerObject = SCHEDULER:New( ZoneObject ) +-- +-- Several parameters can be specified that influence the behaviour of a Schedule. +-- +-- ### A single schedule, immediately executed +-- +-- SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {} ) +-- +-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within milleseconds ... +-- +-- ### A single schedule, planned over time +-- +-- SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10 ) +-- +-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds ... +-- +-- ### A schedule with a repeating time interval, planned over time +-- +-- SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 60 ) +-- +-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds, +-- and repeating 60 every seconds ... +-- +-- ### A schedule with a repeating time interval, planned over time, with time interval randomization +-- +-- SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 60, 0.5 ) +-- +-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds, +-- and repeating 60 seconds, with a 50% time interval randomization ... +-- So the repeating time interval will be randomized using the **0.5**, +-- and will calculate between **60 - ( 60 * 0.5 )** and **60 + ( 60 * 0.5 )** for each repeat, +-- which is in this example between **30** and **90** seconds. +-- +-- ### A schedule with a repeating time interval, planned over time, with time interval randomization, and stop after a time interval +-- +-- SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 60, 0.5, 300 ) +-- +-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds, +-- The schedule will repeat every 60 seconds. +-- So the repeating time interval will be randomized using the **0.5**, +-- and will calculate between **60 - ( 60 * 0.5 )** and **60 + ( 60 * 0.5 )** for each repeat, +-- which is in this example between **30** and **90** seconds. +-- The schedule will stop after **300** seconds. +-- +-- @field #SCHEDULER SCHEDULER = { ClassName = "SCHEDULER", Schedules = {}, diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua index d7c00ae39..713ca5eb2 100644 --- a/Moose Development/Moose/Core/Zone.lua +++ b/Moose Development/Moose/Core/Zone.lua @@ -66,8 +66,7 @@ -- @module Zone ---- The ZONE_BASE class --- @type ZONE_BASE +--- @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 Core.Base#BASE @@ -83,19 +82,26 @@ -- -- ## Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}: -- --- * @{#ZONE_BASE.IsVec2InZone}(): Returns if a Vec2 is within the zone. --- * @{#ZONE_BASE.IsVec3InZone}(): Returns if a Vec3 is within the zone. +-- * @{#ZONE_BASE.IsVec2InZone}(): Returns if a 2D vector is within the zone. +-- * @{#ZONE_BASE.IsVec3InZone}(): Returns if a 3D vector is within the zone. +-- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a 2D point vector is within the zone. +-- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a 3D point vector is within the zone. -- -- ## A zone has a probability factor that can be set to randomize a selection between zones: -- --- * @{#ZONE_BASE.SetRandomizeProbability}(): Set the randomization probability of a zone to be selected, taking a value between 0 and 1 ( 0 = 0%, 1 = 100% ) --- * @{#ZONE_BASE.GetRandomizeProbability}(): Get the randomization probability of a zone to be selected, passing a value between 0 and 1 ( 0 = 0%, 1 = 100% ) +-- * @{#ZONE_BASE.SetZoneProbability}(): Set the randomization probability of a zone to be selected, taking a value between 0 and 1 ( 0 = 0%, 1 = 100% ) +-- * @{#ZONE_BASE.GetZoneProbability}(): Get the randomization probability of a zone to be selected, passing a value between 0 and 1 ( 0 = 0%, 1 = 100% ) -- * @{#ZONE_BASE.GetZoneMaybe}(): Get the zone taking into account the randomization probability. nil is returned if this zone is not a candidate. -- --- ## A zone manages Vectors: +-- ## 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 2D vector coordinate of the zone. +-- * @{#ZONE_BASE.GetVec3}(): Returns the 3D vector coordinate of the zone. +-- * @{#ZONE_BASE.GetPointVec2}(): Returns the 2D point vector coordinate of the zone. +-- * @{#ZONE_BASE.GetPointVec3}(): Returns the 3D point vector coordinate of the zone. +-- * @{#ZONE_BASE.GetRandomVec2}(): Define a random 2D vector within the zone. +-- * @{#ZONE_BASE.GetRandomPointVec2}(): Define a random 2D point vector within the zone. +-- * @{#ZONE_BASE.GetRandomPointVec3}(): Define a random 3D point vector within the zone. -- -- ## A zone has a bounding square: -- @@ -106,8 +112,7 @@ -- * @{#ZONE_BASE.SmokeZone}(): Smokes the zone boundaries in a color. -- * @{#ZONE_BASE.FlareZone}(): Flares the zone boundaries in a color. -- --- @field #ZONE_BASE ZONE_BASE --- +-- @field #ZONE_BASE ZONE_BASE = { ClassName = "ZONE_BASE", ZoneName = "", @@ -366,8 +371,7 @@ end -- * @{#ZONE_RADIUS.GetRandomPointVec2}(): Gets a @{Point#POINT_VEC2} object representing a random 2D point in the zone. -- * @{#ZONE_RADIUS.GetRandomPointVec3}(): Gets a @{Point#POINT_VEC3} object representing a random 3D point in the zone. Note that the height of the point is at landheight. -- --- @field #ZONE_RADIUS ZONE_RADIUS --- +-- @field #ZONE_RADIUS ZONE_RADIUS = { ClassName="ZONE_RADIUS", } @@ -648,8 +652,7 @@ end -- The ZONE class, defined by the zone name as defined within the Mission Editor. -- This class implements the inherited functions from @{#ZONE_RADIUS} taking into account the own zone format and properties. -- --- @field #ZONE ZONE --- +-- @field #ZONE ZONE = { ClassName="ZONE", } @@ -686,8 +689,7 @@ end -- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius. -- This class implements the inherited functions from @{#ZONE_RADIUS} taking into account the own zone format and properties. -- --- @field #ZONE_UNIT ZONE_UNIT --- +-- @field #ZONE_UNIT ZONE_UNIT = { ClassName="ZONE_UNIT", } @@ -769,7 +771,6 @@ function ZONE_UNIT:GetVec3( Height ) end --- @type ZONE_GROUP --- @field Wrapper.Group#GROUP ZoneGROUP -- @extends #ZONE_RADIUS @@ -778,8 +779,7 @@ end -- 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. -- --- @field #ZONE_GROUP ZONE_GROUP --- +-- @field #ZONE_GROUP ZONE_GROUP = { ClassName="ZONE_GROUP", } @@ -794,7 +794,7 @@ function ZONE_GROUP:New( ZoneName, ZoneGROUP, Radius ) local self = BASE:Inherit( self, ZONE_RADIUS:New( ZoneName, ZoneGROUP:GetVec2(), Radius ) ) self:F( { ZoneName, ZoneGROUP:GetVec2(), Radius } ) - self.ZoneGROUP = ZoneGROUP + self._.ZoneGROUP = ZoneGROUP return self end @@ -806,7 +806,7 @@ end function ZONE_GROUP:GetVec2() self:F( self.ZoneName ) - local ZoneVec2 = self.ZoneGROUP:GetVec2() + local ZoneVec2 = self._.ZoneGROUP:GetVec2() self:T( { ZoneVec2 } ) @@ -820,7 +820,7 @@ function ZONE_GROUP:GetRandomVec2() self:F( self.ZoneName ) local Point = {} - local Vec2 = self.ZoneGROUP:GetVec2() + local Vec2 = self._.ZoneGROUP:GetVec2() local angle = math.random() * math.pi*2; Point.x = Vec2.x + math.cos( angle ) * math.random() * self:GetRadius(); @@ -834,7 +834,7 @@ end --- @type ZONE_POLYGON_BASE --- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{DCSTypes#Vec2}. +-- --@field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{DCSTypes#Vec2}. -- @extends #ZONE_BASE @@ -852,8 +852,7 @@ end -- * @{#ZONE_POLYGON_BASE.GetRandomPointVec2}(): Return a @{Point#POINT_VEC2} object representing a random 2D point within the zone. -- * @{#ZONE_POLYGON_BASE.GetRandomPointVec3}(): Return a @{Point#POINT_VEC3} object representing a random 3D point at landheight within the zone. -- --- @field #ZONE_POLYGON_BASE ZONE_POLYGON_BASE --- +-- @field #ZONE_POLYGON_BASE ZONE_POLYGON_BASE = { ClassName="ZONE_POLYGON_BASE", } @@ -874,12 +873,12 @@ function ZONE_POLYGON_BASE:New( ZoneName, PointsArray ) local i = 0 - self.Polygon = {} + self._.Polygon = {} for i = 1, #PointsArray do - self.Polygon[i] = {} - self.Polygon[i].x = PointsArray[i].x - self.Polygon[i].y = PointsArray[i].y + self._.Polygon[i] = {} + self._.Polygon[i].x = PointsArray[i].x + self._.Polygon[i].y = PointsArray[i].y end return self @@ -902,7 +901,7 @@ end function ZONE_POLYGON_BASE:Flush() self:F2() - self:E( { Polygon = self.ZoneName, Coordinates = self.Polygon } ) + self:E( { Polygon = self.ZoneName, Coordinates = self._.Polygon } ) return self end @@ -918,17 +917,17 @@ function ZONE_POLYGON_BASE:BoundZone( UnBound ) local Segments = 10 i = 1 - j = #self.Polygon + j = #self._.Polygon - while i <= #self.Polygon do - self:T( { i, j, self.Polygon[i], self.Polygon[j] } ) + while i <= #self._.Polygon do + self:T( { i, j, self._.Polygon[i], self._.Polygon[j] } ) - local DeltaX = self.Polygon[j].x - self.Polygon[i].x - local DeltaY = self.Polygon[j].y - self.Polygon[i].y + local DeltaX = self._.Polygon[j].x - self._.Polygon[i].x + local DeltaY = self._.Polygon[j].y - self._.Polygon[i].y for Segment = 0, Segments do -- We divide each line in 5 segments and smoke a point on the line. - local PointX = self.Polygon[i].x + ( Segment * DeltaX / Segments ) - local PointY = self.Polygon[i].y + ( Segment * DeltaY / Segments ) + local PointX = self._.Polygon[i].x + ( Segment * DeltaX / Segments ) + local PointY = self._.Polygon[i].y + ( Segment * DeltaY / Segments ) local Tire = { ["country"] = "USA", ["category"] = "Fortifications", @@ -968,17 +967,17 @@ function ZONE_POLYGON_BASE:SmokeZone( SmokeColor ) local Segments = 10 i = 1 - j = #self.Polygon + j = #self._.Polygon - while i <= #self.Polygon do - self:T( { i, j, self.Polygon[i], self.Polygon[j] } ) + while i <= #self._.Polygon do + self:T( { i, j, self._.Polygon[i], self._.Polygon[j] } ) - local DeltaX = self.Polygon[j].x - self.Polygon[i].x - local DeltaY = self.Polygon[j].y - self.Polygon[i].y + local DeltaX = self._.Polygon[j].x - self._.Polygon[i].x + local DeltaY = self._.Polygon[j].y - self._.Polygon[i].y for Segment = 0, Segments do -- We divide each line in 5 segments and smoke a point on the line. - local PointX = self.Polygon[i].x + ( Segment * DeltaX / Segments ) - local PointY = self.Polygon[i].y + ( Segment * DeltaY / Segments ) + local PointX = self._.Polygon[i].x + ( Segment * DeltaX / Segments ) + local PointY = self._.Polygon[i].y + ( Segment * DeltaY / Segments ) POINT_VEC2:New( PointX, PointY ):Smoke( SmokeColor ) end j = i @@ -1004,12 +1003,12 @@ function ZONE_POLYGON_BASE:IsVec2InZone( Vec2 ) local InPolygon = false Next = 1 - Prev = #self.Polygon + Prev = #self._.Polygon - while Next <= #self.Polygon do - self:T( { Next, Prev, self.Polygon[Next], self.Polygon[Prev] } ) - if ( ( ( self.Polygon[Next].y > Vec2.y ) ~= ( self.Polygon[Prev].y > Vec2.y ) ) and - ( Vec2.x < ( self.Polygon[Prev].x - self.Polygon[Next].x ) * ( Vec2.y - self.Polygon[Next].y ) / ( self.Polygon[Prev].y - self.Polygon[Next].y ) + self.Polygon[Next].x ) + while Next <= #self._.Polygon do + self:T( { Next, Prev, self._.Polygon[Next], self._.Polygon[Prev] } ) + if ( ( ( self._.Polygon[Next].y > Vec2.y ) ~= ( self._.Polygon[Prev].y > Vec2.y ) ) and + ( Vec2.x < ( self._.Polygon[Prev].x - self._.Polygon[Next].x ) * ( Vec2.y - self._.Polygon[Next].y ) / ( self._.Polygon[Prev].y - self._.Polygon[Next].y ) + self._.Polygon[Next].x ) ) then InPolygon = not InPolygon end @@ -1080,17 +1079,17 @@ end -- @return #ZONE_POLYGON_BASE.BoundingSquare The bounding square. function ZONE_POLYGON_BASE:GetBoundingSquare() - local x1 = self.Polygon[1].x - local y1 = self.Polygon[1].y - local x2 = self.Polygon[1].x - local y2 = self.Polygon[1].y + local x1 = self._.Polygon[1].x + local y1 = self._.Polygon[1].y + local x2 = self._.Polygon[1].x + local y2 = self._.Polygon[1].y - for i = 2, #self.Polygon do - self:T2( { self.Polygon[i], x1, y1, x2, y2 } ) - x1 = ( x1 > self.Polygon[i].x ) and self.Polygon[i].x or x1 - x2 = ( x2 < self.Polygon[i].x ) and self.Polygon[i].x or x2 - y1 = ( y1 > self.Polygon[i].y ) and self.Polygon[i].y or y1 - y2 = ( y2 < self.Polygon[i].y ) and self.Polygon[i].y or y2 + for i = 2, #self._.Polygon do + self:T2( { self._.Polygon[i], x1, y1, x2, y2 } ) + x1 = ( x1 > self._.Polygon[i].x ) and self._.Polygon[i].x or x1 + x2 = ( x2 < self._.Polygon[i].x ) and self._.Polygon[i].x or x2 + y1 = ( y1 > self._.Polygon[i].y ) and self._.Polygon[i].y or y1 + y2 = ( y2 < self._.Polygon[i].y ) and self._.Polygon[i].y or y2 end @@ -1107,8 +1106,7 @@ end -- 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. -- --- @field #ZONE_POLYGON ZONE_POLYGON --- +-- @field #ZONE_POLYGON ZONE_POLYGON = { ClassName="ZONE_POLYGON", } @@ -1124,7 +1122,7 @@ function ZONE_POLYGON:New( ZoneName, ZoneGroup ) local GroupPoints = ZoneGroup:GetTaskRoute() local self = BASE:Inherit( self, ZONE_POLYGON_BASE:New( ZoneName, GroupPoints ) ) - self:F( { ZoneName, ZoneGroup, self.Polygon } ) + self:F( { ZoneName, ZoneGroup, self._.Polygon } ) return self end diff --git a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua index a30c335ba..3ac526534 100644 --- a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua +++ b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua @@ -72,6 +72,8 @@ do -- TASK_A2G_DISPATCHER self.Detection = Detection self.Mission = Mission + self.Detection:FilterCategories( Unit.Category.GROUND_UNIT, Unit.Category.SHIP ) + self:AddTransition( "Started", "Assign", "Started" ) --- OnAfter Transition Handler for Event Assign. diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index cd4762652..a8d4e75ca 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -640,7 +640,7 @@ function UNIT:GetThreatLevel() "Bomber", "Strategic Bomber", "Attack Helicopter", - "Interceptor", + "Battleplane", "Multirole Fighter", "Fighter" } diff --git a/docs/Documentation/AI_Balancer.html b/docs/Documentation/AI_Balancer.html index 84f7b559e..75e5c06cd 100644 --- a/docs/Documentation/AI_Balancer.html +++ b/docs/Documentation/AI_Balancer.html @@ -101,75 +101,28 @@ even when there are hardly any players in the mission.
The AIBalancer#AIBALANCER class monitors and manages as many replacement AI groups as there are -CLIENTS in a SET_CLIENT collection, which are not occupied by human players.
+In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.
+The parent class Fsm#FSM_SET manages the functionality to control the Finite State Machine (FSM). -The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods. -An explanation about state and event transition methods can be found in the FSM module documentation.
+The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following:
+Create a new AI_BALANCER object with the AI_BALANCER.New() method:
- -Use the method AI_BALANCER.InitSpawnInterval() to set the earliest and latest interval in seconds that is waited until a new replacement AI is spawned.
- -By default, When a human player joins a slot that is AI_BALANCED, the AI group will be destroyed by default. -However, there are 2 additional options that you can use to customize the destroy behaviour. -When a human player joins a slot, you can configure to let the AI return to:
- -Note that when AI returns to an airbase, the AIBALANCER will trigger the Return event and the AI will return, -otherwise the AIBALANCER will trigger a Destroy event, and the AI will be destroyed.
+The underlying change log documents the API changes. Please read this carefully. The following notation is used:
+The underlying change log documents the API changes.
+ + +Please read this carefully. The following notation is used:
The AIBALANCER class monitors and manages as many replacement AI groups as there are +CLIENTS in a SETCLIENT collection, which are not occupied by human players.
AI_BALANCER| AI_BALANCER.AIGroups | -- - | -||||
| AI_BALANCER.ClassName | -- - | -||||
| AI_BALANCER.Earliest | @@ -245,12 +189,6 @@ otherwise the AIBALANCER will trigger a Destroy event, and | AI_BALANCER:New(SetClient, SpawnAI) |
Creates a new AI_BALANCER object - |
- ||
| AI_BALANCER.PatrolZones | -- | ||||
| AI_CAP_ZONE |
-1) #AICAPZONE class, extends AICAP#AIPATROL_ZONE+AICAPZONE class, extends AICAP#AIPATROL_ZONE-The #AICAPZONE class implements the core functions to patrol a Zone by an AI Controllable or Group + The AICAPZONE class implements the core functions to patrol a Zone by an AI Controllable or Group and automatically engage any airborne enemies that are within a certain range or within a certain zone. |
||||
| AI_CAS_ZONE |
-1) #AICASZONE class, extends AIPatrol#AIPATROL_ZONE+AICASZONE class, extends AIPatrol#AIPATROL_ZONE-#AICASZONE derives from the AIPatrol#AIPATROL_ZONE, inheriting its methods and behaviour. +AICASZONE derives from the AIPatrol#AIPATROL_ZONE, inheriting its methods and behaviour. |
||||
| AI_PATROL_ZONE |
-1) #AIPATROLZONE class, extends Fsm#FSM_CONTROLLABLE+AIPATROLZONE class, extends Fsm#FSM_CONTROLLABLE-The #AIPATROLZONE class implements the core functions to patrol a Zone by an AI Controllable or Group. +The AIPATROLZONE class implements the core functions to patrol a Zone by an AI Controllable or Group. |
The #AIPATROLZONE class implements the core functions to patrol a Zone by an AI Controllable or Group.
+The AIPATROLZONE class implements the core functions to patrol a Zone by an AI Controllable or Group.
@@ -692,17 +708,17 @@ When the fuel treshold has been reached, the airplane will fly towards the neareThe detection process of the AI controllable can be manipulated. Detection requires an amount of CPU power, which has an impact on your mission performance. @@ -757,7 +773,7 @@ Use the method AIPATROLZO Note that when the zone is too far away, or the AI is not heading towards the zone, or the AI is too high, no targets may be detected according the weather conditions.
-When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. @@ -766,7 +782,7 @@ while a new AI is targetted to the AIPATROLZONE. Once the time is finished, the old AI will return to the base. Use the method AIPATROLZONE.ManageFuel() to have this proces in place.
-When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on.
Therefore, when the damage treshold is reached, the AI will return immediately to the home base (RTB).
@@ -933,9 +949,6 @@ Use the method AIPATROLZONE.M
-
- This table contains the targets detected during patrol.
The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere...
+CARGO_REPRESENTABLE| CARGO_REPRESENTABLE.ClassName | -- - | -|||
| CARGO_REPRESENTABLE:New(CargoObject, Type, Name, Weight, ReportRadius, NearRadius) | +CARGO_REPRESENTABLE:New(Type, Name, Weight, ReportRadius, NearRadius, CargoObject) |
CARGO_REPRESENTABLE Constructor. |
@@ -598,6 +598,12 @@
CARGO_REPRESENTABLE:RouteTo(ToPointVec2, Speed) |
Route a cargo unit to a PointVec2. + |
+
| CARGO_REPRESENTABLE.test | ++ |
The alive DCS object representing the cargo. This value can be nil, meaning, that the cargo is not represented anywhere...
+ + +Wrapper.Controllable#Controllable CargoObject :
#string Type :
#number NearRadius :
(optional)
CargoObject :
CARGO_UNITHello
+ +A Finite State Machine (FSM) models a process flow that transitions between various States through triggered Events.
+A FSM can only be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by an internal or external triggering event, which is called a transition. @@ -199,11 +201,9 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
The FSM class is the base class of all FSM_ derived classes.
+A Finite State Machine (FSM) models a process flow that transitions between various States through triggered Events.
A Finite State Machine (FSM) models a process flow that transitions between various States through triggered Events.
+ + + +A FSM can only be in one of a finite number of states. +The machine is in only one state at a time; the state it is in at any given time is called the current state. +It can change from one state to another when initiated by an internal or external triggering event, which is called a transition. +An FSM implementation is defined by a list of its states, its initial state, and the triggering events for each possible transition. +An FSM implementation is composed out of two parts, a set of state transition rules, and an implementation set of state transition handlers, implementing those transitions.
+ +The FSM class supports a hierarchical implementation of a Finite State Machine, +that is, it allows to embed existing FSM implementations in a master FSM. +FSM hierarchies allow for efficient FSM re-use, not having to re-invent the wheel every time again when designing complex processes.
+ +The above diagram shows a graphical representation of a FSM implementation for a Task, which guides a Human towards a Zone, +orders him to destroy x targets and account the results. +Other examples of ready made FSM could be:
+ +The MOOSE framework uses extensively the FSM class and derived FSM_ classes, +because the goal of MOOSE is to simplify mission design complexity for mission building. +By efficiently utilizing the FSM class and derived classes, MOOSE allows mission designers to quickly build processes. +Ready made FSM-based implementations classes exist within the MOOSE framework that can easily be re-used, +and tailored by mission designers through the implementation of Transition Handlers. +Each of these FSM implementation classes start either with:
+ +The FSM class is the base class of all FSM_ derived classes.
- - -It implements the main functionality to define and execute Finite State Machines. +
The FSM class is the base class of all FSM_ derived classes. It implements the main functionality to define and execute Finite State Machines. The derived FSM_ classes extend the Finite State Machine functionality to run a workflow process for a specific purpose or component.
Finite State Machines have Transition Rules, Transition Handlers and Event Triggers.
@@ -753,13 +791,13 @@ Most of the time, these Event Triggers are used within the Transition Handler meAs explained above, a FSM supports Linear State Transitions and Hierarchical State Transitions, and both can be mixed to make a comprehensive FSM implementation. The below documentation has a seperate chapter explaining both transition modes, taking into account the Transition Rules, Transition Handlers and Event Triggers.
-Linear Transitions are Transition Rules allowing an FSM to transition from one or multiple possible From state(s) towards a To state upon a Triggered Event. The Lineair transition rule evaluation will always be done from the current state of the FSM. If no valid Transition Rule can be found in the FSM, the FSM will log an error and stop.
-The FSM has transition rules that it follows and validates, as it walks the process. These rules define when an FSM can transition from a specific state towards an other specific state upon a triggered event.
@@ -787,7 +825,7 @@ These rules define when an FSM can transition from a specific state towards an oNote that Linear Transition Rules can be declared in a few variations:
@@ -801,7 +839,7 @@ These rules define when an FSM can transition from a specific state towards an o FsmSwitch:AddTransition( { "On", "Middle" }, "SwitchOff", "Off" )
-On top, each of these methods can have a variable amount of parameters passed. See the example in section 1.1.3.
-Because ... When Event was asynchronously processed after 5 seconds, Amount was set to 2. So be careful when processing and passing values and objects in asynchronous processing!
-This example is fully implemented in the MOOSE test mission on GITHUB: FSM-100 - Transition Explanation
@@ -960,7 +998,7 @@ The transition for event Stop can be executed if the current state of the FSM isSo... When FsmDemo:Stop() is being triggered, the state of FsmDemo will transition from Red or Green to Stopped. And there is no transition handling method defined for that transition, thus, no new event is being triggered causing the FsmDemo process flow to halt.
-Hierarchical Transitions allow to re-use readily available and implemented FSMs. This becomes in very useful for mission building, where mission designers build complex processes and workflows, @@ -1582,7 +1620,7 @@ A string defining the start state.
The above menus classes are derived from 2 main abstract classes defined within the MOOSE framework (so don't use these):
+The underlying base menu classes are NOT to be used within your missions. -These are simply abstract base classes defining a couple of fields that are used by the -derived MENU_ classes to manage menus.
+The #MENU_BASE class defines the main MENU class where other MENU classes are derived from.
- -The #MENUCOMMANDBASE class defines the main MENU class where other MENU COMMAND_ classes are derived from, in order to set commands.
- -The next menus define the MENU classes that you can use within your missions.
- -The underlying classes manage the menus for a complete mission file.
- -The Menu#MENU_MISSION class manages the main menus for a complete mission.
-You can add menus with the MENU_MISSION.New method, which constructs a MENU_MISSION object and returns you the object reference.
-Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENU_MISSION.Remove.
The Menu#MENUMISSIONCOMMAND class manages the command menus for a complete mission, which allow players to execute functions during mission execution.
-You can add menus with the MENUMISSIONCOMMAND.New method, which constructs a MENUMISSIONCOMMAND object and returns you the object reference.
-Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUMISSIONCOMMAND.Remove.
The underlying classes manage the menus for whole coalitions.
- -The Menu#MENU_COALITION class manages the main menus for coalitions.
-You can add menus with the MENU_COALITION.New method, which constructs a MENU_COALITION object and returns you the object reference.
-Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENU_COALITION.Remove.
The Menu#MENUCOALITIONCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-You can add menus with the MENUCOALITIONCOMMAND.New method, which constructs a MENUCOALITIONCOMMAND object and returns you the object reference.
-Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUCOALITIONCOMMAND.Remove.
The underlying classes manage the menus for groups. Note that groups can be inactive, alive or can be destroyed.
- -The Menu#MENU_GROUP class manages the main menus for coalitions.
-You can add menus with the MENU_GROUP.New method, which constructs a MENU_GROUP object and returns you the object reference.
-Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENU_GROUP.Remove.
The Menu#MENUGROUPCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-You can add menus with the MENUGROUPCOMMAND.New method, which constructs a MENUGROUPCOMMAND object and returns you the object reference.
-Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUGROUPCOMMAND.Remove.
The underlying classes manage the menus for units with skill level client or player.
- -The Menu#MENU_CLIENT class manages the main menus for coalitions.
-You can add menus with the MENU_CLIENT.New method, which constructs a MENU_CLIENT object and returns you the object reference.
-Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENU_CLIENT.Remove.
The Menu#MENUCLIENTCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution.
-You can add menus with the MENUCLIENTCOMMAND.New method, which constructs a MENUCLIENTCOMMAND object and returns you the object reference.
-Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUCLIENTCOMMAND.Remove.
| MENU_BASE |
-
+MENU_BASE class, extends Base#BASE+The MENU_BASE class defines the main MENU class where other MENU classes are derived from. |
| MENU_CLIENT |
+MENU_CLIENT class, extends Menu#MENU_BASE+The MENU_CLIENT class manages the main menus for coalitions. |
| MENU_CLIENT_COMMAND |
+MENUCLIENTCOMMAND class, extends Menu#MENUCOMMANDBASE+The MENUCLIENTCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution. |
| MENU_COALITION |
+MENU_COALITION class, extends Menu#MENU_BASE+The Menu#MENU_COALITION class manages the main menus for coalitions. |
| MENU_COALITION_COMMAND |
+MENUCOALITIONCOMMAND class, extends Menu#MENUCOMMANDBASE+The MENUCOALITIONCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution. |
| MENU_COMMAND_BASE |
-
+MENUCOMMANDBASE class, extends Base#BASE++ The MENUCOMMANDBASE class defines the main MENU class where other MENU COMMAND_ +classes are derived from, in order to set commands. |
| MENU_GROUP |
+MENU_GROUP class, extends Menu#MENU_BASE+The MENU_GROUP class manages the main menus for coalitions. |
| MENU_GROUP_COMMAND |
+MENUGROUPCOMMAND class, extends Menu#MENUCOMMANDBASE+The Menu#MENUGROUPCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution. |
| MENU_MISSION |
+MENU_MISSION class, extends Menu#MENU_BASE+The MENU_MISSION class manages the main menus for a complete mission. |
| MENU_MISSION_COMMAND |
+MENUMISSIONCOMMAND class, extends Menu#MENUCOMMANDBASE+The MENUMISSIONCOMMAND class manages the command menus for a complete mission, which allow players to execute functions during mission execution. |
MENU_BASE| MENU_BASE.ClassName | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_BASE:GetMenu(MenuText) | - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_BASE.MenuParentPath | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_BASE.MenuPath | -- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_BASE.MenuRemoveParent | - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_BASE.MenuText | -- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_CLIENT.ClassName | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_CLIENT:New(Client, MenuText, ParentMenu) |
MENU_CLIENT constructor. @@ -367,12 +287,6 @@ Using this object reference, you can then remove ALL the menus and submenus undeType
|
| MENU_CLIENT_COMMAND.ClassName | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_CLIENT_COMMAND:New(Client, MenuText, ParentMenu, CommandMenuFunction, ...) |
MENUCLIENTCOMMAND constructor. @@ -389,12 +303,6 @@ Using this object reference, you can then remove ALL the menus and submenus undeType
|
| MENU_COALITION.ClassName | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_COALITION:New(Coalition, MenuText, ParentMenu) |
MENU_COALITION constructor. @@ -417,12 +325,6 @@ Using this object reference, you can then remove ALL the menus and submenus undeType
|
| MENU_COALITION_COMMAND.ClassName | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_COALITION_COMMAND:New(Coalition, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument, ...) |
MENU_COALITION constructor. @@ -439,24 +341,6 @@ Using this object reference, you can then remove ALL the menus and submenus undeType
|
| MENU_COMMAND_BASE.ClassName | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_COMMAND_BASE.CommandMenuArgument | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_COMMAND_BASE.CommandMenuFunction | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_COMMAND_BASE.MenuCallHandler |
@@ -473,12 +357,6 @@ Using this object reference, you can then remove ALL the menus and submenus unde
Type
|
| MENU_GROUP.ClassName | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_GROUP.MenuGroup |
@@ -537,12 +415,6 @@ Using this object reference, you can then remove ALL the menus and submenus unde
Type
|
| MENU_GROUP_COMMAND.ClassName | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_GROUP_COMMAND.MenuGroup |
@@ -595,12 +467,6 @@ Using this object reference, you can then remove ALL the menus and submenus unde
Type
|
| MENU_MISSION.ClassName | -- - | -||||||||||||||||||||||||||||||||||||||||||||||||||
| MENU_MISSION:New(MenuText, ParentMenu) |
MENU_MISSION constructor. @@ -623,12 +489,6 @@ Using this object reference, you can then remove ALL the menus and submenus undeType
|
| MENU_MISSION_COMMAND.ClassName | -- - | -||||||||||||||||
| MENU_MISSION_COMMAND:New(MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument, ...) |
MENU_MISSION constructor. @@ -653,7 +513,11 @@ Using this object reference, you can then remove ALL the menus and submenus undeMENU_BASE class, extends Base#BASE+The MENU_BASE class defines the main MENU class where other MENU classes are derived from. + +This is an abstract class, so don't use it. MENU_CLIENT class, extends Menu#MENU_BASE+The 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. + + +Usage:+
MENUCLIENTCOMMAND class, extends Menu#MENUCOMMANDBASE+ +The MENUCLIENTCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution. + + +You can add menus with the MENUCLIENTCOMMAND.New method, which constructs a MENUCLIENTCOMMAND object and returns you the object reference. +Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUCLIENTCOMMAND.Remove. MENU_COALITION class, extends Menu#MENU_BASE+The Menu#MENU_COALITION class manages the main menus for coalitions. + + +You can add menus with the MENU_COALITION.New method, which constructs a MENU_COALITION object and returns you the object reference. +Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENU_COALITION.Remove. + + + +Usage:+
MENUCOALITIONCOMMAND class, extends Menu#MENUCOMMANDBASE+ +The MENUCOALITIONCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution. + + +You can add menus with the MENUCOALITIONCOMMAND.New method, which constructs a MENUCOALITIONCOMMAND object and returns you the object reference. +Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUCOALITIONCOMMAND.Remove. MENUCOMMANDBASE class, extends Base#BASE++ The MENUCOMMANDBASE class defines the main MENU class where other MENU COMMAND_ +classes are derived from, in order to set commands. MENU_GROUP class, extends Menu#MENU_BASE+The 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. + + +Usage:+
MENUGROUPCOMMAND class, extends Menu#MENUCOMMANDBASE+ +The Menu#MENUGROUPCOMMAND class manages the command menus for coalitions, which allow players to execute functions during mission execution. + + +You can add menus with the MENUGROUPCOMMAND.New method, which constructs a MENUGROUPCOMMAND object and returns you the object reference. +Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUGROUPCOMMAND.Remove. MENU_MISSION class, extends Menu#MENU_BASE+The 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. MENUMISSIONCOMMAND class, extends Menu#MENUCOMMANDBASE+ +The MENUMISSIONCOMMAND class manages the command menus for a complete mission, which allow players to execute functions during mission execution. + + +You can add menus with the MENUMISSIONCOMMAND.New method, which constructs a MENUMISSIONCOMMAND object and returns you the object reference. +Using this object reference, you can then remove ALL the menus and submenus underlying automatically with MENUMISSIONCOMMAND.Remove. Type
|
| MESSAGE |
+MESSAGE class, extends Base#BASE+Message System to display Messages to Clients, Coalitions or All. |
MESSAGE| MESSAGE.ClassName | -- - | -||||
| MESSAGE.MessageCategory | -- - | -||||
| MESSAGE.MessageID | -- - | -||||
| MESSAGE:New(MessageText, MessageDuration, MessageCategory) |
Creates a new MESSAGE object. @@ -232,6 +182,40 @@ To send messages, you need to use the To functions.MESSAGE class, extends Base#BASE+ +Message System to display Messages to Clients, Coalitions or All. + + +Messages are shown on the display panel for an amount of seconds, and will then disappear. +Messages can contain a category which is indicating the category of the message. + +MESSAGE construction+ +Messages are created with Message#MESSAGE.New. Note that when the MESSAGE object is created, no message is sent yet. +To send messages, you need to use the To functions. + +Send messages to an audience+ +Messages are sent: + +
Send conditionally to an audience+ +Messages can be sent conditionally to an audience (when a condition is true): + +
1) Point#POINT_VEC3 class, extends Base#BASE-The Point#POINT_VEC3 class defines a 3D point in the simulator. +Important Note: Most of the functions in this section were taken from MIST, and reworked to OO concepts. -In order to keep the credibility of the the author, I want to emphasize that the of the MIST framework was created by Grimes, who you can find on the Eagle Dynamics Forums. +- 1.1) POINT_VEC3 constructor+Demo Missions-A new POINT_VEC3 instance can be created with: +POINT_VEC Demo Missions source code-
POINT_VEC Demo Missions, only for beta testers-1.2) Manupulate the X, Y, Z coordinates of the point+ALL Demo Missions pack of the last release-A POINT_VEC3 class works in 3D space. It contains internally an X, Y, Z coordinate. -Methods exist to manupulate these coordinates. +- The current X, Y, Z axis can be retrieved with the methods POINT_VEC3.GetX(), POINT_VEC3.GetY(), POINT_VEC3.GetZ() respectively. -The methods POINT_VEC3.SetX(), POINT_VEC3.SetY(), POINT_VEC3.SetZ() change the respective axis with a new value. -The current axis values can be changed by using the methods POINT_VEC3.AddX(), POINT_VEC3.AddY(), POINT_VEC3.AddZ() -to add or substract a value from the current respective axis value. -Note that the Set and Add methods return the current POINT_VEC3 object, so these manipulation methods can be chained... For example: +YouTube Channel-
-
-1.3) Create waypoints for routes- -A POINT_VEC3 can prepare waypoints for Ground, Air and Naval groups to be embedded into a Route. - - -1.5) Smoke, flare, explode, illuminate- -At the point a smoke, flare, explosion and illumination bomb can be triggered. Use the following methods: - -1.5.1) Smoke- -
1.5.2) Flare- -
1.5.3) Explode- -
1.5.4) Illuminate- -
2) Point#POINT_VEC2 class, extends 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. - -2.1) POINT_VEC2 constructor-A new POINT_VEC2 instance can be created with: - -
1.2) Manupulate the X, Altitude, Y coordinates of the 2D point- -A POINT_VEC2 class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate. -Methods exist to manupulate these coordinates. - -The current X, Altitude, Y axis can be retrieved with the methods POINT_VEC2.GetX(), POINT_VEC2.GetAlt(), POINT_VEC2.GetY() respectively. -The methods POINT_VEC2.SetX(), POINT_VEC2.SetAlt(), POINT_VEC2.SetY() change the respective axis with a new value. -The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods POINT_VEC2.GetLat(), POINT_VEC2.GetAlt(), POINT_VEC2.GetLon() respectively. -The current axis values can be changed by using the methods POINT_VEC2.AddX(), POINT_VEC2.AddAlt(), POINT_VEC2.AddY() -to add or substract a value from the current respective axis value. -Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example: - -
+POINT_VEC YouTube Channel@@ -238,13 +158,17 @@ Note that the Set and Add methods return the current POINT_VEC2 object, so these POINT_VEC2 |
+ |
POINT_VEC2 class, extends Point#POINT_VEC3+The Point#POINT_VEC2 class defines a 2D point in the simulator. POINT_VEC3 |
+ |
POINT_VEC3 class, extends Base#BASE+POINT_VEC3 defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space. |
Add to the y coordinate of the POINT_VEC2.
-Add to the z coordinate of the POINT_VEC3.
-Return a BR string from a POINTVEC3 to the POINTVEC3.
+Return an angle in degrees from the POINT_VEC3 using a direction vector in Vec3 format.
Return a direction in radians from the POINT_VEC3 using a direction vector in Vec3 format.
+Return an angle in radians from the POINT_VEC3 using a direction vector in Vec3 format.
+Return a BR string from a POINTVEC3 to the POINTVEC3.
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.
+ +A new POINT_VEC2 instance can be created with:
+ +A POINT_VEC2 class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate. +Methods exist to manupulate these coordinates.
+ +The current X, Altitude, Y axis can be retrieved with the methods POINT_VEC2.GetX(), POINT_VEC2.GetAlt(), POINT_VEC2.GetY() respectively. +The methods POINT_VEC2.SetX(), POINT_VEC2.SetAlt(), POINT_VEC2.SetY() change the respective axis with a new value. +The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods POINT_VEC2.GetLat(), POINT_VEC2.GetAlt(), POINT_VEC2.GetLon() respectively. +The current axis values can be changed by using the methods POINT_VEC2.AddX(), POINT_VEC2.AddAlt(), POINT_VEC2.AddY() +to add or substract a value from the current respective axis value. +Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example:
+ + local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
+
+
POINT_VEC3 defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
+ + + +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 formulas embedded in the MIST framework were created by Grimes or previous authors, +who you can find on the Eagle Dynamics Forums.
+ + +A new POINT_VEC3 object can be created with:
+ +A POINT_VEC3 class works in 3D space. It contains internally an X, Y, Z coordinate. +Methods exist to manupulate these coordinates.
+ +The current X, Y, Z axis can be retrieved with the methods POINT_VEC3.GetX(), POINT_VEC3.GetY(), POINT_VEC3.GetZ() respectively. +The methods POINT_VEC3.SetX(), POINT_VEC3.SetY(), POINT_VEC3.SetZ() change the respective axis with a new value. +The current axis values can be changed by using the methods POINT_VEC3.AddX(), POINT_VEC3.AddY(), POINT_VEC3.AddZ() +to add or substract a value from the current respective axis value. +Note that the Set and Add methods return the current POINT_VEC3 object, so these manipulation methods can be chained... For example:
+ + local Vec3 = PointVec3:AddX( 100 ):AddZ( 150 ):GetVec3()
+
+
+
+A POINT_VEC3 can prepare waypoints for Ground and Air groups to be embedded into a Route.
+ +Route points can be used in the Route methods of the Group#GROUP class.
+ + +At the point a smoke, flare, explosion and illumination bomb can be triggered. Use the following methods:
+ +Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:
+ +Various methods exist to calculate random locations around a given 3D point.
+ +PointPOINT_VEC2The POINT_VEC2 class
- -Return an angle in degrees from the POINT_VEC3 using a direction vector in Vec3 format.
+ +Dcs.DCSTypes#Vec3 DirectionVec3 :
+The direction vector in Vec3 format.
#number: +DirectionRadians The angle in degrees.
+ +Return an angle in radians from the POINT_VEC3 using a direction vector in Vec3 format.
+ +Dcs.DCSTypes#Vec3 DirectionVec3 :
+The direction vector in Vec3 format.
#number: +DirectionRadians The angle in radians.
+ +Return a direction in radians from the POINT_VEC3 using a direction vector in Vec3 format.
- -Dcs.DCSTypes#Vec3 DirectionVec3 :
-The direction vector in Vec3 format.
#number: -DirectionRadians The direction in radians.
- -The Scheduler#SCHEDULER class creates schedule.
- -The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters:
+SCHEDULER manages the scheduling of functions:
The SCHEDULER can be stopped and restarted with the following methods:
+With Scheduler#SCHEDULER.Schedule() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.
+The SCHEDULER class creates schedule.
SCHEDULER| SCHEDULER.ClassName | -- - | -||
| SCHEDULER:Clear() |
Clears all pending schedules. @@ -203,12 +190,6 @@ | SCHEDULER.SchedulerObject | - | -
| SCHEDULER.Schedules | -- | ||
| SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle) | + | +||
| SPAWN.uncontrolled | ++ |
Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
-Overwrite unit names by default with group name.
-Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
+When the first Spawn executes, all the Groups need to be made visible before start.
Add a PlayerUnit to join the Task.
-For each Group within the Task, the Unit is check if it can join the Task. +
For each Group within the Task, the Unit is checked if it can join the Task. If the Unit was not part of the Task, false is returned. If the Unit is part of the Task, true is returned.
diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html index d6a95cfc8..b2cbf3569 100644 --- a/docs/Documentation/Task_Cargo.html +++ b/docs/Documentation/Task_Cargo.html @@ -190,6 +190,18 @@ and various dedicated deployment zones.Core.Set#SET_CARGO: +The Cargo Set.
+ +#list: +Core.Zone#ZONE_BASE> The Deployment Zones.
+ +#boolean:
+ +listConstructor to create a ZONE_GROUP instance, taking the zone name, a zone Group#GROUP and a radius.
-Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of DCSTypes#Vec2, forming a polygon.
-The polygon defined by an array of DCSTypes#Vec2.
ZONE_BASEThe ZONE_BASE class
- -#ZONE_GROUP: self
- -#ZONEPOLYGONBASE: self
- - -The polygon defined by an array of DCSTypes#Vec2.
-The AIBalancer#AIBALANCER class monitors and manages as many replacement AI groups as there are -CLIENTS in a SET_CLIENT collection, which are not occupied by human players.
+The underlying change log documents the API changes.