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 @@ -- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) -- --- === +-- ==== -- --- # 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 --- --- ![Process](..\Presentations\AI_Balancer\Dia13.JPG) --- --- ### 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 +-- +-- ![Process](..\Presentations\AI_Balancer\Dia13.JPG) +-- +-- ### 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. -- -- ![Process](..\Presentations\AI_CAP\Dia3.JPG) @@ -81,22 +97,22 @@ -- -- ![Process](..\Presentations\AI_CAP\Dia13.JPG) -- --- ## 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 -- -- ![Process](..\Presentations\AI_CAP\Dia2.JPG) -- --- ### 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 -- -- ![Range](..\Presentations\AI_CAP\Dia11.JPG) -- @@ -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 -- -- ![Zone](..\Presentations\AI_CAP\Dia12.JPG) -- @@ -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. -- -- ![HoldAndEngage](..\Presentations\AI_CAS\Dia3.JPG) @@ -104,22 +120,22 @@ -- -- ![Engage Event](..\Presentations\AI_CAS\Dia12.JPG) -- --- # 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 -- -- ![Process](..\Presentations\AI_CAS\Dia2.JPG) -- --- ### 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}. -- -- ![Process](..\Presentations\AI_PATROL\Dia3.JPG) -- @@ -97,15 +113,15 @@ -- -- ![Process](..\Presentations\AI_PATROL\Dia11.JPG) -- --- ## 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 -- -- ![Process](..\Presentations\AI_PATROL\Dia2.JPG) -- --- ### 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. + -- + -- ![Workflow Example](..\Presentations\FSM\Dia2.JPG) + -- + -- 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. + -- -- ![Transition Rules and Transition Handlers and Event Triggers](..\Presentations\FSM\Dia3.JPG) -- -- 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 -- -- ![Transition Handlers](..\Presentations\FSM\Dia4.JPG) -- @@ -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 -- -- ![Event Triggers](..\Presentations\FSM\Dia5.JPG) -- @@ -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. +-- ![Banner Image](..\Presentations\POINT\Dia1.JPG) +-- +-- ==== -- --- 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.


-

1) AIBalancer#AIBALANCER class, extends Fsm#FSM_SET

+

Demo Missions

-

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.

+

AI_BALANCER Demo Missions source code

- -

In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.

+

AI_BALANCER Demo Missions, only for beta testers

-

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.

+

ALL Demo Missions pack of the last release

-

The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following:

+
- +

YouTube Channel

-

1.1) AI_BALANCER construction

- -

Create a new AI_BALANCER object with the AI_BALANCER.New() method:

- -

1.2) AI_BALANCER is a FSM

- -

Process

- -

1.2.1) AI_BALANCER States

- - - -

1.2.2) AI_BALANCER Events

- - - -

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:

- - - -

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.

+

AI_BALANCER YouTube Channel


API CHANGE HISTORY

-

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:

-

Some additional comments:

+

Some additional comments:

Note 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" )
 
-

1.1.2) Transition Handling

+

Transition Handling

Transition Handlers

@@ -827,7 +865,7 @@ These parameters are on the correct order: From, Event, To:

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

+

Event Triggers

Event Triggers

@@ -870,7 +908,7 @@ Event will be processed after 5 seconds, and Amount is given as a parameter.

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

@@ -960,7 +998,7 @@ The transition for event Stop can be executed if the current state of the FSM is

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, @@ -1582,7 +1620,7 @@ A string defining the start state.

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

+ FSM.current diff --git a/docs/Documentation/Menu.html b/docs/Documentation/Menu.html index e6a65ed88..7cab8f742 100644 --- a/docs/Documentation/Menu.html +++ b/docs/Documentation/Menu.html @@ -128,186 +128,112 @@ On top, MOOSE implements variable parameter passing for command
-

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

- -
- -

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) #MENUMISSIONCOMMAND class, extends Menu#MENUCOMMANDBASE

-

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.

- -
- -

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#MENUCOALITIONCOMMAND class, extends Menu#MENUCOMMANDBASE

-

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.

- -
- -

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

- -
- -

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#MENUCLIENTCOMMAND class, extends Menu#MENUCOMMANDBASE

-

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.

- -
- -

Contributions: -

-

Authors: FlightControl : Design & Programming

+

Authors:

+
    +
  • FlightControl: Design & Programming +
  • +

Global(s)

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.

Type MENU_BASE

- - - - - - - - - - - - - - - - @@ -339,12 +265,6 @@ Using this object reference, you can then remove ALL the menus and submenus unde

Type MENU_CLIENT

MENU_BASE.ClassName - -
MENU_BASE:GetMenu(MenuText)

Gets a Menu from a parent Menu

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

Type MENU_CLIENT_COMMAND

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

