From e06b2c5e4f549a43b68b6b1dd872c85a1b563151 Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Sat, 27 May 2017 10:04:43 +0200
Subject: [PATCH 1/7] Documentation
---
Moose Development/Moose/Core/Cargo.lua | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Moose Development/Moose/Core/Cargo.lua b/Moose Development/Moose/Core/Cargo.lua
index 02f4c344b..5ecb9e6b3 100644
--- a/Moose Development/Moose/Core/Cargo.lua
+++ b/Moose Development/Moose/Core/Cargo.lua
@@ -13,9 +13,9 @@
--
-- # Demo Missions
--
--- ### [CARGO Demo Missions source code]()
+-- ### [CARGO Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/CGO%20-%20Cargo)
--
--- ### [CARGO Demo Missions, only for beta testers]()
+-- ### [CARGO Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CGO%20-%20Cargo)
--
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
--
@@ -23,7 +23,7 @@
--
-- # YouTube Channel
--
--- ### [SPAWNSTATIC YouTube Channel]()
+-- ### [CARGO YouTube Channel](https://www.youtube.com/watch?v=tM00lTlkpYs&list=PL7ZUrU4zZUl2zUTuKrLW5RsO9zLMqUtbf)
--
-- ====
--
From 051cc4955f73097387f8238210fdf5d573d5ddd7 Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Sat, 27 May 2017 10:09:44 +0200
Subject: [PATCH 2/7] CARGO
---
.../bin/TreeHierarchy.csv | 30 ++---
docs/Documentation/Cargo.html | 8 +-
docs/Documentation/Group.html | 24 ++++
docs/Documentation/Mission.html | 125 ++++++++++++++++++
docs/Documentation/Point.html | 117 +---------------
docs/Documentation/Radio.html | 4 +-
docs/Documentation/Spawn.html | 9 +-
docs/Documentation/Spot.html | 4 +
docs/Documentation/Task_Cargo.html | 82 +++++++++++-
9 files changed, 262 insertions(+), 141 deletions(-)
diff --git a/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv b/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv
index c5a17961d..2f09984f2 100644
--- a/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv
+++ b/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv
@@ -8,21 +8,21 @@
@K=function, @M=Task_A2G, @N=onafterEngage, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=6215,
@K=function, @M=Task_A2G, @N=onafterRouteToTarget, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=6537,
@K=function, @M=Task_A2G, @N=onafterRouteToTargets, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=7416,
-@K=function, @M=Task_Cargo, @N=onafterSelectAction, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=10673,
-@K=function, @M=Task_Cargo, @N=OnLeaveWaitingForCommand, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=13702,
-@K=function, @M=Task_Cargo, @N=onafterRouteToPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=14474,
-@K=function, @M=Task_Cargo, @N=onafterArriveAtPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15093,
-@K=function, @M=Task_Cargo, @N=onafterCancelRouteToPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15634,
-@K=function, @M=Task_Cargo, @N=onafterRouteToDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15971,
-@K=function, @M=Task_Cargo, @N=onafterArriveAtDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16418,
-@K=function, @M=Task_Cargo, @N=onafterCancelRouteToDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16846,
-@K=function, @M=Task_Cargo, @N=onafterLanded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=18133,
-@K=function, @M=Task_Cargo, @N=onafterPrepareBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=18899,
-@K=function, @M=Task_Cargo, @N=onafterBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=19359,
-@K=function, @M=Task_Cargo, @N=onafterBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=20300,
-@K=function, @M=Task_Cargo, @N=onafterPrepareUnBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=20983,
-@K=function, @M=Task_Cargo, @N=onafterUnBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=21943,
-@K=function, @M=Task_Cargo, @N=onafterUnBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=22962,
+@K=function, @M=Task_Cargo, @N=onafterSelectAction, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=10711,
+@K=function, @M=Task_Cargo, @N=OnLeaveWaitingForCommand, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=13740,
+@K=function, @M=Task_Cargo, @N=onafterRouteToPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=14601,
+@K=function, @M=Task_Cargo, @N=onafterArriveAtPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15222,
+@K=function, @M=Task_Cargo, @N=onafterCancelRouteToPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15751,
+@K=function, @M=Task_Cargo, @N=onafterRouteToDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16088,
+@K=function, @M=Task_Cargo, @N=onafterArriveAtDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16535,
+@K=function, @M=Task_Cargo, @N=onafterCancelRouteToDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16963,
+@K=function, @M=Task_Cargo, @N=onafterLanded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=18250,
+@K=function, @M=Task_Cargo, @N=onafterPrepareBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=19016,
+@K=function, @M=Task_Cargo, @N=onafterBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=19476,
+@K=function, @M=Task_Cargo, @N=onafterBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=20417,
+@K=function, @M=Task_Cargo, @N=onafterPrepareUnBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=21100,
+@K=function, @M=Task_Cargo, @N=onafterUnBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=22060,
+@K=function, @M=Task_Cargo, @N=onafterUnBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=23079,
@K=function, @M=Designate, @N=OnBeforeLaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12218,
@K=function, @M=Designate, @N=OnAfterLaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12466,
@K=function, @M=Designate, @N=LaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12687,
diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html
index 875f99a43..243a8f68c 100644
--- a/docs/Documentation/Cargo.html
+++ b/docs/Documentation/Cargo.html
@@ -119,9 +119,9 @@
Demo Missions
-
+
-
+
@@ -129,7 +129,7 @@
YouTube Channel
-
+
@@ -2924,6 +2924,7 @@ The range till cargo will board.
-
+
CARGO_UNIT.CargoCarrier
@@ -3049,7 +3050,6 @@ The range till cargo will board.
-
- #number
CARGO_UNIT.RunCount
diff --git a/docs/Documentation/Group.html b/docs/Documentation/Group.html
index 13a3699cd..5cfa7fc71 100644
--- a/docs/Documentation/Group.html
+++ b/docs/Documentation/Group.html
@@ -305,6 +305,12 @@
| GROUP:GetMinHeight() |
Returns the current minimum height of the group.
+ |
+
+
+ | GROUP:GetPlayerName() |
+
+ Gets the player name of the group.
|
@@ -1103,6 +1109,24 @@ Minimum height found.
-
+
+GROUP:GetPlayerName()
+
+
+-
+
+
Gets the player name of the group.
+
+ Return value
+
+#string:
+The player name of the group.
+
+
+
+
+-
+
GROUP:GetPlayerNames()
diff --git a/docs/Documentation/Mission.html b/docs/Documentation/Mission.html
index 127fc4288..6d500b748 100644
--- a/docs/Documentation/Mission.html
+++ b/docs/Documentation/Mission.html
@@ -301,6 +301,12 @@ A CLIENT needs to be registered within the MISSION.MissionBriefing
|
+ |
+
+
+ | MISSION:MissionGoals() |
+
+ MissionGoals Trigger for MISSION
|
@@ -337,6 +343,12 @@ A CLIENT needs to be registered within the MISSION:OnAfterFail(From, Event, To)
|
OnAfter Transition Handler for Event Fail.
+ |
+
+
+ | MISSION:OnAfterMissionGoals(From, Event, To) |
+
+ MissionGoals Handler OnAfter for MISSION
|
@@ -361,6 +373,12 @@ A CLIENT needs to be registered within the MISSION:OnBeforeFail(From, Event, To)
|
OnBefore Transition Handler for Event Fail.
+ |
+
+
+ | MISSION:OnBeforeMissionGoals(From, Event, To) |
+
+ MissionGoals Handler OnBefore for MISSION
|
@@ -523,6 +541,12 @@ A CLIENT needs to be registered within the MISSION:__Fail(Delay)
|
Asynchronous Event Trigger for Event Fail.
+ |
+
+
+ | MISSION:__MissionGoals(Delay) |
+
+ MissionGoals Asynchronous Trigger for MISSION
|
@@ -1272,6 +1296,19 @@ The status
+
+
+
+-
+
+
+MISSION:MissionGoals()
+
+
+-
+
+
MissionGoals Trigger for MISSION
+
@@ -1440,6 +1477,37 @@ The To State string.
-
+
+MISSION:OnAfterMissionGoals(From, Event, To)
+
+
+-
+
+
MissionGoals Handler OnAfter for MISSION
+
+ Parameters
+
+ -
+
+
#string From :
+
+
+ -
+
+
#string Event :
+
+
+ -
+
+
#string To :
+
+
+
+
+
+
+-
+
MISSION:OnAfterStart(From, Event, To)
@@ -1581,6 +1649,42 @@ The To State string.
#boolean:
Return false to cancel Transition.
+
+
+
+-
+
+
+MISSION:OnBeforeMissionGoals(From, Event, To)
+
+
+-
+
+
MissionGoals Handler OnBefore for MISSION
+
+ Parameters
+
+ -
+
+
#string From :
+
+
+ -
+
+
#string Event :
+
+
+ -
+
+
#string To :
+
+
+
+ Return value
+
+#boolean:
+
+
@@ -2325,6 +2429,27 @@ The delay in seconds.
-
+
+MISSION:__MissionGoals(Delay)
+
+
+-
+
+
MissionGoals Asynchronous Trigger for MISSION
+
+ Parameter
+
+ -
+
+
#number Delay :
+
+
+
+
+
+
+-
+
MISSION:__Start(Delay)
diff --git a/docs/Documentation/Point.html b/docs/Documentation/Point.html
index dee30da78..1f63adeda 100644
--- a/docs/Documentation/Point.html
+++ b/docs/Documentation/Point.html
@@ -331,24 +331,6 @@
| COORDINATE:IsLOS(ToCoordinate) |
Returns if a Coordinate has Line of Sight (LOS) with the ToCoordinate.
- |
-
-
- | COORDINATE:IsModeA2A() |
-
- Is the mode to A2A
- |
-
-
- | COORDINATE:IsModeA2G() |
-
- Is the mode to A2G
- |
-
-
- | COORDINATE.Mode |
-
-
|
@@ -385,18 +367,6 @@
| COORDINATE:SetHeading(Heading) |
- |
-
-
- | COORDINATE:SetModeA2A() |
-
- Set the mode to A2A
- |
-
-
- | COORDINATE:SetModeA2G() |
-
- Set the mode to A2G
|
@@ -1698,56 +1668,6 @@ The Vec3 format coordinate.
#boolean:
true If the ToCoordinate has LOS with the Coordinate, otherwise false.
-
-
-
--
-
-
-COORDINATE:IsModeA2A()
-
-
--
-
-
Is the mode to A2A
-
- Return value
-
-#boolean:
-
-
-
-
-
--
-
-
-COORDINATE:IsModeA2G()
-
-
--
-
-
Is the mode to A2G
-
- Return value
-
-#boolean:
-
-
-
-
-
--
-
- #string
-
-COORDINATE.Mode
-
-
--
-
-
-
@@ -1957,42 +1877,6 @@ The route point.
-
-
-COORDINATE:SetModeA2A()
-
-
--
-
-
Set the mode to A2A
-
- Return value
-
-#COORDINATE:
-
-
-
-
-
--
-
-
-COORDINATE:SetModeA2G()
-
-
--
-
-
Set the mode to A2G
-
- Return value
-
-#COORDINATE:
-
-
-
-
-
--
-
COORDINATE:Smoke(SmokeColor)
@@ -2883,6 +2767,7 @@ The y coordinate.
-
+
POINT_VEC2.z
diff --git a/docs/Documentation/Radio.html b/docs/Documentation/Radio.html
index 93a2ea611..2c1c82608 100644
--- a/docs/Documentation/Radio.html
+++ b/docs/Documentation/Radio.html
@@ -235,7 +235,7 @@ This uses the very generic singleton function "trigger.action.radioTransmission(
| RADIO.Loop |
-
+ (default true)
|
@@ -781,7 +781,7 @@ self
-
-
+
(default true)
diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html
index c96559421..0ce1033f1 100644
--- a/docs/Documentation/Spawn.html
+++ b/docs/Documentation/Spawn.html
@@ -2549,6 +2549,9 @@ when nothing was spawned.
+
+ By default, no InitLimit
+
@@ -2584,7 +2587,7 @@ when nothing was spawned.
-
-
+ #number
SPAWN.SpawnMaxGroups
@@ -2601,7 +2604,7 @@ when nothing was spawned.
-
-
+ #number
SPAWN.SpawnMaxUnitsAlive
@@ -2929,7 +2932,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
-
-
+ #boolean
SPAWN.SpawnUnControlled
diff --git a/docs/Documentation/Spot.html b/docs/Documentation/Spot.html
index 018cdd833..765a0449d 100644
--- a/docs/Documentation/Spot.html
+++ b/docs/Documentation/Spot.html
@@ -766,6 +766,7 @@ true if it is lasing
-
+
SPOT.ScheduleID
@@ -779,6 +780,7 @@ true if it is lasing
-
+
SPOT.SpotIR
@@ -792,6 +794,7 @@ true if it is lasing
-
+
SPOT.SpotLaser
@@ -805,6 +808,7 @@ true if it is lasing
-
+
SPOT.Target
diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html
index 5740dc732..551956b7a 100644
--- a/docs/Documentation/Task_Cargo.html
+++ b/docs/Documentation/Task_Cargo.html
@@ -215,6 +215,12 @@ and various dedicated deployment zones.
| TASK_CARGO:GetPlannedMenuText() |
+ |
+
+
+ | TASK_CARGO:GetSmokeColor() |
+
+
|
@@ -275,6 +281,18 @@ and various dedicated deployment zones.
| TASK_CARGO:SetScoreOnSuccess(Text, Score, TaskUnit) |
Set a score when all the targets in scope of the A2G attack, have been destroyed.
+ |
+
+
+ | TASK_CARGO.SetSmokeColor(Color, self, SmokeColor) |
+
+
+ |
+
+
+ | TASK_CARGO.SmokeColor |
+
+
|
@@ -506,7 +524,7 @@ based on the tasking capabilities defined in Task#TA
-
- Core.Cargo#CARGO_GROUP
+
FSM_PROCESS.Cargo
@@ -629,6 +647,22 @@ Core.Zone#ZONE_BASE> The Deployment Zones.
+
+
+
+-
+
+
+TASK_CARGO:GetSmokeColor()
+
+
+-
+
+
+
+
+
@return SmokeColor
+
@@ -970,6 +1004,52 @@ The score in points.
#TASK_CARGO:
+
+
+
+-
+
+
+TASK_CARGO.SetSmokeColor(Color, self, SmokeColor)
+
+
+-
+
+
+
+
Parameters
+
+
+
+
+-
+
+
+
+TASK_CARGO.SmokeColor
+
+
+-
+
+
+
From 6f183bad7438ea932f8d6e4c22d3f3e31d700c10 Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Sun, 28 May 2017 09:13:00 +0200
Subject: [PATCH 3/7] Update
---
Moose Development/Moose/Core/Database.lua | 6 +++
.../Moose/Tasking/CommandCenter.lua | 31 +++++++++++
.../Moose/Tasking/Task_A2A_Dispatcher.lua | 52 +++++++------------
3 files changed, 57 insertions(+), 32 deletions(-)
diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua
index fed13c2a4..d4e6e7e95 100644
--- a/Moose Development/Moose/Core/Database.lua
+++ b/Moose Development/Moose/Core/Database.lua
@@ -64,6 +64,7 @@ DATABASE = {
COUNTRY_NAME = {},
NavPoints = {},
PLAYERSETTINGS = {},
+ ZONENAMES = {},
}
local _DATABASECoalition =
@@ -1024,6 +1025,11 @@ function DATABASE:_RegisterTemplates()
end --if coa_name == 'red' or coa_name == 'blue' and type(coa_data) == 'table' then
end --for coa_name, coa_data in pairs(mission.coalition) do
+ for ZoneID, ZoneData in pairs( env.triggers.zones ) do
+ local ZoneName = ZoneData.Name
+ self.ZONENAMES[ZoneName] = ZoneName
+ end
+
return self
end
diff --git a/Moose Development/Moose/Tasking/CommandCenter.lua b/Moose Development/Moose/Tasking/CommandCenter.lua
index 1c03860e8..6be2a0834 100644
--- a/Moose Development/Moose/Tasking/CommandCenter.lua
+++ b/Moose Development/Moose/Tasking/CommandCenter.lua
@@ -91,6 +91,9 @@ COMMANDCENTER = {
CommandCenterCoalition = nil,
CommandCenterPositionable = nil,
Name = "",
+ ReferencePoints = {},
+ ReferenceNames = {},
+ CommunicationMode = "80",
}
--- The constructor takes an IDENTIFIABLE as the HQ command center.
-- @param #COMMANDCENTER self
@@ -251,6 +254,34 @@ function COMMANDCENTER:RemoveMission( Mission )
return Mission
end
+--- Set reference points known by the command center to guide airborne units during WWII.
+-- These reference points are zones, with a special name.
+-- @param #COMMANDCENTER self
+-- @param #string ReferenceZonePrefix Reference points.
+-- @return #COMMANDCENTER
+function COMMANDCENTER:SetReferenceZones( ReferenceZonePrefix )
+ local MatchPattern = "(" .. ReferenceZonePrefix .. ")" .. "#(a+)"
+ for ReferenceZoneName in pairs( _DATABASE.ZONENAMES ) do
+ local ZoneName, ReferenceName = string.match( ReferenceZoneName, MatchPattern )
+ self:T( { ZoneName = ZoneName, ReferenceName = ReferenceName } )
+ if ZoneName and ReferenceName then
+ self.ReferencePoints[ZoneName] = ZONE:New( ZoneName )
+ self.ReferenceNames[ZoneName] = ReferenceName
+ end
+ end
+ return self
+end
+
+--- Set the commandcenter operations in WWII mode
+-- This will disable LL, MGRS, BRA, BULLS from the settings.
+-- It will also disable the settings at the settings menu for these.
+-- And, it will use any ReferenceZones set as reference points for communication.
+-- @param #COMMANDCENTER self
+-- @return #COMMANDCENTER
+function COMMANDCENTER:SetModeWWII()
+ self.CommunicationMode = "WWII"
+end
+
--- Sets the menu structure of the Missions governed by the HQ command center.
-- @param #COMMANDCENTER self
function COMMANDCENTER:SetMenu()
diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
index ca0f56050..3e95e6f29 100644
--- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
@@ -1,35 +1,6 @@
--- **Tasking** - The TASK_A2A_DISPATCHER creates and manages player TASK_A2A tasks based on detected targets.
--
-- ===
---
--- # 1) @{#TASK_A2A_DISPATCHER} class, extends @{#DETECTION_MANAGER}
---
--- The @{#TASK_A2A_DISPATCHER} 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 @{Task}s 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.
---
--- Other task types will follow...
---
--- 3.1) TASK_A2A_DISPATCHER constructor:
--- --------------------------------------
--- The @{#TASK_A2A_DISPATCHER.New}() method creates a new TASK_A2A_DISPATCHER instance.
---
--- ===
---
--- # **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:
---
--- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
--
@@ -45,10 +16,25 @@ do -- TASK_A2A_DISPATCHER
--- TASK_A2A_DISPATCHER class.
-- @type TASK_A2A_DISPATCHER
- -- @field Set#SET_GROUP SetGroup The groups to which the FAC will report to.
- -- @field Functional.Detection#DETECTION_BASE Detection The DETECTION_BASE object that is used to report the detected objects. The Detection object will only function in RADAR mode!!!
- -- @field Tasking.Mission#MISSION Mission
-- @extends Tasking.DetectionManager#DETECTION_MANAGER
+
+ --- # TASK_A2A_DISPATCHER class, extends @{Tasking#DETECTION_MANAGER}
+ --
+ -- The @{#TASK_A2A_DISPATCHER} 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 @{Task}s 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.
+ --
+ -- Other task types will follow...
+ --
+ -- # TASK_A2A_DISPATCHER constructor:
+ -- --------------------------------------
+ -- The @{#TASK_A2A_DISPATCHER.New}() method creates a new TASK_A2A_DISPATCHER instance.
+ --
+ -- @field #TASK_A2A_DISPATCHER
TASK_A2A_DISPATCHER = {
ClassName = "TASK_A2A_DISPATCHER",
Mission = nil,
@@ -71,6 +57,8 @@ do -- TASK_A2A_DISPATCHER
self.Detection = Detection
self.Mission = Mission
+
+ -- TODO: Check detection through radar.
self.Detection:FilterCategories( Unit.Category.AIRPLANE, Unit.Category.HELICOPTER )
--self.Detection:InitDetectRadar( true )
self.Detection:SetDetectionInterval( 30 )
From f8ab65ce0e323cb42ef7332712f412677dd53f7b Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Sun, 28 May 2017 18:24:44 +0200
Subject: [PATCH 4/7] Reference points implemented
---
Moose Development/Moose/Actions/Act_Route.lua | 40 ++++++++++++++--
Moose Development/Moose/Core/Database.lua | 4 +-
Moose Development/Moose/Core/Point.lua | 43 ++++++++++++++---
Moose Development/Moose/Core/Zone.lua | 1 -
.../Moose/Tasking/CommandCenter.lua | 22 +++++++--
Moose Development/Moose/Tasking/Task_A2A.lua | 47 +++++++++++++++++++
6 files changed, 138 insertions(+), 19 deletions(-)
diff --git a/Moose Development/Moose/Actions/Act_Route.lua b/Moose Development/Moose/Actions/Act_Route.lua
index a336dffea..56d0a849c 100644
--- a/Moose Development/Moose/Actions/Act_Route.lua
+++ b/Moose Development/Moose/Actions/Act_Route.lua
@@ -157,17 +157,49 @@ do -- ACT_ROUTE
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @return #string
function ACT_ROUTE:GetRouteText( Controllable )
-
+
+ self:E()
+
local RouteText = ""
+ local Coordinate = nil -- Core.Point#COORDINATE
+
if self.Coordinate then
- RouteText = self.Coordinate:ToString( Controllable )
+ Coordinate = self.Coordinate
end
if self.Zone then
- local Coordinate = self.Zone:GetPointVec3( self.Altitude )
+ Coordinate = self.Zone:GetPointVec3( self.Altitude )
Coordinate:SetHeading( self.Heading )
- RouteText = Coordinate:ToString( Controllable )
+ end
+
+
+ local CC = self:GetTask():GetMission():GetCommandCenter()
+ if CC then
+ if CC:IsModeWWII() then
+ -- Find closest reference point to the target.
+ local ShortestDistance = 0
+ local ShortestReferencePoint = nil
+ local ShortestReferenceName = ""
+ self:E( { CC.ReferencePoints } )
+ for ZoneName, Zone in pairs( CC.ReferencePoints ) do
+ self:E( { ZoneName = ZoneName } )
+ local Zone = Zone -- Core.Zone#ZONE
+ local ZoneCoord = Zone:GetCoordinate()
+ local ZoneDistance = ZoneCoord:Get2DDistance( self.Coordinate )
+ self:E( { ShortestDistance, ShortestReferenceName } )
+ if ShortestDistance == 0 or ZoneDistance < ShortestDistance then
+ ShortestDistance = ZoneDistance
+ ShortestReferencePoint = ZoneCoord
+ ShortestReferenceName = CC.ReferenceNames[ZoneName]
+ end
+ end
+ if ShortestReferencePoint then
+ RouteText = Coordinate:ToStringFromRP( ShortestReferencePoint, ShortestReferenceName, Controllable )
+ end
+ else
+ RouteText = self.Coordinate:ToString( Controllable )
+ end
end
return RouteText
diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua
index d4e6e7e95..0a40cfb62 100644
--- a/Moose Development/Moose/Core/Database.lua
+++ b/Moose Development/Moose/Core/Database.lua
@@ -1025,8 +1025,8 @@ function DATABASE:_RegisterTemplates()
end --if coa_name == 'red' or coa_name == 'blue' and type(coa_data) == 'table' then
end --for coa_name, coa_data in pairs(mission.coalition) do
- for ZoneID, ZoneData in pairs( env.triggers.zones ) do
- local ZoneName = ZoneData.Name
+ for ZoneID, ZoneData in pairs( env.mission.triggers.zones ) do
+ local ZoneName = ZoneData.name
self.ZONENAMES[ZoneName] = ZoneName
end
diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua
index 35cd570c9..7b299aba1 100644
--- a/Moose Development/Moose/Core/Point.lua
+++ b/Moose Development/Moose/Core/Point.lua
@@ -62,6 +62,7 @@ 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.
@@ -182,7 +183,7 @@ do -- COORDINATE
-- @param #COORDINATE self
-- @param Dcs.DCSTypes#Vec2 Vec2 The Vec2 point.
-- @param Dcs.DCSTypes#Distance LandHeightAdd (optional) The default height if required to be evaluated will be the land height of the x, y coordinate. You can specify an extra height to be added to the land height.
- -- @return Core.Point#COORDINATE
+ -- @return #COORDINATE
function COORDINATE:NewFromVec2( Vec2, LandHeightAdd )
local LandHeight = land.getHeight( Vec2 )
@@ -204,9 +205,8 @@ do -- COORDINATE
-- @return Core.Point#COORDINATE
function COORDINATE:NewFromVec3( Vec3 )
- local self = self:New( Vec3.x, Vec3.y, Vec3.z )
+ local self = self:New( Vec3.x, Vec3.y, Vec3.z ) -- #COORDINATE
- --local self = BASE:Inherit( self, POINT_VEC3:NewFromVec3( Vec3 ) ) -- Core.Point#COORDINATE
self:F2( self )
return self
@@ -773,6 +773,37 @@ do -- COORDINATE
return "MGRS, " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
end
+ --- Provides a coordinate string of the point, based on a coordinate format system:
+ -- * 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 Wrapper.Controllable#CONTROLLABLE Controllable
+ -- @param Core.Settings#SETTINGS Settings
+ -- @return #string The coordinate Text in the configured coordinate system.
+ function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings ) -- R2.2
+
+ self:E( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } )
+
+ local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS
+
+ local IsAir = Controllable and Controllable:IsAirPlane() or false
+
+ if IsAir then
+ local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
+ local AngleRadians = self:GetAngleRadians( DirectionVec3 )
+ local Distance = self:Get2DDistance( ReferenceCoord )
+ return "Targets are the last seen " .. self:GetBRText( AngleRadians, Distance, Settings ) .. " from " .. ReferenceName
+ else
+ local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
+ local AngleRadians = self:GetAngleRadians( DirectionVec3 )
+ local Distance = self:Get2DDistance( ReferenceCoord )
+ return "Target are located " .. self:GetBRText( AngleRadians, Distance, Settings ) .. " from " .. ReferenceName
+ end
+
+ return nil
+
+ end
+
--- Provides a coordinate string of the point, based on a coordinate format system:
-- * Uses default settings in COORDINATE.
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
@@ -1107,7 +1138,7 @@ do -- POINT_VEC2
LandHeightAdd = LandHeightAdd or 0
LandHeight = LandHeight + LandHeightAdd
- local self = BASE:Inherit( self, COORDINATE:NewFromVec2( Vec2, LandHeightAdd ) ) -- Core.Point#POINT_VEC2
+ local self = BASE:Inherit( self, COORDINATE:NewFromVec2( Vec2, LandHeightAdd ) ) -- #POINT_VEC2
self:F2( self )
return self
@@ -1119,9 +1150,7 @@ do -- POINT_VEC2
-- @return Core.Point#POINT_VEC2 self
function POINT_VEC2:NewFromVec3( Vec3 )
- local self = BASE:Inherit( self, BASE:New() )
-
- local self = BASE:Inherit( self, COORDINATE:New( Vec3.x, Vec3.y, Vec3.z ) ) -- Core.Point#POINT_VEC2
+ local self = BASE:Inherit( self, COORDINATE:NewFromVec3( Vec3 ) ) -- #POINT_VEC2
self:F2( self )
return self
diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua
index 7544c43bc..8ae7aa3ff 100644
--- a/Moose Development/Moose/Core/Zone.lua
+++ b/Moose Development/Moose/Core/Zone.lua
@@ -225,7 +225,6 @@ end
--- Returns a @{Point#COORDINATE} of the zone.
-- @param #ZONE_BASE self
--- @param Dcs.DCSTypes#Distance Height The height to add to the land height where the center of the zone is located.
-- @return Core.Point#COORDINATE The Coordinate of the zone.
function ZONE_BASE:GetCoordinate()
self:F2( self.ZoneName )
diff --git a/Moose Development/Moose/Tasking/CommandCenter.lua b/Moose Development/Moose/Tasking/CommandCenter.lua
index e892df728..30a4fe883 100644
--- a/Moose Development/Moose/Tasking/CommandCenter.lua
+++ b/Moose Development/Moose/Tasking/CommandCenter.lua
@@ -262,13 +262,14 @@ end
-- @param #string ReferenceZonePrefix Reference points.
-- @return #COMMANDCENTER
function COMMANDCENTER:SetReferenceZones( ReferenceZonePrefix )
- local MatchPattern = "(" .. ReferenceZonePrefix .. ")" .. "#(a+)"
+ local MatchPattern = "(.*)#(.*)"
+ self:F( { MatchPattern = MatchPattern } )
for ReferenceZoneName in pairs( _DATABASE.ZONENAMES ) do
local ZoneName, ReferenceName = string.match( ReferenceZoneName, MatchPattern )
- self:T( { ZoneName = ZoneName, ReferenceName = ReferenceName } )
- if ZoneName and ReferenceName then
- self.ReferencePoints[ZoneName] = ZONE:New( ZoneName )
- self.ReferenceNames[ZoneName] = ReferenceName
+ self:F( { ZoneName = ZoneName, ReferenceName = ReferenceName } )
+ if ZoneName and ReferenceName and ZoneName == ReferenceZonePrefix then
+ self.ReferencePoints[ReferenceZoneName] = ZONE:New( ReferenceZoneName )
+ self.ReferenceNames[ReferenceZoneName] = ReferenceName
end
end
return self
@@ -284,6 +285,17 @@ function COMMANDCENTER:SetModeWWII()
self.CommunicationMode = "WWII"
end
+
+--- Returns if the commandcenter operations is in WWII mode
+-- @param #COMMANDCENTER self
+-- @return #boolean true if in WWII mode.
+function COMMANDCENTER:IsModeWWII()
+ return self.CommunicationMode == "WWII"
+end
+
+
+
+
--- Sets the menu structure of the Missions governed by the HQ command center.
-- @param #COMMANDCENTER self
function COMMANDCENTER:SetMenu()
diff --git a/Moose Development/Moose/Tasking/Task_A2A.lua b/Moose Development/Moose/Tasking/Task_A2A.lua
index 2590a06f9..2bd6cfc80 100644
--- a/Moose Development/Moose/Tasking/Task_A2A.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A.lua
@@ -384,6 +384,53 @@ do -- TASK_A2A_INTERCEPT
end
+do -- TASK_A2A_SWEEP
+
+ --- The TASK_A2A_SWEEP class
+ -- @type TASK_A2A_SWEEP
+ -- @field Set#SET_UNIT TargetSetUnit
+ -- @extends Tasking.Task#TASK
+ TASK_A2A_SWEEP = {
+ ClassName = "TASK_A2A_SWEEP",
+ }
+
+
+
+ --- Instantiates a new TASK_A2A_SWEEP.
+ -- @param #TASK_A2A_SWEEP self
+ -- @param Tasking.Mission#MISSION Mission
+ -- @param Core.Set#SET_GROUP SetGroup The set of groups for which the Task can be assigned.
+ -- @param #string TaskName The name of the Task.
+ -- @param Core.Set#SET_UNIT TargetSetUnit
+ -- @param #string TaskBriefing The briefing of the task.
+ -- @return #TASK_A2A_SWEEP self
+ function TASK_A2A_SWEEP:New( Mission, SetGroup, TaskName, TargetSetUnit, TaskBriefing )
+ local self = BASE:Inherit( self, TASK_A2A:New( Mission, SetGroup, TaskName, TargetSetUnit, "INTERCEPT", TaskBriefing ) ) -- #TASK_A2A_SWEEP
+ self:F()
+
+ Mission:AddTask( self )
+
+ --TODO: Add BR, Altitude, type of planes...
+
+ self:SetBriefing(
+ TaskBriefing or
+ "Perform a fighter sweep. Incoming intruders were detected and could be hiding at the location.\n"
+ )
+
+ local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
+ self:SetInfo( "Coordinates", TargetCoordinate )
+
+ self:SetInfo( "Assumed Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
+ local DetectedItemsCount = TargetSetUnit:Count()
+ local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
+ self:SetInfo( "Lost Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
+
+ return self
+ end
+
+end
+
+
do -- TASK_A2A_ENGAGE
--- The TASK_A2A_ENGAGE class
From 333eba2cb83bb593ff78f55285349f1056767e3c Mon Sep 17 00:00:00 2001
From: Delta-99 <99delta+github@gmail.com>
Date: Sun, 28 May 2017 12:51:50 -0400
Subject: [PATCH 5/7] OnSpawnGroup happening before BIRTH sometimes
Add a little bit of a delay in calling the OnSpawnGroup function as it
sometimes happens before the actual BIRTH event of the group.
---
Moose Development/Moose/Functional/Spawn.lua | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Moose Development/Moose/Functional/Spawn.lua b/Moose Development/Moose/Functional/Spawn.lua
index 6e9386a7d..862cc6f07 100644
--- a/Moose Development/Moose/Functional/Spawn.lua
+++ b/Moose Development/Moose/Functional/Spawn.lua
@@ -855,7 +855,10 @@ function SPAWN:SpawnWithIndex( SpawnIndex )
-- If there is a SpawnFunction hook defined, call it.
if self.SpawnFunctionHook then
- self.SpawnFunctionHook( self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) )
+ -- delay calling this for .1 seconds so that it hopefully comes after the BIRTH event of the group.
+ self.SpawnHookScheduler = SCHEDULER:New()
+ self.SpawnHookScheduler:Schedule( nil, self.SpawnFunctionHook, { self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments)}, 0.1 )
+ -- self.SpawnFunctionHook( self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) )
end
-- TODO: Need to fix this by putting an "R" in the name of the group when the group repeats.
--if self.Repeat then
From 8096c170d5f352925c12292060192c910946604f Mon Sep 17 00:00:00 2001
From: Delta-99 <99delta+github@gmail.com>
Date: Sun, 28 May 2017 13:09:50 -0400
Subject: [PATCH 6/7] EnRouteTaskEngageTargets defined twice
EnRouteTaskEngageTargets was defined twice. The 2nd instance looks like
it should have been named EnRouteTaskEngageTargetsInZone. Fixed and
added documentation at the top.
---
Moose Development/Moose/Wrapper/Controllable.lua | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua
index a1e05db0d..d56bb6dad 100644
--- a/Moose Development/Moose/Wrapper/Controllable.lua
+++ b/Moose Development/Moose/Wrapper/Controllable.lua
@@ -61,6 +61,7 @@
-- * @{#CONTROLLABLE.EnRouteTaskAWACS}: (AIR) Aircraft will act as an AWACS for friendly units (will provide them with information about contacts). No parameters.
-- * @{#CONTROLLABLE.EnRouteTaskEngageControllable}: (AIR) Engaging a controllable. The task does not assign the target controllable to the unit/controllable to attack now; it just allows the unit/controllable to engage the target controllable as well as other assigned targets.
-- * @{#CONTROLLABLE.EnRouteTaskEngageTargets}: (AIR) Engaging targets of defined types.
+-- * @{#CONTROLLABLE.EnRouteTaskEngageTargetsInZone}: (AIR) Engaging a targets of defined types at circle-shaped zone.
-- * @{#CONTROLLABLE.EnRouteTaskEWR}: (AIR) Attack the Unit.
-- * @{#CONTROLLABLE.EnRouteTaskFAC}: (AIR + GROUND) The task makes the controllable/unit a FAC and lets the FAC to choose a targets (enemy ground controllable) around as well as other assigned targets.
-- * @{#CONTROLLABLE.EnRouteTaskFAC_EngageControllable}: (AIR + GROUND) The task makes the controllable/unit a FAC and lets the FAC to choose the target (enemy ground controllable) as well as other assigned targets.
@@ -1088,7 +1089,7 @@ end
-- @param Dcs.DCSTypes#AttributeNameArray TargetTypes Array of target categories allowed to engage.
-- @param #number Priority All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
-- @return Dcs.DCSTasking.Task#Task The DCS task structure.
-function CONTROLLABLE:EnRouteTaskEngageTargets( Vec2, Radius, TargetTypes, Priority )
+function CONTROLLABLE:EnRouteTaskEngageTargetsInZone( Vec2, Radius, TargetTypes, Priority )
self:F2( { self.ControllableName, Vec2, Radius, TargetTypes, Priority } )
-- EngageTargetsInZone = {
From f2e966735cb314c8c8752105bf0340d185accf13 Mon Sep 17 00:00:00 2001
From: FlightControl
Date: Mon, 29 May 2017 05:29:41 +0200
Subject: [PATCH 7/7] A2A SWEEP Tasking
---
.../Moose/Functional/Detection.lua | 82 +++++++++++++++----
.../Moose/Tasking/Task_A2A_Dispatcher.lua | 56 +++++++++++--
2 files changed, 114 insertions(+), 24 deletions(-)
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index 8ece18ed5..856e40851 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -519,9 +519,11 @@ do -- DETECTION_BASE
self.DetectionRun = 0
self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table
+ local DetectionTimeStamp = timer.getTime()
+
for DetectionGroupID, DetectionGroupData in pairs( self.DetectionSetGroup:GetSet() ) do
--self:E( { DetectionGroupData } )
- self:__DetectionGroup( DetectDelay, DetectionGroupData ) -- Process each detection asynchronously.
+ self:__DetectionGroup( DetectDelay, DetectionGroupData, DetectionTimeStamp ) -- Process each detection asynchronously.
self.DetectionCount = self.DetectionCount + 1
DetectDelay = DetectDelay + 0.1
end
@@ -532,7 +534,7 @@ do -- DETECTION_BASE
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @param Wrapper.Group#GROUP DetectionGroup The Group detecting.
- function DETECTION_BASE:onafterDetectionGroup( From, Event, To, DetectionGroup )
+ function DETECTION_BASE:onafterDetectionGroup( From, Event, To, DetectionGroup, DetectionTimeStamp )
self:E( { From, Event, To } )
self.DetectionRun = self.DetectionRun + 1
@@ -557,7 +559,7 @@ do -- DETECTION_BASE
self.DetectDLINK
)
- self:T( DetectedTargets )
+ self:F( DetectedTargets )
for DetectionObjectID, Detection in pairs( DetectedTargets ) do
local DetectedObject = Detection.object -- Dcs.DCSWrapper.Object#Object
@@ -592,7 +594,7 @@ do -- DETECTION_BASE
local DetectedUnitCategory = DetectedObject:getDesc().category
- self:T2( { "Detected Target:", DetectionGroupName, DetectedObjectName, Distance, DetectedUnitCategory } )
+ self:F( { "Detected Target:", DetectionGroupName, DetectedObjectName, Distance, DetectedUnitCategory } )
-- Calculate Acceptance
@@ -676,6 +678,7 @@ do -- DETECTION_BASE
self.DetectedObjects[DetectedObjectName] = self.DetectedObjects[DetectedObjectName] or {}
self.DetectedObjects[DetectedObjectName].Name = DetectedObjectName
+ self.DetectedObjects[DetectedObjectName].IsDetected = TargetIsDetected
self.DetectedObjects[DetectedObjectName].IsVisible = TargetIsVisible
self.DetectedObjects[DetectedObjectName].LastTime = TargetLastTime
self.DetectedObjects[DetectedObjectName].LastPos = TargetLastPos
@@ -683,6 +686,7 @@ do -- DETECTION_BASE
self.DetectedObjects[DetectedObjectName].KnowType = TargetKnowType
self.DetectedObjects[DetectedObjectName].KnowDistance = Detection.distance -- TargetKnowDistance
self.DetectedObjects[DetectedObjectName].Distance = Distance
+ self.DetectedObjects[DetectedObjectName].DetectionTimeStamp = DetectionTimeStamp
local DetectedUnit = UNIT:FindByName( DetectedObjectName )
@@ -706,9 +710,23 @@ do -- DETECTION_BASE
if self.DetectionCount > 0 and self.DetectionRun == self.DetectionCount then
self:T( "--> Create Detection Sets" )
+
+ -- First check if all DetectedObjects were detected.
+ -- This is important. When there are DetectedObjects in the list, but were not detected,
+ -- And these remain undetected for more than 60 seconds, then these DetectedObjects will be flagged as not Detected.
+ -- IsDetected = false!
+ -- This is used in A2A_TASK_DISPATCHER to initiate fighter sweeping! The TASK_A2A_INTERCEPT tasks will be replaced with TASK_A2A_SWEEP tasks.
+ for DetectedObjectName, DetectedObject in pairs( self.DetectedObjects ) do
+ if self.DetectedObjects[DetectedObjectName].IsDetected == true and self.DetectedObjects[DetectedObjectName].DetectionTimeStamp + 60 <= DetectionTimeStamp then
+ self.DetectedObjects[DetectedObjectName].IsDetected = false
+ end
+ end
self:CreateDetectionItems() -- Polymorphic call to Create/Update the DetectionItems list for the DETECTION_ class grouping method.
- self:CleanDetectionItems() -- Any DetectionItem that has a Set with zero elements in it, must be removed from the DetectionItems list.
+ for DetectedItemID, DetectedItem in pairs( self.DetectedItems ) do
+ self:UpdateDetectedItemDetection( DetectedItem )
+ self:CleanDetectionItem( DetectedItem, DetectedItemID ) -- Any DetectionItem that has a Set with zero elements in it, must be removed from the DetectionItems list.
+ end
self:__Detect( self.DetectionInterval )
end
@@ -720,23 +738,19 @@ do -- DETECTION_BASE
do -- DetectionItems Creation
- --- Make a DetectionSet table. This function will be overridden in the derived clsses.
+ -- Clean the DetectedItem table.
-- @param #DETECTION_BASE self
-- @return #DETECTION_BASE
- function DETECTION_BASE:CleanDetectionItems() --R2.1 Clean the DetectionItems list
+ function DETECTION_BASE:CleanDetectionItem( DetectedItem, DetectedItemID )
self:F2()
-- We clean all DetectedItems.
-- if there are any remaining DetectedItems with no Set Objects then the Item in the DetectedItems must be deleted.
- for DetectedItemID, DetectedItemData in pairs( self.DetectedItems ) do
-
- local DetectedItem = DetectedItemData -- #DETECTION_BASE.DetectedItem
- local DetectedSet = DetectedItem.Set
-
- if DetectedSet:Count() == 0 then
- self:RemoveDetectedItem(DetectedItemID)
- end
+ local DetectedSet = DetectedItem.Set
+
+ if DetectedSet:Count() == 0 then
+ self:RemoveDetectedItem( DetectedItemID )
end
return self
@@ -1160,7 +1174,7 @@ do -- DETECTION_BASE
--- @param Wrapper.Unit#UNIT PlayerUnit
function( PlayerUnitName )
local PlayerUnit = UNIT:FindByName( PlayerUnitName )
- if PlayerUnit:IsInZone(DetectionZone) then
+ if PlayerUnit and PlayerUnit:IsInZone(DetectionZone) then
DetectedItem.FriendliesNearBy = DetectedItem.FriendliesNearBy or {}
local PlayerUnitName = PlayerUnit:GetName()
DetectedItem.PlayersNearBy = DetectedItem.PlayersNearBy or {}
@@ -1368,6 +1382,37 @@ do -- DETECTION_BASE
return nil
end
+ --- Set IsDetected flag for all DetectedItems.
+ -- @param #DETECTION_BASE self
+ -- @return #DETECTION_BASE.DetectedItem DetectedItem
+ -- @return #boolean true if at least one UNIT is detected from the DetectedSet, false if no UNIT was detected from the DetectedSet.
+ function DETECTION_BASE:UpdateDetectedItemDetection( DetectedItem )
+
+ local IsDetected = false
+
+ for UnitName, UnitData in pairs( DetectedItem.Set:GetSet() ) do
+ local DetectedObject = self.DetectedObjects[UnitName]
+ if DetectedObject.IsDetected then
+ IsDetected = true
+ break
+ end
+ end
+
+ self:F( { IsDetected = DetectedItem.IsDetected } )
+
+ DetectedItem.IsDetected = IsDetected
+
+ return IsDetected
+ end
+
+ --- Checks if there is at least one UNIT detected in the Set of the the DetectedItem.
+ -- @param #DETECTION_BASE self
+ -- @return #boolean true if at least one UNIT is detected from the DetectedSet, false if no UNIT was detected from the DetectedSet.
+ function DETECTION_BASE:IsDetectedItemDetected( DetectedItem )
+
+ return DetectedItem.IsDetected
+ end
+
do -- Coordinates
--- Get the COORDINATE of a detection item using a given numeric index.
@@ -2195,7 +2240,7 @@ do -- DETECTION_AREAS
DetectedItem.NearestFAC = NearestFAC
end
-
+
--- Returns the A2G threat level of the units in the DetectedItem
-- @param #DETECTION_AREAS self
-- @param #DETECTION_BASE.DetectedItem DetectedItem
@@ -2325,6 +2370,7 @@ do -- DETECTION_AREAS
for DetectedItemID, DetectedItemData in pairs( self.DetectedItems ) do
local DetectedItem = DetectedItemData -- #DETECTION_BASE.DetectedItem
+
if DetectedItem then
self:T( { "Detected Item ID:", DetectedItemID } )
@@ -2489,7 +2535,7 @@ do -- DETECTION_AREAS
self:ReportFriendliesNearBy( { DetectedItem = DetectedItem, ReportSetGroup = self.DetectionSetGroup } ) -- Fill the Friendlies table
self:CalculateThreatLevelA2G( DetectedItem ) -- Calculate A2G threat level
self:NearestFAC( DetectedItem )
-
+
if DETECTION_AREAS._SmokeDetectedUnits or self._SmokeDetectedUnits then
DetectedZone.ZoneUNIT:SmokeRed()
end
diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
index 3e95e6f29..0a7d58a08 100644
--- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
@@ -40,6 +40,7 @@ do -- TASK_A2A_DISPATCHER
Mission = nil,
Detection = nil,
Tasks = {},
+ SweepZones = {},
}
@@ -92,10 +93,11 @@ do -- TASK_A2A_DISPATCHER
local DetectedSet = DetectedItem.Set
local DetectedZone = DetectedItem.Zone
+ -- Check if there is at least one UNIT in the DetectedSet is visible.
+
+ if DetectedItem.IsDetected == true then
- if true then
-
- -- Here we're doing something advanced... We're copying the DetectedSet, but making a new Set only with SEADable Radar units in it.
+ -- Here we're doing something advanced... We're copying the DetectedSet.
local TargetSetUnit = SET_UNIT:New()
TargetSetUnit:SetDatabase( DetectedSet )
TargetSetUnit:FilterOnce() -- Filter but don't do any events!!! Elements are added manually upon each detection.
@@ -105,6 +107,33 @@ do -- TASK_A2A_DISPATCHER
return nil
end
+
+
+ --- Creates an SWEEP task when there are targets for it.
+ -- @param #TASK_A2A_DISPATCHER self
+ -- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
+ -- @return Set#SET_UNIT TargetSetUnit: The target set of units.
+ -- @return #nil If there are no targets to be set.
+ function TASK_A2A_DISPATCHER:EvaluateSWEEP( DetectedItem )
+ self:F( { DetectedItem.ItemID } )
+
+ local DetectedSet = DetectedItem.Set
+ local DetectedZone = DetectedItem.Zone
+
+
+ if DetectedItem.IsDetected == false then
+
+ -- Here we're doing something advanced... We're copying the DetectedSet.
+ local TargetSetUnit = SET_UNIT:New()
+ TargetSetUnit:SetDatabase( DetectedSet )
+ TargetSetUnit:FilterOnce() -- Filter but don't do any events!!! Elements are added manually upon each detection.
+
+ return TargetSetUnit
+ end
+
+ return nil
+ end
+
--- Creates an ENGAGE task when there are human friendlies airborne near the targets.
-- @param #TASK_A2A_DISPATCHER self
@@ -119,10 +148,11 @@ do -- TASK_A2A_DISPATCHER
local PlayersCount, PlayersReport = self:GetPlayerFriendliesNearBy( DetectedItem )
+
+ -- Only allow ENGAGE when there are Players near the zone, and when the Area has detected items since the last run in a 60 seconds time zone.
+ if PlayersCount > 0 and DetectedItem.IsDetected == true then
- if PlayersCount > 0 then
-
- -- Here we're doing something advanced... We're copying the DetectedSet, but making a new Set only with SEADable Radar units in it.
+ -- Here we're doing something advanced... We're copying the DetectedSet.
local TargetSetUnit = SET_UNIT:New()
TargetSetUnit:SetDatabase( DetectedSet )
TargetSetUnit:FilterOnce() -- Filter but don't do any events!!! Elements are added manually upon each detection.
@@ -168,6 +198,15 @@ do -- TASK_A2A_DISPATCHER
if IsPlayers == true then
Remove = true
end
+ if DetectedItem.IsDetected == false then
+ Remove = true
+ end
+ end
+
+ if TaskType == "SWEEP" then
+ if DetectedItem.IsDetected == true then
+ Remove = true
+ end
end
local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT
@@ -338,6 +377,11 @@ do -- TASK_A2A_DISPATCHER
local TargetSetUnit = self:EvaluateINTERCEPT( DetectedItem ) -- Returns a SetUnit if there are targets to be INTERCEPTed...
if TargetSetUnit then
Task = TASK_A2A_INTERCEPT:New( Mission, self.SetGroup, string.format( "INTERCEPT.%03d", DetectedID ), TargetSetUnit )
+ else
+ local TargetSetUnit = self:EvaluateSWEEP( DetectedItem ) -- Returns a SetUnit
+ if TargetSetUnit then
+ Task = TASK_A2A_SWEEP:New( Mission, self.SetGroup, string.format( "SWEEP.%03d", DetectedID ), TargetSetUnit )
+ end
end
end