Iterate the DATABASE and call an iterator function for each player who has joined the mission, providing the Unit of the player and optional parameters.
@@ -1385,6 +1418,11 @@ An example of how to use the method is shown below.
Detection:Start()
+
Detection of Friendlies Nearby
+
+
Use the method Detection#DETECTION_BASE.SetFriendliesRange() to set the range what will indicate when friendlies are nearby
+a DetectedItem. The default range is 6000 meters. For air detections, it is advisory to use about 30.000 meters.
+
DETECTION_BASE is a Finite State Machine
Various Events and State Transitions can be tailored using DETECTION_BASE.
The COORDINATE class defines a 2D coordinate in the simulator.
@@ -844,9 +853,9 @@ to add or substract a value from the current respective axis value.
Note that the Set and Add methods return the current COORDINATE object, so these manipulation methods can be chained... For example:
local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
-
+
@@ -859,7 +868,7 @@ Note that the Set and Add methods return the current COORDINATE object, so these
@@ -888,9 +897,9 @@ to add or substract a value from the current respective axis value.
Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example:
local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
-
+
@@ -903,15 +912,15 @@ Note that the Set and Add methods return the current POINT_VEC2 object, so these
POINT_VEC3 defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
Important Note: Most of the functions in this section were taken from MIST, and reworked to OO concepts.
-In order to keep the credibility of the the author,
-I want to emphasize that the formulas embedded in the MIST framework were created by Grimes or previous authors,
+In order to keep the credibility of the the author,
+I want to emphasize that the formulas embedded in the MIST framework were created by Grimes or previous authors,
who you can find on the Eagle Dynamics Forums.
@@ -1046,10 +1055,10 @@ Note that the Set and Add methods return the current POINT_VEC3 object, so these
POINT_VEC3.ToStringBR(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
@@ -1235,8 +1697,8 @@ The y coordinate of the Vec3 point, pointing to the Right.
-
Dcs.DCSTypes#Distance LandHeightAdd :
-(optional) The default height if required to be evaluated will be the land height of the x, y coordinate. You can specify an extra height to be added to the land height.
+
Dcs.DCSTypes#Distance z :
+The z coordinate of the Vec3 point, pointing to the Right.
Calculate the distance from a reference #POINT_VEC2.
+
+
+
+
TODO: Check this to replace
+- Calculate the distance from a reference #POINT_VEC2.
+ @param #POINTVEC2 self
+ @param #POINTVEC2 PointVec2Reference The reference #POINT_VEC2.
+ @return Dcs.DCSTypes#Distance The distance from the reference #POINT_VEC2 in meters.
@@ -232,6 +235,34 @@ local ScoringSecondMission = SCORING:New( "SecondMission" )
The above documents that 2 Scoring objects are created, ScoringFirstMission and ScoringSecondMission.
+
*IMPORTANT!!!
+
In order to allow DCS world to write CSV files, you need to adapt a configuration file in your DCS world installation on the server.
+For this, browse to the missionscripting.lua file in your DCS world installation folder.
+For me, this installation folder is in D:\Program Files\Eagle Dynamics\DCS World\Scripts.
+
+
Edit a few code lines in the MissionScripting.lua file. Comment out the lines os, io and lfs:
+
+
do
+ --sanitizeModule('os')
+ --sanitizeModule('io')
+ --sanitizeModule('lfs')
+ require = nil
+ loadlib = nil
+ end
+
+
+
When these lines are not sanitized, functions become available to check the time, and to write files to your system at the above specified location.
+Note that the MissionScripting.lua file provides a warning. So please beware of this warning as outlined by Eagle Dynamics!
+
+
--Sanitize Mission Scripting environment
+ --This makes unavailable some unsecure functions.
+ --Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions.
+ --You can remove the code below and make availble these functions at your own risk.
+
+
+
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.
When players hit or destroy targets, messages are sent.
diff --git a/docs/Documentation/Sead.html b/docs/Documentation/Sead.html
index 7d90b36be..796e9884d 100644
--- a/docs/Documentation/Sead.html
+++ b/docs/Documentation/Sead.html
@@ -75,6 +75,7 @@
The #TASK_A2A class defines Air To Air tasks for a Set of Target Units,
+based on the tasking capabilities defined in Task#TASK.
+The TASK_A2A is implemented using a Statemachine#FSM_TASK, and has the following statuses:
+
+
+
None: Start of the process
+
Planned: The A2A task is planned.
+
Assigned: The A2A task is assigned to a Group#GROUP.
+
Success: The A2A task is successfully completed.
+
Failed: The A2A task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
+
+
+
1.1) Set the scoring of achievements in an A2A attack.
+
+
Scoring or penalties can be given in the following circumstances:
#number TargetDistance :
+The distance to Target when the Player is considered to have "arrived" at the engagement range.
+
+
+
+
+
Core.Zone#ZONE_BASE TargetZone :
+The target zone, if known.
+If the TargetZone parameter is specified, the player will be routed to the center of the zone where all the targets are assumed to be.
The #TASKA2ADISPATCHER class implements the dynamic dispatching of tasks upon groups of detected units determined a Set of EWR installation groups.
+The EWR will detect units, will group them, and will dispatch Tasks to groups. Depending on the type of target detected, different tasks will be dispatched.
+Find a summary below describing for which situation a task type is created:
+
+
+
INTERCEPT Task: Is created when the target is known, is detected and within a danger zone, and there is no friendly airborne in range.
+
SWEEP Task: Is created when the target is unknown, was detected and the last position is only known, and within a danger zone, and there is no friendly airborne in range.
+
ENGAGE Task: Is created when the target is known, is detected and within a danger zone, and there is a friendly airborne in range, that will receive this task.
From f3b49ecc0a2b66537ae2ecdda40a4fb81a605ae7 Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Wed, 24 May 2017 07:14:40 +0200
Subject: [PATCH 08/16] Fixed the removal of obscolete planned tasks
---
.../Moose/Functional/Detection.lua | 4 ++--
.../Moose/Tasking/Task_A2A_Dispatcher.lua | 23 +++++++++++++------
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index 9d58528fe..d7c8bec7d 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -2365,7 +2365,7 @@ do -- DETECTION_AREAS
self:IdentifyDetectedObject( DetectedObject )
AreaExists = true
- DetectedItem.Zone:BoundZone( 12, self.CountryID, true)
+ --DetectedItem.Zone:BoundZone( 12, self.CountryID, true)
-- Assign the Unit as the new center unit of the detected area.
DetectedItem.Zone = ZONE_UNIT:New( DetectedUnit:GetName(), DetectedUnit, self.DetectionZoneRange )
@@ -2418,7 +2418,7 @@ do -- DETECTION_AREAS
end
end
else
- DetectedItem.Zone:BoundZone( 12, self.CountryID, true)
+ --DetectedItem.Zone:BoundZone( 12, self.CountryID, true)
self:RemoveDetectedItem( DetectedItemID )
self:AddChangeItem( DetectedItem, "RA" )
end
diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
index 9f1d48990..427dd7a46 100644
--- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
@@ -181,9 +181,16 @@ do -- TASK_A2A_DISPATCHER
Remove = true
end
end
+
+ local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT
+ DetectedSet:Flush()
+ self:E( { DetectedSetCount = DetectedSet:Count() } )
+ if DetectedSet:Count() == 0 then
+ Remove = true
+ end
if DetectedItemChanged == true or Remove then
- self:T2( "Removing Tasking: " .. Task:GetTaskName() )
+ self:E( "Removing Tasking: " .. Task:GetTaskName() )
Mission:RemoveTask( Task )
self.Tasks[DetectedItemID] = nil
end
@@ -306,6 +313,7 @@ do -- TASK_A2A_DISPATCHER
local DetectedItem = DetectedItem -- Functional.Detection#DETECTION_BASE.DetectedItem
local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT
+ local DetectedCount = DetectedSet:Count()
local DetectedZone = DetectedItem.Zone
self:E( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } )
DetectedSet:Flush()
@@ -318,7 +326,7 @@ do -- TASK_A2A_DISPATCHER
Task = self:EvaluateRemoveTask( Mission, Task, Detection, DetectedItem, DetectedID, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
-- Evaluate INTERCEPT
- if not Task then
+ if not Task and DetectedCount > 0 then
local TargetSetUnit = self:EvaluateENGAGE( DetectedItem ) -- Returns a SetUnit if there are targets to be INTERCEPTed...
if TargetSetUnit then
Task = TASK_A2A_ENGAGE:New( Mission, self.SetGroup, string.format( "ENGAGE.%03d", DetectedID ), TargetSetUnit )
@@ -342,11 +350,12 @@ do -- TASK_A2A_DISPATCHER
end
- local FriendliesCount, FriendliesReport = self:GetFriendliesNearBy( DetectedItem )
- Task:SetInfo( "Friendlies", string.format( "%d ( %s )", FriendliesCount, FriendliesReport:Text( "," ) ) )
-
- local PlayersCount, PlayersReport = self:GetPlayerFriendliesNearBy( DetectedItem )
- Task:SetInfo( "Players", string.format( "%d ( %s )", PlayersCount, PlayersReport:Text( "," ) ) )
+ if Task then
+ local FriendliesCount, FriendliesReport = self:GetFriendliesNearBy( DetectedItem )
+ Task:SetInfo( "Friendlies", string.format( "%d ( %s )", FriendliesCount, FriendliesReport:Text( "," ) ) )
+ local PlayersCount, PlayersReport = self:GetPlayerFriendliesNearBy( DetectedItem )
+ Task:SetInfo( "Players", string.format( "%d ( %s )", PlayersCount, PlayersReport:Text( "," ) ) )
+ end
-- OK, so the tasking has been done, now delete the changes reported for the area.
Detection:AcceptChanges( DetectedItem )
From 89371378b7168dfb01a0bb3db922b00eba6d95c1 Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Wed, 24 May 2017 11:49:03 +0200
Subject: [PATCH 09/16] Fixed non removal of Planned Tasks
---
.../Moose/Functional/Detection.lua | 22 +++++++---
.../Moose/Tasking/Task_A2A_Dispatcher.lua | 43 ++++++++++++-------
2 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index d7c8bec7d..8ece18ed5 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -512,7 +512,7 @@ do -- DETECTION_BASE
-- @param #string Event The Event string.
-- @param #string To The To State string.
function DETECTION_BASE:onafterDetect(From,Event,To)
- self:E( {From,Event,To})
+ self:E( { From, Event, To } )
local DetectDelay = 0.1
self.DetectionCount = 0
@@ -520,7 +520,7 @@ do -- DETECTION_BASE
self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table
for DetectionGroupID, DetectionGroupData in pairs( self.DetectionSetGroup:GetSet() ) do
- self:E( {DetectionGroupData})
+ --self:E( { DetectionGroupData } )
self:__DetectionGroup( DetectDelay, DetectionGroupData ) -- Process each detection asynchronously.
self.DetectionCount = self.DetectionCount + 1
DetectDelay = DetectDelay + 0.1
@@ -533,7 +533,7 @@ do -- DETECTION_BASE
-- @param #string To The To State string.
-- @param Wrapper.Group#GROUP DetectionGroup The Group detecting.
function DETECTION_BASE:onafterDetectionGroup( From, Event, To, DetectionGroup )
- self:E( {From,Event,To})
+ self:E( { From, Event, To } )
self.DetectionRun = self.DetectionRun + 1
@@ -1563,7 +1563,7 @@ do -- DETECTION_UNITS
local DetectedUnit = DetectedUnitData -- Wrapper.Unit#UNIT
local DetectedObject = nil
- self:E( DetectedUnit )
+ --self:E( DetectedUnit )
if DetectedUnit:IsAlive() then
--self:E(DetectedUnit:GetName())
DetectedObject = self:GetDetectedObject( DetectedUnit:GetName() )
@@ -1924,8 +1924,8 @@ do -- DETECTION_TYPES
local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup )
- self:E( { DetectedItemID,
- DetectedItemCoordText } )
+ --self:E( { DetectedItemID,
+ -- DetectedItemCoordText } )
local ReportSummary = string.format(
"%s - %s",
@@ -2374,6 +2374,9 @@ do -- DETECTION_AREAS
-- We don't need to add the DetectedObject to the area set, because it is already there ...
break
+ else
+ DetectedSet:Remove( DetectedUnitName )
+ self:AddChangeUnit( DetectedItem, "RU", DetectedUnit:GetTypeName() )
end
end
end
@@ -2425,6 +2428,8 @@ do -- DETECTION_AREAS
end
end
+
+
-- We iterated through the existing detection areas and:
-- - We checked which units are still detected in each detection area. Those units were flagged as Identified.
-- - We recentered the detection area to new center units where it was needed.
@@ -2488,11 +2493,14 @@ do -- DETECTION_AREAS
if DETECTION_AREAS._SmokeDetectedUnits or self._SmokeDetectedUnits then
DetectedZone.ZoneUNIT:SmokeRed()
end
+
+ --DetectedSet:Flush()
+
DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit )
if DetectedUnit:IsAlive() then
- self:T( "Detected Set #" .. DetectedItem.ItemID .. ":" .. DetectedUnit:GetName() )
+ --self:T( "Detected Set #" .. DetectedItem.ItemID .. ":" .. DetectedUnit:GetName() )
if DETECTION_AREAS._FlareDetectedUnits or self._FlareDetectedUnits then
DetectedUnit:FlareGreen()
end
diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
index 427dd7a46..2790bbc36 100644
--- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
@@ -157,7 +157,7 @@ do -- TASK_A2A_DISPATCHER
-- @param #boolean DetectedItemID
-- @param #boolean DetectedItemChange
-- @return Tasking.Task#TASK
- function TASK_A2A_DISPATCHER:EvaluateRemoveTask( Mission, Task, Detection, DetectedItem, DetectedItemID, DetectedItemChanged )
+ function TASK_A2A_DISPATCHER:EvaluateRemoveTask( Mission, Task, Detection, DetectedItem, DetectedItemIndex, DetectedItemChanged )
if Task then
@@ -183,16 +183,16 @@ do -- TASK_A2A_DISPATCHER
end
local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT
- DetectedSet:Flush()
- self:E( { DetectedSetCount = DetectedSet:Count() } )
+ --DetectedSet:Flush()
+ --self:E( { DetectedSetCount = DetectedSet:Count() } )
if DetectedSet:Count() == 0 then
Remove = true
end
if DetectedItemChanged == true or Remove then
- self:E( "Removing Tasking: " .. Task:GetTaskName() )
+ --self:E( "Removing Tasking: " .. Task:GetTaskName() )
Mission:RemoveTask( Task )
- self.Tasks[DetectedItemID] = nil
+ self.Tasks[DetectedItemIndex] = nil
end
end
end
@@ -228,7 +228,7 @@ do -- TASK_A2A_DISPATCHER
end
- self:E( { FriendliesCount = FriendliesCount } )
+ --self:E( { FriendliesCount = FriendliesCount } )
local FriendlyTypesReport = REPORT:New()
@@ -261,7 +261,7 @@ do -- TASK_A2A_DISPATCHER
for PlayerUnitName, PlayerUnitData in pairs( PlayersNearBy ) do
local PlayerUnit = PlayerUnitData -- Wrapper.Unit#UNIT
local PlayerName = PlayerUnit:GetPlayerName()
- self:E( { PlayerName = PlayerName, PlayerUnit = PlayerUnit } )
+ --self:E( { PlayerName = PlayerName, PlayerUnit = PlayerUnit } )
if PlayerUnit:IsAirPlane() and PlayerName ~= nil then
local FriendlyUnitThreatLevel = PlayerUnit:GetThreatLevel()
PlayersCount = PlayersCount + 1
@@ -274,7 +274,7 @@ do -- TASK_A2A_DISPATCHER
end
- self:E( { PlayersCount = PlayersCount } )
+ --self:E( { PlayersCount = PlayersCount } )
local PlayerTypesReport = REPORT:New()
@@ -307,23 +307,36 @@ do -- TASK_A2A_DISPATCHER
if Mission:IsIDLE() or Mission:IsENGAGED() then
local TaskReport = REPORT:New()
+
+ -- Checking the task queue for the dispatcher, and removing any obsolete task!
+ for TaskIndex, Task in pairs( self.Tasks ) do
+ local DetectedItem = Detection:GetDetectedItem( TaskIndex )
+ if not DetectedItem then
+ local TaskText = Task:GetName()
+ for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
+ Mission:GetCommandCenter():MessageToGroup( string.format( "Obsolete A2A task %s for %s removed.", TaskText, Mission:GetName() ), TaskGroup )
+ end
+ Mission:RemoveTask( Task )
+ self.Tasks[TaskIndex] = nil
+ end
+ end
- --- First we need to the detected targets.
+ -- Now that all obsolete tasks are removed, loop through the detected targets.
for DetectedItemID, DetectedItem in pairs( Detection:GetDetectedItems() ) do
local DetectedItem = DetectedItem -- Functional.Detection#DETECTION_BASE.DetectedItem
local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT
local DetectedCount = DetectedSet:Count()
local DetectedZone = DetectedItem.Zone
- self:E( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } )
- DetectedSet:Flush()
+ --self:E( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } )
+ --DetectedSet:Flush()
local DetectedID = DetectedItem.ID
- local DetectedIndex = DetectedItem.Index
+ local TaskIndex = DetectedItem.Index
local DetectedItemChanged = DetectedItem.Changed
- local Task = self.Tasks[DetectedID]
- Task = self:EvaluateRemoveTask( Mission, Task, Detection, DetectedItem, DetectedID, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
+ local Task = self.Tasks[TaskIndex]
+ Task = self:EvaluateRemoveTask( Mission, Task, Detection, DetectedItem, TaskIndex, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
-- Evaluate INTERCEPT
if not Task and DetectedCount > 0 then
@@ -338,7 +351,7 @@ do -- TASK_A2A_DISPATCHER
end
if Task then
- self.Tasks[DetectedID] = Task
+ self.Tasks[TaskIndex] = Task
Task:SetTargetZone( DetectedZone, DetectedSet:GetFirst():GetAltitude(), DetectedSet:GetFirst():GetHeading() )
Task:SetDispatcher( self )
Mission:AddTask( Task )
From 0702057f47eacb73ebc81793d58d85991778779f Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Wed, 24 May 2017 12:07:49 +0200
Subject: [PATCH 10/16] Only remove planned tasks
---
.../Moose/Tasking/Task_A2A_Dispatcher.lua | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
index 2790bbc36..ca0f56050 100644
--- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
@@ -309,15 +309,18 @@ do -- TASK_A2A_DISPATCHER
local TaskReport = REPORT:New()
-- Checking the task queue for the dispatcher, and removing any obsolete task!
- for TaskIndex, Task in pairs( self.Tasks ) do
- local DetectedItem = Detection:GetDetectedItem( TaskIndex )
- if not DetectedItem then
- local TaskText = Task:GetName()
- for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
- Mission:GetCommandCenter():MessageToGroup( string.format( "Obsolete A2A task %s for %s removed.", TaskText, Mission:GetName() ), TaskGroup )
+ for TaskIndex, TaskData in pairs( self.Tasks ) do
+ local Task = TaskData -- Tasking.Task#TASK
+ if Task:IsStatePlanned() then
+ local DetectedItem = Detection:GetDetectedItem( TaskIndex )
+ if not DetectedItem then
+ local TaskText = Task:GetName()
+ for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
+ Mission:GetCommandCenter():MessageToGroup( string.format( "Obsolete A2A task %s for %s removed.", TaskText, Mission:GetName() ), TaskGroup )
+ end
+ Mission:RemoveTask( Task )
+ self.Tasks[TaskIndex] = nil
end
- Mission:RemoveTask( Task )
- self.Tasks[TaskIndex] = nil
end
end
From 624a4aa70afc01fef8d486a9789b4f5d5b62e95d Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Wed, 24 May 2017 12:58:14 +0200
Subject: [PATCH 11/16] Planned task removal for A2G areas that have no targets
anymore.
---
.../Moose/Tasking/Task_A2G_Dispatcher.lua | 30 ++++++++++++++-----
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua
index 4d77cee7b..488c7a256 100644
--- a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua
@@ -185,13 +185,13 @@ do -- TASK_A2G_DISPATCHER
-- @param #boolean DetectedItemID
-- @param #boolean DetectedItemChange
-- @return Tasking.Task#TASK
- function TASK_A2G_DISPATCHER:EvaluateRemoveTask( Mission, Task, DetectedItemID, DetectedItemChanged )
+ function TASK_A2G_DISPATCHER:EvaluateRemoveTask( Mission, Task, TaskIndex, DetectedItemChanged )
if Task then
if Task:IsStatePlanned() and DetectedItemChanged == true then
self:E( "Removing Tasking: " .. Task:GetTaskName() )
Mission:RemoveTask( Task )
- self.Tasks[DetectedItemID] = nil
+ self.Tasks[TaskIndex] = nil
end
end
@@ -216,6 +216,22 @@ do -- TASK_A2G_DISPATCHER
local TaskReport = REPORT:New()
+ -- Checking the task queue for the dispatcher, and removing any obsolete task!
+ for TaskIndex, TaskData in pairs( self.Tasks ) do
+ local Task = TaskData -- Tasking.Task#TASK
+ if Task:IsStatePlanned() then
+ local DetectedItem = Detection:GetDetectedItem( TaskIndex )
+ if not DetectedItem then
+ local TaskText = Task:GetName()
+ for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
+ Mission:GetCommandCenter():MessageToGroup( string.format( "Obsolete A2G task %s for %s removed.", TaskText, Mission:GetName() ), TaskGroup )
+ end
+ Mission:RemoveTask( Task )
+ self.Tasks[TaskIndex] = nil
+ end
+ end
+ end
+
--- First we need to the detected targets.
for DetectedItemID, DetectedItem in pairs( Detection:GetDetectedItems() ) do
@@ -226,11 +242,11 @@ do -- TASK_A2G_DISPATCHER
DetectedSet:Flush()
local DetectedItemID = DetectedItem.ID
- local DetectedItemIndex = DetectedItem.Index
+ local TaskIndex = DetectedItem.Index
local DetectedItemChanged = DetectedItem.Changed
- local Task = self.Tasks[DetectedItemID]
- Task = self:EvaluateRemoveTask( Mission, Task, DetectedItemID, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
+ local Task = self.Tasks[TaskIndex]
+ Task = self:EvaluateRemoveTask( Mission, Task, TaskIndex, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
-- Evaluate SEAD
if not Task then
@@ -256,11 +272,11 @@ do -- TASK_A2G_DISPATCHER
end
if Task then
- self.Tasks[DetectedItemID] = Task
+ self.Tasks[TaskIndex] = Task
Task:SetTargetZone( DetectedZone )
Task:SetDispatcher( self )
Task:SetInfo( "ThreatLevel", DetectedSet:CalculateThreatLevelA2G() )
- Task:SetInfo( "Detection", Detection:DetectedItemReportSummary( DetectedItemIndex ) )
+ Task:SetInfo( "Detection", Detection:DetectedItemReportSummary( TaskIndex ) )
Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) )
Mission:AddTask( Task )
else
From bcae1bbd892eadbb09c475627d383d875b681898 Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Thu, 25 May 2017 07:44:27 +0200
Subject: [PATCH 12/16] Fixed some stuff
---
Moose Development/Moose/Core/Point.lua | 590 ++++++++++----------
docs/Documentation/Detection.html | 2 +-
docs/Documentation/Fsm.html | 3 +-
docs/Documentation/Point.html | 485 ++++++++--------
docs/Documentation/Settings.html | 2 +-
docs/Documentation/Spawn.html | 5 +-
docs/Documentation/Task_A2A_Dispatcher.html | 9 +-
docs/Documentation/Task_A2G_Dispatcher.html | 9 +-
docs/Documentation/Task_Cargo.html | 3 +-
9 files changed, 537 insertions(+), 571 deletions(-)
diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua
index 9c6628980..0c63371ba 100644
--- a/Moose Development/Moose/Core/Point.lua
+++ b/Moose Development/Moose/Core/Point.lua
@@ -54,227 +54,114 @@
-- @module Point
---- @type COORDINATE
--- @extends Core.Base#BASE
---- # COORDINATE class, extends @{Base#BASE}
---
--- The COORDINATE class defines a 2D coordinate in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
--- A COORDINATE can be expressed in LL or in MGRS.
---
--- ## COORDINATE constructor
---
--- A new COORDINATE instance can be created with:
---
--- * @{Point#COORDINATE.New}(): a 2D point, taking an additional height parameter.
--- * @{Point#COORDINATE.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
---
--- ## Manupulate the X, Altitude, Y coordinates of the 2D point
---
--- A COORDINATE class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate.
--- Methods exist to manupulate these coordinates.
---
--- The current X, Altitude, Y axis can be retrieved with the methods @{#COORDINATE.GetX}(), @{#COORDINATE.GetAlt}(), @{#COORDINATE.GetY}() respectively.
--- The methods @{#COORDINATE.SetX}(), @{#COORDINATE.SetAlt}(), @{#COORDINATE.SetY}() change the respective axis with a new value.
--- The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods @{#COORDINATE.GetLat}(), @{#COORDINATE.GetAlt}(), @{#COORDINATE.GetLon}() respectively.
--- The current axis values can be changed by using the methods @{#COORDINATE.AddX}(), @{#COORDINATE.AddAlt}(), @{#COORDINATE.AddY}()
--- to add or substract a value from the current respective axis value.
--- Note that the Set and Add methods return the current COORDINATE object, so these manipulation methods can be chained... For example:
---
--- local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
---
--- @field #COORDINATE
-COORDINATE = {
- ClassName = "COORDINATE",
-}
-
---- The POINT_VEC3 class
--- @type POINT_VEC3
--- @field #number x The x coordinate in 3D space.
--- @field #number y The y coordinate in 3D space.
--- @field #number z The z coordiante in 3D space.
--- @field Utilities.Utils#SMOKECOLOR SmokeColor
--- @field Utilities.Utils#FLARECOLOR FlareColor
--- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
--- @field #POINT_VEC3.RoutePointType RoutePointType
--- @field #POINT_VEC3.RoutePointAction RoutePointAction
--- @extends Core.Point#COORDINATE
-
-
---- # POINT_VEC3 class, extends @{Point#COORDINATE}
---
--- POINT_VEC3 defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
---
--- **Important Note:** Most of the functions in this section were taken from MIST, and reworked to OO concepts.
--- In order to keep the credibility of the the author,
--- I want to emphasize that the formulas embedded in the MIST framework were created by Grimes or previous authors,
--- who you can find on the Eagle Dynamics Forums.
---
---
--- ## POINT_VEC3 constructor
---
--- A new POINT_VEC3 object can be created with:
---
--- * @{#POINT_VEC3.New}(): a 3D point.
--- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
---
---
--- ## Manupulate the X, Y, Z coordinates of the POINT_VEC3
---
--- A POINT_VEC3 class works in 3D space. It contains internally an X, Y, Z coordinate.
--- Methods exist to manupulate these coordinates.
---
--- The current X, Y, Z axis can be retrieved with the methods @{#POINT_VEC3.GetX}(), @{#POINT_VEC3.GetY}(), @{#POINT_VEC3.GetZ}() respectively.
--- The methods @{#POINT_VEC3.SetX}(), @{#POINT_VEC3.SetY}(), @{#POINT_VEC3.SetZ}() change the respective axis with a new value.
--- The current axis values can be changed by using the methods @{#POINT_VEC3.AddX}(), @{#POINT_VEC3.AddY}(), @{#POINT_VEC3.AddZ}()
--- to add or substract a value from the current respective axis value.
--- Note that the Set and Add methods return the current POINT_VEC3 object, so these manipulation methods can be chained... For example:
---
--- local Vec3 = PointVec3:AddX( 100 ):AddZ( 150 ):GetVec3()
---
---
--- ## Create waypoints for routes
---
--- A POINT_VEC3 can prepare waypoints for Ground and Air groups to be embedded into a Route.
---
--- * @{#POINT_VEC3.RoutePointAir}(): Build an air route point.
--- * @{#POINT_VEC3.RoutePointGround}(): Build a ground route point.
---
--- Route points can be used in the Route methods of the @{Group#GROUP} class.
---
---
--- ## Smoke, flare, explode, illuminate
---
--- At the point a smoke, flare, explosion and illumination bomb can be triggered. Use the following methods:
---
--- ### Smoke
---
--- * @{#POINT_VEC3.Smoke}(): To smoke the point in a certain color.
--- * @{#POINT_VEC3.SmokeBlue}(): To smoke the point in blue.
--- * @{#POINT_VEC3.SmokeRed}(): To smoke the point in red.
--- * @{#POINT_VEC3.SmokeOrange}(): To smoke the point in orange.
--- * @{#POINT_VEC3.SmokeWhite}(): To smoke the point in white.
--- * @{#POINT_VEC3.SmokeGreen}(): To smoke the point in green.
---
--- ### Flare
---
--- * @{#POINT_VEC3.Flare}(): To flare the point in a certain color.
--- * @{#POINT_VEC3.FlareRed}(): To flare the point in red.
--- * @{#POINT_VEC3.FlareYellow}(): To flare the point in yellow.
--- * @{#POINT_VEC3.FlareWhite}(): To flare the point in white.
--- * @{#POINT_VEC3.FlareGreen}(): To flare the point in green.
---
--- ### Explode
---
--- * @{#POINT_VEC3.Explosion}(): To explode the point with a certain intensity.
---
--- ### Illuminate
---
--- * @{#POINT_VEC3.IlluminationBomb}(): To illuminate the point.
---
---
--- ## 3D calculation methods
---
--- Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:
---
--- ### Distance
---
--- * @{#POINT_VEC3.Get3DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 3D space.
--- * @{#POINT_VEC3.Get2DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 2D space.
---
--- ### Angle
---
--- * @{#POINT_VEC3.GetAngleDegrees}(): Obtain the angle in degrees from the current 3D point with the provided 3D direction vector.
--- * @{#POINT_VEC3.GetAngleRadians}(): Obtain the angle in radians from the current 3D point with the provided 3D direction vector.
--- * @{#POINT_VEC3.GetDirectionVec3}(): Obtain the 3D direction vector from the current 3D point to the provided 3D point.
---
--- ### Translation
---
--- * @{#POINT_VEC3.Translate}(): Translate the current 3D point towards an other 3D point using the given Distance and Angle.
---
--- ### Get the North correction of the current location
---
--- * @{#POINT_VEC3.GetNorthCorrection}(): Obtains the north correction at the current 3D point.
---
---
--- ## Point Randomization
---
--- Various methods exist to calculate random locations around a given 3D point.
---
--- * @{#POINT_VEC3.GetRandomPointVec2InRadius}(): Provides a random 2D point around the current 3D point, in the given inner to outer band.
--- * @{#POINT_VEC3.GetRandomPointVec3InRadius}(): Provides a random 3D point around the current 3D point, in the given inner to outer band.
--- * @{#POINT_VEC3.GetRandomVec2InRadius}(): Provides a random 2D vector around the current 3D point, in the given inner to outer band.
--- * @{#POINT_VEC3.GetRandomVec3InRadius}(): Provides a random 3D vector around the current 3D point, in the given inner to outer band.
---
---
--- ## Metric system
---
--- * @{#POINT_VEC3.IsMetric}(): Returns if the 3D point is Metric or Nautical Miles.
--- * @{#POINT_VEC3.SetMetric}(): Sets the 3D point to Metric or Nautical Miles.
---
---
--- ## Coorinate text generation
---
--- * @{#POINT_VEC3.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
--- * @{#POINT_VEC3.ToStringLL}(): Generates a Latutude & Longutude text.
---
--- @field #POINT_VEC3
-POINT_VEC3 = {
- ClassName = "POINT_VEC3",
- Metric = true,
- RoutePointAltType = {
- BARO = "BARO",
- },
- RoutePointType = {
- TakeOffParking = "TakeOffParking",
- TurningPoint = "Turning Point",
- },
- RoutePointAction = {
- FromParkingArea = "From Parking Area",
- TurningPoint = "Turning Point",
- },
-}
-
---- @type POINT_VEC2
--- @field Dcs.DCSTypes#Distance x The x coordinate in meters.
--- @field Dcs.DCSTypes#Distance y the y coordinate in meters.
--- @extends Core.Point#COORDINATE
-
-
-
---- # POINT_VEC2 class, extends @{Point#COORDINATE}
---
--- The @{Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
---
--- ## POINT_VEC2 constructor
---
--- A new POINT_VEC2 instance can be created with:
---
--- * @{Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
--- * @{Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
---
--- ## Manupulate the X, Altitude, Y coordinates of the 2D point
---
--- A POINT_VEC2 class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate.
--- Methods exist to manupulate these coordinates.
---
--- The current X, Altitude, Y axis can be retrieved with the methods @{#POINT_VEC2.GetX}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetY}() respectively.
--- The methods @{#POINT_VEC2.SetX}(), @{#POINT_VEC2.SetAlt}(), @{#POINT_VEC2.SetY}() change the respective axis with a new value.
--- The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods @{#POINT_VEC2.GetLat}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetLon}() respectively.
--- The current axis values can be changed by using the methods @{#POINT_VEC2.AddX}(), @{#POINT_VEC2.AddAlt}(), @{#POINT_VEC2.AddY}()
--- to add or substract a value from the current respective axis value.
--- Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example:
---
--- local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
---
--- @field #POINT_VEC2
-POINT_VEC2 = {
- ClassName = "POINT_VEC2",
-}
do -- COORDINATE
+ --- @type COORDINATE
+ -- @extends Core.Base#BASE
+
+ --- # COORDINATE class, extends @{Base#BASE}
+ --
+ -- COORDINATE defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
+ --
+ -- ## COORDINATE constructor
+ --
+ -- A new COORDINATE object can be created with:
+ --
+ -- * @{#COORDINATE.New}(): a 3D point.
+ -- * @{#COORDINATE.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
+ -- * @{#COORDINATE.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
+ --
+ -- ## Create waypoints for routes
+ --
+ -- A COORDINATE can prepare waypoints for Ground and Air groups to be embedded into a Route.
+ --
+ -- * @{#COORDINATE.RoutePointAir}(): Build an air route point.
+ -- * @{#COORDINATE.RoutePointGround}(): Build a ground route point.
+ --
+ -- Route points can be used in the Route methods of the @{Group#GROUP} class.
+ --
+ --
+ -- ## Smoke, flare, explode, illuminate
+ --
+ -- At the point a smoke, flare, explosion and illumination bomb can be triggered. Use the following methods:
+ --
+ -- ### Smoke
+ --
+ -- * @{#COORDINATE.Smoke}(): To smoke the point in a certain color.
+ -- * @{#COORDINATE.SmokeBlue}(): To smoke the point in blue.
+ -- * @{#COORDINATE.SmokeRed}(): To smoke the point in red.
+ -- * @{#COORDINATE.SmokeOrange}(): To smoke the point in orange.
+ -- * @{#COORDINATE.SmokeWhite}(): To smoke the point in white.
+ -- * @{#COORDINATE.SmokeGreen}(): To smoke the point in green.
+ --
+ -- ### Flare
+ --
+ -- * @{#COORDINATE.Flare}(): To flare the point in a certain color.
+ -- * @{#COORDINATE.FlareRed}(): To flare the point in red.
+ -- * @{#COORDINATE.FlareYellow}(): To flare the point in yellow.
+ -- * @{#COORDINATE.FlareWhite}(): To flare the point in white.
+ -- * @{#COORDINATE.FlareGreen}(): To flare the point in green.
+ --
+ -- ### Explode
+ --
+ -- * @{#COORDINATE.Explosion}(): To explode the point with a certain intensity.
+ --
+ -- ### Illuminate
+ --
+ -- * @{#COORDINATE.IlluminationBomb}(): To illuminate the point.
+ --
+ --
+ -- ## 3D calculation methods
+ --
+ -- Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:
+ --
+ -- ### Distance
+ --
+ -- * @{#COORDINATE.Get3DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 3D space.
+ -- * @{#COORDINATE.Get2DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 2D space.
+ --
+ -- ### Angle
+ --
+ -- * @{#COORDINATE.GetAngleDegrees}(): Obtain the angle in degrees from the current 3D point with the provided 3D direction vector.
+ -- * @{#COORDINATE.GetAngleRadians}(): Obtain the angle in radians from the current 3D point with the provided 3D direction vector.
+ -- * @{#COORDINATE.GetDirectionVec3}(): Obtain the 3D direction vector from the current 3D point to the provided 3D point.
+ --
+ -- ### Translation
+ --
+ -- * @{#COORDINATE.Translate}(): Translate the current 3D point towards an other 3D point using the given Distance and Angle.
+ --
+ -- ### Get the North correction of the current location
+ --
+ -- * @{#COORDINATE.GetNorthCorrection}(): Obtains the north correction at the current 3D point.
+ --
+ --
+ -- ## Point Randomization
+ --
+ -- Various methods exist to calculate random locations around a given 3D point.
+ --
+ -- * @{#COORDINATE.GetRandomVec2InRadius}(): Provides a random 2D vector around the current 3D point, in the given inner to outer band.
+ -- * @{#COORDINATE.GetRandomVec3InRadius}(): Provides a random 3D vector around the current 3D point, in the given inner to outer band.
+ --
+ --
+ -- ## Metric system
+ --
+ -- * @{#COORDINATE.IsMetric}(): Returns if the 3D point is Metric or Nautical Miles.
+ -- * @{#COORDINATE.SetMetric}(): Sets the 3D point to Metric or Nautical Miles.
+ --
+ --
+ -- ## Coorinate text generation
+ --
+ -- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
+ -- * @{#COORDINATE.ToStringLL}(): Generates a Latutude & Longutude text.
+ --
+ -- @field #COORDINATE
+ COORDINATE = {
+ ClassName = "COORDINATE",
+ }
+
--- COORDINATE constructor.
-- @param #COORDINATE self
-- @param Dcs.DCSTypes#Distance x The x coordinate of the Vec3 point, pointing to the North.
@@ -342,7 +229,83 @@ do -- COORDINATE
function COORDINATE:GetVec2()
return { x = self.x, y = self.z }
end
-
+
+ --TODO: check this to replace
+ --- Calculate the distance from a reference @{DCSTypes#Vec2}.
+ -- @param #COORDINATE self
+ -- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{DCSTypes#Vec2}.
+ -- @return Dcs.DCSTypes#Distance The distance from the reference @{DCSTypes#Vec2} in meters.
+ function COORDINATE:DistanceFromVec2( Vec2Reference )
+ self:F2( Vec2Reference )
+
+ local Distance = ( ( Vec2Reference.x - self.x ) ^ 2 + ( Vec2Reference.y - self.z ) ^2 ) ^0.5
+
+ self:T2( Distance )
+ return Distance
+ end
+
+
+ --- Add a Distance in meters from the COORDINATE orthonormal plane, with the given angle, and calculate the new COORDINATE.
+ -- @param #COORDINATE self
+ -- @param Dcs.DCSTypes#Distance Distance The Distance to be added in meters.
+ -- @param Dcs.DCSTypes#Angle Angle The Angle in degrees.
+ -- @return #COORDINATE The new calculated COORDINATE.
+ function COORDINATE:Translate( Distance, Angle )
+ local SX = self.x
+ local SY = self.z
+ local Radians = Angle / 180 * math.pi
+ local TX = Distance * math.cos( Radians ) + SX
+ local TY = Distance * math.sin( Radians ) + SY
+
+ return COORDINATE:NewFromVec2( { x = TX, y = TY } )
+ end
+
+ --- Return a random Vec2 within an Outer Radius and optionally NOT within an Inner Radius of the COORDINATE.
+ -- @param #COORDINATE self
+ -- @param Dcs.DCSTypes#Distance OuterRadius
+ -- @param Dcs.DCSTypes#Distance InnerRadius
+ -- @return Dcs.DCSTypes#Vec2 Vec2
+ function COORDINATE:GetRandomVec2InRadius( OuterRadius, InnerRadius )
+ self:F2( { OuterRadius, InnerRadius } )
+
+ local Theta = 2 * math.pi * math.random()
+ local Radials = math.random() + math.random()
+ if Radials > 1 then
+ Radials = 2 - Radials
+ end
+
+ local RadialMultiplier
+ if InnerRadius and InnerRadius <= OuterRadius then
+ RadialMultiplier = ( OuterRadius - InnerRadius ) * Radials + InnerRadius
+ else
+ RadialMultiplier = OuterRadius * Radials
+ end
+
+ local RandomVec2
+ if OuterRadius > 0 then
+ RandomVec2 = { x = math.cos( Theta ) * RadialMultiplier + self.x, y = math.sin( Theta ) * RadialMultiplier + self.z }
+ else
+ RandomVec2 = { x = self.x, y = self.z }
+ end
+
+ return RandomVec2
+ end
+
+
+ --- Return a random Vec3 within an Outer Radius and optionally NOT within an Inner Radius of the COORDINATE.
+ -- @param #COORDINATE self
+ -- @param Dcs.DCSTypes#Distance OuterRadius
+ -- @param Dcs.DCSTypes#Distance InnerRadius
+ -- @return Dcs.DCSTypes#Vec3 Vec3
+ function COORDINATE:GetRandomVec3InRadius( OuterRadius, InnerRadius )
+
+ local RandomVec2 = self:GetRandomVec2InRadius( OuterRadius, InnerRadius )
+ local y = self.y + math.random( InnerRadius, OuterRadius )
+ local RandomVec3 = { x = RandomVec2.x, y = y, z = RandomVec2.y }
+
+ return RandomVec3
+ end
+
function COORDINATE:SetHeading( Heading )
self.Heading = Heading
@@ -706,7 +669,7 @@ do -- COORDINATE
self:Flare( FLARECOLOR.Red, Azimuth )
end
- --- Returns if a Coordinate has Line of Sight (LOS) with the ToPointVec3.
+ --- Returns if a Coordinate has Line of Sight (LOS) with the ToCoordinate.
-- @param #COORDINATE self
-- @param #COORDINATE ToCoordinate
-- @return #boolean true If the ToCoordinate has LOS with the Coordinate, otherwise false.
@@ -890,6 +853,80 @@ end
do -- POINT_VEC3
+ --- The POINT_VEC3 class
+ -- @type POINT_VEC3
+ -- @field #number x The x coordinate in 3D space.
+ -- @field #number y The y coordinate in 3D space.
+ -- @field #number z The z coordiante in 3D space.
+ -- @field Utilities.Utils#SMOKECOLOR SmokeColor
+ -- @field Utilities.Utils#FLARECOLOR FlareColor
+ -- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
+ -- @field #POINT_VEC3.RoutePointType RoutePointType
+ -- @field #POINT_VEC3.RoutePointAction RoutePointAction
+ -- @extends Core.Point#COORDINATE
+
+
+ --- # POINT_VEC3 class, extends @{Point#COORDINATE}
+ --
+ -- POINT_VEC3 defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
+ --
+ -- **Important Note:** Most of the functions in this section were taken from MIST, and reworked to OO concepts.
+ -- In order to keep the credibility of the the author,
+ -- I want to emphasize that the formulas embedded in the MIST framework were created by Grimes or previous authors,
+ -- who you can find on the Eagle Dynamics Forums.
+ --
+ --
+ -- ## POINT_VEC3 constructor
+ --
+ -- A new POINT_VEC3 object can be created with:
+ --
+ -- * @{#POINT_VEC3.New}(): a 3D point.
+ -- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
+ --
+ --
+ -- ## Manupulate the X, Y, Z coordinates of the POINT_VEC3
+ --
+ -- A POINT_VEC3 class works in 3D space. It contains internally an X, Y, Z coordinate.
+ -- Methods exist to manupulate these coordinates.
+ --
+ -- The current X, Y, Z axis can be retrieved with the methods @{#POINT_VEC3.GetX}(), @{#POINT_VEC3.GetY}(), @{#POINT_VEC3.GetZ}() respectively.
+ -- The methods @{#POINT_VEC3.SetX}(), @{#POINT_VEC3.SetY}(), @{#POINT_VEC3.SetZ}() change the respective axis with a new value.
+ -- The current axis values can be changed by using the methods @{#POINT_VEC3.AddX}(), @{#POINT_VEC3.AddY}(), @{#POINT_VEC3.AddZ}()
+ -- to add or substract a value from the current respective axis value.
+ -- Note that the Set and Add methods return the current POINT_VEC3 object, so these manipulation methods can be chained... For example:
+ --
+ -- local Vec3 = PointVec3:AddX( 100 ):AddZ( 150 ):GetVec3()
+ --
+ --
+ -- ## 3D calculation methods
+ --
+ -- Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:
+ --
+ --
+ -- ## Point Randomization
+ --
+ -- Various methods exist to calculate random locations around a given 3D point.
+ --
+ -- * @{#POINT_VEC3.GetRandomPointVec3InRadius}(): Provides a random 3D point around the current 3D point, in the given inner to outer band.
+ --
+ --
+ -- @field #POINT_VEC3
+ POINT_VEC3 = {
+ ClassName = "POINT_VEC3",
+ Metric = true,
+ RoutePointAltType = {
+ BARO = "BARO",
+ },
+ RoutePointType = {
+ TakeOffParking = "TakeOffParking",
+ TurningPoint = "Turning Point",
+ },
+ RoutePointAction = {
+ FromParkingArea = "From Parking Area",
+ TurningPoint = "Turning Point",
+ },
+ }
+
--- RoutePoint AltTypes
-- @type POINT_VEC3.RoutePointAltType
-- @field BARO "BARO"
@@ -916,7 +953,7 @@ do -- POINT_VEC3
local self = BASE:Inherit( self, COORDINATE:New( x, y, z ) ) -- Core.Point#POINT_VEC3
self:F2( self )
-
+
return self
end
@@ -1023,20 +1060,6 @@ do -- POINT_VEC3
return self
end
- --- Return a random Vec3 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
- -- @param #POINT_VEC3 self
- -- @param Dcs.DCSTypes#Distance OuterRadius
- -- @param Dcs.DCSTypes#Distance InnerRadius
- -- @return Dcs.DCSTypes#Vec3 Vec3
- function POINT_VEC3:GetRandomVec3InRadius( OuterRadius, InnerRadius )
-
- local RandomVec2 = self:GetRandomVec2InRadius( OuterRadius, InnerRadius )
- local y = self:GetY() + math.random( InnerRadius, OuterRadius )
- local RandomVec3 = { x = RandomVec2.x, y = y, z = RandomVec2.y }
-
- return RandomVec3
- end
-
--- Return a random POINT_VEC3 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
-- @param #POINT_VEC3 self
-- @param Dcs.DCSTypes#Distance OuterRadius
@@ -1051,6 +1074,41 @@ end
do -- POINT_VEC2
+ --- @type POINT_VEC2
+ -- @field Dcs.DCSTypes#Distance x The x coordinate in meters.
+ -- @field Dcs.DCSTypes#Distance y the y coordinate in meters.
+ -- @extends Core.Point#COORDINATE
+
+ --- # POINT_VEC2 class, extends @{Point#COORDINATE}
+ --
+ -- The @{Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
+ --
+ -- ## POINT_VEC2 constructor
+ --
+ -- A new POINT_VEC2 instance can be created with:
+ --
+ -- * @{Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
+ -- * @{Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
+ --
+ -- ## Manupulate the X, Altitude, Y coordinates of the 2D point
+ --
+ -- A POINT_VEC2 class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate.
+ -- Methods exist to manupulate these coordinates.
+ --
+ -- The current X, Altitude, Y axis can be retrieved with the methods @{#POINT_VEC2.GetX}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetY}() respectively.
+ -- The methods @{#POINT_VEC2.SetX}(), @{#POINT_VEC2.SetAlt}(), @{#POINT_VEC2.SetY}() change the respective axis with a new value.
+ -- The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods @{#POINT_VEC2.GetLat}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetLon}() respectively.
+ -- The current axis values can be changed by using the methods @{#POINT_VEC2.AddX}(), @{#POINT_VEC2.AddAlt}(), @{#POINT_VEC2.AddY}()
+ -- to add or substract a value from the current respective axis value.
+ -- Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example:
+ --
+ -- local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
+ --
+ -- @field #POINT_VEC2
+ POINT_VEC2 = {
+ ClassName = "POINT_VEC2",
+ }
+
--- POINT_VEC2 constructor.
@@ -1210,36 +1268,6 @@ do -- POINT_VEC2
return self
end
- --- Return a random Vec2 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC2.
- -- @param #POINT_VEC2 self
- -- @param Dcs.DCSTypes#Distance OuterRadius
- -- @param Dcs.DCSTypes#Distance InnerRadius
- -- @return Dcs.DCSTypes#Vec2 Vec2
- function POINT_VEC2:GetRandomVec2InRadius( OuterRadius, InnerRadius )
- self:F2( { OuterRadius, InnerRadius } )
-
- local Theta = 2 * math.pi * math.random()
- local Radials = math.random() + math.random()
- if Radials > 1 then
- Radials = 2 - Radials
- end
-
- local RadialMultiplier
- if InnerRadius and InnerRadius <= OuterRadius then
- RadialMultiplier = ( OuterRadius - InnerRadius ) * Radials + InnerRadius
- else
- RadialMultiplier = OuterRadius * Radials
- end
-
- local RandomVec2
- if OuterRadius > 0 then
- RandomVec2 = { x = math.cos( Theta ) * RadialMultiplier + self:GetX(), y = math.sin( Theta ) * RadialMultiplier + self:GetZ() }
- else
- RandomVec2 = { x = self:GetX(), y = self:GetZ() }
- end
-
- return RandomVec2
- end
--- Return a random POINT_VEC2 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC2.
-- @param #POINT_VEC2 self
@@ -1252,8 +1280,7 @@ do -- POINT_VEC2
return POINT_VEC2:NewFromVec2( self:GetRandomVec2InRadius( OuterRadius, InnerRadius ) )
end
-
--- TODO: Check this to replace
+ -- TODO: Check this to replace
--- Calculate the distance from a reference @{#POINT_VEC2}.
-- @param #POINT_VEC2 self
-- @param #POINT_VEC2 PointVec2Reference The reference @{#POINT_VEC2}.
@@ -1261,43 +1288,12 @@ do -- POINT_VEC2
function POINT_VEC2:DistanceFromPointVec2( PointVec2Reference )
self:F2( PointVec2Reference )
- local Distance = ( ( PointVec2Reference:GetX() - self:GetX() ) ^ 2 + ( PointVec2Reference:GetY() - self:GetY() ) ^2 ) ^0.5
+ local Distance = ( ( PointVec2Reference.x - self.x ) ^ 2 + ( PointVec2Reference.z - self.z ) ^2 ) ^ 0.5
self:T2( Distance )
return Distance
end
---TODO: check this to replace
-
- --- Calculate the distance from a reference @{DCSTypes#Vec2}.
- -- @param #POINT_VEC2 self
- -- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{DCSTypes#Vec2}.
- -- @return Dcs.DCSTypes#Distance The distance from the reference @{DCSTypes#Vec2} in meters.
- function POINT_VEC2:DistanceFromVec2( Vec2Reference )
- self:F2( Vec2Reference )
-
- local Distance = ( ( Vec2Reference.x - self:GetX() ) ^ 2 + ( Vec2Reference.y - self:GetY() ) ^2 ) ^0.5
-
- self:T2( Distance )
- return Distance
- end
-
-
- --- Add a Distance in meters from the POINT_VEC2 orthonormal plane, with the given angle, and calculate the new POINT_VEC2.
- -- @param #POINT_VEC2 self
- -- @param Dcs.DCSTypes#Distance Distance The Distance to be added in meters.
- -- @param Dcs.DCSTypes#Angle Angle The Angle in degrees.
- -- @return #POINT_VEC2 The new calculated POINT_VEC2.
- function POINT_VEC2:Translate( Distance, Angle )
- local SX = self:GetX()
- local SY = self:GetY()
- local Radians = Angle / 180 * math.pi
- local TX = Distance * math.cos( Radians ) + SX
- local TY = Distance * math.sin( Radians ) + SY
-
- return POINT_VEC2:New( TX, TY )
- end
-
end
diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html
index a1c42a3b0..5cbd9bb85 100644
--- a/docs/Documentation/Detection.html
+++ b/docs/Documentation/Detection.html
@@ -2526,7 +2526,7 @@ The index of the DetectedItem.
-
+ #numberDETECTION_BASE.DetectionInterval
diff --git a/docs/Documentation/Fsm.html b/docs/Documentation/Fsm.html
index c5184cb8d..1b1039138 100644
--- a/docs/Documentation/Fsm.html
+++ b/docs/Documentation/Fsm.html
@@ -1627,7 +1627,7 @@ A string defining the start state.
-
+ #stringFSM._StartState
@@ -1926,7 +1926,6 @@ A string defining the start state.
Manupulate the X, Altitude, Y coordinates of the 2D point
+
Create waypoints for routes
-
A COORDINATE class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate.
-Methods exist to manupulate these coordinates.
+
A COORDINATE can prepare waypoints for Ground and Air groups to be embedded into a Route.
TODO: check this to replace
+- Calculate the distance from a reference DCSTypes#Vec2.
+ @param #COORDINATE self
+ @param Dcs.DCSTypes#Vec2 Vec2Reference The reference DCSTypes#Vec2.
+ @return Dcs.DCSTypes#Distance The distance from the reference DCSTypes#Vec2 in meters.
When the first Spawn executes, all the Groups need to be made visible before start.
+
Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
diff --git a/docs/Documentation/Task_A2A_Dispatcher.html b/docs/Documentation/Task_A2A_Dispatcher.html
index 5faeb923b..56997d179 100644
--- a/docs/Documentation/Task_A2A_Dispatcher.html
+++ b/docs/Documentation/Task_A2A_Dispatcher.html
@@ -185,7 +185,7 @@ Find a summary below describing for which situation a task type is created:
@@ -381,6 +381,11 @@ Find a summary below describing for which situation a task type is created:
+
TaskIndex :
+
+
+
+
DetectedItemChanged :
diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html
index adb4ba2fe..5740dc732 100644
--- a/docs/Documentation/Task_Cargo.html
+++ b/docs/Documentation/Task_Cargo.html
@@ -506,7 +506,7 @@ based on the tasking capabilities defined in Task#TA