Compare commits

...

45 Commits
2.4.0 ... 2.4.2

Author SHA1 Message Date
FlightControl
cad1c8c462 Merge branch 'develop' 2018-10-12 21:11:32 +02:00
FlightControl
19e2af08e0 increased the altitude of hover. 2018-10-12 21:10:58 +02:00
FlightControl
4386b19b06 Merge branch 'develop' 2018-10-12 20:20:16 +02:00
FlightControl
da90826bd0 Fix height problem in workaround solution. 2018-10-12 20:15:10 +02:00
FlightControl
514d9f3eb3 Implemented workaround request to board and unboard cargo from buildings. Now "InAir" means a velocity < 1 m/s and a height < 30 m. Once DCS properly fixes the flag to land on buildings, this workaround can be removed. 2018-10-12 07:17:56 +02:00
FlightControl
690805d7ca Implemented workaround request to board and unboard cargo from buildings. Now "InAir" means a velocity < 1 m/s and a height < 30 m. Once DCS properly fixes the flag to land on buildings, this workaround can be removed. 2018-10-12 07:14:05 +02:00
FlightControl
f1f37b6598 Merge branch 'develop' 2018-10-11 19:18:01 +02:00
FlightControl
08c593578f Fixing issues with cargo loading for helos and apcs when the near range was too small... 2018-10-11 19:17:33 +02:00
FlightControl
6625de9005 Some optimizations for group. 2018-10-11 17:44:49 +02:00
FlightControl
804a356f13 Merge branch 'develop' 2018-10-09 20:13:32 +02:00
FlightControl
f03a2e3657 Revision of core classes documentation. 2018-10-09 19:30:57 +02:00
FlightControl
e6f51af34c Documentation 2018-10-09 09:47:22 +02:00
FlightControl
db85883026 Merge branch 'develop' 2018-10-08 06:43:30 +02:00
FlightControl
a3e29a8d5c Documentation 2018-10-08 06:05:44 +02:00
FlightControl
e5e9bc2ef7 docuemntation 2018-10-08 06:01:49 +02:00
FlightControl
41aee35b5d Documentation 2018-10-08 05:56:14 +02:00
FlightControl
7081a9eff5 ATC ground updates 2018-10-08 05:42:18 +02:00
FlightControl
be839f3a3b Fixing late activated HQs for command centers. 2018-10-08 04:57:53 +02:00
FlightControl
f35b27451f Update CargoGroup.lua 2018-10-07 18:46:19 +02:00
Frank
016e59860f Merge pull request #1022 from FlightControl-Master/FF/Develop
Warehouse v0.6.1
2018-10-07 16:58:28 +02:00
Frank
d9719923c1 Warehouse v0.6.1
- Added spawn zone max distance as optional parameter to SetSpawnZone function.
- Added optional RefCoord parameter to FindNearestWarehouse function.
2018-10-07 16:54:26 +02:00
Frank
15a6c5f6a8 Merge pull request #1021 from FlightControl-Master/FF/Develop
Warehouse v0.6.0
2018-10-07 16:13:45 +02:00
Frank
88d4580f9e Warehouse v0.6.0
- Added user function to find nearest warehouse.
- Fixed bug in GetNumberOfAssets function.
2018-10-07 16:11:34 +02:00
Frank
87d82aa674 Merge pull request #1019 from FlightControl-Master/FF/Develop
Warehouse v0.5.9
2018-10-07 00:21:52 +02:00
Frank
d58c7f8fab Warehouse v0.5.9
* Fixed bug for distance to spawn zone.
* Fixed bug when carriers get killed.
* Added example for supply chains to docs.
* Added option to specify skll and livery when adding assets.
* Added option for specifying assignments when adding assets.
2018-10-07 00:18:32 +02:00
FlightControl
8d30dfacd5 Merge branch 'develop' 2018-10-06 07:56:40 +02:00
Frank
7340b0aad3 Merge pull request #1015 from FlightControl-Master/FF/Develop
Warehouse v0.5.8
2018-10-05 23:11:07 +02:00
Frank
03fd8c93eb Merge branch 'develop' into FF/Develop 2018-10-05 22:45:54 +02:00
Frank
f727aa0a17 Revert "Merge branch 'master' into FF/Develop"
This reverts commit 502c356784, reversing
changes made to 0e7291a912.
2018-10-05 22:44:19 +02:00
Frank
502c356784 Merge branch 'master' into FF/Develop 2018-10-05 22:44:07 +02:00
Frank
0e7291a912 WAREHOUSE v0.5.8
Fixed bug with dist to spawn zone.
2018-10-05 22:43:31 +02:00
funkyfranky
2dc14097b8 SPOT parameters and docu 2018-10-05 15:34:04 +02:00
Frank
9655d60bf8 Merge pull request #1014 from FlightControl-Master/FF/Develop
Warehouse v0.5.7
2018-10-05 01:50:40 +02:00
Frank
cc920682fd Merge branch 'develop' into FF/Develop 2018-10-05 01:47:28 +02:00
Frank
205f69b3ab Warehouse v0.5.7
- Added check if spawn zones are on land
- Removed check that ground units cannot go to ships
- Added check that spawn zone is 5 km from warehouse (needs to be revised).

Coordinate:
- added surface type checks api functions
2018-10-05 01:47:10 +02:00
FlightControl
c4376f081b Pushing a fix for shadowze 2018-10-04 21:37:19 +02:00
FlightControl
1ae062dc6e Fixed in CLEANUP
- Scan initial units within the subscribed airbases.
- Scan if at a birth the unit is within an airbase.
- Scan upon checking if the units are within the airbases.
2018-10-04 21:28:45 +02:00
funkyfranky
ea3bae39cc Warehouse v0.5.6w 2018-10-04 16:28:18 +02:00
FlightControl
0bb62ce43f Merge pull request #1012 from FlightControl-Master/FF/Develop
Warehouse v0.5.6
2018-10-03 21:57:46 +02:00
Frank
a4595090c4 Warehouse v0.5.6
- Neutral warehouses can be captured
- Added example 16 for resupply
2018-10-03 21:41:33 +02:00
FlightControl
9df3f52fd5 Warehouse 2018-10-02 21:42:16 +02:00
FlightControl
6f37ff1831 remove old release notes 2018-10-02 19:37:33 +02:00
funkyfranky
cba7bec477 WH and ARTY 2018-10-02 15:27:46 +02:00
Frank
e990db8070 Merge branch 'develop' into FF/Develop 2018-10-01 22:20:31 +02:00
funkyfranky
f8404f336d Arty v1.0.6 2018-10-01 16:24:13 +02:00
42 changed files with 1784 additions and 816 deletions

View File

@@ -872,7 +872,7 @@ do -- CARGO
--self:F( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
--self:F( { PointVec2 = PointVec2:GetVec2() } )
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
--self:F( Distance )
--self:F( { Distance = Distance, NearRadius = NearRadius or "nil" } )
if Distance <= NearRadius then
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )

View File

@@ -51,7 +51,7 @@ do -- CARGO_GROUP
-- @param #CARGO_GROUP self
-- @param Wrapper.Group#GROUP CargoGroup Group to be transported as cargo.
-- @param #string Type Cargo type, e.g. "Infantry". This is the type used in SET_CARGO:New():FilterTypes("Infantry") to define the valid cargo groups of the set.
-- @param #string Name Some user defined name of the cargo group.
-- @param #string Name A user defined name of the cargo group. This name CAN be the same as the group object but can also have a different name. This name MUST be unique!
-- @param #number LoadRadius (optional) Distance in meters until which a cargo is loaded into the carrier. Cargo outside this radius has to be routed by other means to within the radius to be loaded.
-- @param #number NearRadius (optional) Once the units are within this radius of the carrier, they are actually loaded, i.e. disappear from the scene.
-- @return #CARGO_GROUP Cargo group object.

View File

@@ -248,7 +248,7 @@ do -- CARGO_UNIT
local Speed = 90
local Angle = 180
local Distance = 5
local Distance = 0
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
@@ -297,14 +297,14 @@ do -- CARGO_UNIT
self:__Boarding( -1, CargoCarrier, NearRadius, ... )
self.RunCount = self.RunCount + 1
else
self:__Boarding( -5, CargoCarrier, NearRadius, ... )
self.RunCount = self.RunCount + 5
self:__Boarding( -2, CargoCarrier, NearRadius, ... )
self.RunCount = self.RunCount + 2
end
if self.RunCount >= 40 then
self.RunCount = 0
local Speed = 90
local Angle = 180
local Distance = 5
local Distance = 0
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.

View File