Type MENU_COALITION

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

Type MENU_COALITION_COMMAND

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

Type MENU_COMMAND_BASE

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

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

- - - - - - - - @@ -690,23 +678,30 @@

Each zone implements two polymorphic functions defined in Zone#ZONE_BASE:

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:

A zone has a bounding square:

@@ -901,10 +896,7 @@ The name of the zone as defined within the mission editor.

Type ZONE_BASE

- -

The ZONE_BASE class

- -

Field(s)

+

Field(s)

@@ -1498,20 +1490,6 @@ The radius of the zone.

#ZONE_GROUP: self

- -
-
-
- - Wrapper.Group#GROUP - -ZONE_GROUP.ZoneGROUP - -
-
- - -
@@ -1755,20 +1733,6 @@ An array of DCSTypes#Vec2, forming a polygon

#ZONEPOLYGONBASE: self

- - -
-
- - #ZONE_POLYGON_BASE.ListVec2 - -ZONE_POLYGON_BASE.Polygon - -
-
- -

The polygon defined by an array of DCSTypes#Vec2.

-
diff --git a/docs/Documentation/index.html b/docs/Documentation/index.html index 91ea5f63f..bb25ca5bb 100644 --- a/docs/Documentation/index.html +++ b/docs/Documentation/index.html @@ -104,10 +104,25 @@ even when there are hardly any players in the mission.


-

1) AIBalancer#AIBALANCER class, extends Fsm#FSM_SET

+

Demo Missions

-

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.

+

AI_BALANCER Demo Missions source code

+ +

AI_BALANCER Demo Missions, only for beta testers

+ +

ALL Demo Missions pack of the last release

+ +
+ +

YouTube Channel

+ +

AI_BALANCER YouTube Channel

+ +
+ +

API CHANGE HISTORY

+ +

The underlying change log documents the API changes.

diff --git a/docs/Presentations/EVENT.pptx b/docs/Presentations/EVENT.pptx deleted file mode 100644 index 5ae8628cb..000000000 Binary files a/docs/Presentations/EVENT.pptx and /dev/null differ diff --git a/docs/Presentations/POINT/Dia1.JPG b/docs/Presentations/POINT/Dia1.JPG new file mode 100644 index 000000000..2f3a683bb Binary files /dev/null and b/docs/Presentations/POINT/Dia1.JPG differ diff --git a/docs/Presentations/SCORING.pptx b/docs/Presentations/SCORING.pptx deleted file mode 100644 index 511f83f82..000000000 Binary files a/docs/Presentations/SCORING.pptx and /dev/null differ diff --git a/docs/Presentations/SPAWNSTATIC.pptx b/docs/Presentations/SPAWNSTATIC.pptx deleted file mode 100644 index 53e14f0dc..000000000 Binary files a/docs/Presentations/SPAWNSTATIC.pptx and /dev/null differ diff --git a/docs/Presentations/ZONE/Dia1.JPG b/docs/Presentations/ZONE/Dia1.JPG index ca4dd2b3f..8341de972 100644 Binary files a/docs/Presentations/ZONE/Dia1.JPG and b/docs/Presentations/ZONE/Dia1.JPG differ diff --git a/docs/_config.yml b/docs/_config.yml index 3397c9a49..de516ee15 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1 +1,2 @@ -theme: jekyll-theme-architect \ No newline at end of file +theme: jekyll-theme-architect +google_analytics: UA-97385487-1 \ No newline at end of file
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

- - - - + + + + + + + + @@ -272,6 +284,12 @@ and various dedicated deployment zones.

+ + + + @@ -512,6 +530,42 @@ based on the tasking capabilities defined in Task#TA
+ +TASK_CARGO:GetCargoSet() + +
+
+ + + +

Return value

+ +

Core.Set#SET_CARGO: +The Cargo Set.

+ +
+
+
+
+ + +TASK_CARGO:GetDeployZones() + +
+
+ + + +

Return value

+ +

#list: +Core.Zone#ZONE_BASE> The Deployment Zones.

+ +
+
+
+
+ TASK_CARGO:GetPlannedMenuText() @@ -889,6 +943,24 @@ The score in points.

+ +
+
+
+ + +TASK_CARGO_TRANSPORT:IsAllCargoTransported() + +
+
+ + + +

Return value

+ +

#boolean:

+ +
@@ -936,6 +1008,8 @@ self

+

Type list

+ diff --git a/docs/Documentation/Zone.html b/docs/Documentation/Zone.html index 57eba9a61..c684d66da 100644 --- a/docs/Documentation/Zone.html +++ b/docs/Documentation/Zone.html @@ -414,12 +414,6 @@ - - - -
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 unde

Type MENU_MISSION_COMMAND

- - - - - - - - @@ -414,12 +332,6 @@ Note that the Set and Add methods return the current POINT_VEC2 object, so these - - - - @@ -483,15 +395,21 @@ Note that the Set and Add methods return the current POINT_VEC2 object, so these - + - + + + + + @@ -783,7 +701,37 @@ Note that the Set and Add methods return the current POINT_VEC2 object, so these
+

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:

+ + + +

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()
+ 
+
@@ -797,17 +745,159 @@ Note that the Set and Add methods return the current POINT_VEC2 object, so these
+

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:

+ + + + +

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.

+ + + +

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

+ + + +

Flare

+ + + +

Explode

+ + + +

Illuminate

+ + + + +

3D calculation methods

+ +

Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:

+ +

Distance

+ + + +

Angle

+ + + +

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 Randomization

+ +

Various methods exist to calculate random locations around a given 3D point.

+ + + + +

Metric system

+ + + + +

Coorinate text generation

+ +

Type Point

Type POINT_VEC2

- -

The POINT_VEC2 class

- -

Field(s)

+

Field(s)

@@ -887,20 +977,6 @@ The y coordinate.

#POINT_VEC2:

- -
-
-
- - #string - -POINT_VEC2.ClassName - -
-
- - -
@@ -1463,20 +1539,6 @@ The z coordinate value to add to the current z coodinate.

#POINT_VEC3:

- -
-
-
- - #string - -POINT_VEC3.ClassName - -
-
- - -
@@ -1723,6 +1785,60 @@ Altitude text.

+ +POINT_VEC3:GetAngleDegrees(DirectionVec3) + +
+
+ +

Return an angle in degrees from the POINT_VEC3 using a direction vector in Vec3 format.

+ +

Parameter

+ +

Return value

+ +

#number: +DirectionRadians The angle in degrees.

+ +
+
+
+
+ + +POINT_VEC3:GetAngleRadians(DirectionVec3) + +
+
+ +

Return an angle in radians from the POINT_VEC3 using a direction vector in Vec3 format.

+ +

Parameter

+ +

Return value

+ +

#number: +DirectionRadians The angle in radians.

+ +
+
+
+
+ POINT_VEC3:GetBRText(TargetPointVec3) @@ -1750,33 +1866,6 @@ The BR text.

- -POINT_VEC3:GetDirectionRadians(DirectionVec3) - -
-
- -

Return a direction in radians from the POINT_VEC3 using a direction vector in Vec3 format.

- -

Parameter

- -

Return value

- -

#number: -DirectionRadians The direction in radians.

- -
-
-
-
- POINT_VEC3:GetDirectionVec3(TargetPointVec3) diff --git a/docs/Documentation/Scheduler.html b/docs/Documentation/Scheduler.html index 78118365a..fb456fcc0 100644 --- a/docs/Documentation/Scheduler.html +++ b/docs/Documentation/Scheduler.html @@ -101,33 +101,30 @@
-

1) Scheduler#SCHEDULER class, extends Base#BASE

- -

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 manages the scheduling of functions:

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

1.2) SCHEDULER timer stopping and (re-)starting.

+
-

The SCHEDULER can be stopped and restarted with the following methods:

+

Demo Missions

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

SCHEDULER Demo Missions source code

-

1.3) Create a new schedule

+

SCHEDULER Demo Missions, only for beta testers

-

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.

+

ALL Demo Missions pack of the last release

+ +
+ +

YouTube Channel

+ +

SCHEDULER YouTube Channel (none)