@@ -1,4 +1,22 @@
--- **Core** -- BASE forms **the basis of the MOOSE framework**. Each class within the MOOSE framework derives from BASE.
--- **Core** - The base class within the framework.
--
-- ===
--
-- ## Features:
--
-- * The construction and inheritance of MOOSE classes.
-- * The class naming and numbering system.
-- * The class hierarchy search system.
-- * The tracing of information or objects during mission execution for debuggin purposes.
-- * The subscription to DCS events for event handling in MOOSE objects.
-- * Object inspection.
--
-- ===
--
-- All classes within the MOOSE framework are derived from the BASE class.
-- Note: The BASE class is an abstract class and is not meant to be used directly.
--
-- ===
--
-- ### Author: **FlightControl**
-- ### Contributions:
@@ -23,24 +41,14 @@ local _ClassID = 0
-- @field ClassID The ID number of the class.
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
--- All classes within the MOOSE framework are derived from the BASE class.
--- BASE class
--
-- BASE provides facilities for :
--
-- * The construction and inheritance of MOOSE classes.
-- * The class naming and numbering system.
-- * The class hierarchy search system.
-- * The tracing of information or objects during mission execution for debuggin purposes.
-- * The subscription to DCS events for event handling in MOOSE objects.
--
-- Note: The BASE class is an abstract class and is not meant to be used directly.
--
-- ## 1.1) BASE constructor
-- # 1. BASE constructor.
--
-- Any class derived from BASE, will use the @{Core.Base#BASE.New} constructor embedded in the @{Core.Base#BASE.Inherit} method.
-- See an example at the @{Core.Base#BASE.New} method how this is done.
--
-- ## 1.2) Trace information for debugging
-- # 2. Trace information for debugging.
--
-- The BASE class contains trace methods to trace progress within a mission execution of a certain object.
-- These trace methods are inherited by each MOOSE class interiting BASE, soeach object created from derived class from BASE can use the tracing methods to trace its execution.
@@ -71,7 +79,7 @@ local _ClassID = 0
--
-- Below a more detailed explanation of the different method types for tracing.
--
-- ### 1.2.1) Tracing methods categories
-- ## 2.1. Tracing methods categories.
--
-- There are basically 3 types of tracing methods available:
--
@@ -79,7 +87,7 @@ local _ClassID = 0
-- * @{#BASE.T}: Used to trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.
-- * @{#BASE.E}: Used to always trace information giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file.
--
-- ### 1.2.2) Tracing levels
-- ## 2.2 Tracing levels.
--
-- There are 3 tracing levels within MOOSE.
-- These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects.
@@ -91,7 +99,7 @@ local _ClassID = 0
-- * @{#BASE.T2}: Trace further logic within a function giving optional variables or parameters with tracing level 2.
-- * @{#BASE.T3}: Trace further logic within a function giving optional variables or parameters with tracing level 3.
--
-- ### 1.2.3) Trace activation.
-- ## 2.3. Trace activation.
--
-- Tracing can be activated in several ways:
--
@@ -101,16 +109,17 @@ local _ClassID = 0
-- * Activate only the tracing of a certain method of a certain class through the @{#BASE.TraceClassMethod}() method.
-- * Activate only the tracing of a certain level through the @{#BASE.TraceLevel}() method.
--
-- ### 1.2.4) Check if tracing is on.
-- ## 2.4. Check if tracing is on.
--
-- The method @{#BASE.IsTrace}() will validate if tracing is activated or not.
--
-- ## 1.3 DCS simulator Event Handling
--
-- # 3. DCS simulator Event Handling.
--
-- The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator,
-- and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently.
--
-- ### 1.3.1 Subscribe / Unsubscribe to DCS Events
-- ## 3.1. Subscribe / Unsubscribe to DCS Events.
--
-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
-- So, when the DCS event occurs, the class will be notified of that event.
@@ -119,7 +128,7 @@ local _ClassID = 0
-- * @{#BASE.HandleEvent}(): Subscribe to a DCS Event.
-- * @{#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
--
-- ### 1.3.2 Event Handling of DCS Events
-- ## 3.2. Event Handling of DCS Events.
--
-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
-- when the DCS event occurs. The Event Handling method receives an @{Core.Event#EVENTDATA} structure, which contains a lot of information
@@ -154,7 +163,7 @@ local _ClassID = 0
--
-- See the @{Event} module for more information about event handling.
--
-- ## 1.4) Class identification methods
-- # 4. Class identification methods.
--
-- BASE provides methods to get more information of each object:
--
@@ -162,7 +171,7 @@ local _ClassID = 0
-- * @{#BASE.GetClassName}(): Gets the name of the object, which is the name of the class the object was instantiated from.
-- * @{#BASE.GetClassNameAndID}(): Gets the name and ID of the object.
--
-- ## 1.5) All objects derived from BASE can have "States"
-- # 5. All objects derived from BASE can have "States".
--
-- A mechanism is in place in MOOSE, that allows to let the objects administer **states**.
-- States are essentially properties of objects, which are identified by a **Key** and a **Value**.
@@ -177,7 +186,7 @@ local _ClassID = 0
-- Thus, if the state is to be set for the same object as the object for which the method is used, then provide the same
-- object name to the method.
--
-- ## 1.10) Inheritance
-- # 6. Inheritance.
--
-- The following methods are available to implement inheritance
--
@@ -186,8 +195,7 @@ local _ClassID = 0
--
-- ===
--
-- @field #BASE BASE
--
-- @field #BASE
BASE = {
ClassName = "BASE",
ClassID = 0,

View File

@@ -1,4 +1,25 @@
--- **Core** -- DATABASE manages the database of mission objects.
--- **Core** - Manages several databases containing templates, mission objects, and mission information.
--
-- ===
--
-- ## Features:
--
-- * During mission startup, scan the mission environment, and create / instantiate intelligently the different objects as defined within the mission.
-- * Manage database of DCS Group templates (as modelled using the mission editor).
-- - Group templates.
-- - Unit templates.
-- - Statics templates.
-- * Manage database of @{Wrapper.Group#GROUP} objects alive in the mission.
-- * Manage database of @{Wrapper.Unit#UNIT} objects alive in the mission.
-- * Manage database of @{Wrapper.Static#STATIC} objects alive in the mission.
-- * Manage database of players.
-- * Manage database of client slots defined using the mission editor.
-- * Manage database of airbases on the map, and from FARPs and ships as defined using the mission editor.
-- * Manage database of countries.
-- * Manage database of zone names.
-- * Manage database of hits to units and statics.
-- * Manage database of destroys of units and statics.
-- * Manage database of @{Core.Zone#ZONE_BASE} objects.
--
-- ===
--

View File

@@ -1,8 +1,15 @@
--- **Core** -- EVENT models DCS **event dispatching** using a **publish-subscribe** model.
--- **Core** - Models DCS event dispatching using a publish-subscribe model.
--
-- ===
--
-- # 1) Event Handling Overview
-- ## Features:
--
-- * Capture DCS events and dispatch them to the subscribed objects.
-- * Generate DCS events to the subscribed objects from within the code.
--
-- ===
--
-- # Event Handling Overview
--
-- ![Objects](..\Presentations\EVENT\Dia2.JPG)
--
@@ -14,7 +21,7 @@
-- Objects can subscribe to different events. The Event dispatcher will publish the received DCS events to the subscribed MOOSE objects, in a specified order.
-- In this way, the subscribed MOOSE objects are kept in sync with your evolving running mission.
--
-- ## 1.1) Event Dispatching
-- ## 1. Event Dispatching
--
-- ![Objects](..\Presentations\EVENT\Dia4.JPG)
--
@@ -41,7 +48,7 @@
--
-- But for some DCS events, the publishing order is reversed. This is due to the fact that objects need to be **erased** instead of added.
--
-- ## 1.2) Event Handling
-- # 2. Event Handling
--
-- ![Objects](..\Presentations\EVENT\Dia8.JPG)
--
@@ -53,7 +60,7 @@
-- The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator,
-- and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently.
--
-- ### 1.2.1 Subscribe / Unsubscribe to DCS Events
-- ## 2.1. Subscribe to / Unsubscribe from DCS Events.
--
-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
-- So, when the DCS event occurs, the class will be notified of that event.
@@ -69,7 +76,7 @@
-- So if a UNIT within the mission has the subscribed event for that object,
-- then the object event handler will receive the event for that UNIT!
--
-- ### 1.3.2 Event Handling of DCS Events
-- ## 2.2 Event Handling of DCS Events
--
-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
-- when the DCS event occurs. The Event Handling method receives an @{Core.Event#EVENTDATA} structure, which contains a lot of information
@@ -100,19 +107,19 @@
-- self:SmokeBlue()
-- end
--
-- ### 1.3.3 Event Handling methods that are automatically called upon subscribed DCS events
-- ## 2.3 Event Handling methods that are automatically called upon subscribed DCS events.
--
-- ![Objects](..\Presentations\EVENT\Dia10.JPG)
--
-- The following list outlines which EVENTS item in the structure corresponds to which Event Handling method.
-- Always ensure that your event handling methods align with the events being subscribed to, or nothing will be executed.
--
-- # 2) EVENTS type
-- # 3. EVENTS type
--
-- The EVENTS structure contains names for all the different DCS events that objects can subscribe to using the
-- @{Core.Base#BASE.HandleEvent}() method.
--
-- # 3) EVENTDATA type
-- # 4. EVENTDATA type
--
-- The @{Core.Event#EVENTDATA} structure contains all the fields that are populated with event information before
-- an Event Handler method is being called by the event dispatcher.
@@ -166,11 +173,12 @@
-- @image Core_Event.JPG
--- The EVENT structure
--
-- @type EVENT
--- @type EVENT
-- @field #EVENT.Events Events
-- @extends Core.Base#BASE
--- The EVENT class
-- @field #EVENT
EVENT = {
ClassName = "EVENT",
ClassID = 0,

View File

@@ -1,5 +1,18 @@
--- **Core** -- The **FSM** (**F**inite **S**tate **M**achine) class and derived **FSM\_** classes
-- are design patterns allowing efficient (long-lasting) processes and workflows.
--- **Core** - FSM (Finite State Machine) are objects that model and control long lasting business processes and workflow.
--
-- ===
--
-- ## Features:
--
-- * Provide a base class to model your own state machines.
-- * Trigger events synchronously.
-- * Trigger events asynchronously.
-- * Handle events before or after the event was triggered.
-- * Handle state transitions as a result of event before and after the state change.
-- * For internal moose purposes, further state machines have been designed:
-- - to handle controllables (groups and units).
-- - to handle tasks.
-- - to handle processes.
--
-- ===
--

View File

@@ -1,8 +1,16 @@
--- **Core (WIP)** -- Base class to allow the modeling of processes to achieve Goals.
--- **Core** - Models the process to achieve goal(s).
--
-- ===
--
-- GOAL models processes that have an objective with a defined achievement. Derived classes implement the ways how the achievements can be realized.
-- ## Features:
--
-- * Define the goal.
-- * Monitor the goal achievement.
-- * Manage goal contribution by players.
--
-- ===
--
-- Classes that implement a goal achievement, will derive from GOAL to implement the ways how the achievements can be realized.
--
-- ===
--
@@ -13,6 +21,7 @@
-- @module Core.Goal
-- @image Core_Goal.JPG
do -- Goal
--- @type GOAL
@@ -21,21 +30,43 @@ do -- Goal
--- Models processes that have an objective with a defined achievement. Derived classes implement the ways how the achievements can be realized.
--
-- ## 1. GOAL constructor
-- # 1. GOAL constructor
--
-- * @{#GOAL.New}(): Creates a new GOAL object.
--
-- ## 2. GOAL is a finite state machine (FSM).
-- # 2. GOAL is a finite state machine (FSM).
--
-- ### 2.1 GOAL States
-- ## 2.1. GOAL States
--
-- * **Pending**: The goal object is in progress.
-- * **Achieved**: The goal objective is Achieved.
--
-- ### 2.2 GOAL Events
-- ## 2.2. GOAL Events
--
-- * **Achieved**: Set the goal objective to Achieved.
--
-- # 3. Player contributions.
--
-- Goals are most of the time achieved by players. These player achievements can be registered as part of the goal achievement.
-- Use @{#GOAL.AddPlayerContribution}() to add a player contribution to the goal.
-- The player contributions are based on a points system, an internal counter per player.
-- So once the goal has been achieved, the player contributions can be queried using @{#GOAL.GetPlayerContributions}(),
-- that retrieves all contributions done by the players. For one player, the contribution can be queried using @{#GOAL.GetPlayerContribution}().
-- The total amount of player contributions can be queried using @{#GOAL.GetTotalContributions}().
--
-- # 4. Goal achievement.
--
-- Once the goal is achieved, the mission designer will need to trigger the goal achievement using the **Achieved** event.
-- The underlying 2 examples will achieve the goals for the `Goal` object:
--
-- Goal:Achieved() -- Achieve the goal immediately.
-- Goal:__Achieved( 30 ) -- Achieve the goal within 30 seconds.
--
-- # 5. Check goal achievement.
--
-- The method @{#GOAL.IsAchieved}() will return true if the goal is achieved (the trigger **Achieved** was executed).
-- You can use this method to check asynchronously if a goal has been achieved, for example using a scheduler.
--
-- @field #GOAL
GOAL = {
ClassName = "GOAL",

View File

@@ -1,7 +1,27 @@
--- **Core** -- MENU_ classes model the definition of **hierarchical menu structures** and **commands for players** within a mission.
--- **Core** - Manage hierarchical menu structures and commands for players within a mission.
--
-- ===
--
-- ### Features:
--
-- * Setup mission sub menus.
-- * Setup mission command menus.
-- * Setup coalition sub menus.
-- * Setup coalition command menus.
-- * Setup group sub menus.
-- * Setup group command menus.
-- * Manage menu creation intelligently, avoid double menu creation.
-- * Only create or delete menus when required, and keep existing menus persistent.
-- * Update menu structures.
-- * Refresh menu structures intelligently, based on a time stamp of updates.
-- - Delete obscolete menus.
-- - Create new one where required.
-- - Don't touch the existing ones.
-- * Provide a variable amount of parameters to menus.
-- * Update the parameters and the receiving methods, without updating the menu within DCS!
-- * Provide a great performance boost in menu management.
-- * Provide a great tool to manage menus in your code.
--
-- DCS Menus can be managed using the MENU classes.
-- The advantage of using MENU classes is that it hides the complexity of dealing with menu management in more advanced scanerios where you need to
-- set menus and later remove them, and later set them again. You'll find while using use normal DCS scripting functions, that setting and removing
@@ -92,7 +112,7 @@ end
---
-- @param Wrapper.Group#GROUP Group
function MENU_INDEX:PrepareGroup( Group )
if Group and Group:IsAlive() then
if Group and Group:IsAlive() ~= nil then -- something was changed here!
local GroupName = Group:GetName()
self.Group[GroupName] = self.Group[GroupName] or {}
self.Group[GroupName].Menus = self.Group[GroupName].Menus or {}
@@ -146,6 +166,7 @@ end
function MENU_INDEX:SetGroupMenu( Group, Path, Menu )
local MenuGroupName = Group:GetName()
Group:F({MenuGroupName=MenuGroupName,Path=Path})
self.Group[MenuGroupName].Menus[Path] = Menu
end

View File

@@ -1,4 +1,15 @@
--- **Core** -- MESSAGE class takes are of the **real-time notifications** and **messages to players** during a simulation.
--- **Core** - Informs the players using messages during a simulation.
--
-- ===
--
-- ## Features:
--
-- * A more advanced messaging system using the DCS message system.
-- * Time messages.
-- * Send messages based on a message type, which has a pre-defined duration that can be tweaked in SETTINGS.
-- * Send message to all players.
-- * Send messages to a coalition.
-- * Send messages to a specific group.
--
-- ===
--

View File

@@ -1,6 +1,6 @@
--- **Core** -- Defines an **extensive API** to **manage 3D points** in the DCS World 3D simulation space.
--- **Core** - Defines an extensive API to manage 3D points in the DCS World 3D simulation space.
--
-- **Features:**
-- ## Features:
--
-- * Provides a COORDINATE class, which allows to manage points in 3D space and perform various operations on it.
-- * Provides a POINT\_VEC2 class, which is derived from COORDINATE, and allows to manage points in 3D space, but from a Lat/Lon and Altitude perspective.
@@ -1383,9 +1383,53 @@ do -- COORDINATE
return surface
end
--- Checks if the surface type is on land.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is land.
function COORDINATE:IsSurfaceTypeLand()
return self:GetSurfaceType()==land.SurfaceType.LAND
end
--- Checks if the surface type is road.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is land.
function COORDINATE:IsSurfaceTypeLand()
return self:GetSurfaceType()==land.SurfaceType.LAND
end
--- Checks if the surface type is road.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is a road.
function COORDINATE:IsSurfaceTypeRoad()
return self:GetSurfaceType()==land.SurfaceType.ROAD
end
--- Checks if the surface type is runway.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is a runway or taxi way.
function COORDINATE:IsSurfaceTypeRunway()
return self:GetSurfaceType()==land.SurfaceType.RUNWAY
end
--- Checks if the surface type is shallow water.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is a shallow water.
function COORDINATE:IsSurfaceTypeShallowWater()
return self:GetSurfaceType()==land.SurfaceType.SHALLOW_WATER
end
--- Checks if the surface type is water.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is a deep water.
function COORDINATE:IsSurfaceTypeWater()
return self:GetSurfaceType()==land.SurfaceType.WATER
end
--- Creates an explosion at the point of a certain intensity.
-- @param #COORDINATE self
-- @param #number ExplosionIntensity
-- @param #number ExplosionIntensity Intensity of the explosion in kg TNT.
function COORDINATE:Explosion( ExplosionIntensity )
self:F2( { ExplosionIntensity } )
trigger.action.explosion( self:GetVec3(), ExplosionIntensity )
@@ -1723,7 +1767,8 @@ do -- COORDINATE
--- Return a BR string from a COORDINATE to the COORDINATE.
-- @param #COORDINATE self
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The BR text.
function COORDINATE:ToStringBR( FromCoordinate, Settings )
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
@@ -1734,7 +1779,8 @@ do -- COORDINATE
--- Return a BRAA string from a COORDINATE to the COORDINATE.
-- @param #COORDINATE self
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The BR text.
function COORDINATE:ToStringBRA( FromCoordinate, Settings )
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
@@ -1747,6 +1793,7 @@ do -- COORDINATE
--- Return a BULLS string out of the BULLS of the coalition to the COORDINATE.
-- @param #COORDINATE self
-- @param DCS#coalition.side Coalition The coalition.
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The BR text.
function COORDINATE:ToStringBULLS( Coalition, Settings )
local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) )
@@ -1786,7 +1833,7 @@ do -- COORDINATE
--- Provides a Lat Lon string in Degree Minute Second format.
-- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) Settings
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The LL DMS Text
function COORDINATE:ToStringLLDMS( Settings )
@@ -1797,7 +1844,7 @@ do -- COORDINATE
--- Provides a Lat Lon string in Degree Decimal Minute format.
-- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) Settings
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The LL DDM Text
function COORDINATE:ToStringLLDDM( Settings )
@@ -1808,7 +1855,7 @@ do -- COORDINATE
--- Provides a MGRS string
-- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) Settings
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The MGRS Text
function COORDINATE:ToStringMGRS( Settings ) --R2.1 Fixes issue #424.
@@ -1822,10 +1869,12 @@ do -- COORDINATE
-- * Uses default settings in COORDINATE.
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self
-- @param #COORDINATE ReferenceCoord The refrence coordinate.
-- @param #string ReferenceName The refrence name.
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings ) -- R2.2
function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings )
self:F2( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } )
@@ -1852,9 +1901,9 @@ do -- COORDINATE
--- Provides a coordinate string of the point, based on the A2G coordinate format system.
-- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringA2G( Controllable, Settings ) -- R2.2
function COORDINATE:ToStringA2G( Controllable, Settings )
self:F2( { Controllable = Controllable and Controllable:GetName() } )
@@ -1887,7 +1936,7 @@ do -- COORDINATE
--- Provides a coordinate string of the point, based on the A2A coordinate format system.
-- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringA2A( Controllable, Settings ) -- R2.2
@@ -1926,7 +1975,7 @@ do -- COORDINATE
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @param Tasking.Task#TASK Task The task for which coordinates need to be calculated.
-- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToString( Controllable, Settings, Task )
@@ -1979,7 +2028,7 @@ do -- COORDINATE
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The pressure text in the configured measurement system.
function COORDINATE:ToStringPressure( Controllable, Settings ) -- R2.3
@@ -1995,9 +2044,9 @@ do -- COORDINATE
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string The wind text in the configured measurement system.
function COORDINATE:ToStringWind( Controllable, Settings ) -- R2.3
function COORDINATE:ToStringWind( Controllable, Settings )
self:F2( { Controllable = Controllable and Controllable:GetName() } )
@@ -2011,9 +2060,9 @@ do -- COORDINATE
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings
-- @param Core.Settings#SETTINGS
-- @return #string The temperature text in the configured measurement system.
function COORDINATE:ToStringTemperature( Controllable, Settings ) -- R2.3
function COORDINATE:ToStringTemperature( Controllable, Settings )
self:F2( { Controllable = Controllable and Controllable:GetName() } )

View File

@@ -1,7 +1,12 @@
--- **Core** -- The RADIO Module is responsible for everything that is related to radio transmission and you can hear in DCS, be it TACAN beacons, Radio transmissions...
--- **Core** - Is responsible for everything that is related to radio transmission and you can hear in DCS, be it TACAN beacons, Radio transmissions.
--
-- ===
--
-- ## Features:
--
-- * Provide radio functionality to broadcast radio transmissions.
-- * Provide beacon functionality to assist pilots.
--
-- The Radio contains 2 classes : RADIO and BEACON
--
-- What are radio communications in DCS ?

View File

@@ -1,20 +1,26 @@
--- **Core** -- **REPORT** class provides a handy means to create messages and reports.
--- **Core** - Provides a handy means to create messages and reports.
--
-- ===
--
-- ### Authors:
-- ## Features:
--
-- * FlightControl : Design & Programming
-- * Create text blocks that are formatted.
-- * Create automatic indents.
-- * Variate the delimiters between reporting lines.
--
-- ### Contributions:
-- ===
--
-- ### Authors: FlightControl : Design & Programming
--
-- @module Core.Report
-- @image Core_Report.JPG
--- The REPORT class
-- @type REPORT
--- @type REPORT
-- @extends Core.Base#BASE
--- Provides a handy means to create messages and reports.
-- @field #REPORT
REPORT = {
ClassName = "REPORT",
Title = "",

View File

@@ -1,9 +1,10 @@
--- **Core** -- SCHEDULER prepares and handles the **execution of functions over scheduled time (intervals)**.
--- **Core** - Prepares and handles the execution of functions over scheduled time (intervals).
--
-- ===
--
-- SCHEDULER manages the **scheduling of functions**:
-- ## Features:
--
-- * Schedule functions over time,
-- * optionally in an optional specified time interval,
-- * optionally **repeating** with a specified time repeat interval,
-- * optionally **randomizing** with a specified time interval randomization factor,

View File

@@ -1,22 +1,35 @@
--- **Core** -- SET_ classes define **collections** of objects to perform **bulk actions** and logically **group** objects.
--- **Core** - Define collections of objects to perform bulk actions and logically group objects.
--
-- ===
--
-- SET_ classes group objects of the same type into a collection, which is either:
-- ## Features:
--
-- * Manually managed using the **:Add...()** or **:Remove...()** methods. The initial SET can be filtered with the **@{#SET_BASE.FilterOnce}()** method
-- * Dynamically maintain collections of objects.
-- * Manually modify the collection, by adding or removing objects.
-- * Collections of different types.
-- * Validate the presence of objects in the collection.
-- * Perform bulk actions on collection.
--
-- ===
--
-- Group objects or data of the same type into a collection, which is either:
--
-- * Manually managed using the **:Add...()** or **:Remove...()** methods. The initial SET can be filtered with the **@{#SET_BASE.FilterOnce}()** method.
-- * Dynamically updated when new objects are created or objects are destroyed using the **@{#SET_BASE.FilterStart}()** method.
--
-- Various types of SET_ classes are available:
--
-- * @{#SET_UNIT}: Defines a colleciton of @{Wrapper.Unit}s filtered by filter criteria.
-- * @{#SET_GROUP}: Defines a collection of @{Wrapper.Group}s filtered by filter criteria.
-- * @{#SET_UNIT}: Defines a colleciton of @{Wrapper.Unit}s filtered by filter criteria.
-- * @{#SET_STATIC}: Defines a collection of @{Wrapper.Static}s filtered by filter criteria.
-- * @{#SET_CLIENT}: Defines a collection of @{Client}s filterd by filter criteria.
-- * @{#SET_AIRBASE}: Defines a collection of @{Wrapper.Airbase}s filtered by filter criteria.
-- * @{#SET_CARGO}: Defines a collection of @{Cargo.Cargo}s filtered by filter criteria.
-- * @{#SET_ZONE}: Defines a collection of @{Core.Zone}s filtered by filter criteria.
--
-- These classes are derived from @{#SET_BASE}, which contains the main methods to manage SETs.
-- These classes are derived from @{#SET_BASE}, which contains the main methods to manage the collections.
--
-- A multitude of other methods are available in SET_ classes that allow to:
-- A multitude of other methods are available in the individual set classes that allow to:
--
-- * Validate the presence of objects in the SET.
-- * Trigger events when objects in the SET change a zone presence.
@@ -2431,7 +2444,12 @@ do -- SET_UNIT
-- @return #SET_UNIT self
function SET_UNIT:IsIncludeObject( MUnit )
self:F2( MUnit )
local MUnitInclude = true
local MUnitInclude = false
if MUnit:IsAlive() ~= nil then
MUnitInclude = true
if self.Filter.Active ~= nil then
local MUnitActive = false
@@ -2518,6 +2536,7 @@ do -- SET_UNIT
end
MUnitInclude = MUnitInclude and MUnitSEAD
end
end
self:T2( MUnitInclude )
return MUnitInclude

View File

@@ -1,4 +1,16 @@
--- **Core** -- Manages various settings for MOOSE classes.
--- **Core** - Manages various settings for running missions, consumed by moose classes and provides a menu system for players to tweak settings in running missions.
--
-- ===
--
-- ## Features:
--
-- * Provide a settings menu system to the players.
-- * Provide a player settings menu and an overall mission settings menu.
-- * Mission settings provide default settings, while player settings override mission settings.
-- * Provide a menu to select between different coordinate formats for A2G coordinates.
-- * Provide a menu to select between different coordinate formats for A2A coordinates.
-- * Provide a menu to select between different message time duration options.
-- * Provide a menu to select between different metric systems.
--
-- ===
--

View File

@@ -1,8 +1,32 @@
--- **Core** --Spawn dynamically new GROUPs of UNITs in your missions.
--- **Core** - Spawn dynamically new groups of units in running missions.
--
-- ===
--
-- The documentation of the SPAWN class can be found further in this document.
-- ## Features:
--
-- * Spawn new groups in running missions.
-- * Schedule spawning of new groups.
-- * Put limits on the amount of groups that can be spawned, and the amount of units that can be alive at the same time.
-- * Randomize the spawning location between different zones.
-- * Randomize the intial positions within the zones.
-- * Spawn in array formation.
-- * Spawn uncontrolled (for planes or helos only).
-- * Clean up inactive helicopters that "crashed".
-- * Place a hook to capture a spawn event, and tailor with customer code.
-- * Spawn late activated.
-- * Spawn with or without an initial delay.
-- * Respawn after landing, on the runway or at the ramp after engine shutdown.
-- * Spawn with custom heading.
-- * Spawn with different skills.
-- * Spawn with different liveries.
-- * Spawn with an inner and outer radius to set the initial position.
-- * Spawn with a randomize route.
-- * Spawn with a randomized template.
-- * Spawn with a randomized start points on a route.
-- * Spawn with an alternative name.
-- * Spawn and keep the unit names.
-- * Spawn with a different coalition and country.
-- * Enquiry methods to check on spawn status.
--
-- ===
--

View File

@@ -1,8 +1,14 @@
--- **Core** -- Spawn dynamically new STATICs in your missions.
--- **Core** - Spawn new statics in your running missions.
--
-- ===
--
-- SPAWNSTATIC spawns static structures in your missions dynamically. See below the SPAWNSTATIC class documentation.
-- ## Features:
--
-- * Spawn new statics from a static already defined using the mission editor.
-- * Spawn new statics from a given template.
-- * Spawn new statics from a given type.
-- * Spawn with a custom heading and location.
-- * Spawn within a zone.
--
-- ===
--

View File

@@ -1,11 +1,12 @@
--- **Core** -- Management of SPOT logistics, that can be transported from and to transportation carriers.
--- **Core** - Management of spotting logistics, that can be activated and deactivated upon command.
--
-- ===
--
-- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to:
--
-- * Spot for a defined duration.
-- * wiggle the spot at the target.
-- * Updates of laer spot position every 0.2 seconds for moving targets.
-- * Wiggle the spot at the target.
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
-- * Implement a status machine, LaseOn, LaseOff.
--
@@ -49,7 +50,8 @@ do
--- Implements the target spotting or marking functionality, but adds additional luxury to be able to:
--
-- * Mark targets for a defined duration.
-- * wiggle the spot at the target.
-- * Updates of laer spot position every 0.2 seconds for moving targets.
-- * Wiggle the spot at the target.
-- * Provide a @{Wrapper.Unit} as a target, instead of a point.
-- * Implement a status machine, LaseOn, LaseOff.
--
@@ -85,9 +87,7 @@ do
--- SPOT Constructor.
-- @param #SPOT self
-- @param Wrapper.Unit#UNIT Recce
-- @param #number LaserCode
-- @param #number Duration
-- @param Wrapper.Unit#UNIT Recce Unit that is lasing
-- @return #SPOT
function SPOT:New( Recce )
@@ -115,12 +115,17 @@ do
--- LaseOn Trigger for SPOT
-- @function [parent=#SPOT] LaseOn
-- @param #SPOT self
-- @param Wrapper.Positionable#POSITIONABLE Target
-- @param #number LaserCode Laser code.
-- @param #number Duration Duration of lasing in seconds.
--- LaseOn Asynchronous Trigger for SPOT
-- @function [parent=#SPOT] __LaseOn
-- @param #SPOT self
-- @param #number Delay
-- @param Wrapper.Positionable#POSITIONABLE Target
-- @param #number LaserCode Laser code.
-- @param #number Duration Duration of lasing in seconds.
self:AddTransition( "On", "Lasing", "On" )
@@ -193,9 +198,9 @@ do
-- @param From
-- @param Event
-- @param To
-- @param Wrapper.Positionable#POSITIONABLE Target
-- @param #number LaserCode
-- @param #number Duration
-- @param Wrapper.Positionable#POSITIONABLE Target Unit that is being lased.
-- @param #number LaserCode Laser code.
-- @param #number Duration Duration of lasing in seconds.
function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration )
self:F( { "LaseOn", Target, LaserCode, Duration } )

View File

@@ -1,8 +1,10 @@
--- **Core (WIP)** -- Manage user flags.
--- **Core** - Manage user flags to interact with the mission editor trigger system and server side scripts.
--
-- ===
--
-- Management of DCS User Flags.
-- ## Features:
--
-- * Set or get DCS user flags within running missions.
--
-- ===
--
@@ -22,7 +24,7 @@ do -- UserFlag
--- Management of DCS User Flags.
--
-- ## USERFLAG constructor
-- # 1. USERFLAG constructor
--
-- * @{#USERFLAG.New}(): Creates a new USERFLAG object.
--

View File

@@ -1,4 +1,10 @@
--- **Core (WIP)** -- Manage user sound.
--- **Core** - Manage user sound.
--
-- ===
--
-- ## Features:
--
-- * Play sounds wihtin running missions.
--
-- ===
--

View File

@@ -1,4 +1,12 @@
--- **Core** -- VELOCITY models a speed, which can be expressed in various formats according the Settings.
--- **Core** - Models a velocity or speed, which can be expressed in various formats according the settings.
--
-- ===
--
-- ## Features:
--
-- * Convert velocity in various metric systems.
-- * Set the velocity.
-- * Create a text in a specific format of a velocity.
--
-- ===
--

View File

@@ -1,7 +1,24 @@
--- **Core** -- ZONE classes define **zones** within your mission of **various forms**, with **various capabilities**.
--- **Core** - Define zones within your mission of various forms, with various capabilities.
--
-- ===
--
-- ## Features:
--
-- * Create radius zones.
-- * Create trigger zones.
-- * Create polygon zones.
-- * Create moving zones around a unit.
-- * Create moving zones around a group.
-- * Provide the zone behaviour. Some zones are static, while others are moveable.
-- * Enquiry if a coordinate is within a zone.
-- * Smoke zones.
-- * Set a zone probability to control zone selection.
-- * Get zone coordinates.
-- * Get zone properties.
-- * Get zone bounding box.
-- * Set/get zone name.
--
--
-- There are essentially two core functions that zones accomodate:
--
-- * Test if an object is within the zone boundaries.

View File

@@ -1,8 +1,18 @@
--- **Functional** -- The ATC\_GROUND classes monitor airbase traffic and regulate speed while taxiing.
--- **Functional** -- Monitor airbase traffic and regulate speed while taxiing.
--
-- ===
--
-- ![Banner Image](..\Presentations\ATC_GROUND\Dia1.JPG)
-- ## Features:
--
-- * Monitor speed of the airplanes of players during taxi.
-- * Communicate ATC ground operations.
-- * Kick speeding players during taxi.
--
-- ===
--
-- ## Missions:
--
-- [ABP - Airbase Police](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ABP%20-%20Airbase%20Police)
--
-- ===
--

View File

@@ -1,4 +1,4 @@
--- **Functional** - (R2.4) Control artillery units.
--- **Functional** - Control artillery units.
--
-- ===
--
@@ -21,15 +21,7 @@
--
-- ====
--
-- # Demo Missions
--
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ====
--
-- # YouTube Channel
--
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
-- ## [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
--
-- ===
--
@@ -597,8 +589,15 @@ ARTY={
autorelocateonroad=false,
}
--- Weapong type ID. http://wiki.hoggit.us/view/DCS_enum_weapon_flag
-- @list WeaponType
--- Weapong type ID. See [here](http://wiki.hoggit.us/view/DCS_enum_weapon_flag).
-- @type ARTY.WeaponType
-- @field #number Auto Automatic selection of weapon type.
-- @field #number Cannon Cannons using conventional shells.
-- @field #number Rockets Unguided rockets.
-- @field #number CruiseMissile Cruise missiles.
-- @field #number TacticalNukes Tactical nuclear shells (simulated).
-- @field #number IlluminationShells Illumination shells (simulated).
-- @field #number SmokeShells Smoke shells (simulated).
ARTY.WeaponType={
Auto=1073741822,
Cannon=805306368,
@@ -610,7 +609,7 @@ ARTY.WeaponType={
}
--- Database of common artillery unit properties.
-- @list db
-- @type ARTY.db
ARTY.db={
["2B11 mortar"] = { -- type "2B11 mortar"
minrange = 500, -- correct?
@@ -675,7 +674,7 @@ ARTY.id="ARTY | "
--- Arty script version.
-- @field #string version
ARTY.version="1.0.5"
ARTY.version="1.0.6"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -1189,7 +1188,14 @@ function ARTY:AssignTargetCoord(coord, prio, radius, nshells, maxengage, time, w
end
-- Time in seconds.
local _time=self:_ClockToSeconds(time)
local _time
if type(time)=="string" then
_time=self:_ClockToSeconds(time)
elseif type(time)=="number" then
_time=timer.getAbsTime()+time
else
_time=timer.getAbsTime()
end
-- Prepare target array.
local _target={name=_name, coord=coord, radius=radius, nshells=nshells, engaged=0, underfire=false, prio=prio, maxengage=maxengage, time=_time, weapontype=weapontype}
@@ -1240,9 +1246,6 @@ function ARTY:AssignMoveCoord(coord, time, speed, onroad, cancel, name, unique)
return nil
end
-- Default is current time if no time was specified.
time=time or self:_SecondsToClock(timer.getAbsTime())
-- Set speed.
if speed then
-- Make sure, given speed is less than max physiaclly possible speed of group.
@@ -1264,7 +1267,14 @@ function ARTY:AssignMoveCoord(coord, time, speed, onroad, cancel, name, unique)
end
-- Time in seconds.
local _time=self:_ClockToSeconds(time)
local _time
if type(time)=="string" then
_time=self:_ClockToSeconds(time)
elseif type(time)=="number" then
_time=timer.getAbsTime()+time
else
_time=timer.getAbsTime()
end
-- Prepare move array.
local _move={name=_name, coord=coord, time=_time, speed=speed, onroad=onroad, cancel=cancel}

View File

@@ -1,23 +1,22 @@
--- **Functional** -- The CLEANUP_AIRBASE class keeps an area clean of crashing or colliding airplanes. It also prevents airplanes from firing within this area.
--- **Functional** -- Keep airbases clean of crashing or colliding airplanes, and kill missiles when being fired at airbases.
--
-- ===
--
-- ### Author: **FlightControl**
-- ### Contributions:
-- ## Features:
--
--
-- * Try to keep the airbase clean and operational.
-- * Prevent airplanes from crashing.
-- * Clean up obstructing airplanes from the runway that are standing still for a period of time.
-- * Prevent airplanes firing missiles within the airbase zone.
--
-- ===
--
-- @module Functional.CleanUp
-- @image CleanUp_Airbases.JPG
--- @type CLEANUP_AIRBASE.__ Methods which are not intended for mission designers, but which are used interally by the moose designer :-)
-- @field #map<#string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.
-- @extends Core.Base#BASE
--- @type CLEANUP_AIRBASE
-- @extends #CLEANUP_AIRBASE.__
--- Keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.
-- ## Missions:
--
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CLA%20-%20CleanUp%20Airbase)
--
-- ===
--
-- Specific airbases need to be provided that need to be guarded. Each airbase registered, will be guarded within a zone of 8 km around the airbase.
-- Any unit that fires a missile, or shoots within the zone of an airbase, will be monitored by CLEANUP_AIRBASE.
@@ -43,7 +42,26 @@
--
-- By following the above guidelines, you can add airbase cleanup with acceptable CPU overhead.
--
-- ## 1. CLEANUP_AIRBASE Constructor
-- ===
--
-- ### Author: **FlightControl**
-- ### Contributions:
--
-- ===
--
-- @module Functional.CleanUp
-- @image CleanUp_Airbases.JPG
--- @type CLEANUP_AIRBASE.__ Methods which are not intended for mission designers, but which are used interally by the moose designer :-)
-- @field #map<#string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.
-- @extends Core.Base#BASE
--- @type CLEANUP_AIRBASE
-- @extends #CLEANUP_AIRBASE.__
--- Keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.
--
-- # 1. CLEANUP_AIRBASE Constructor
--
-- Creates the main object which is preventing the airbase to get polluted with debris on the runway, which halts the airbase.
--
@@ -54,12 +72,12 @@
-- CleanUpTbilisi = CLEANUP_AIRBASE:New( AIRBASE.Caucasus.Tbilisi )
-- CleanUpKutaisi = CLEANUP_AIRBASE:New( AIRBASE.Caucasus.Kutaisi )
--
-- ## 2. Add or Remove airbases
-- # 2. Add or Remove airbases
--
-- The method @{#CLEANUP_AIRBASE.AddAirbase}() to add an airbase to the cleanup validation process.
-- The method @{#CLEANUP_AIRBASE.RemoveAirbase}() removes an airbase from the cleanup validation process.
--
-- ## 3. Clean missiles and bombs within the airbase zone.
-- # 3. Clean missiles and bombs within the airbase zone.
--
-- When missiles or bombs hit the runway, the airbase operations stop.
-- Use the method @{#CLEANUP_AIRBASE.SetCleanMissiles}() to control the cleaning of missiles, which will prevent airbases to stop.
@@ -113,6 +131,20 @@ function CLEANUP_AIRBASE:New( AirbaseNames )
self:HandleEvent( EVENTS.Dead, self.__.OnEventCrash )
self:HandleEvent( EVENTS.Crash, self.__.OnEventCrash )
for UnitName, Unit in pairs( _DATABASE.UNITS ) do
local Unit = Unit -- Wrapper.Unit#UNIT
if Unit:IsAlive() ~= nil then
if self:IsInAirbase( Unit:GetVec2() ) then
self:F( { UnitName = UnitName } )
self.CleanUpList[UnitName] = {}
self.CleanUpList[UnitName].CleanUpUnit = Unit
self.CleanUpList[UnitName].CleanUpGroup = Unit:GetGroup()
self.CleanUpList[UnitName].CleanUpGroupName = Unit:GetGroup():GetName()
self.CleanUpList[UnitName].CleanUpUnitName = Unit:GetName()
end
end
end
return self
end
@@ -213,11 +245,15 @@ end
function CLEANUP_AIRBASE.__:OnEventBirth( EventData )
self:F( { EventData } )
if EventData.IniUnit:IsAlive() ~= nil then
if self:IsInAirbase( EventData.IniUnit:GetVec2() ) then
self.CleanUpList[EventData.IniDCSUnitName] = {}
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnit = EventData.IniUnit
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroup = EventData.IniGroup
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroupName = EventData.IniDCSGroupName
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnitName = EventData.IniDCSUnitName
end
end
end
@@ -350,6 +386,8 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
if CleanUpUnit:IsAlive() ~= nil then
if self:IsInAirbase( CleanUpUnit:GetVec2() ) then
if _DATABASE:GetStatusGroup( CleanUpGroupName ) ~= "ReSpawn" then
local CleanUpCoordinate = CleanUpUnit:GetCoordinate()
@@ -373,7 +411,7 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
end
end
-- Clean Units which are waiting for a very long time in the CleanUpZone.
if CleanUpUnit then
if CleanUpUnit and not CleanUpUnit:GetPlayerName() then
local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH()
if CleanUpUnitVelocity < 1 then
if CleanUpListData.CleanUpMoved then
@@ -387,7 +425,10 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
CleanUpListData.CleanUpMoved = true
end
end
else
-- not anymore in an airbase zone, remove from cleanup list.
self.CleanUpList[CleanUpUnitName] = nil
end
else
-- Do nothing ...
self.CleanUpList[CleanUpUnitName] = nil

View File

@@ -2,41 +2,24 @@
--
-- ===
--
-- Orchestrate the designation of potential targets executed by a Recce group,
-- and communicates these to a dedicated attacking group of players,
-- so that following a dynamically generated menu system,
-- each detected set of potential targets can be lased or smoked...
-- ## Features:
--
-- Targets can be:
--
-- * **Lased** for a period of time.
-- * **Smoked**. Artillery or airplanes with Illuminatino ordonance need to be present. (WIP, but early demo ready.)
-- * **Illuminated** through an illumination bomb. Artillery or airplanes with Illuminatino ordonance need to be present. (WIP, but early demo ready.
-- * Faciliate the communication of detected targets to players.
-- * Designate targets using lasers, through a menu system.
-- * Designate targets using smoking, through a menu system.
-- * Designate targets using illumination, through a menu system.
-- * Auto lase targets.
-- * Refresh detection upon specified time intervals.
-- * Prioritization on threat levels.
-- * Reporting system of threats.
--
-- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
-- ## Missions:
--
-- ### Contributions:
-- [DES - Designation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DES%20-%20Designation)
--
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing
--
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- @module Functional.Designate
-- @image Designation.JPG
do -- DESIGNATE
--- @type DESIGNATE
-- @extends Core.Fsm#FSM_PROCESS
--- Manage the designation of detected targets.
-- ===
--
-- Targets detected by recce will be communicated to a group of attacking players.
-- A menu system is made available that allows to:
@@ -61,7 +44,7 @@ do -- DESIGNATE
-- * A **Player** is an active CLIENT object containing a human player.
-- * A **Designate Menu** is the menu that is dynamically created during the designation process for each _AttackGroup_.
--
-- ## 0. Player Manual
-- # Player Manual
--
-- ![Banner Image](..\Presentations\DESIGNATE\Dia3.JPG)
--
@@ -88,7 +71,7 @@ do -- DESIGNATE
-- This will ensure that the detection process won't be interrupted and that targets can be designated.
-- However, you don't have to, so to simulate a more real-word situation or simulation, **Recce can also be destroyed**!
--
-- ### 0.1. Player View (Observer)
-- ## 1. Player View (Observer)
--
-- ![Banner Image](..\Presentations\DESIGNATE\Dia4.JPG)
--
@@ -101,7 +84,7 @@ do -- DESIGNATE
-- that can be put in **scope** of the DesignateObject.
-- We call this the **MaximumDesignations** term.
--
-- ### 0.2. Designate Menu
-- ## 2. Designate Menu
--
-- ![Banner Image](..\Presentations\DESIGNATE\Dia5.JPG)
--
@@ -135,7 +118,7 @@ do -- DESIGNATE
-- * Smoke Targets using a specific smoke color.
-- * Illuminate areas.
--
-- ### 0.3. Lasing Targets
-- ## 3. Lasing Targets
--
-- ![Banner Image](..\Presentations\DESIGNATE\Dia7.JPG)
--
@@ -159,7 +142,7 @@ do -- DESIGNATE
--
-- In this way, DESIGNATE assists players to designate ground targets for a coordinated attack!
--
-- ### 0.4. Illuminating Targets
-- ## 4. Illuminating Targets
--
-- ![Banner Image](..\Presentations\DESIGNATE\Dia9.JPG)
--
@@ -168,7 +151,7 @@ do -- DESIGNATE
-- Illumination bombs can be fired in while lasing targets.
-- When illumination bombs are fired, it will take about 2 minutes until a sequent bomb run can be requested using the menus.
--
-- ### 0.5. Smoking Targets
-- ## 5. Smoking Targets
--
-- ![Banner Image](..\Presentations\DESIGNATE\Dia10.JPG)
--
@@ -180,19 +163,44 @@ do -- DESIGNATE
--
-- Have FUN!
--
-- ## 1. DESIGNATE constructor
-- ===
--
-- ### Contributions:
--
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- ===
--
-- @module Functional.Designate
-- @image Designation.JPG
do -- DESIGNATE
--- @type DESIGNATE
-- @extends Core.Fsm#FSM_PROCESS
--- Manage the designation of detected targets.
--
--
-- # 1. DESIGNATE constructor
--
-- * @{#DESIGNATE.New}(): Creates a new DESIGNATE object.
--
-- ## 2. DESIGNATE is a FSM
-- # 2. DESIGNATE is a FSM
--
-- Designate is a finite state machine, which allows for controlled transitions of states.
--
-- ### 2.1 DESIGNATE States
-- ## 2.1 DESIGNATE States
--
-- * **Designating** ( Group ): The designation process.
--
-- ### 2.2 DESIGNATE Events
-- ## 2.2 DESIGNATE Events
--
-- * **@{#DESIGNATE.Detect}**: Detect targets.
-- * **@{#DESIGNATE.LaseOn}**: Lase the targets with the specified Index.
@@ -200,7 +208,7 @@ do -- DESIGNATE
-- * **@{#DESIGNATE.Smoke}**: Smoke the targets with the specified Index.
-- * **@{#DESIGNATE.Status}**: Report designation status.
--
-- ## 3. Maximum Designations
-- # 3. Maximum Designations
--
-- In order to prevent an overflow of designations due to many Detected Targets, there is a
-- Maximum Designations scope that is set in the DesignationObject.
@@ -208,9 +216,9 @@ do -- DESIGNATE
-- The method @{#DESIGNATE.SetMaximumDesignations}() will put a limit on the amount of designations put in scope of the DesignationObject.
-- Using the menu system, the player can "forget" a designation, so that gradually a new designation can be put in scope when detected.
--
-- ## 4. Laser codes
-- # 4. Laser codes
--
-- ### 4.1. Set possible laser codes
-- ## 4.1. Set possible laser codes
--
-- An array of laser codes can be provided, that will be used by the DESIGNATE when lasing.
-- The laser code is communicated by the Recce when it is lasing a larget.
@@ -228,11 +236,11 @@ do -- DESIGNATE
--
-- The above sets a collection of possible laser codes that can be assigned. **Note the { } notation!**
--
-- ### 4.2. Auto generate laser codes
-- ## 4.2. Auto generate laser codes
--
-- Use the method @{#DESIGNATE.GenerateLaserCodes}() to generate all possible laser codes. Logic implemented and advised by Ciribob!
--
-- ### 4.3. Add specific lase codes to the lase menu
-- ## 4.3. Add specific lase codes to the lase menu
--
-- Certain plane types can only drop laser guided ordonnance when targets are lased with specific laser codes.
-- The SU-25T needs targets to be lased using laser code 1113.
@@ -241,7 +249,7 @@ do -- DESIGNATE
-- The method @{#DESIGNATE.AddMenuLaserCode}() to allow a player to lase a target using a specific laser code.
-- Remove such a lase menu option using @{#DESIGNATE.RemoveMenuLaserCode}().
--
-- ## 5. Autolase to automatically lase detected targets.
-- # 5. Autolase to automatically lase detected targets.
--
-- DetectionItems can be auto lased once detected by Recces. As such, there is almost no action required from the Players using the Designate Menu.
-- The **auto lase** function can be activated through the Designation Menu.
@@ -252,7 +260,7 @@ do -- DESIGNATE
--
-- Activate the auto lasing.
--
-- ## 6. Target prioritization on threat level
-- # 6. Target prioritization on threat level
--
-- Targets can be detected of different types in one DetectionItem. Depending on the type of the Target, a different threat level applies in an Air to Ground combat context.
-- SAMs are of a higher threat than normal tanks. So, if the Target type was recognized, the Recces will select those targets that form the biggest threat first,
@@ -265,12 +273,12 @@ do -- DESIGNATE
--
-- The example will activate the threat level prioritization for this the Designate object. Threats will be marked based on the threat level of the Target.
--
-- ## 6. Designate Menu Location for a Mission
-- # 7. Designate Menu Location for a Mission
--
-- You can make DESIGNATE work for a @{Tasking.Mission#MISSION} object. In this way, the designate menu will not appear in the root of the radio menu, but in the menu of the Mission.
-- Use the method @{#DESIGNATE.SetMission}() to set the @{Mission} object for the designate function.
--
-- ## 7. Status Report
-- # 8. Status Report
--
-- A status report is available that displays the current Targets detected, grouped per DetectionItem, and a list of which Targets are currently being marked.
--

View File

@@ -2,18 +2,25 @@
--
-- ===
--
-- ## Features:
--
-- * Detection of targets by recce units.
-- * Group detected targets per unit, type or area (zone).
-- * Keep persistency of detected targets, if when detection is lost.
-- * Provide an indication of detected targets.
-- * Report detected targets.
-- * Refresh detection upon specified time intervals.
--
-- ===
--
-- ## Missions:
--
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DET%20-%20Detection)
--
-- ===
--
-- Facilitate the detection of enemy units within the battle zone executed by FACs (Forward Air Controllers) or RECCEs (Reconnassance Units).
-- DETECTION uses the in-built detection capabilities of DCS World, but adds new functionalities.
--
-- Find the DETECTION classes documentation further in this document in the globals section.
--
-- ===
--
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DET%20-%20Detection)
--
-- ===
--
-- ### [YouTube Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl3Cf5jpI6BS0sBOVWK__tji)
-- It uses the in-built detection capabilities of DCS World, but adds new functionalities.
--
-- ===
--
@@ -25,13 +32,11 @@
--
-- * FlightControl : Analysis, Design, Programming, Testing
--
-- ===
--
-- @module Functional.Detection
-- @image Detection.JPG
----BASE:TraceClass("DETECTION_BASE")
----BASE:TraceClass("DETECTION_AREAS")
----BASE:TraceClass("DETECTION_UNITS")
----BASE:TraceClass("DETECTION_TYPES")
do -- DETECTION_BASE

View File

@@ -2,6 +2,27 @@
--
-- ===
--
-- ## Features:
--
-- * Escort navigation commands.
-- * Escort hold at position commands.
-- * Escorts reporting detected targets.
-- * Escorts scanning targets in advance.
-- * Escorts attacking specific targets.
-- * Request assistance from other groups for attack.
-- * Manage rule of engagement of escorts.
-- * Manage the allowed evasion techniques of escorts.
-- * Make escort to execute a defined mission or path.
-- * Escort tactical situation reporting.
--
-- ===
--
-- ## Missions:
--
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
--
-- ===
--
-- Allows you to interact with escorting AI on your flight and take the lead.
--
-- Each escorting group can be commanded with a whole set of radio commands (radio menu in your flight, and then F10).
@@ -77,47 +98,18 @@
-- Escort groups can have their own mission. This menu item will allow the escort group to resume their Mission from a given waypoint.
-- Note that this is really fantastic, as you now have the dynamic of taking control of the escort groups, and allowing them to resume their path or mission.
--
-- # ESCORT construction methods.
--
-- Create a new SPAWN object with the @{#ESCORT.New} method:
--
-- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Wrapper.Group#GROUP} for a @{Wrapper.Client#CLIENT}, with an optional briefing text.
--
-- # ESCORT initialization methods.
--
-- The following menus are created within the RADIO MENU (F10) of an active unit hosted by a player:
--
-- * @{#ESCORT.MenuFollowAt}: Creates a menu to make the escort follow the client.
-- * @{#ESCORT.MenuHoldAtEscortPosition}: Creates a menu to hold the escort at its current position.
-- * @{#ESCORT.MenuHoldAtLeaderPosition}: Creates a menu to hold the escort at the client position.
-- * @{#ESCORT.MenuScanForTargets}: Creates a menu so that the escort scans targets.
-- * @{#ESCORT.MenuFlare}: Creates a menu to disperse flares.
-- * @{#ESCORT.MenuSmoke}: Creates a menu to disparse smoke.
-- * @{#ESCORT.MenuReportTargets}: Creates a menu so that the escort reports targets.
-- * @{#ESCORT.MenuReportPosition}: Creates a menu so that the escort reports its current position from bullseye.
-- * @{#ESCORT.MenuAssistedAttack: Creates a menu so that the escort supportes assisted attack from other escorts with the client.
-- * @{#ESCORT.MenuROE: Creates a menu structure to set the rules of engagement of the escort.
-- * @{#ESCORT.MenuEvasion: Creates a menu structure to set the evasion techniques when the escort is under threat.
-- * @{#ESCORT.MenuResumeMission}: Creates a menu structure so that the escort can resume from a waypoint.
--
--
-- @usage
-- -- Declare a new EscortPlanes object as follows:
--
-- -- First find the GROUP object and the CLIENT object.
-- local EscortClient = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
--
-- -- Now use these 2 objects to construct the new EscortPlanes object.
-- EscortPlanes = ESCORT:New( EscortClient, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
-- ===
--
-- ### Authors: **FlightControl**
--
-- ===
--
-- @module Functional.Escort
-- @image Escorting.JPG
--- ESCORT class
-- @type ESCORT
--- @type ESCORT
-- @extends Core.Base#BASE
-- @field Wrapper.Client#CLIENT EscortClient
-- @field Wrapper.Group#GROUP EscortGroup
@@ -129,6 +121,26 @@
-- @Field DCS#AI.Option.Air.val.ROE OptionROE Which ROE is set to the EscortGroup.
-- @field DCS#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the EscortGroup.
-- @field FunctionalMENU_GROUPDETECTION_BASE Detection
--- ESCORT class
--
-- # ESCORT construction methods.
--
-- Create a new SPAWN object with the @{#ESCORT.New} method:
--
-- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Wrapper.Group#GROUP} for a @{Wrapper.Client#CLIENT}, with an optional briefing text.
--
-- @usage
-- -- Declare a new EscortPlanes object as follows:
--
-- -- First find the GROUP object and the CLIENT object.
-- local EscortClient = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
--
-- -- Now use these 2 objects to construct the new EscortPlanes object.
-- EscortPlanes = ESCORT:New( EscortClient, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
--
-- @field #ESCORT
ESCORT = {
ClassName = "ESCORT",
EscortName = nil, -- The Escort Name

View File

@@ -1,10 +1,8 @@
--- **Functional** -- MISSILETRAINER helps you to train missile avoidance.
--- **Functional** -- Train missile defence and deflection.
--
-- ===
--
-- The @{#MISSILETRAINER} class uses the DCS world messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft,
-- the class will destroy the missile within a certain range, to avoid damage to your aircraft.
-- It suports the following functionality:
-- ## Features:
--
-- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes.
-- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range <20>
@@ -12,7 +10,18 @@
-- * Provide alerts when the missile self destructs.
-- * Enable / Disable and Configure the Missile Trainer using the various menu options.
--
-- When running a mission where MISSILETRAINER is used, the following radio menu structure ( 'Radio Menu' -> 'Other (F10)' -> 'MissileTrainer' ) options are available for the players:
-- ===
--
-- ## Missions:
--
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MIT%20-%20Missile%20Trainer)
--
-- ===
--
-- Uses the MOOSE messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft,
-- the class will destroy the missile within a certain range, to avoid damage to your aircraft.
--
-- When running a mission where the missile trainer is used, the following radio menu structure ( 'Radio Menu' -> 'Other (F10)' -> 'MissileTrainer' ) options are available for the players:
--
-- * **Messages**: Menu to configure all messages.
-- * **Messages On**: Show all messages.
@@ -42,17 +51,40 @@
-- * **150 meter**: Destroys the missile when the distance to the aircraft is below or equal to 150 meter.
-- * **200 meter**: Destroys the missile when the distance to the aircraft is below or equal to 200 meter.
--
-- ===
--
-- ### Authors: **FlightControl**
--
-- ### Contributions:
--
-- * **Stuka (Danny)**: Who you can search on the Eagle Dynamics Forums. Working together with Danny has resulted in the MISSILETRAINER class.
-- Danny has shared his ideas and together we made a design.
-- Together with the **476 virtual team**, we tested the MISSILETRAINER class, and got much positive feedback!
-- * **132nd Squadron**: Testing and optimizing the logic.
--
-- ===
--
-- @module Functional.MissileTrainer
-- @image Missile_Trainer.JPG
--- @type MISSILETRAINER
-- @field Core.Set#SET_CLIENT DBClients
-- @extends Core.Base#BASE
---
--
-- # Constructor:
--
-- 1.1) MISSILETRAINER construction methods:
-- -----------------------------------------
-- Create a new MISSILETRAINER object with the @{#MISSILETRAINER.New} method:
--
-- * @{#MISSILETRAINER.New}: Creates a new MISSILETRAINER object taking the maximum distance to your aircraft to evaluate when a missile needs to be destroyed.
--
-- MISSILETRAINER will collect each unit declared in the mission with a skill level "Client" and "Player", and will monitor the missiles shot at those.
--
-- 1.2) MISSILETRAINER initialization methods:
-- -------------------------------------------
-- # Initialization:
--
-- A MISSILETRAINER object will behave differently based on the usage of initialization methods:
--
-- * @{#MISSILETRAINER.InitMessagesOnOff}: Sets by default the display of any message to be ON or OFF.
@@ -66,23 +98,7 @@
-- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF.
-- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu.
--
-- ===
--
-- CREDITS
-- ===
-- **Stuka (Danny)** Who you can search on the Eagle Dynamics Forums.
-- Working together with Danny has resulted in the MISSILETRAINER class.
-- Danny has shared his ideas and together we made a design.
-- Together with the **476 virtual team**, we tested the MISSILETRAINER class, and got much positive feedback!
--
-- @module Functional.MissileTrainer
-- @image Missile_Trainer.JPG
--- The MISSILETRAINER class
-- @type MISSILETRAINER
-- @field Core.Set#SET_CLIENT DBClients
-- @extends Core.Base#BASE
-- @field #MISSILETRAINER
MISSILETRAINER = {
ClassName = "MISSILETRAINER",
TrackingMissiles = {},

View File

@@ -1,4 +1,4 @@
--- **Functional** -- Limit the MOVEMENT of simulaneous moving ground vehicles.
--- **Functional** -- Limit the movement of simulaneous moving ground vehicles.
--
-- ===
--
@@ -10,9 +10,11 @@
-- @module Functional.Movement
-- @image MOOSE.JPG
--- the MOVEMENT class
-- @type MOVEMENT
--- @type MOVEMENT
-- @extends Core.Base#BASE
---
--@field #MOVEMENT
MOVEMENT = {
ClassName = "MOVEMENT",
}

View File

@@ -1,4 +1,4 @@
--- **Functional** - (R2.4) Rudimentary ATC.
--- **Functional** - Rudimentary ATC.
--
-- ![Banner Image](..\Presentations\PSEUDOATC\PSEUDOATC_Main.jpg)
--
@@ -8,7 +8,7 @@
--
-- In particular, a menu entry "Pseudo ATC" is created in the "F10 Other..." radiomenu.
--
-- ## Features
-- ## Features:
--
-- * Weather report at nearby airbases and mission waypoints.
-- * Report absolute bearing and range to nearest airports and mission waypoints.
@@ -20,12 +20,6 @@
--
-- ====
--
-- # Demo Missions
--
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ====
--
-- # YouTube Channel
--
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)

View File

@@ -1,14 +1,12 @@
--- **Functional** - (R2.2) - Create random airtraffic in your missions.
--- **Functional** - Create random airtraffic in your missions.
--
-- ===
--
-- The aim of the RAT class is to fill the empty DCS world with randomized air traffic and bring more life to your airports.
--
-- In particular, it is designed to spawn AI air units at random airports. These units will be assigned a random flight path to another random airport on the map.
--
-- Even the mission designer will not know where aircraft will be spawned and which route they follow.
--
-- ## Features
-- ## Features:
--
-- * Very simple interface. Just one unit and two lines of Lua code needed to fill your map.
-- * High degree of randomization. Aircraft will spawn at random airports, have random routes and random destinations.
@@ -22,7 +20,7 @@
-- * All of the above can be customized by the user if necessary.
-- * All current (Caucasus, Nevada, Normandy, Persian Gulf) and future maps are supported.
--
-- The RAT class creates an entry in the F10 radio menu which allows to
-- The RAT class creates an entry in the F10 radio menu which allows to:
--
-- * Create new groups on-the-fly, i.e. at run time within the mission,
-- * Destroy specific groups (e.g. if they get stuck or damaged and block a runway),
@@ -35,10 +33,9 @@
--
-- ===
--
-- # Demo Missions
-- ## Missions:
--
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
-- ### [MOOSE - RAT Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/RAT%20-%20Random%20Air%20Traffic)
-- ### [RAT - Random Air Traffic](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/RAT%20-%20Random%20Air%20Traffic)
--
-- ===
--

View File

@@ -1,4 +1,4 @@
--- **Functional** - (R2.3) - Range Practice.
--- **Functional** - Range Practice.
--
-- ===
--
@@ -9,7 +9,7 @@
--
-- [476th - Air Weapons Range Objects mod](http://www.476vfightergroup.com/downloads.php?do=file&id=287) is highly recommended for this class.
--
-- ## Features
-- ## Features:
--
-- * Impact points of bombs, rockets and missils are recorded and distance to closest range target is measured and reported to the player.
-- * Number of hits on strafing passes are counted and reported. Also the percentage of hits w.r.t fired shots is evaluated.
@@ -25,14 +25,6 @@
--
-- ===
--
-- # Demo Missions
--
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ===
--
-- # YouTube Channel
--
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
-- ### [MOOSE - On the Range - Demonstration Video](https://www.youtube.com/watch?v=kIXcxNB9_3M)
--

View File

@@ -1,4 +1,25 @@
--- **Functional** -- (R2.0) - Administer the scoring of player achievements, and create a CSV file logging the scoring events for use at team or squadron websites.
--- **Functional** - Administer the scoring of player achievements, and create a CSV file logging the scoring events for use at team or squadron websites.
--
-- ===
--
-- ## Features:
--
-- * Set the scoring scales based on threat level.
-- * Positive scores and negative scores.
-- * A contribution model to score achievements.
-- * Score goals.
-- * Score specific achievements.
-- * Score the hits and destroys of units.
-- * Score the hits and destroys of statics.
-- * Score the hits and destroys of scenery.
-- * Log scores into a CSV file.
-- * Connect to a remote server using JSON and IP.
--
-- ===
--
-- ## Missions:
--
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCO%20-%20Scoring)
--
-- ===
--
@@ -52,9 +73,34 @@
-- Use the radio menu F10 to consult the scores while running the mission.
-- Scores can be reported for your user, or an overall score can be reported of all players currently active in the mission.
--
-- # 1) @{Functional.Scoring#SCORING} class, extends @{Core.Base#BASE}
-- ===
--
-- ## 1.1) Set the destroy score or penalty scale
-- ### Authors: **FlightControl**
--
-- ### Contributions:
--
-- * **Wingthor (TAW)**: Testing & Advice.
-- * **Dutch-Baron (TAW)**: Testing & Advice.
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing and Advice.
--
-- ===
--
-- @module Functional.Scoring
-- @image Scoring.JPG
--- @type SCORING
-- @field Players A collection of the current players that have joined the game.
-- @extends Core.Base#BASE
--- SCORING class
--
-- # Constructor:
--
-- local Scoring = SCORING:New( "Scoring File" )
--
--
-- # Set the destroy score or penalty scale:
--
-- Score scales can be set for scores granted when enemies or friendlies are destroyed.
-- Use the method @{#SCORING.SetScaleDestroyScore}() to set the scale of enemy destroys (positive destroys).
@@ -67,7 +113,7 @@
-- The above sets the scale for valid scores to 10. So scores will be given in a scale from 0 to 10.
-- The penalties will be given in a scale from 0 to 40.
--
-- ## 1.2) Define special targets that will give extra scores.
-- # Define special targets that will give extra scores:
--
-- Special targets can be set that will give extra scores to the players when these are destroyed.
-- Use the methods @{#SCORING.AddUnitScore}() and @{#SCORING.RemoveUnitScore}() to specify a special additional score for a specific @{Wrapper.Unit}s.
@@ -84,7 +130,7 @@
--
-- Scoring:RemoveUnitScore( UNIT:FindByName( "Unit #001" ) )
--
-- ## 1.3) Define destruction zones that will give extra scores.
-- # Define destruction zones that will give extra scores:
--
-- Define zones of destruction. Any object destroyed within the zone of the given category will give extra points.
-- Use the method @{#SCORING.AddZoneScore}() to add a @{Zone} for additional scoring.
@@ -94,12 +140,12 @@
-- The other implementation could be to designate a scenery target (a building) in the mission editor surrounded by a @{Zone},
-- just large enough around that building.
--
-- ## 1.4) Add extra Goal scores upon an event or a condition.
-- # Add extra Goal scores upon an event or a condition:
--
-- A mission has goals and achievements. The scoring system provides an API to set additional scores when a goal or achievement event happens.
-- Use the method @{#SCORING.AddGoalScore}() to add a score for a Player at any time in your mission.
--
-- ## 1.5) (Decommissioned) Configure fratricide level.
-- # (Decommissioned) Configure fratricide level.
--
-- **This functionality is decomissioned until the DCS bug concerning Unit:destroy() not being functional in multi player for player units has been fixed by ED**.
--
@@ -107,13 +153,13 @@
-- Use the method @{#SCORING.SetFratricide}() to define the level when a player gets kicked.
-- By default, the fratricide level is the default penalty mutiplier * 2 for the penalty score.
--
-- ## 1.6) Penalty score when a player changes the coalition.
-- # Penalty score when a player changes the coalition.
--
-- When a player changes the coalition, he can receive a penalty score.
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
-- By default, the penalty for changing coalition is the default penalty scale.
--
-- ## 1.8) Define output CSV files.
-- # Define output CSV files.
--
-- The CSV file is given the name of the string given in the @{#SCORING.New}{} constructor, followed by the .csv extension.
-- The file is incrementally saved in the **<User>\\Saved Games\\DCS\\Logs** folder, and has a time stamp indicating each mission run.
@@ -150,7 +196,7 @@
-- The MOOSE designer cannot take any responsibility of any damage inflicted as a result of the de-sanitization.
-- That being said, I hope that the SCORING class provides you with a great add-on to score your squad mates achievements.
--
-- ## 1.9) Configure messages.
-- # Configure messages.
--
-- When players hit or destroy targets, messages are sent.
-- Various methods exist to configure:
@@ -158,7 +204,7 @@
-- * Which messages are sent upon the event.
-- * Which audience receives the message.
--
-- ### 1.9.1) Configure the messages sent upon the event.
-- ## Configure the messages sent upon the event.
--
-- Use the following methods to configure when to send messages. By default, all messages are sent.
--
@@ -167,49 +213,16 @@
-- * @{#SCORING.SetMessagesAddon}(): Configure to send messages for additional score, after a target has been destroyed.
-- * @{#SCORING.SetMessagesZone}(): Configure to send messages for additional score, after a target has been destroyed within a given zone.
--
-- ### 1.9.2) Configure the audience of the messages.
-- ## Configure the audience of the messages.
--
-- Use the following methods to configure the audience of the messages. By default, the messages are sent to all players in the mission.
--
-- * @{#SCORING.SetMessagesToAll}(): Configure to send messages to all players.
-- * @{#SCORING.SetMessagesToCoalition}(): Configure to send messages to only those players within the same coalition as the player.
--
--
-- ===
--
-- # **API CHANGE HISTORY**
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
-- * **Added** parts are expressed in bold type face.
-- * _Removed_ parts are expressed in italic type face.
--
-- Hereby the change log:
--
-- 2017-02-26: Initial class and API.
--
-- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
-- * **Wingthor (TAW)**: Testing & Advice.
-- * **Dutch-Baron (TAW)**: Testing & Advice.
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing and Advice.
--
-- ### Authors:
--
-- * **FlightControl**: Concept, Design & Programming.
--
-- @module Functional.Scoring
-- @image Scoring.JPG
--- The Scoring class
-- @type SCORING
-- @field Players A collection of the current players that have joined the game.
-- @extends Core.Base#BASE
-- @field #SCORING
SCORING = {
ClassName = "SCORING",
ClassID = 0,
@@ -236,8 +249,10 @@ local _SCORINGCategory =
-- @param #string GameName The name of the game. This name is also logged in the CSV score file.
-- @return #SCORING self
-- @usage
--
-- -- Define a new scoring object for the mission Gori Valley.
-- ScoringObject = SCORING:New( "Gori Valley" )
--
function SCORING:New( GameName )
-- Inherits from BASE

View File

@@ -1,13 +1,41 @@
--- **Functional** -- Provides defensive behaviour to a set of SAM sites within a running Mission.
--- **Functional** -- Make SAM sites execute evasive and defensive behaviour when being fired upon.
--
-- ===
--
-- ## Features:
--
-- * When SAM sites are being fired upon, the SAMs will take evasive action will reposition themselves when possible.
-- * When SAM sites are being fired upon, the SAMs will take defensive action by shutting down their radars.
--
-- ===
--
-- ## Missions:
--
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SEV%20-%20SEAD%20Evasion)
--
-- ===
--
-- ### Authors: **FlightControl**
--
-- ===
--
-- @module Functional.Sead
-- @image SEAD.JPG
--- The SEAD class
-- @type SEAD
--- @type SEAD
-- @extends Core.Base#BASE
--- Make SAM sites execute evasive and defensive behaviour when being fired upon.
--
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
--
-- # Constructor:
--
-- Use the @{#SEAD.New}() constructor to create a new SEAD object.
--
-- SEAD_RU_SAM_Defenses = SEAD:New( { 'RU SA-6 Kub', 'RU SA-6 Defenses', 'RU MI-26 Troops', 'RU Attack Gori' } )
--
-- @field #SEAD
SEAD = {
ClassName = "SEAD",
TargetSkill = {

View File

@@ -1,7 +1,18 @@
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- **Functional** - (R2.4) Suppress fire of ground units when they get hit.
--- **Functional** - Suppress fire of ground units when they get hit.
--
-- ====
-- ===
--
-- ## Features:
--
-- * Hold fire of attacked units when being fired upon.
--
-- ===
--
-- ## Missions:
--
-- ## [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ===
--
-- When ground units get hit by (suppressive) enemy fire, they will not be able to shoot back for a certain amount of time.
--
@@ -12,12 +23,6 @@
--
-- ====
--
-- # Demo Missions
--
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ====
--
-- # YouTube Channel
--
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
@@ -28,7 +33,8 @@
--
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
--
-- ====
-- ===
--
-- @module Functional.Suppression
-- @image Suppression.JPG

View File

@@ -1,10 +1,8 @@
--- **Functional** - (R2.4) - Simulation of logistic operations.
--- **Functional** - Simulation of logistic operations.
--
-- The MOOSE warehouse concept simulates the organization and implementation of complex operations regarding the flow of assets between the point of origin and the point of consumption
-- in order to meet requirements of a potential conflict. In particular, this class is concerned with maintaining army supply lines while disrupting those of the enemy, since an armed
-- force without resources and transportation is defenseless.
-- ===
--
-- Features:
-- ## Features:
--
-- * Holds (virtual) assests in stock and spawns them upon request.
-- * Manages requests of assets from other warehouses.
@@ -16,13 +14,25 @@
-- * Possibility to hook into events and customize actions.
-- * Can be easily interfaced to other MOOSE classes.
--
-- Please not that his class is work in progress and in an **alpha** stage.
-- ===
--
-- ## Missions:
--
-- ===
--
-- The MOOSE warehouse concept simulates the organization and implementation of complex operations regarding the flow of assets between the point of origin and the point of consumption
-- in order to meet requirements of a potential conflict. In particular, this class is concerned with maintaining army supply lines while disrupting those of the enemy, since an armed
-- force without resources and transportation is defenseless.
--
-- Please note that his class is work in progress and in an **alpha** stage.
--
-- ===
--
-- ### Author: **funkyfranky**
-- ### Co-author: FlightControl (cargo dispatcher classes)
--
-- ===
--
-- @module Functional.Warehouse
-- @image MOOSE.JPG
@@ -54,14 +64,13 @@
-- @field #table shippinglanes Table holding the user defined shipping between warehouses.
-- @field #table offroadpaths Table holding user defined paths from one warehouse to another.
-- @field #boolean autodefence When the warehouse is under attack, automatically spawn assets to defend the warehouse.
-- @field #number spawnzonemaxdist Max distance between warehouse and spawn zone. Default 5000 meters.
-- @extends Core.Fsm#FSM
--- Have your assets at the right place at the right time - or not!
--
-- ===
--
-- ![Banner Image](..\Presentations\WAREHOUSE\Warehouse_Main.png)
--
-- # The Warehouse Concept
--
-- The MOOSE warehouse adds a new logistic component to the DCS World. *Assets*, i.e. ground, airborne and naval units, can be transferred from one place
@@ -137,7 +146,7 @@
--
-- # Adding Assets
--
-- Assets can be added to the warehouse stock by using the @{#WAREHOUSE.AddAsset}(*group*, *ngroups*, *forceattribute*, *forcecargobay*, *forceweight*, *loadradius*) function.
-- Assets can be added to the warehouse stock by using the @{#WAREHOUSE.AddAsset}(*group*, *ngroups*, *forceattribute*, *forcecargobay*, *forceweight*, *loadradius*, *skill*, *liveries*, *assignment*) function.
-- The parameter *group* has to be a MOOSE @{Wrapper.Group#GROUP}. This is also the only mandatory parameters. All other parameters are optional and can be used for fine tuning if
-- nessary. The parameter *ngroups* specifies how many clones of this group are added to the stock.
--
@@ -150,8 +159,8 @@
-- Also note that the coalition of the template group (red, blue or neutral) does not matter. The coalition of the assets is determined by the coalition of the warehouse owner.
-- In other words, it is no problem to add red groups to blue warehouses and vice versa. The assets will automatically have the coalition of the warehouse.
--
-- You can add assets with a delay by using the @{#WAREHOUSE.__AddAsset}(*delay*, *group*, *ngroups*, *foceattribute*, *forcecargobay*, *forceweight*, *loadradius*), where *delay*
-- is the delay in seconds before the asset is added.
-- You can add assets with a delay by using the @{#WAREHOUSE.__AddAsset}(*delay*, *group*, *ngroups*, *forceattribute*, *forcecargobay*, *forceweight*, *loadradius*, *skill*, *liveries*, *assignment*),
-- where *delay* is the delay in seconds before the asset is added.
--
-- In game, the warehouse will get a mark which is regularly updated and showing the currently available assets in stock.
--
@@ -205,6 +214,54 @@
--
-- Adding the asset like this will cause the units to be loaded into the carrier already at a distance of 250 meters.
--
-- ### Setting the AI Skill
--
-- By default, the asset has the skill of its template group. The optional parameter *skill* allows to set a different skill when the asset is added. See the
-- [hoggit page](https://wiki.hoggitworld.com/view/DCS_enum_AI) possible values of this enumerator.
-- For example you can use
--
-- warehouseBatumi:AddAsset("Leopard 2", nil, nil, nil, nil, nil, AI.Skill.EXCELLENT)
--
-- do set the skill of the asset to excellent.
--
-- ### Setting Liveries
--
-- By default ,the asset uses the livery of its template group. The optional parameter *liveries* allows to define one or multiple liveries.
-- If multiple liveries are given in form of a table of livery names, each asset gets a random one.
--
-- For example
--
-- warehouseBatumi:AddAsset("Mi-8", nil, nil, nil, nil, nil, nil, "China UN")
--
-- would spawn the asset with a chinese UN livery.
--
-- Or
--
-- warehouseBatumi:AddAsset("Mi-8", nil, nil, nil, nil, nil, nil, {"China UN", "German"})
--
-- would spawn the asset with either a chinese UN or German livery. Mind the curly brackets **{}** when you want to specify multiple liveries.
--
-- Four each unit type, the livery names can be found in the DCS root folder under Bazar\Liveries. You have to use the name of the livery subdirectory. The names of the liveries
-- as displayed in the mission editor might be different and won't work in general.
--
-- ### Setting an Assignment
--
-- Assets can be added with a specific assignment given as a text, e.g.
--
-- warehouseBatumi:AddAsset("Mi-8", nil, nil, nil, nil, nil, nil, nil, "Go to Warehouse Kobuleti")
--
-- This is helpful to establish supply chains once an asset has arrived at its (first) destination and is meant to be forwarded to another warehouse.
--
-- ## Retrieving the Asset
--
-- Once a an asset is added to a warehouse, the @{#WAREHOUSE.NewAsset} event is triggered. You can hook into this event with the @{#WAREHOUSE.OnAfterNewAsset}(*asset*, *assignment*) function.
--
-- The first parameter *asset* is a table of type @{#WAREHOUSE.Assetitem} and contains a lot of information about the asset. The seconed parameter *assignment* is optional and is the specific
-- assignment the asset got when it was added.
--
-- Note that the assignment is can also be the assignment that was specified when adding a request (see next section). Once an asset that was requested from another warehouse and an assignment
-- was specified in the @{#WAREHOUSE.AddRequest} function, the assignment can be checked when the asset has arrived and is added to the receiving warehouse.
--
-- ===
--
-- # Requesting Assets
@@ -606,6 +663,7 @@
-- * "Attacked" --> "Captured" --> "Running" (warehouse was captured by the enemy)
-- * "*" --> "AirbaseCaptured" --> "*" (airbase belonging to the warehouse was captured by the enemy)
-- * "*" --> "AirbaseRecaptured" --> "*" (airbase was re-captured)
-- * "*" --> "AssetDead" --> "*" (a whole asset group is dead)
-- * "*" --> "Destroyed" --> "Destroyed" (warehouse was destroyed)
-- * "Running" --> "Pause" --> "Paused" (warehouse is paused)
-- * "Paused" --> "Unpause" --> "Running" (warehouse is unpaused)
@@ -872,7 +930,7 @@
--
-- -- Big explosion at the warehose. It has a very nice damage model by the way :)
-- local function DestroyWarehouse()
-- warehouse.Batumi.warehouse:GetCoordinate():Explosion(999)
-- warehouse.Batumi:GetCoordinate():Explosion(999)
-- end
-- SCHEDULER:New(nil, DestroyWarehouse, {}, 30)
--
@@ -935,9 +993,9 @@
-- -- Get Number of ships at Batumi.
-- local nships=warehouse.Batumi:GetNumberOfAssets(WAREHOUSE.Descriptor.CATEGORY, Group.Category.SHIP)
--
-- -- Send one ship every 5 minutes.
-- -- Send one ship every 3 minutes (ships do not evade each other well, so we need a bit space between them).
-- for i=1, nships do
-- warehouse.Batumi:__AddRequest(300*(i-1)+10, warehouse.Kobuleti, WAREHOUSE.Descriptor.CATEGORY, Group.Category.SHIP, 1)
-- warehouse.Batumi:__AddRequest(180*(i-1)+10, warehouse.Kobuleti, WAREHOUSE.Descriptor.CATEGORY, Group.Category.SHIP, 1)
-- end
--
-- ## Example 10: Warehouse on Aircraft Carrier
@@ -1001,7 +1059,6 @@
--
-- --- Function called after self request
-- function warehouse.Stennis:OnAfterSelfRequest(From, Event, To,_groupset, request)
--
-- local groupset=_groupset --Core.Set#SET_GROUP
-- local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
--
@@ -1216,15 +1273,14 @@
-- for _,_group in pairs(groupset:GetSet()) do
-- local group=_group --Wrapper.Group#GROUP
--
-- -- Start uncontrolled aircraft.
-- group:StartUncontrolled()
-- group:SmokeBlue()
--
-- -- Target coordinate!
-- local ToCoord=warehouse.Sukhumi:GetCoordinate()
-- ToCoord.y=5000 -- Adjust altitude
-- local ToCoord=warehouse.Sukhumi:GetCoordinate():SetAltitude(5000)
--
-- local FoCoord=warehouse.Kobuleti:GetCoordinate()
-- FoCoord.y=3000 -- Ajust altitude.
-- -- Home coordinate.
-- local HomeCoord=warehouse.Kobuleti:GetCoordinate():SetAltitude(3000)
--
-- -- Task bomb Sukhumi warehouse using all bombs (2032) from direction 180 at altitude 5000 m.
-- local task=group:TaskBombing(warehouse.Sukhumi:GetCoordinate():GetVec2(), false, "All", nil , 180, 5000, 2032)
@@ -1237,7 +1293,7 @@
-- -- Begin bombing run 20 km south of target.
-- WayPoints[2]=ToCoord:Translate(20*1000, 180):WaypointAirTurningPoint(nil, 600, {task}, "Bombing Run")
-- -- Return to base.
-- WayPoints[3]=FoCoord:WaypointAirTurningPoint()
-- WayPoints[3]=HomeCoord:WaypointAirTurningPoint()
-- -- Land at homebase. Bombers are added back to stock and can be employed in later assignments.
-- WayPoints[4]=warehouse.Kobuleti:GetCoordinate():WaypointAirLanding()
--
@@ -1262,6 +1318,7 @@
-- -- Define a polygon zone as spawn zone at Kobuleti.
-- warehouse.Kobuleti:SetSpawnZone(ZONE_POLYGON:New("Warehouse Kobuleti Spawn Zone", GROUP:FindByName("Warehouse Kobuleti Spawn Zone")))
--
-- -- Add assets.
-- warehouse.Kobuleti:AddAsset("M978", 20)
-- warehouse.London:AddAsset("M818", 20)
--
@@ -1275,6 +1332,129 @@
-- -- Kobuleti requests all available trucks from London.
-- warehouse.London:AddRequest(warehouse.Kobuleti, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_TRUCK, WAREHOUSE.Quantity.HALF)
--
-- ## Example 16: Resupply of Dead Assets
--
-- Warehouse at FARP Berlin is located at the front line and sends infantry groups to the battle zone.
-- Whenever a group dies, a new group is send from the warehouse to the battle zone.
-- Additionally, for each dead group, Berlin requests resupply from Batumi.
--
-- -- Start warehouses.
-- warehouse.Batumi:Start()
-- warehouse.Berlin:Start()
--
-- -- Front line warehouse.
-- warehouse.Berlin:AddAsset("Infantry Platoon Alpha", 6)
--
-- -- Resupply warehouse.
-- warehouse.Batumi:AddAsset("Infantry Platoon Alpha", 50)
--
-- -- Battle zone near FARP Berlin. This is where the action is!
-- local BattleZone=ZONE:New("Virtual Battle Zone")
--
-- -- Send infantry groups to the battle zone. Two groups every ~60 seconds.
-- for i=1,2 do
-- local time=(i-1)*60+10
-- warehouse.Berlin:__AddRequest(time, warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 2, nil, nil, nil, "To Battle Zone")
-- end
--
-- -- Take care of the spawned units.
-- function warehouse.Berlin:OnAfterSelfRequest(From,Event,To,groupset,request)
-- local groupset=groupset --Core.Set#SET_GROUP
-- local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
--
-- -- Get assignment of this request.
-- local assignment=warehouse.Berlin:GetAssignment(request)
--
-- if assignment=="To Battle Zone" then
--
-- for _,group in pairs(groupset:GetSet()) do
-- local group=group --Wrapper.Group#GROUP
--
-- -- Route group to Battle zone.
-- local ToCoord=BattleZone:GetRandomCoordinate()
-- group:RouteGroundOnRoad(ToCoord, group:GetSpeedMax()*0.8)
--
-- -- After 3-5 minutes we create an explosion to destroy the group.
-- SCHEDULER:New(nil, Explosion, {group, 50}, math.random(180, 300))
-- end
--
-- end
--
-- end
--
-- -- An asset has died ==> request resupply for it.
-- function warehouse.Berlin:OnAfterAssetDead(From, Event, To, asset, request)
-- local asset=asset --Functional.Warehouse#WAREHOUSE.Assetitem
-- local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
--
-- -- Get assignment.
-- local assignment=warehouse.Berlin:GetAssignment(request)
--
-- -- Request resupply for dead asset from Batumi.
-- warehouse.Batumi:AddRequest(warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, asset.attribute, nil, nil, nil, nil, "Resupply")
--
-- -- Send asset to Battle zone either now or when they arrive.
-- warehouse.Berlin:AddRequest(warehouse.Berlin, WAREHOUSE.Descriptor.ATTRIBUTE, asset.attribute, 1, nil, nil, nil, assignment)
-- end
--
-- ## Example 17: Supply Chains
--
-- Our remote warehouse "Pampa" south of Batumi needs assets but does not have any air infrastructure (FARP or airdrome).
-- Leopard 2 tanks are transported from Kobuleti to Batumi using two C-17As. From there they go be themselfs to Pampa.
-- Eight infantry groups and two mortar groups are also being transferred from Kobuleti to Batumi by helicopter.
-- The infantry has a higher priority and will be transported first using all available Mi-8 helicopters.
-- Once infantry has arrived at Batumi, it will walk by itself to warehouse Pampa.
-- The mortars can only be transported once the Mi-8 helos are available again, i.e. when the infantry has been delivered.
-- Once the mortars arrive at Batumi, they will be transported by APCs to Pampa.
--
-- -- Start warehouses.
-- warehouse.Kobuleti:Start()
-- warehouse.Batumi:Start()
-- warehouse.Pampa:Start()
--
-- -- Add assets to Kobuleti warehouse, which is our main hub.
-- warehouse.Kobuleti:AddAsset("C-130", 2)
-- warehouse.Kobuleti:AddAsset("C-17A", 2, nil, 77000)
-- warehouse.Kobuleti:AddAsset("Mi-8", 2, WAREHOUSE.Attribute.AIR_TRANSPORTHELO, nil, nil, nil, AI.Skill.EXCELLENT, {"Germany", "United Kingdom"})
-- warehouse.Kobuleti:AddAsset("Leopard 2", 10, nil, nil, 62000, 500)
-- warehouse.Kobuleti:AddAsset("Mortar Alpha", 10, nil, nil, 210)
-- warehouse.Kobuleti:AddAsset("Infantry Platoon Alpha", 20)
--
-- -- Transports at Batumi.
-- warehouse.Batumi:AddAsset("SPz Marder", 2)
-- warehouse.Batumi:AddAsset("TPz Fuchs", 2)
--
-- -- Tanks transported by plane from from Kobuleti to Batumi.
-- warehouse.Kobuleti:AddRequest(warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_TANK, 2, WAREHOUSE.TransportType.AIRPLANE, 2, 10, "Assets for Pampa")
-- -- Artillery transported by helicopter from Kobuleti to Batumi.
-- warehouse.Kobuleti:AddRequest(warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_ARTILLERY, 2, WAREHOUSE.TransportType.HELICOPTER, 2, 30, "Assets for Pampa via APC")
-- -- Infantry transported by helicopter from Kobuleti to Batumi.
-- warehouse.Kobuleti:AddRequest(warehouse.Batumi, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 8, WAREHOUSE.TransportType.HELICOPTER, 2, 20, "Assets for Pampa")
--
-- --- Function handling assets delivered from Kobuleti warehouse.
-- function warehouse.Kobuleti:OnAfterDelivered(From, Event, To, request)
-- local request=request --Functional.Warehouse#WAREHOUSE.Pendingitem
--
-- -- Get assignment.
-- local assignment=warehouse.Kobuleti:GetAssignment(request)
--
-- -- Check if these assets were meant for Warehouse Pampa.
-- if assignment=="Assets for Pampa via APC" then
-- -- Forward everything that arrived at Batumi to Pampa via APC.
-- warehouse.Batumi:AddRequest(warehouse.Pampa, WAREHOUSE.Descriptor.ATTRIBUTE, request.cargoattribute, request.ndelivered, WAREHOUSE.TransportType.APC, WAREHOUSE.Quantity.ALL)
-- end
-- end
--
-- -- Forward all mobile ground assets to Pampa once they arrived.
-- function warehouse.Batumi:OnAfterNewAsset(From, Event, To, asset, assignment)
-- local asset=asset --Functional.Warehouse#WAREHOUSE.Assetitem
-- if assignment=="Assets for Pampa" then
-- if asset.category==Group.Category.GROUND and asset.speedmax>0 then
-- warehouse.Batumi:AddRequest(warehouse.Pampa, WAREHOUSE.Descriptor.GROUPNAME, asset.templatename)
-- end
-- end
-- end
--
--
-- @field #WAREHOUSE
WAREHOUSE = {
@@ -1304,6 +1484,7 @@ WAREHOUSE = {
shippinglanes = {},
offroadpaths = {},
autodefence = false,
spawnzonemaxdist = 5000,
}
--- Item of the warehouse stock table.
@@ -1324,6 +1505,8 @@ WAREHOUSE = {
-- @field #number cargobaytot Total weight in kg that fits in the cargo bay of all asset group units.
-- @field #number cargobaymax Largest cargo bay of all units in the group.
-- @field #number loadradius Distance when cargo is loaded into the carrier.
-- @field DCS#AI.Skill skill Skill of AI unit.
-- @field #string livery Livery of the asset.
--- Item of the warehouse queue table.
-- @type WAREHOUSE.Queueitem
@@ -1350,6 +1533,7 @@ WAREHOUSE = {
--- Item of the warehouse pending queue table.
-- @type WAREHOUSE.Pendingitem
-- @field #number timestamp Absolute mission time in seconds when the request was processed.
-- @field #table assetproblem Table with assets that might have problems (damage or stuck).
-- @field Core.Set#SET_GROUP cargogroupset Set of cargo groups do be delivered.
-- @field #number ndelivered Number of groups delivered to destination.
-- @field Core.Set#SET_GROUP transportgroupset Set of cargo transport carrier groups.
@@ -1471,7 +1655,7 @@ WAREHOUSE.db = {
--- Warehouse class version.
-- @field #string version
WAREHOUSE.version="0.5.5"
WAREHOUSE.version="0.6.1"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: Warehouse todo list.
@@ -1673,6 +1857,9 @@ function WAREHOUSE:New(warehouse, alias)
-- @param #number forcecargobay (Optional) Explicitly force cargobay weight limit in kg for cargo carriers. This is for each *unit* of the group.
-- @param #number forceweight (Optional) Explicitly force weight in kg of each unit in the group.
-- @param #number loadradius (Optional) The distance in meters when the cargo is loaded into the carrier. Default is the bounding box size of the carrier.
-- @param DCS#AI.Skill skill Skill of the asset.
-- @param #table liveries Table of livery names. When the asset is spawned one livery is chosen randomly.
-- @param #string assignment A free to choose string specifying an assignment for the asset. This can be used with the @{#WAREHOUSE.OnAfterNewAsset} function.
--- Trigger the FSM event "AddAsset" with a delay. Add a group to the warehouse stock.
-- @function [parent=#WAREHOUSE] __AddAsset
@@ -1684,18 +1871,23 @@ function WAREHOUSE:New(warehouse, alias)
-- @param #number forcecargobay (Optional) Explicitly force cargobay weight limit in kg for cargo carriers. This is for each *unit* of the group.
-- @param #number forceweight (Optional) Explicitly force weight in kg of each unit in the group.
-- @param #number loadradius (Optional) The distance in meters when the cargo is loaded into the carrier. Default is the bounding box size of the carrier.
-- @param DCS#AI.Skill skill Skill of the asset.
-- @param #table liveries Table of livery names. When the asset is spawned one livery is chosen randomly.
-- @param #string assignment A free to choose string specifying an assignment for the asset. This can be used with the @{#WAREHOUSE.OnAfterNewAsset} function.
--- Triggers the FSM event "NewAsset" when a new asset has been added to the warehouse stock.
-- @function [parent=#WAREHOUSE] NewAsset
-- @param #WAREHOUSE self
-- @param #number delay Delay in seconds.
-- @param #WAREHOUSE.Assetitem asset The new asset.
--- Triggers the FSM delayed event "NewAsset" when a new asset has been added to the warehouse stock.
-- @function [parent=#WAREHOUSE] NewAsset
-- @param #WAREHOUSE self
-- @param #WAREHOUSE.Assetitem asset The new asset.
-- @param #string assignment (Optional) Assignment text for the asset.
--- Triggers the FSM delayed event "NewAsset" when a new asset has been added to the warehouse stock.
-- @function [parent=#WAREHOUSE] __NewAsset
-- @param #WAREHOUSE self
-- @param #number delay Delay in seconds.
-- @param #WAREHOUSE.Assetitem asset The new asset.
-- @param #string assignment (Optional) Assignment text for the asset.
--- On after "NewAsset" event user function. A new asset has been added to the warehouse stock.
-- @function [parent=#WAREHOUSE] OnAfterNewAsset
@@ -1703,7 +1895,8 @@ function WAREHOUSE:New(warehouse, alias)
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param #WAREHOUSE.Assetitem asset The asset that has just been added
-- @param #WAREHOUSE.Assetitem asset The asset that has just been added.
-- @param #string assignment (Optional) Assignment text for the asset.
--- Triggers the FSM event "AddRequest". Add a request to the warehouse queue, which is processed when possible.
@@ -2031,12 +2224,15 @@ end
--- Set a zone where the (ground) assets of the warehouse are spawned once requested.
-- @param #WAREHOUSE self
-- @param Core.Zone#ZONE zone The spawn zone.
-- @param #number maxdist (Optional) Maximum distance in meters between spawn zone and warehouse. Units are not spawned if distance is larger. Default is 5000 m.
-- @return #WAREHOUSE self
function WAREHOUSE:SetSpawnZone(zone)
function WAREHOUSE:SetSpawnZone(zone, maxdist)
self.spawnzone=zone
self.spawnzonemaxdist=maxdist or 5000
return self
end
--- Set a warehouse zone. If this zone is captured, the warehouse and all its assets fall into the hands of the enemy.
-- @param #WAREHOUSE self
-- @param Core.Zone#ZONE zone The warehouse zone. Note that this **cannot** be a polygon zone!
@@ -2425,20 +2621,21 @@ function WAREHOUSE:HasConnectionOffRoad(warehouse, markpath, smokepath)
end
--- Get number of assets in warehouse stock.
--- Get number of assets in warehouse stock. Optionally, only specific assets can be counted.
-- @param #WAREHOUSE self
-- @param #string Descriptor (Optional) Descriptor return the number of a specifc asset type. See @{#WAREHOUSE.Descriptor} for possible values.
-- @param DescriptorValue (Optional) Descriptor value selecting the type of assets.
-- @param #boolean OnlyMobile (Optional) If true only mobile units are considered.
-- @return #number Number of assets in stock.
function WAREHOUSE:GetNumberOfAssets(Descriptor, DescriptorValue)
function WAREHOUSE:GetNumberOfAssets(Descriptor, DescriptorValue, OnlyMobile)
if Descriptor==nil or DescriptorValue==nil then
-- Selected assets.
local _stock,_nstock=self:_FilterStock(self.stock, Descriptor, DescriptorValue)
return _nstock
else
-- All assets.
return #self.stock
else
-- Selected assets.
local _stock,_nstock=self:_FilterStock(self.stock, Descriptor, DescriptorValue, nil, OnlyMobile)
return _nstock
end
end
@@ -2533,6 +2730,87 @@ function WAREHOUSE:FindWarehouseInDB(uid)
return WAREHOUSE.db.Warehouses[uid]
end
--- Find nearest warehouse in service, i.e. warehouses which are not started, stopped or destroyed are not considered.
-- Optionally, only warehouses with (specific) assets can be included in the search or warehouses of a certain coalition.
-- @param #WAREHOUSE self
-- @param MinAssets (Optional) Minimum number of assets the warehouse should have. Default 0.
-- @param #string Descriptor (Optional) Descriptor describing the selected assets which should be in stock. See @{#WAREHOUSE.Descriptor} for possible values.
-- @param DescriptorValue (Optional) Descriptor value selecting the type of assets which should be in stock.
-- @param DCS#Coalition.side Coalition (Optional) Coalition side of the warehouse. Default is the same coaliton as the present warehouse. Set to false for any coalition.
-- @param Core.Point#COORDINATE RefCoordinate (Optional) Coordinate to which the closest warehouse is searched. Default is the warehouse calling this function.
-- @return #WAREHOUSE The the nearest warehouse object. Or nil if no warehouse is found.
-- @return #number The distance to the nearest warehouse in meters. Or nil if no warehouse is found.
function WAREHOUSE:FindNearestWarehouse(MinAssets, Descriptor, DescriptorValue, Coalition, RefCoordinate)
-- Defaults
if Descriptor~=nil and DescriptorValue~=nil then
MinAssets=MinAssets or 1
else
MinAssets=MinAssets or 0
end
-- Coalition - default only the same as this warehouse.
local anycoalition=nil
if Coalition~=nil then
if Coalition==false then
anycoalition=true
else
-- Nothing to do
end
else
if self~=nil then
Coalition=self:GetCoalition()
else
anycoalition=true
end
end
-- Coordinate of this warehouse or user specified reference.
local coord=RefCoordinate or self:GetCoordinate()
-- Loop over all warehouses.
local nearest=nil
local distmin=nil
for wid,warehouse in pairs(WAREHOUSE.db.Warehouses) do
local warehouse=warehouse --#WAREHOUSE
-- Distance from this warehouse to the other warehouse.
local dist=coord:Get2DDistance(warehouse:GetCoordinate())
if dist>0 then
-- Check if coalition is right.
local samecoalition=anycoalition or Coalition==warehouse:GetCoalition()
-- Check that warehouse is in service.
if samecoalition and not (warehouse:IsNotReadyYet() or warehouse:IsStopped() or warehouse:IsDestroyed()) then
-- Get number of assets. Whole stock is returned if no descriptor/value is given.
local nassets=warehouse:GetNumberOfAssets(Descriptor, DescriptorValue)
--env.info(string.format(" FF warehouse %s nassets = %d for %s=%s", warehouse.alias, nassets, tostring(Descriptor), tostring(DescriptorValue)))
-- Assume we have enough.
local enough=true
-- If specifc assets need to be present...
if Descriptor and DescriptorValue then
-- Check that enough assets (default 1) are available.
enough = nassets>=MinAssets
end
-- Check distance.
if enough and (distmin==nil or dist<distmin) then
distmin=dist
nearest=warehouse
end
end
end
end
return nearest, distmin
end
--- Find an asset in the the global warehouse data base. Parameter is the MOOSE group object.
-- Note that the group name must contain they "AID" keyword.
-- @param #WAREHOUSE self
@@ -2586,6 +2864,8 @@ function WAREHOUSE:onafterStart(From, Event, To)
self.spawnzone:BoundZone(30, self.country)
]]
--self.spawnzone:GetCoordinate():MarkToCoalition(string.format("Warehouse %s spawn zone", self.alias), self:GetCoalition())
-- Get the closest point on road wrt spawnzone of ground assets.
local _road=self.spawnzone:GetCoordinate():GetClosestPointToRoad()
if _road and self.road==nil then
@@ -2632,7 +2912,6 @@ function WAREHOUSE:onafterStart(From, Event, To)
-- Start the status monitoring.
self:__Status(-1)
end
--- On after "Stop" event. Stops the warehouse, unhandles all events.
@@ -2795,8 +3074,8 @@ function WAREHOUSE:_JobDone()
---------------
-- Info on job.
local text=string.format("Warehouse %s: Job on request id=%d done!\n", self.alias, request.uid)
text=text..string.format("- %d of %d assets delivered to %s. Casualties %d.", ncargodelivered, ncargotot, request.warehouse.alias, ncargodead)
local text=string.format("Warehouse %s: Job on request id=%d for warehouse %s done!\n", self.alias, request.uid, request.warehouse.alias)
text=text..string.format("- %d of %d assets delivered. Casualties %d.", ncargodelivered, ncargotot, ncargodead)
if request.ntransport>0 then
text=text..string.format("\n- %d of %d transports returned home. Casualties %d.", ntransporthome, ntransporttot, ntransportdead)
end
@@ -2877,8 +3156,7 @@ function WAREHOUSE:_JobDone()
-- Still cargo but no transports --
-----------------------------------
-- Info message.
self:_InfoMessage(string.format("Warehouse %s: All transports of request id=%s dead! Putting remaining %s cargo assets back into warehouse!", self.alias, request.uid, ncargo))
local ncargoalive=0
-- All transports are dead but there is still cargo left ==> Put cargo back into stock.
for _,_group in pairs(request.cargogroupset:GetSetObjects()) do
@@ -2899,10 +3177,14 @@ function WAREHOUSE:_JobDone()
end
-- Add asset group back to stock.
self:AddAsset(group)
ncargoalive=ncargoalive+1
end
end
end
-- Info message.
self:_InfoMessage(string.format("Warehouse %s: All transports of request id=%s dead! Putting remaining %s cargo assets back into warehouse!", self.alias, request.uid, ncargoalive))
end
end
@@ -2914,6 +3196,84 @@ function WAREHOUSE:_JobDone()
self:_DeleteQueueItem(request, self.pending)
end
end
--- Function that checks if an asset group is still okay.
-- @param #WAREHOUSE self
function WAREHOUSE:_CheckAssetStatus()
-- Check if a unit of the group has problems.
local function _CheckGroup(_request, _group)
local request=_request --#WAREHOUSE.Pendingitem
local group=_group --Wrapper.Group#GROUP
if group and group:IsAlive() then
-- Category of group.
local category=group:GetCategory()
for _,_unit in pairs(group:GetUnits()) do
local unit=_unit --Wrapper.Unit#UNIT
if unit and unit:IsAlive() then
local unitid=unit:GetID()
local life9=unit:GetLife()
local life0=unit:GetLife0()
local life=life9/life0*100
local speed=unit:GetVelocityMPS()
local onground=unit:InAir()
local problem=false
if life<10 then
self:T(string.format("Unit %s is heavily damaged!", unit:GetName()))
end
if speed<1 and unit:GetSpeedMax()>1 and onground then
self:T(string.format("Unit %s is not moving!", unit:GetName()))
problem=true
end
if problem then
if request.assetproblem[unitid] then
local deltaT=timer.getAbsTime()-request.assetproblem[unitid]
if deltaT>300 then
--Todo: which event to generate? Removeunit or Dead/Creash or both?
unit:Destroy()
end
else
request.assetproblem[unitid]=timer.getAbsTime()
end
end
end
end
end
end
for _,request in pairs(self.pending) do
local request=request --#WAREHOUSE.Pendingitem
-- Cargo groups.
if request.cargogroupset then
for _,_group in pairs(request.cargogroupset:GetSet()) do
local group=_group --Wrapper.Group#GROUP
_CheckGroup(request, group)
end
end
-- Transport groups.
if request.transportgroupset then
for _,group in pairs(request.transportgroupset:GetSet()) do
_CheckGroup(request, group)
end
end
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- On after "AddAsset" event. Add a group to the warehouse stock. If the group is alive, it is destroyed.
@@ -2927,7 +3287,10 @@ end
-- @param #number forcecargobay (Optional) Explicitly force cargobay weight limit in kg for cargo carriers. This is for each *unit* of the group.
-- @param #number forceweight (Optional) Explicitly force weight in kg of each unit in the group.
-- @param #number loadradius (Optional) Radius in meters when the cargo is loaded into the carrier.
function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribute, forcecargobay, forceweight, loadradius)
-- @param DCS#AI.Skill skill Skill of the asset.
-- @param #table liveries Table of livery names. When the asset is spawned one livery is chosen randomly.
-- @param #string assignment A free to choose string specifying an assignment for the asset. This can be used with the @{#WAREHOUSE.OnAfterNewAsset} function.
function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribute, forcecargobay, forceweight, loadradius, skill, liveries, assignment)
self:T({group=group, ngroups=ngroups, forceattribute=forceattribute, forcecargobay=forcecargobay, forceweight=forceweight})
-- Set default.
@@ -2938,6 +3301,9 @@ function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribu
group=GROUP:FindByName(group)
end
if liveries and type(liveries)=="string" then
liveries={liveries}
end
if group then
@@ -2970,17 +3336,30 @@ function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribu
end
end
-- If no assignment was given we take the assignment of the request if there is any.
if assignment==nil and request.assignment~=nil then
assignment=request.assignment
end
end
-- Get the asset from the global DB.
local asset=self:FindAssetInDB(group)
-- Set livery.
if liveries then
asset.livery=liveries[math.random(#liveries)]
end
-- Set skill.
asset.skill=skill
-- Note the group is only added once, i.e. the ngroups parameter is ignored here.
-- This is because usually these request comes from an asset that has been transfered from another warehouse and hence should only be added once.
if asset~=nil then
self:_DebugMessage(string.format("Warehouse %s: Adding KNOWN asset uid=%d with attribute=%s to stock.", self.alias, asset.uid, asset.attribute), 5)
table.insert(self.stock, asset)
self:NewAsset(asset)
self:NewAsset(asset, assignment or "")
else
self:_ErrorMessage(string.format("ERROR: Known asset could not be found in global warehouse db!"), 0)
end
@@ -2994,12 +3373,12 @@ function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribu
self:_DebugMessage(string.format("Warehouse %s: Adding %d NEW assets of group %s to stock.", self.alias, n, tostring(group:GetName())), 5)
-- This is a group that is not in the db yet. Add it n times.
local assets=self:_RegisterAsset(group, n, forceattribute, forcecargobay, forceweight, loadradius)
local assets=self:_RegisterAsset(group, n, forceattribute, forcecargobay, forceweight, loadradius, liveries, skill)
-- Add created assets to stock of this warehouse.
for _,asset in pairs(assets) do
table.insert(self.stock, asset)
self:NewAsset(asset)
self:NewAsset(asset, assignment or "")
end
end
@@ -3016,7 +3395,7 @@ function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribu
end
-- Update status.
self:__Status(-1)
--self:__Status(-1)
end
--- Register new asset in globase warehouse data base.
@@ -3027,8 +3406,10 @@ end
-- @param #number forcecargobay Cargo bay weight limit in kg.
-- @param #number forceweight Weight of units in kg.
-- @param #number loadradius Radius in meters when cargo is loaded into the carrier.
-- @param #table liveries Table of liveries.
-- @param DCS#AI.Skill skill Skill of AI.
-- @return #table A table containing all registered assets.
function WAREHOUSE:_RegisterAsset(group, ngroups, forceattribute, forcecargobay, forceweight, loadradius)
function WAREHOUSE:_RegisterAsset(group, ngroups, forceattribute, forcecargobay, forceweight, loadradius, liveries, skill)
self:F({groupname=group:GetName(), ngroups=ngroups, forceattribute=forceattribute, forcecargobay=forcecargobay, forceweight=forceweight})
-- Set default.
@@ -3124,6 +3505,10 @@ function WAREHOUSE:_RegisterAsset(group, ngroups, forceattribute, forcecargobay,
asset.cargobaytot=cargobaytot
asset.cargobaymax=cargobaymax
asset.loadradius=loadradius
if liveries then
asset.livery=liveries[math.random(#liveries)]
end
asset.skill=skill
if i==1 then
self:_AssetItemInfo(asset)
@@ -3156,7 +3541,9 @@ function WAREHOUSE:_AssetItemInfo(asset)
text=text..string.format("Weight total = %5.2f kg\n", asset.weight)
text=text..string.format("Cargo bay tot = %5.2f kg\n", asset.cargobaytot)
text=text..string.format("Cargo bay max = %5.2f kg\n", asset.cargobaymax)
text=text..string.format("Load radius = %s m", tostring(asset.loadradius))
text=text..string.format("Load radius = %s m\n", tostring(asset.loadradius))
text=text..string.format("Skill = %s\n", tostring(asset.skill))
text=text..string.format("Livery = %s", tostring(asset.livery))
self:T(self.wid..text)
self:T({DCSdesc=asset.DCSdesc})
self:T3({Template=asset.template})
@@ -3167,8 +3554,10 @@ end
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param #WAREHOUSE.Assetitem asset The asset that has just been added
function WAREHOUSE:onafterNewAsset(From, Event, To, asset)
-- @param #WAREHOUSE.Assetitem asset The asset that has just been added.
-- @parma #string assignment The (optional) assignment for the asset.
function WAREHOUSE:onafterNewAsset(From, Event, To, asset, assignment)
self:T(self.wid..string.format("New asset %s id=%d with assignment %s.", asset.templatename, asset.uid, assignment))
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -3317,7 +3706,7 @@ function WAREHOUSE:onafterAddRequest(From, Event, To, warehouse, AssetDescriptor
self:_DebugMessage(text, 5)
-- Update status
self:__Status(-1)
--self:__Status(-1)
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -3390,6 +3779,9 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
-- Set time stamp.
Pending.timestamp=timer.getAbsTime()
-- Init problem table.
Pending.assetproblem={}
-- Spawn assets of this request.
local _spawngroups=self:_SpawnAssetRequest(Pending) --Core.Set#SET_GROUP
@@ -3776,7 +4168,7 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
local warehouse=Carrier:GetState(Carrier, "WAREHOUSE") --#WAREHOUSE
-- Debug message.
local text=string.format("Carrier group %s loaded cargo %s into unit %s in pickup zone %s", Carrier:GetName(), Cargo:GetObject():GetName(), CarrierUnit:GetName(), PickupZone:GetName())
local text=string.format("Carrier group %s loaded cargo %s into unit %s in pickup zone %s", Carrier:GetName(), Cargo:GetName(), CarrierUnit:GetName(), PickupZone:GetName())
warehouse:T(warehouse.wid..text)
-- Get cargo group object.
@@ -3786,7 +4178,7 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
local request=warehouse:_GetRequestOfGroup(group, warehouse.pending)
-- Add cargo group to this carrier.
table.insert(request.carriercargo[CarrierUnit:GetName()], group)
table.insert(request.carriercargo[CarrierUnit:GetName()], warehouse:_GetNameWithOut(Cargo:GetName()))
end
@@ -3953,7 +4345,9 @@ function WAREHOUSE:onafterDelivered(From, Event, To, request)
self:_InfoMessage(text, 5)
-- Make some noise :)
if self.Debug then
self:_Fireworks(request.warehouse:GetCoordinate())
end
-- Set delivered status for this request uid.
self.delivered[request.uid]=true
@@ -4356,6 +4750,13 @@ function WAREHOUSE:_SpawnAssetGroundNaval(alias, asset, request, spawnzone, aiof
template.units[i].x = TX
template.units[i].y = TY
if asset.livery then
unit.livery_id = asset.livery
end
if asset.skill then
unit.skill= asset.skill
end
end
template.route.points[1].x = coord.x
@@ -4475,6 +4876,14 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
unit.parking = terminal
end
if asset.livery then
unit.livery_id = asset.livery
end
if asset.skill then
unit.skill= asset.skill
end
end
-- And template position.
@@ -5018,7 +5427,7 @@ function WAREHOUSE:_UnitDead(deadunit, request)
-- Not sure what this does actually and if it would be better to set it to true.
local NoTriggerEvent=false
local NoTriggerEvent=true
if request.transporttype==WAREHOUSE.TransportType.SELFPROPELLED then
@@ -5046,13 +5455,12 @@ function WAREHOUSE:_UnitDead(deadunit, request)
if istransport==true then
-- Get the carrier unit table holding the cargo groups inside this carrier.
local cargogroups=request.carriercargo[unitname]
local cargogroupnames=request.carriercargo[unitname]
if cargogroups then
if cargogroupnames then
-- Loop over all groups inside the destroyed carrier ==> all dead.
for _,cargogroup in pairs(cargogroups) do
local cargoname=self:_GetNameWithOut(cargogroup)
for _,cargoname in pairs(cargogroupnames) do
request.cargogroupset:Remove(cargoname, NoTriggerEvent)
self:T(self.wid..string.format("Removed transported cargo %s inside dead carrier %s: ncargo=%d", cargoname, unitname, request.cargogroupset:Count()))
end
@@ -5236,6 +5644,11 @@ function WAREHOUSE:_CheckConquered()
end
elseif self:GetCoalition()==coalition.side.NEUTRAL then
-- Neutrals dont attack!
if self:IsRunning() and Nred>0 then
self:Attacked(coalition.side.RED, CountryRed)
elseif self:IsRunning() and Nblue>0 then
self:Attacked(coalition.side.BLUE, CountryBlue)
end
end
end
@@ -5442,13 +5855,21 @@ function WAREHOUSE:_CheckRequestValid(request)
elseif asset_ground then
-- No ground assets directly to or from ships.
-- TODO: May needs refinement if warehouse is on land and requestor is ship in harbour?!
if (requestcategory==Airbase.Category.SHIP or self:GetAirbaseCategory()==Airbase.Category.SHIP) then
self:E("ERROR: Incorrect request. Ground asset requested but warehouse or requestor is SHIP!")
-- Check that both spawn zones are not in water.
local inwater=self.spawnzone:GetCoordinate():IsSurfaceTypeWater() or request.warehouse.spawnzone:GetCoordinate():IsSurfaceTypeWater()
if inwater then
self:E("ERROR: Incorrect request. Ground asset requested but at least one spawn zone is in water!")
valid=false
end
-- No ground assets directly to or from ships.
-- TODO: May needs refinement if warehouse is on land and requestor is ship in harbour?!
--if (requestcategory==Airbase.Category.SHIP or self:GetAirbaseCategory()==Airbase.Category.SHIP) then
-- self:E("ERROR: Incorrect request. Ground asset requested but warehouse or requestor is SHIP!")
-- valid=false
--end
if asset_train then
-- Check if there is a valid path on rail.
@@ -5635,7 +6056,6 @@ function WAREHOUSE:_CheckRequestNow(request)
-- Check if number of requested assets is in stock.
local _assets,_nassets,_enough=self:_FilterStock(self.stock, request.assetdesc, request.assetdescval, request.nasset, onlymobile)
local _transports
-- Check if enough assets are in stock.
if not _enough then
@@ -5646,12 +6066,16 @@ function WAREHOUSE:_CheckRequestNow(request)
return false
end
local _transports
local _assetattribute
local _assetcategory
-- Check if at least one (cargo) asset is available.
if _nassets>0 then
-- Get the attibute of the requested asset.
local _assetattribute=_assets[1].attribute
local _assetcategory=_assets[1].category
_assetattribute=_assets[1].attribute
_assetcategory=_assets[1].category
-- Check available parking for air asset units.
if self.airbase and (_assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER) then
@@ -5710,6 +6134,22 @@ function WAREHOUSE:_CheckRequestNow(request)
-- Self propelled case. Nothing to do for now.
-- Ground asset checks.
if _assetcategory==Group.Category.GROUND then
-- Distance between warehouse and spawn zone.
local dist=self.warehouse:GetCoordinate():Get2DDistance(self.spawnzone:GetCoordinate())
-- Check min dist to spawn zone.
if dist>self.spawnzonemaxdist then
-- Not close enough to spawn zone.
local text=string.format("Warehouse %s: Request denied! Not close enough to spawn zone. Distance = %d m. We need to be at least within %d m range to spawn.", self.alias, dist, self.spawnzonemaxdist)
self:_InfoMessage(text, 5)
return false
end
end
end
@@ -6289,7 +6729,12 @@ end
-- @return #string Name of the object without trailing #...
function WAREHOUSE:_GetNameWithOut(group)
if group then
local name=group:GetName()
local name
if type(group)=="string" then
name=group
else
name=group:GetName()
end
local namewithout=UTILS.Split(name, "#")[1]
if namewithout then
return namewithout
@@ -6297,8 +6742,12 @@ function WAREHOUSE:_GetNameWithOut(group)
return name
end
end
if type(group)=="string" then
return group
else
return group:GetName()
end
end
--- Get warehouse id, asset id and request id from group name (alias).

View File

@@ -1,14 +1,40 @@
--- **Functional** -- (R2.3) Models the process to zone guarding and capturing.
--- **Functional** -- Models the process to zone guarding and capturing.
--
-- ===
--
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAZ - Capture Zones)
-- ## Features:
--
-- - CAZ-000 - Capture Zone: Demonstrates the basic concept of capturing a zone.
-- * Models the possible state transitions between the Guarded, Attacked, Empty and Captured states.
-- * A zone has an owning coalition, that means that at a specific point in time, a zone can be owned by the red or blue coalition.
-- * Provide event handlers to tailor the actions when a zone changes coalition or state.
--
-- ===
--
-- ### [YouTube Playlist](https://www.youtube.com/watch?v=0m6K6Yxa-os&list=PL7ZUrU4zZUl0qqJsfa8DPvZWDY-OyDumE)
-- ## Missions:
--
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAZ%20-%20Capture%20Zones)
--
-- ===
--
-- # Player Experience
--
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia3.JPG)
--
-- The above models the possible state transitions between the **Guarded**, **Attacked**, **Empty** and **Captured** states.
-- A zone has an __owning coalition__, that means that at a specific point in time, a zone can be owned by the red or blue coalition.
--
-- The Zone can be in the state **Guarded** by the __owning coalition__, which is the coalition that initially occupies the zone with units of its coalition.
-- Once units of an other coalition are entering the Zone, the state will change to **Attacked**. As long as these units remain in the zone, the state keeps set to Attacked.
-- When all units are destroyed in the Zone, the state will change to **Empty**, which expresses that the Zone is empty, and can be captured.
-- When units of the other coalition are in the Zone, and no other units of the owning coalition is in the Zone, the Zone is captured, and its state will change to **Captured**.
--
-- The zone needs to be monitored regularly for the presence of units to interprete the correct state transition required.
-- This monitoring process MUST be started using the @{#ZONE_CAPTURE_COALITION.Start}() method.
-- Otherwise no monitoring will be active and the zone will stay in the current state forever.
--
-- ===
--
-- ## [YouTube Playlist](https://www.youtube.com/watch?v=0m6K6Yxa-os&list=PL7ZUrU4zZUl0qqJsfa8DPvZWDY-OyDumE)
--
-- ===
--
@@ -29,65 +55,76 @@ do -- ZONE_CAPTURE_COALITION
--- Models the process to capture a Zone for a Coalition, which is guarded by another Coalition.
-- This is a powerful concept that allows to create very dynamic missions based on the different state transitions of various zones.
--
-- ---
-- ===
--
-- ![Banner Image](..\Presentations\ZONE_CAPTURE_COALITION\Dia1.JPG)
-- In order to use ZONE_CAPTURE_COALITION, you need to:
--
-- ---
--
-- # 0. Player Experience
--
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia3.JPG)
--
-- The above models the possible state transitions between the **Guarded**, **Attacked**, **Empty** and **Captured** states.
-- A zone has an __owning coalition__, that means that at a specific point in time, a zone can be owned by the red or blue coalition.
--
-- The Zone can be in the state **Guarded** by the __owning coalition__, which is the coalition that initially occupies the zone with units of its coalition.
-- Once units of an other coalition are entering the Zone, the state will change to **Attacked**. As long as these units remain in the zone, the state keeps set to Attacked.
-- When all units are destroyed in the Zone, the state will change to **Empty**, which expresses that the Zone is empty, and can be captured.
-- When units of the other coalition are in the Zone, and no other units of the owning coalition is in the Zone, the Zone is captured, and its state will change to **Captured**.
--
-- The zone needs to be monitored regularly for the presence of units to interprete the correct state transition required.
-- This monitoring process MUST be started using the @{#ZONE_CAPTURE_COALITION.Start}() method.
-- Otherwise no monitoring will be active and the zone will stay in the current state forever.
-- See further in chapter 3.3 for more information about this.
--
-- ## 1. ZONE\_CAPTURE\_COALITION constructor
--
-- * @{#ZONE_CAPTURE_COALITION.New}(): Creates a new ZONE\_CAPTURE\_COALITION object.
--
-- In order to use ZONE\_CAPTURE\_COALITION, you need to:
--
-- - Create a @{Zone} object from one of the ZONE\_ classes. Note that ZONE\_POLYGON\_ classes are not yet functional. The only functional ZONE\_ classses are those derived from a ZONE\_RADIUS.
-- * Create a @{Zone} object from one of the ZONE_ classes.
-- Note that ZONE_POLYGON_ classes are not yet functional.
-- The only functional ZONE_ classses are those derived from a ZONE_RADIUS.
-- * Set the state of the zone. Most of the time, Guarded would be the initial state.
-- * Start the zone capturing **monitoring process**.
-- This will check the presence of friendly and/or enemy units within the zone and will transition the state of the zone when the tactical situation changed.
-- The frequency of the monitoring must not be real-time, a 30 second interval to execute the checks is sufficient.
--
-- ![New](..\Presentations\ZONE_CAPTURE_COALITION\Dia5.JPG)
--
-- Ensure that during the life cycle of the ZONE\_CAPTURE\_COALITION object, the object keeps alive.
-- It is best to declare the object globally within your script.
-- ### Important:
--
-- ## 2. ZONE\_CAPTURE\_COALITION is a finite state machine (FSM).
-- You must start the monitoring process within your code, or there won't be any state transition checks executed.
-- See further the start/stop monitoring process.
--
-- ### Important:
--
-- Ensure that the object containing the ZONE_CAPTURE_COALITION object is persistent.
-- Otherwise the garbage collector of lua will remove the object and the monitoring process will stop.
-- This will result in your object to be destroyed (removed) from internal memory and there won't be any zone state transitions anymore detected!
-- So use the `local` keyword in lua with thought! Most of the time, you can declare your object gobally.
--
--
--
-- # Example:
--
-- -- Define a new ZONE object, which is based on the trigger zone `CaptureZone`, which is defined within the mission editor.
-- CaptureZone = ZONE:New( "CaptureZone" )
--
-- -- Here we create a new ZONE_CAPTURE_COALITION object, using the :New constructor.
-- ZoneCaptureCoalition = ZONE_CAPTURE_COALITION:New( CaptureZone, coalition.side.RED )
--
-- -- Set the zone to Guarding state.
-- ZoneCaptureCoalition:__Guard( 1 )
--
-- -- Start the zone monitoring process in 30 seconds and check every 30 seconds.
-- ZoneCaptureCoalition:Start( 30, 30 )
--
--
-- # Constructor:
--
-- Use the @{#ZONE_CAPTURE_COALITION.New}() constructor to create a new ZONE_CAPTURE_COALITION object.
--
-- # ZONE_CAPTURE_COALITION is a finite state machine (FSM).
--
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia4.JPG)
--
-- ### 2.1 ZONE\_CAPTURE\_COALITION States
-- ## ZONE_CAPTURE_COALITION States
--
-- * **Captured**: The Zone has been captured by an other coalition.
-- * **Attacked**: The Zone is currently intruded by an other coalition. There are units of the owning coalition and an other coalition in the Zone.
-- * **Guarded**: The Zone is guarded by the owning coalition. There is no other unit of an other coalition in the Zone.
-- * **Empty**: The Zone is empty. There is not valid unit in the Zone.
--
-- ### 2.2 ZONE\_CAPTURE\_COALITION Events
-- ## 2.2 ZONE_CAPTURE_COALITION Events
--
-- * **Capture**: The Zone has been captured by an other coalition.
-- * **Attack**: The Zone is currently intruded by an other coalition. There are units of the owning coalition and an other coalition in the Zone.
-- * **Guard**: The Zone is guarded by the owning coalition. There is no other unit of an other coalition in the Zone.
-- * **Empty**: The Zone is empty. There is not valid unit in the Zone.
--
-- ## 3. "Script It"
-- # "Script It"
--
-- ZONE\_CAPTURE\_COALITION allows to take action on the various state transitions and add your custom code and logic.
-- ZONE_CAPTURE_COALITION allows to take action on the various state transitions and add your custom code and logic.
--
-- ### 3.1. Take action using state- and event handlers.
-- ## Take action using state- and event handlers.
--
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia6.JPG)
--
@@ -104,8 +141,6 @@ do -- ZONE_CAPTURE_COALITION
-- - On Before the event is triggered. Return false to cancel the transition.
-- - On After the event is triggered.
--
--
--
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia7.JPG)
--
-- Each handler can receive optionally 3 parameters:
@@ -126,7 +161,7 @@ do -- ZONE_CAPTURE_COALITION
--
-- This code checks that when the __Guarded__ state has been reached, that if the **From** state was __Empty__, then display a message.
--
-- ### 3.2. Example Event Handler.
-- ## Example Event Handler.
--
-- --- @param Functional.ZoneCaptureCoalition#ZONE_CAPTURE_COALITION self
-- function ZoneCaptureCoalition:OnEnterGuarded( From, Event, To )
@@ -145,7 +180,7 @@ do -- ZONE_CAPTURE_COALITION
-- end
-- end
--
-- ### 3.3. Stop and Start the zone monitoring process.
-- ## Stop and Start the zone monitoring process.
--
-- At regular intervals, the state of the zone needs to be monitored.
-- The zone needs to be scanned for the presence of units within the zone boundaries.
@@ -157,8 +192,8 @@ do -- ZONE_CAPTURE_COALITION
--
-- Therefore, the mission designer is given 2 methods that allow to take control of the CPU utilization efficiency:
--
-- - @{#ZONE_CAPTURE_COALITION.Start()}(): This starts the monitoring process.
-- - @{#ZONE_CAPTURE_COALITION.Stop()}(): This stops the monitoring process.
-- * @{#ZONE_CAPTURE_COALITION.Start}(): This starts the monitoring process.
-- * @{#ZONE_CAPTURE_COALITION.Stop}(): This stops the monitoring process.
--
-- ### IMPORTANT
--
@@ -166,9 +201,9 @@ do -- ZONE_CAPTURE_COALITION
-- The monitoring process is NOT started by default!!!**
--
--
-- ## 4. Full Example
-- # Full Example
--
-- The following annotated code shows a real example of how ZONE\_CAPTURE\_COALITION can be applied.
-- The following annotated code shows a real example of how ZONE_CAPTURE_COALITION can be applied.
--
-- The concept is simple.
--
@@ -329,7 +364,7 @@ do -- ZONE_CAPTURE_COALITION
do
--- Captured State Handler OnLeave for ZONE\_CAPTURE\_COALITION
--- Captured State Handler OnLeave for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveCaptured
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -337,7 +372,7 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To
-- @return #boolean
--- Captured State Handler OnEnter for ZONE\_CAPTURE\_COALITION
--- Captured State Handler OnEnter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterCaptured
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -349,7 +384,7 @@ do -- ZONE_CAPTURE_COALITION
do
--- Attacked State Handler OnLeave for ZONE\_CAPTURE\_COALITION
--- Attacked State Handler OnLeave for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveAttacked
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -357,7 +392,7 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To
-- @return #boolean
--- Attacked State Handler OnEnter for ZONE\_CAPTURE\_COALITION
--- Attacked State Handler OnEnter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterAttacked
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -368,7 +403,7 @@ do -- ZONE_CAPTURE_COALITION
do
--- Guarded State Handler OnLeave for ZONE\_CAPTURE\_COALITION
--- Guarded State Handler OnLeave for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveGuarded
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -376,7 +411,7 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To
-- @return #boolean
--- Guarded State Handler OnEnter for ZONE\_CAPTURE\_COALITION
--- Guarded State Handler OnEnter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterGuarded
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -388,7 +423,7 @@ do -- ZONE_CAPTURE_COALITION
do
--- Empty State Handler OnLeave for ZONE\_CAPTURE\_COALITION
--- Empty State Handler OnLeave for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveEmpty
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -396,7 +431,7 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To
-- @return #boolean
--- Empty State Handler OnEnter for ZONE\_CAPTURE\_COALITION
--- Empty State Handler OnEnter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterEmpty
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -407,7 +442,7 @@ do -- ZONE_CAPTURE_COALITION
self:AddTransition( "*", "Guard", "Guarded" )
--- Guard Handler OnBefore for ZONE\_CAPTURE\_COALITION
--- Guard Handler OnBefore for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeGuard
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -415,25 +450,25 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To
-- @return #boolean
--- Guard Handler OnAfter for ZONE\_CAPTURE\_COALITION
--- Guard Handler OnAfter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterGuard
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
-- @param #string Event
-- @param #string To
--- Guard Trigger for ZONE\_CAPTURE\_COALITION
--- Guard Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] Guard
-- @param #ZONE_CAPTURE_COALITION self
--- Guard Asynchronous Trigger for ZONE\_CAPTURE\_COALITION
--- Guard Asynchronous Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] __Guard
-- @param #ZONE_CAPTURE_COALITION self
-- @param #number Delay
self:AddTransition( "*", "Empty", "Empty" )
--- Empty Handler OnBefore for ZONE\_CAPTURE\_COALITION
--- Empty Handler OnBefore for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeEmpty
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -441,18 +476,18 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To
-- @return #boolean
--- Empty Handler OnAfter for ZONE\_CAPTURE\_COALITION
--- Empty Handler OnAfter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterEmpty
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
-- @param #string Event
-- @param #string To
--- Empty Trigger for ZONE\_CAPTURE\_COALITION
--- Empty Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] Empty
-- @param #ZONE_CAPTURE_COALITION self
--- Empty Asynchronous Trigger for ZONE\_CAPTURE\_COALITION
--- Empty Asynchronous Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] __Empty
-- @param #ZONE_CAPTURE_COALITION self
-- @param #number Delay
@@ -460,7 +495,7 @@ do -- ZONE_CAPTURE_COALITION
self:AddTransition( { "Guarded", "Empty" }, "Attack", "Attacked" )
--- Attack Handler OnBefore for ZONE\_CAPTURE\_COALITION
--- Attack Handler OnBefore for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeAttack
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -468,25 +503,25 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To
-- @return #boolean
--- Attack Handler OnAfter for ZONE\_CAPTURE\_COALITION
--- Attack Handler OnAfter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterAttack
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
-- @param #string Event
-- @param #string To
--- Attack Trigger for ZONE\_CAPTURE\_COALITION
--- Attack Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] Attack
-- @param #ZONE_CAPTURE_COALITION self
--- Attack Asynchronous Trigger for ZONE\_CAPTURE\_COALITION
--- Attack Asynchronous Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] __Attack
-- @param #ZONE_CAPTURE_COALITION self
-- @param #number Delay
self:AddTransition( { "Guarded", "Attacked", "Empty" }, "Capture", "Captured" )
--- Capture Handler OnBefore for ZONE\_CAPTURE\_COALITION
--- Capture Handler OnBefore for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeCapture
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
@@ -494,18 +529,18 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To
-- @return #boolean
--- Capture Handler OnAfter for ZONE\_CAPTURE\_COALITION
--- Capture Handler OnAfter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterCapture
-- @param #ZONE_CAPTURE_COALITION self
-- @param #string From
-- @param #string Event
-- @param #string To
--- Capture Trigger for ZONE\_CAPTURE\_COALITION
--- Capture Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] Capture
-- @param #ZONE_CAPTURE_COALITION self
--- Capture Asynchronous Trigger for ZONE\_CAPTURE\_COALITION
--- Capture Asynchronous Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] __Capture
-- @param #ZONE_CAPTURE_COALITION self
-- @param #number Delay

View File

@@ -623,10 +623,8 @@ end
-- @return #CONTROLLABLE self
function CONTROLLABLE:StartUncontrolled(delay)
if delay and delay>0 then
env.info(string.format("FF %s delayed start after %d seconds", self:GetName(), delay))
SCHEDULER:New(nil, CONTROLLABLE.StartUncontrolled, {self}, delay)
else
env.info(string.format("FF %s instant start", self:GetName()))
self:SetCommand({id='Start', params={}})
end
return self
@@ -1079,10 +1077,10 @@ end
-- The unit / controllable will follow lead unit of another controllable, wingmens of both controllables will continue following their leaders.
-- The unit / controllable will also protect that controllable from threats of specified types.
-- @param #CONTROLLABLE self
-- @param Wrapper.Controllable#CONTROLLABLE EscortControllable The controllable to be escorted.
-- @param Wrapper.Controllable#CONTROLLABLE FollowControllable The controllable to be escorted.
-- @param DCS#Vec3 Vec3 Position of the unit / lead unit of the controllable relative lead unit of another controllable in frame reference oriented by course of lead unit of another controllable. If another controllable is on land the unit / controllable will orbit around.
-- @param #number LastWaypointIndex Detach waypoint of another controllable. Once reached the unit / controllable Follow task is finished.
-- @param #number EngagementDistanceMax Maximal distance from escorted controllable to threat. If the threat is already engaged by escort escort will disengage if the distance becomes greater than 1.5 * engagementDistMax.
-- @param #number EngagementDistance Maximal distance from escorted controllable to threat. If the threat is already engaged by escort escort will disengage if the distance becomes greater than 1.5 * engagementDistMax.
-- @param DCS#AttributeNameArray TargetTypes Array of AttributeName that is contains threat categories allowed to engage.
-- @return DCS#Task The DCS task structure.
function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, EngagementDistance, TargetTypes )
@@ -1105,6 +1103,8 @@ function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, E
LastWaypointIndexFlag = true
end
TargetTypes=TargetTypes or {}
local DCSTask
DCSTask = { id = 'Escort',
params = {

View File

@@ -2,7 +2,9 @@
--
-- ===
--
-- The @{#GROUP} class is a wrapper class to handle the DCS Group objects:
-- The @{#GROUP} class is a wrapper class to handle the DCS Group objects.
--
-- ## Features:
--
-- * Support all DCS Group APIs.
-- * Enhance with Group specific APIs not in the DCS Group API set.
@@ -11,7 +13,16 @@
--
-- **IMPORTANT: ONE SHOULD NEVER SANATIZE these GROUP OBJECT REFERENCES! (make the GROUP object references nil).**
--
-- See the detailed documentation on the GROUP class.
-- ===
--
-- For each DCS Group object alive within a running mission, a GROUP wrapper object (instance) will be created within the _@{DATABASE} object.
-- This is done at the beginning of the mission (when the mission starts), and dynamically when new DCS Group objects are spawned (using the @{SPAWN} class).
--
-- The GROUP class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference
-- using the DCS Group or the DCS GroupName.
--
-- The GROUP methods will reference the DCS Group object by name when it is needed during API execution.
-- If the DCS Group object does not exist or is nil, the GROUP methods will return nil and may log an exception in the DCS.log file.
--
-- ===
--
@@ -34,24 +45,76 @@
--- Wrapper class of the DCS world Group object.
--
-- For each DCS Group object alive within a running mission, a GROUP wrapper object (instance) will be created within the _@{DATABASE} object.
-- This is done at the beginning of the mission (when the mission starts), and dynamically when new DCS Group objects are spawned (using the @{SPAWN} class).
--
-- The GROUP class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference
-- using the DCS Group or the DCS GroupName.
--
-- Another thing to know is that GROUP objects do not "contain" the DCS Group object.
-- The GROUP methods will reference the DCS Group object by name when it is needed during API execution.
-- If the DCS Group object does not exist or is nil, the GROUP methods will return nil and log an exception in the DCS.log file.
--
-- The GROUP class provides the following functions to retrieve quickly the relevant GROUP instance:
--
-- * @{#GROUP.Find}(): Find a GROUP instance from the _DATABASE object using a DCS Group object.
-- * @{#GROUP.FindByName}(): Find a GROUP instance from the _DATABASE object using a DCS Group name.
--
-- ## GROUP task methods
-- # 1. Tasking of groups
--
-- A GROUP is derived from the wrapper class CONTROLLABLE (@{Wrapper.Controllable#CONTROLLABLE}).
-- See the @{Wrapper.Controllable} task methods section for a description of the task methods.
--
-- But here is an example how a group can be assigned a task.
--
-- This test demonstrates the use(s) of the SwitchWayPoint method of the GROUP class.
--
-- First we look up the objects. We create a GROUP object `HeliGroup`, using the @{#GROUP:FindByName}() method, looking up the `"Helicopter"` group object.
-- Same for the `"AttackGroup"`.
--
-- local HeliGroup = GROUP:FindByName( "Helicopter" )
-- local AttackGroup = GROUP:FindByName( "AttackGroup" )
--
-- Now we retrieve the @{Wrapper.Unit#UNIT} objects of the `AttackGroup` object, using the method `:GetUnits()`.
--
-- local AttackUnits = AttackGroup:GetUnits()
--
-- Tasks are actually text strings that we build using methods of GROUP.
-- So first, we declare an list of `Tasks`.
--
-- local Tasks = {}
--
-- Now we loop over the `AttackUnits` using a for loop.
-- We retrieve the `AttackUnit` using the `AttackGroup:GetUnit()` method.
-- Each `AttackUnit` found, will be attacked by `HeliGroup`, using the method `HeliGroup:TaskAttackUnit()`.
-- This method returns a string containing a command line to execute the task to the `HeliGroup`.
-- The code will assign the task string command to the next element in the `Task` list, using `Tasks[#Tasks+1]`.
-- This little code will take the count of `Task` using `#` operator, and will add `1` to the count.
-- This result will be the index of the `Task` element.
--
-- for i = 1, #AttackUnits do
-- local AttackUnit = AttackGroup:GetUnit( i )
-- Tasks[#Tasks+1] = HeliGroup:TaskAttackUnit( AttackUnit )
-- end
--
-- Once these tasks have been executed, a function `_Resume` will be called ...
--
-- Tasks[#Tasks+1] = HeliGroup:TaskFunction( "_Resume", { "''" } )
--
-- --- @param Wrapper.Group#GROUP HeliGroup
-- function _Resume( HeliGroup )
-- env.info( '_Resume' )
--
-- HeliGroup:MessageToAll( "Resuming",10,"Info")
-- end
--
-- Now here is where the task gets assigned!
-- Using `HeliGroup:PushTask`, the task is pushed onto the task queue of the group `HeliGroup`.
-- Since `Tasks` is an array of tasks, we use the `HeliGroup:TaskCombo` method to execute the tasks.
-- The `HeliGroup:PushTask` method can receive a delay parameter in seconds.
-- In the example, `30` is given as a delay.
--
--
-- HeliGroup:PushTask(
-- HeliGroup:TaskCombo(
-- Tasks
-- ), 30
-- )
--
-- That's it!
-- But again, please refer to the @{Wrapper.Controllable} task methods section for a description of the different task methods that are available.
--
--
-- A GROUP is a @{Wrapper.Controllable}. See the @{Wrapper.Controllable} task methods section for a description of the task methods.
--
-- ### Obtain the mission from group templates
--

View File

@@ -896,16 +896,28 @@ function UNIT:IsShip()
end
--- Returns true if the UNIT is in the air.
-- @param Wrapper.Positionable#UNIT self
-- @param #UNIT self
-- @return #boolean true if in the air.
-- @return #nil The UNIT is not existing or alive.
function UNIT:InAir()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSObject()
local DCSUnit = self:GetDCSObject() --DCS#Unit
if DCSUnit then
local UnitInAir = DCSUnit:inAir()
-- Implementation of workaround. The original code is below.
-- This to simulate the landing on buildings.
-- local UnitInAir = DCSUnit:inAir()
local UnitInAir = true
local VelocityVec3 = DCSUnit:getVelocity()
local Velocity = ( VelocityVec3.x ^ 2 + VelocityVec3.y ^ 2 + VelocityVec3.z ^ 2 ) ^ 0.5 -- in meters / sec
local Coordinate = DCSUnit:getPoint()
local LandHeight = land.getHeight( { x = Coordinate.x, y = Coordinate.z } )
local Height = Coordinate.y - LandHeight
if Velocity < 1 and Height <= 60 then
UnitInAir = false
end
self:T3( UnitInAir )
return UnitInAir
end