@@ -143,12 +140,6 @@
  • FlightControl : Design & Programming
  • -

    Test Missions:

    - -
      -
    • SCH - Scheduler
    • -
    -
    @@ -157,19 +148,15 @@
    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 unde
    +

    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.

    @@ -667,7 +531,65 @@ Using this object reference, you can then remove ALL the menus and submenus unde
    +

    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.
    + -- To test, join the planes, then look at the other radio menus (Option F10).
    + -- Then switch planes and check if the menu is still there.
    + -- And play with the Add and Remove menu options.
    + 
    + -- Note that in multi player, this will only work after the DCS clients bug is solved.
    +
    + local function ShowStatus( PlaneClient, StatusText, Coalition )
    +
    +   MESSAGE:New( Coalition, 15 ):ToRed()
    +   PlaneClient:Message( StatusText, 15 )
    + end
    +
    + local MenuStatus = {}
    +
    + local function RemoveStatusMenu( MenuClient )
    +   local MenuClientName = MenuClient:GetName()
    +   MenuStatus[MenuClientName]:Remove()
    + end
    +
    + --- @param Wrapper.Client#CLIENT MenuClient
    + local function AddStatusMenu( MenuClient )
    +   local MenuClientName = MenuClient:GetName()
    +   -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
    +   MenuStatus[MenuClientName] = MENU_CLIENT:New( MenuClient, "Status for Planes" )
    +   MENU_CLIENT_COMMAND:New( MenuClient, "Show Status", MenuStatus[MenuClientName], ShowStatus, MenuClient, "Status of planes is ok!", "Message to Red Coalition" )
    + end
    +
    + SCHEDULER:New( nil,
    +   function()
    +     local PlaneClient = CLIENT:FindByName( "Plane 1" )
    +     if PlaneClient and PlaneClient:IsAlive() then
    +       local MenuManage = MENU_CLIENT:New( PlaneClient, "Manage Menus" )
    +       MENU_CLIENT_COMMAND:New( PlaneClient, "Add Status Menu Plane 1", MenuManage, AddStatusMenu, PlaneClient )
    +       MENU_CLIENT_COMMAND:New( PlaneClient, "Remove Status Menu Plane 1", MenuManage, RemoveStatusMenu, PlaneClient )
    +     end
    +   end, {}, 10, 10 )
    +
    + SCHEDULER:New( nil,
    +   function()
    +     local PlaneClient = CLIENT:FindByName( "Plane 2" )
    +     if PlaneClient and PlaneClient:IsAlive() then
    +       local MenuManage = MENU_CLIENT:New( PlaneClient, "Manage Menus" )
    +       MENU_CLIENT_COMMAND:New( PlaneClient, "Add Status Menu Plane 2", MenuManage, AddStatusMenu, PlaneClient )
    +       MENU_CLIENT_COMMAND:New( PlaneClient, "Remove Status Menu Plane 2", MenuManage, RemoveStatusMenu, PlaneClient )
    +     end
    +   end, {}, 10, 10 )
    +   
    @@ -681,6 +603,13 @@ Using this object reference, you can then remove ALL the menus and submenus unde
    +

    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.

    @@ -695,7 +624,53 @@ Using this object reference, you can then remove ALL the menus and submenus unde
    +

    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).
    + -- Then switch planes and check if the menu is still there.
    +
    + local Plane1 = CLIENT:FindByName( "Plane 1" )
    + local Plane2 = CLIENT:FindByName( "Plane 2" )
    +
    +
    + -- This would create a menu for the red coalition under the main DCS "Others" menu.
    + local MenuCoalitionRed = MENU_COALITION:New( coalition.side.RED, "Manage Menus" )
    +
    +
    + local function ShowStatus( StatusText, Coalition )
    +
    +   MESSAGE:New( Coalition, 15 ):ToRed()
    +   Plane1:Message( StatusText, 15 )
    +   Plane2:Message( StatusText, 15 )
    + end
    +
    + local MenuStatus -- Menu#MENU_COALITION
    + local MenuStatusShow -- Menu#MENU_COALITION_COMMAND
    +
    + local function RemoveStatusMenu()
    +   MenuStatus:Remove()
    + end
    +
    + local function AddStatusMenu()
    +   
    +   -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
    +   MenuStatus = MENU_COALITION:New( coalition.side.RED, "Status for Planes" )
    +   MenuStatusShow = MENU_COALITION_COMMAND:New( coalition.side.RED, "Show Status", MenuStatus, ShowStatus, "Status of planes is ok!", "Message to Red Coalition" )
    + end
    +
    + 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 )
    + 
    @@ -709,6 +684,13 @@ Using this object reference, you can then remove ALL the menus and submenus unde
    +

    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.

    @@ -723,7 +705,10 @@ Using this object reference, you can then remove ALL the menus and submenus unde
    - +

    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.

    @@ -737,7 +722,65 @@ Using this object reference, you can then remove ALL the menus and submenus unde
    +

    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.
    + -- To test, join the planes, then look at the other radio menus (Option F10).
    + -- Then switch planes and check if the menu is still there.
    + -- And play with the Add and Remove menu options.
    + 
    + -- Note that in multi player, this will only work after the DCS groups bug is solved.
    +
    + local function ShowStatus( PlaneGroup, StatusText, Coalition )
    +
    +   MESSAGE:New( Coalition, 15 ):ToRed()
    +   PlaneGroup:Message( StatusText, 15 )
    + end
    +
    + local MenuStatus = {}
    +
    + local function RemoveStatusMenu( MenuGroup )
    +   local MenuGroupName = MenuGroup:GetName()
    +   MenuStatus[MenuGroupName]:Remove()
    + end
    +
    + --- @param Wrapper.Group#GROUP MenuGroup
    + local function AddStatusMenu( MenuGroup )
    +   local MenuGroupName = MenuGroup:GetName()
    +   -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
    +   MenuStatus[MenuGroupName] = MENU_GROUP:New( MenuGroup, "Status for Planes" )
    +   MENU_GROUP_COMMAND:New( MenuGroup, "Show Status", MenuStatus[MenuGroupName], ShowStatus, MenuGroup, "Status of planes is ok!", "Message to Red Coalition" )
    + end
    +
    + SCHEDULER:New( nil,
    +   function()
    +     local PlaneGroup = GROUP:FindByName( "Plane 1" )
    +     if PlaneGroup and PlaneGroup:IsAlive() then
    +       local MenuManage = MENU_GROUP:New( PlaneGroup, "Manage Menus" )
    +       MENU_GROUP_COMMAND:New( PlaneGroup, "Add Status Menu Plane 1", MenuManage, AddStatusMenu, PlaneGroup )
    +       MENU_GROUP_COMMAND:New( PlaneGroup, "Remove Status Menu Plane 1", MenuManage, RemoveStatusMenu, PlaneGroup )
    +     end
    +   end, {}, 10, 10 )
    +
    + SCHEDULER:New( nil,
    +   function()
    +     local PlaneGroup = GROUP:FindByName( "Plane 2" )
    +     if PlaneGroup and PlaneGroup:IsAlive() then
    +       local MenuManage = MENU_GROUP:New( PlaneGroup, "Manage Menus" )
    +       MENU_GROUP_COMMAND:New( PlaneGroup, "Add Status Menu Plane 2", MenuManage, AddStatusMenu, PlaneGroup )
    +       MENU_GROUP_COMMAND:New( PlaneGroup, "Remove Status Menu Plane 2", MenuManage, RemoveStatusMenu, PlaneGroup )
    +     end
    +   end, {}, 10, 10 )
    +
    @@ -751,6 +794,13 @@ Using this object reference, you can then remove ALL the menus and submenus unde
    +

    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.

    @@ -765,7 +815,13 @@ Using this object reference, you can then remove ALL the menus and submenus unde
    +

    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.

    @@ -779,6 +835,13 @@ Using this object reference, you can then remove ALL the menus and submenus unde
    +

    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.

    @@ -786,24 +849,7 @@ Using this object reference, you can then remove ALL the menus and submenus unde

    Type Menu

    Type MENU_BASE

    - -

    The MENU_BASE class

    - -

    Field(s)

    -
    -
    - - #string - -MENU_BASE.ClassName - -
    -
    - - - -
    -
    +

    Field(s)

    @@ -829,32 +875,6 @@ The text of the child menu.

    #MENU_BASE:

    - -
    -
    -
    - - -MENU_BASE.MenuParentPath - -
    -
    - - - -
    -
    -
    -
    - - -MENU_BASE.MenuPath - -
    -
    - - -
    @@ -869,20 +889,6 @@ The text of the child menu.

    - -
    -
    -
    - - #string - -MENU_BASE.MenuText - -
    -
    - - -
    @@ -1002,74 +1008,10 @@ If true, the parent menu is automatically removed when this menu is the last chi

    Creates a new radio command item for a coalition, which can invoke a function with parameters.

    -

    Usage:

    -
     -- This demo creates a menu structure for the two clients of planes.
    - -- Each client will receive a different menu structure.
    - -- To test, join the planes, then look at the other radio menus (Option F10).
    - -- Then switch planes and check if the menu is still there.
    - -- And play with the Add and Remove menu options.
    - 
    - -- Note that in multi player, this will only work after the DCS clients bug is solved.
    -
    - local function ShowStatus( PlaneClient, StatusText, Coalition )
    -
    -   MESSAGE:New( Coalition, 15 ):ToRed()
    -   PlaneClient:Message( StatusText, 15 )
    - end
    -
    - local MenuStatus = {}
    -
    - local function RemoveStatusMenu( MenuClient )
    -   local MenuClientName = MenuClient:GetName()
    -   MenuStatus[MenuClientName]:Remove()
    - end
    -
    - --- @param Wrapper.Client#CLIENT MenuClient
    - local function AddStatusMenu( MenuClient )
    -   local MenuClientName = MenuClient:GetName()
    -   -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
    -   MenuStatus[MenuClientName] = MENU_CLIENT:New( MenuClient, "Status for Planes" )
    -   MENU_CLIENT_COMMAND:New( MenuClient, "Show Status", MenuStatus[MenuClientName], ShowStatus, MenuClient, "Status of planes is ok!", "Message to Red Coalition" )
    - end
    -
    - SCHEDULER:New( nil,
    -   function()
    -     local PlaneClient = CLIENT:FindByName( "Plane 1" )
    -     if PlaneClient and PlaneClient:IsAlive() then
    -       local MenuManage = MENU_CLIENT:New( PlaneClient, "Manage Menus" )
    -       MENU_CLIENT_COMMAND:New( PlaneClient, "Add Status Menu Plane 1", MenuManage, AddStatusMenu, PlaneClient )
    -       MENU_CLIENT_COMMAND:New( PlaneClient, "Remove Status Menu Plane 1", MenuManage, RemoveStatusMenu, PlaneClient )
    -     end
    -   end, {}, 10, 10 )
    -
    - SCHEDULER:New( nil,
    -   function()
    -     local PlaneClient = CLIENT:FindByName( "Plane 2" )
    -     if PlaneClient and PlaneClient:IsAlive() then
    -       local MenuManage = MENU_CLIENT:New( PlaneClient, "Manage Menus" )
    -       MENU_CLIENT_COMMAND:New( PlaneClient, "Add Status Menu Plane 2", MenuManage, AddStatusMenu, PlaneClient )
    -       MENU_CLIENT_COMMAND:New( PlaneClient, "Remove Status Menu Plane 2", MenuManage, RemoveStatusMenu, PlaneClient )
    -     end
    -   end, {}, 10, 10 )
    -

    Field(s)

    - #string - -MENU_CLIENT.ClassName - -
    -
    - - - -
    -
    -
    -
    - MENU_CLIENT:New(Client, MenuText, ParentMenu) @@ -1147,24 +1089,7 @@ self

    Type MENU_CLIENT_COMMAND

    - -

    The MENUCLIENTCOMMAND class

    - -

    Field(s)

    -
    -
    - - #string - -MENU_CLIENT_COMMAND.ClassName - -
    -
    - - - -
    -
    +

    Field(s)

    @@ -1238,61 +1163,7 @@ self

    Type MENU_COALITION

    - -

    The MENU_COALITION class

    - -

    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).
    - -- Then switch planes and check if the menu is still there.
    -
    - local Plane1 = CLIENT:FindByName( "Plane 1" )
    - local Plane2 = CLIENT:FindByName( "Plane 2" )
    -
    -
    - -- This would create a menu for the red coalition under the main DCS "Others" menu.
    - local MenuCoalitionRed = MENU_COALITION:New( coalition.side.RED, "Manage Menus" )
    -
    -
    - local function ShowStatus( StatusText, Coalition )
    -
    -   MESSAGE:New( Coalition, 15 ):ToRed()
    -   Plane1:Message( StatusText, 15 )
    -   Plane2:Message( StatusText, 15 )
    - end
    -
    - local MenuStatus -- Menu#MENU_COALITION
    - local MenuStatusShow -- Menu#MENU_COALITION_COMMAND
    -
    - local function RemoveStatusMenu()
    -   MenuStatus:Remove()
    - end
    -
    - local function AddStatusMenu()
    -   
    -   -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
    -   MenuStatus = MENU_COALITION:New( coalition.side.RED, "Status for Planes" )
    -   MenuStatusShow = MENU_COALITION_COMMAND:New( coalition.side.RED, "Show Status", MenuStatus, ShowStatus, "Status of planes is ok!", "Message to Red Coalition" )
    - end
    -
    - 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(s)

    -
    -
    - - #string - -MENU_COALITION.ClassName - -
    -
    - - - -
    -
    +

    Field(s)

    @@ -1376,24 +1247,7 @@ self

    Type MENU_COALITION_COMMAND

    - -

    The MENUCOALITIONCOMMAND class

    - -

    Field(s)

    -
    -
    - - #string - -MENU_COALITION_COMMAND.ClassName - -
    -
    - - - -
    -
    +

    Field(s)

    @@ -1473,50 +1327,7 @@ An argument for the function. There can only be ONE argument given. So multiple

    Type MENU_COMMAND_BASE

    - -

    The MENUCOMMANDBASE class

    - -

    Field(s)

    -
    -
    - - #string - -MENU_COMMAND_BASE.ClassName - -
    -
    - - - -
    -
    -
    -
    - - -MENU_COMMAND_BASE.CommandMenuArgument - -
    -
    - - - -
    -
    -
    -
    - - -MENU_COMMAND_BASE.CommandMenuFunction - -
    -
    - - - -
    -
    +

    Field(s)

    @@ -1585,75 +1396,7 @@ ENUCOMMANDBASE

    Type MENU_GROUP

    - -

    The MENU_GROUP class

    - -

    Usage:

    -
     -- This demo creates a menu structure for the two groups of planes.
    - -- Each group will receive a different menu structure.
    - -- To test, join the planes, then look at the other radio menus (Option F10).
    - -- Then switch planes and check if the menu is still there.
    - -- And play with the Add and Remove menu options.
    - 
    - -- Note that in multi player, this will only work after the DCS groups bug is solved.
    -
    - local function ShowStatus( PlaneGroup, StatusText, Coalition )
    -
    -   MESSAGE:New( Coalition, 15 ):ToRed()
    -   PlaneGroup:Message( StatusText, 15 )
    - end
    -
    - local MenuStatus = {}
    -
    - local function RemoveStatusMenu( MenuGroup )
    -   local MenuGroupName = MenuGroup:GetName()
    -   MenuStatus[MenuGroupName]:Remove()
    - end
    -
    - --- @param Wrapper.Group#GROUP MenuGroup
    - local function AddStatusMenu( MenuGroup )
    -   local MenuGroupName = MenuGroup:GetName()
    -   -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
    -   MenuStatus[MenuGroupName] = MENU_GROUP:New( MenuGroup, "Status for Planes" )
    -   MENU_GROUP_COMMAND:New( MenuGroup, "Show Status", MenuStatus[MenuGroupName], ShowStatus, MenuGroup, "Status of planes is ok!", "Message to Red Coalition" )
    - end
    -
    - SCHEDULER:New( nil,
    -   function()
    -     local PlaneGroup = GROUP:FindByName( "Plane 1" )
    -     if PlaneGroup and PlaneGroup:IsAlive() then
    -       local MenuManage = MENU_GROUP:New( PlaneGroup, "Manage Menus" )
    -       MENU_GROUP_COMMAND:New( PlaneGroup, "Add Status Menu Plane 1", MenuManage, AddStatusMenu, PlaneGroup )
    -       MENU_GROUP_COMMAND:New( PlaneGroup, "Remove Status Menu Plane 1", MenuManage, RemoveStatusMenu, PlaneGroup )
    -     end
    -   end, {}, 10, 10 )
    -
    - SCHEDULER:New( nil,
    -   function()
    -     local PlaneGroup = GROUP:FindByName( "Plane 2" )
    -     if PlaneGroup and PlaneGroup:IsAlive() then
    -       local MenuManage = MENU_GROUP:New( PlaneGroup, "Manage Menus" )
    -       MENU_GROUP_COMMAND:New( PlaneGroup, "Add Status Menu Plane 2", MenuManage, AddStatusMenu, PlaneGroup )
    -       MENU_GROUP_COMMAND:New( PlaneGroup, "Remove Status Menu Plane 2", MenuManage, RemoveStatusMenu, PlaneGroup )
    -     end
    -   end, {}, 10, 10 )
    -
    - -

    Field(s)

    -
    -
    - - #string - -MENU_GROUP.ClassName - -
    -
    - - - -
    -
    +

    Field(s)

    @@ -1834,24 +1577,7 @@ self

    Type MENU_GROUP_COMMAND

    - -

    The MENUGROUPCOMMAND class

    - -

    Field(s)

    -
    -
    - - #string - -MENU_GROUP_COMMAND.ClassName - -
    -
    - - - -
    -
    +

    Field(s)

    @@ -2020,24 +1746,7 @@ An argument for the function.

    Type MENU_MISSION

    - -

    The MENU_MISSION class

    - -

    Field(s)

    -
    -
    - - #string - -MENU_MISSION.ClassName - -
    -
    - - - -
    -
    +

    Field(s)

    @@ -2115,24 +1824,7 @@ The parent menu. This parameter can be ignored if you want the menu to be locate

    Type MENU_MISSION_COMMAND

    - -

    The MENUMISSIONCOMMAND class

    - -

    Field(s)

    -
    -
    - - #string - -MENU_MISSION_COMMAND.ClassName - -
    -
    - - - -
    -
    +

    Field(s)

    diff --git a/docs/Documentation/Message.html b/docs/Documentation/Message.html index 355d0c6ab..e1f02c94e 100644 --- a/docs/Documentation/Message.html +++ b/docs/Documentation/Message.html @@ -101,71 +101,21 @@
    -

    1) Message#MESSAGE class, extends Base#BASE

    - -

    Message System to display Messages to Clients, Coalitions or All. -Messages are shown on the display panel for an amount of seconds, and will then disappear. -Messages can contain a category which is indicating the category of the message.

    - -

    1.1) 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

    - -

    Messages are sent:

    - - - -

    1.3) Send conditionally to an audience

    - -

    Messages can be sent conditionally to an audience (when a condition is true):

    - - - -

    Global(s)

    MESSAGE +

    MESSAGE class, extends Base#BASE

    +

    Message System to display Messages to Clients, Coalitions or All.

    Type 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):

    + +
    @@ -246,48 +230,6 @@ To send messages, you need to use the To functions.

    - #string - -MESSAGE.ClassName - -
    -
    - - - -
    -
    -
    -
    - - #number - -MESSAGE.MessageCategory - -
    -
    - - - -
    -
    -
    -
    - - #number - -MESSAGE.MessageID - -
    -
    - - - -
    -
    -
    -
    - MESSAGE:New(MessageText, MessageDuration, MessageCategory) diff --git a/docs/Documentation/Movement.html b/docs/Documentation/Movement.html index d3966610d..1a64cbb26 100644 --- a/docs/Documentation/Movement.html +++ b/docs/Documentation/Movement.html @@ -211,6 +211,7 @@ on defined intervals (currently every minute).

    + #number MOVEMENT.AliveUnits @@ -219,6 +220,9 @@ on defined intervals (currently every minute).

    + +

    Contains the counter how many units are currently alive

    +
    diff --git a/docs/Documentation/Point.html b/docs/Documentation/Point.html index b321acabb..2243bb9cc 100644 --- a/docs/Documentation/Point.html +++ b/docs/Documentation/Point.html @@ -97,103 +97,23 @@ -

    1) Point#POINT_VEC3 class, extends Base#BASE

    -

    The Point#POINT_VEC3 class defines a 3D point in the simulator.

    +

    Banner Image

    -

    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

    -
     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

    - - - -

    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:

    - -
     local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
    -
    +

    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.

    @@ -266,12 +190,6 @@ Note that the Set and Add methods return the current POINT_VEC2 object, so these
    POINT_VEC2:AddY(y)

    Add to the y coordinate of the POINT_VEC2.

    -
    POINT_VEC2.ClassName -
    POINT_VEC3:AddZ(z)

    Add to the z coordinate of the POINT_VEC3.

    -
    POINT_VEC3.ClassName -
    POINT_VEC3:GetBRText(TargetPointVec3)POINT_VEC3:GetAngleDegrees(DirectionVec3) -

    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.

    POINT_VEC3:GetDirectionRadians(DirectionVec3)POINT_VEC3:GetAngleRadians(DirectionVec3) -

    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.

    +
    POINT_VEC3:GetBRText(TargetPointVec3) +

    Return a BR string from a POINTVEC3 to the POINTVEC3.

    SCHEDULER +

    SCHEDULER class, extends Base#BASE

    +

    The SCHEDULER class creates schedule.

    Type SCHEDULER

    - - - - - - - - @@ -236,6 +217,169 @@
    +

    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. +
    3. The first schedule planned in the SCHEDULER object.
    4. +
    + +

    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.

    @@ -250,20 +394,6 @@
    - #string - -SCHEDULER.ClassName - -
    -
    - - - -
    -
    -
    -
    - SCHEDULER:Clear() @@ -461,20 +591,6 @@ The ScheduleID of the planned schedule.

    - -
    -
    -
    - - - -SCHEDULER.Schedules - -
    -
    - - -
    diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html index b82a161cb..a495d0c0c 100644 --- a/docs/Documentation/Spawn.html +++ b/docs/Documentation/Spawn.html @@ -810,6 +810,12 @@ and any spaces before and after the resulting name are removed.

    + + + +
    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 +
    @@ -2111,9 +2117,6 @@ The group that was spawned. You can use this group for further actions.

    - -

    Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.

    -
    @@ -2567,9 +2570,6 @@ when nothing was spawned.

    - -

    Overwrite unit names by default with group name.

    -
    @@ -2967,7 +2967,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
    - #boolean + SPAWN.SpawnUnControlled @@ -2991,7 +2991,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 ) -

    Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.

    +

    When the first Spawn executes, all the Groups need to be made visible before start.

    @@ -3557,6 +3557,20 @@ True = Continue Scheduler

    + +
    +
    +
    + + + +SPAWN.uncontrolled + +
    +
    + + +
    diff --git a/docs/Documentation/Task.html b/docs/Documentation/Task.html index edde8df5d..04fcba929 100644 --- a/docs/Documentation/Task.html +++ b/docs/Documentation/Task.html @@ -1452,7 +1452,7 @@ self

    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.

    TASK_CARGO.DeployZones +
    TASK_CARGO:GetCargoSet() + +
    TASK_CARGO:GetDeployZones() +
    TASK_CARGO_TRANSPORT.ClassName +
    TASK_CARGO_TRANSPORT:IsAllCargoTransported() +
    ZONE_GROUP:New(ZoneName, ZoneGROUP, Radius)

    Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Group#GROUP and a radius.

    -
    ZONE_GROUP.ZoneGROUP -
    @@ -488,12 +482,6 @@
    ZONE_POLYGON_BASE:New(ZoneName, PointsArray)

    Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of DCSTypes#Vec2, forming a polygon.

    -
    ZONE_POLYGON_BASE.Polygon -

    The polygon defined by an array of DCSTypes#Vec2.