From 1cf2383dfdb6c8cd95e756da80a34cd9d6680477 Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Tue, 15 Aug 2017 17:44:09 +0200
Subject: [PATCH 1/7] First version
---
.../Moose/AI/AI_A2A_Dispatcher.lua | 3 +-
Moose Development/Moose/Core/Event.lua | 6 +-
Moose Development/Moose/Core/Set.lua | 1 +
Moose Development/Moose/Core/Zone.lua | 14 +
.../Moose/Functional/Designate.lua | 4 +-
.../Moose/Functional/Detection.lua | 353 +++++++++---------
Moose Development/Moose/Tasking/Mission.lua | 15 +-
Moose Development/Moose/Tasking/Task.lua | 42 ++-
Moose Development/Moose/Tasking/Task_A2A.lua | 111 ++++--
.../Moose/Tasking/Task_A2A_Dispatcher.lua | 17 +-
Moose Development/Moose/Tasking/Task_A2G.lua | 80 +++-
.../Moose/Tasking/Task_A2G_Dispatcher.lua | 75 +++-
.../Moose/Wrapper/Controllable.lua | 2 +-
13 files changed, 463 insertions(+), 260 deletions(-)
diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
index 843d9ad5d..22bc8bb26 100644
--- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
@@ -1579,12 +1579,12 @@ do -- AI_A2A_DISPATCHER
local Variance = ( Cap.HighInterval - Cap.LowInterval ) / 2
local Median = Cap.LowInterval + Variance
local Randomization = Variance / Median
+ local Start = math.random( 1, Cap.HighInterval )
if ScheduleID then
Scheduler:Stop( ScheduleID )
end
- Cap.ScheduleID = Scheduler:Schedule( self, self.SchedulerCAP, { SquadronName }, Median, Median, Randomization )
else
error( "This squadron does not exist:" .. SquadronName )
end
@@ -1627,6 +1627,7 @@ do -- AI_A2A_DISPATCHER
local Cap = DefenderSquadron.Cap
if Cap then
local CapCount = self:CountCapAirborne( SquadronName )
+ self:E( { CapCount = CapCount } )
if CapCount < Cap.CapLimit then
local Probability = math.random()
if Probability <= Cap.Probability then
diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua
index 46fdeebb1..28a4ecf26 100644
--- a/Moose Development/Moose/Core/Event.lua
+++ b/Moose Development/Moose/Core/Event.lua
@@ -871,9 +871,9 @@ function EVENT:onEvent( Event )
-- Okay, we got the event from DCS. Now loop the SORTED self.EventSorted[] table for the received Event.id, and for each EventData registered, check if a function needs to be called.
for EventClass, EventData in pairs( self.Events[Event.id][EventPriority] ) do
- if Event.IniObjectCategory ~= Object.Category.STATIC then
- self:E( { "Evaluating: ", EventClass:GetClassNameAndID() } )
- end
+ --if Event.IniObjectCategory ~= Object.Category.STATIC then
+ -- self:E( { "Evaluating: ", EventClass:GetClassNameAndID() } )
+ --end
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
Event.TgtGroup = GROUP:FindByName( Event.TgtDCSGroupName )
diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua
index 65a9354f6..f89224259 100644
--- a/Moose Development/Moose/Core/Set.lua
+++ b/Moose Development/Moose/Core/Set.lua
@@ -1784,6 +1784,7 @@ end
--- Calculate the maxium A2G threat level of the SET_UNIT.
-- @param #SET_UNIT self
+-- @return #number The maximum threatlevel
function SET_UNIT:CalculateThreatLevelA2G()
local MaxThreatLevelA2G = 0
diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua
index 5d183f58d..aa061a94f 100644
--- a/Moose Development/Moose/Core/Zone.lua
+++ b/Moose Development/Moose/Core/Zone.lua
@@ -834,6 +834,20 @@ function ZONE_GROUP:GetRandomVec2()
return Point
end
+--- Returns a @{Point#POINT_VEC2} object reflecting a random 2D location within the zone.
+-- @param #ZONE_GROUP self
+-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0.
+-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
+-- @return Core.Point#POINT_VEC2 The @{Point#POINT_VEC2} object reflecting the random 3D location within the zone.
+function ZONE_GROUP:GetRandomPointVec2( inner, outer )
+ self:F( self.ZoneName, inner, outer )
+
+ local PointVec2 = POINT_VEC2:NewFromVec2( self:GetRandomVec2() )
+
+ self:T3( { PointVec2 } )
+
+ return PointVec2
+end
--- @type ZONE_POLYGON_BASE
diff --git a/Moose Development/Moose/Functional/Designate.lua b/Moose Development/Moose/Functional/Designate.lua
index 44b26a0b7..13fdabfd7 100644
--- a/Moose Development/Moose/Functional/Designate.lua
+++ b/Moose Development/Moose/Functional/Designate.lua
@@ -797,11 +797,9 @@ do -- DESIGNATE
MENU_GROUP_COMMAND:New( AttackGroup, "Flash Status Report On", StatusMenu, self.MenuFlashStatus, self, AttackGroup, true ):SetTime( MenuTime ):SetTag( self.DesignateName )
end
- local DetectedItems = self.Detection:GetDetectedItems()
-
for DesignateIndex, Designating in pairs( self.Designating ) do
- local DetectedItem = DetectedItems[DesignateIndex]
+ local DetectedItem = self.Detection:GetDetectedItem( DesignateIndex )
if DetectedItem then
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index 034361595..71bf9a2ae 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -305,7 +305,7 @@ do -- DETECTION_BASE
-- @field #number ID -- The identifier of the detected area.
-- @field #boolean FriendliesNearBy Indicates if there are friendlies within the detected area.
-- @field Wrapper.Unit#UNIT NearestFAC The nearest FAC near the Area.
-
+ -- @field Core.Point#COORDINATE Coordinate The last known coordinate of the DetectedItem.
--- DETECTION constructor.
-- @param #DETECTION_BASE self
@@ -604,6 +604,14 @@ do -- DETECTION_BASE
DetectionAccepted = self._.FilterCategories[DetectedUnitCategory] ~= nil and DetectionAccepted or false
+-- if Distance > 15000 then
+-- if DetectedUnitCategory == Unit.Category.GROUND_UNIT or DetectedUnitCategory == Unit.Category.SHIP then
+-- if DetectedObject:hasSensors( Unit.SensorType.RADAR, Unit.RadarType.AS ) == false then
+-- DetectionAccepted = false
+-- end
+-- end
+-- end
+
if self.AcceptRange and Distance > self.AcceptRange then
DetectionAccepted = false
end
@@ -1101,8 +1109,8 @@ do -- DETECTION_BASE
DetectedItem.Changes[ChangeCode].ID = ID
DetectedItem.Changes[ChangeCode].ItemUnitType = ItemUnitType
- self:T( { "Change on Detection Item:", DetectedItem.ID, ChangeCode, ItemUnitType } )
-
+ self:E( { "Change on Detection Item:", DetectedItem.ID, ChangeCode, ItemUnitType } )
+
return self
end
@@ -1124,7 +1132,7 @@ do -- DETECTION_BASE
DetectedItem.Changes[ChangeCode][ChangeUnitType] = DetectedItem.Changes[ChangeCode][ChangeUnitType] + 1
DetectedItem.Changes[ChangeCode].ID = ID
- self:T( { "Change on Detection Item:", DetectedItem.ID, ChangeCode, ChangeUnitType } )
+ self:E( { "Change on Detection Item:", DetectedItem.ID, ChangeCode, ChangeUnitType } )
return self
end
@@ -1353,6 +1361,32 @@ do -- DETECTION_BASE
return nil
end
+
+ --- Gets a detected unit type name, taking into account the detection results.
+ -- @param #DETECTION_BASE self
+ -- @param #Wrapper.Unit#UNIT DetectedUnit
+ -- @return #string The type name
+ function DETECTION_BASE:GetDetectedUnitTypeName( DetectedUnit )
+ --self:F2( ObjectName )
+
+ if DetectedUnit and DetectedUnit:IsAlive() then
+ local DetectedUnitName = DetectedUnit:GetName()
+ local DetectedObject = self.DetectedObjects[DetectedUnitName]
+
+ if DetectedObject then
+ if DetectedObject.KnowType then
+ return DetectedUnit:GetTypeName()
+ else
+ return "Unknown"
+ end
+ end
+ else
+ return "Dead:" .. DetectedUnit:GetName()
+ end
+
+ return "Undetected:" .. DetectedUnit:GetName()
+ end
+
--- Adds a new DetectedItem to the DetectedItems list.
-- The DetectedItem is a table and contains a SET_UNIT in the field Set.
@@ -1538,15 +1572,78 @@ do -- DETECTION_BASE
end
+
+ --- Set the detected item coordinate.
+ -- @param #DETECTION_BASE self
+ -- @param #DETECTION_BASE.DetectedItem The DetectedItem to set the coordinate at.
+ -- @param Core.Point#COORDINATE Coordinate The coordinate to set the last know detected position at.
+ -- @param Wrapper.Unit#UNIT DetectedItemUnit The unit to set the heading and altitude from.
+ -- @return #DETECTION_BASE
+ function DETECTION_BASE:SetDetectedItemCoordinate( DetectedItem, Coordinate, DetectedItemUnit )
+ self:F( { Coordinate = Coordinate } )
+
+ if DetectedItem then
+ if DetectedItemUnit then
+ DetectedItem.Coordinate = Coordinate
+ DetectedItem.Coordinate:SetHeading( DetectedItemUnit:GetHeading() )
+ DetectedItem.Coordinate.y = DetectedItemUnit:GetAltitude()
+ DetectedItem.Coordinate.Speed = DetectedItemUnit:GetVelocityMPS()
+ end
+ end
+ end
+
+
--- Get the detected item coordinate.
-- @param #DETECTION_BASE self
- -- @param Index
+ -- @param #number Index
-- @return Core.Point#COORDINATE
function DETECTION_BASE:GetDetectedItemCoordinate( Index )
self:F( { Index = Index } )
+
+ local DetectedItem = self:GetDetectedItem( Index )
+
+ if DetectedItem then
+ return DetectedItem.Coordinate
+ end
+
return nil
end
+ --- Set the detected item threatlevel.
+ -- @param #DETECTION_BASE self
+ -- @param #DETECTION_BASE.DetectedItem The DetectedItem to calculate the threatlevel for.
+ -- @return #DETECTION_BASE
+ function DETECTION_BASE:SetDetectedItemThreatLevel( DetectedItem )
+
+ local DetectedSet = DetectedItem.Set
+
+ if DetectedItem then
+ DetectedItem.ThreatLevel = DetectedSet:CalculateThreatLevelA2G()
+ end
+ end
+
+
+
+ --- Get the detected item coordinate.
+ -- @param #DETECTION_BASE self
+ -- @param #number Index
+ -- @return #number ThreatLevel
+ function DETECTION_BASE:GetDetectedItemThreatLevel( Index )
+ self:F( { Index = Index } )
+
+ local DetectedItem = self:GetDetectedItem( Index )
+
+ if DetectedItem then
+ return DetectedItem.ThreatLevel or 0
+ end
+
+ return nil
+ end
+
+
+
+
+
--- Menu of a detected item using a given numeric index.
-- @param #DETECTION_BASE self
@@ -1639,27 +1736,6 @@ do -- DETECTION_UNITS
return self
end
- --- Get the detected item coordinate.
- -- @param #DETECTION_UNITS self
- -- @param Index
- -- @return Core.Point#COORDINATE
- function DETECTION_UNITS:GetDetectedItemCoordinate( Index )
- self:F( { Index = Index } )
-
- local DetectedItem = self:GetDetectedItem( Index )
- local DetectedSet = self:GetDetectedSet( Index )
-
- if DetectedSet then
- local DetectedItemUnit = DetectedSet:GetFirst() -- Wrapper.Unit#UNIT
- if DetectedItemUnit and DetectedItemUnit:IsAlive() then
- local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
- DetectedItemCoordinate:SetHeading( DetectedItemUnit:GetHeading() )
- return DetectedItemCoordinate
- end
- end
- end
-
-
--- Make text documenting the changes of the detected zone.
-- @param #DETECTION_UNITS self
-- @param #DETECTION_UNITS.DetectedItem DetectedItem
@@ -1727,6 +1803,7 @@ do -- DETECTION_UNITS
-- Update the detection with the new data provided.
DetectedItem.TypeName = DetectedUnit:GetTypeName()
+ DetectedItem.CategoryName = DetectedUnit:GetCategoryName()
DetectedItem.Name = DetectedObject.Name
DetectedItem.IsVisible = DetectedObject.IsVisible
DetectedItem.LastTime = DetectedObject.LastTime
@@ -1781,8 +1858,14 @@ do -- DETECTION_UNITS
local DetectedItem = DetectedItemData -- #DETECTION_BASE.DetectedItem
local DetectedSet = DetectedItem.Set
+ -- Set the last known coordinate.
+ local DetectedFirstUnit = DetectedSet:GetFirst()
+ local DetectedFirstUnitCoord = DetectedFirstUnit:GetCoordinate()
+ self:SetDetectedItemCoordinate( DetectedItem, DetectedFirstUnitCoord, DetectedFirstUnit )
+
self:ReportFriendliesNearBy( { DetectedItem = DetectedItem, ReportSetGroup = self.DetectionSetGroup } ) -- Fill the Friendlies table
--self:NearestFAC( DetectedItem )
+
end
end
@@ -1804,21 +1887,14 @@ do -- DETECTION_UNITS
local UnitDistanceText = ""
local UnitCategoryText = ""
- local DetectedItemUnit = DetectedSet:GetFirst() -- Wrapper.Unit#UNIT
-
- if DetectedItemUnit and DetectedItemUnit:IsAlive() then
- self:T(DetectedItemUnit)
-
- local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
- local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup )
-
- ReportSummary = string.format(
- "%s - %s",
- DetectedItemID,
- DetectedItemCoordText
- )
- end
-
+ local DetectedItemCoordinate = self:GetDetectedItemCoordinate( Index )
+ local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup )
+
+ ReportSummary = string.format(
+ "%s - %s",
+ DetectedItemID,
+ DetectedItemCoordText
+ )
self:T( ReportSummary )
return ReportSummary
@@ -1835,54 +1911,46 @@ do -- DETECTION_UNITS
self:F( { Index, self.DetectedItems } )
local DetectedItem = self:GetDetectedItem( Index )
- local DetectedSet = self:GetDetectedSet( Index )
local DetectedItemID = self:GetDetectedItemID( Index )
- self:T( DetectedSet )
- if DetectedSet then
+ if DetectedItem then
local ReportSummary = ""
local UnitDistanceText = ""
local UnitCategoryText = ""
- local DetectedItemUnit = DetectedSet:GetFirst() -- Wrapper.Unit#UNIT
+ if DetectedItem.KnowType then
+ local UnitCategoryName = DetectedItem.CategoryName
+ if UnitCategoryName then
+ UnitCategoryText = UnitCategoryName
+ end
+ if DetectedItem.TypeName then
+ UnitCategoryText = UnitCategoryText .. " (" .. DetectedItem.TypeName .. ")"
+ end
+ else
+ UnitCategoryText = "Unknown"
+ end
- if DetectedItemUnit and DetectedItemUnit:IsAlive() then
- self:T(DetectedItemUnit)
-
-
- if DetectedItem.KnowType then
- local UnitCategoryName = DetectedItemUnit:GetCategoryName()
- if UnitCategoryName then
- UnitCategoryText = UnitCategoryName
- end
- if DetectedItem.TypeName then
- UnitCategoryText = UnitCategoryText .. " (" .. DetectedItem.TypeName .. ")"
- end
- else
- UnitCategoryText = "Unknown"
+ if DetectedItem.KnowDistance then
+ if DetectedItem.IsVisible then
+ UnitDistanceText = " at " .. string.format( "%.2f", DetectedItem.Distance ) .. " km"
end
-
- if DetectedItem.KnowDistance then
- if DetectedItem.IsVisible then
- UnitDistanceText = " at " .. string.format( "%.2f", DetectedItem.Distance ) .. " km"
- end
- else
- if DetectedItem.IsVisible then
- UnitDistanceText = " at +/- " .. string.format( "%.0f", DetectedItem.Distance ) .. " km"
- end
+ else
+ if DetectedItem.IsVisible then
+ UnitDistanceText = " at +/- " .. string.format( "%.0f", DetectedItem.Distance ) .. " km"
end
+ end
- local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
+ --TODO: solve Index reference
+ local DetectedItemCoordinate = self:GetDetectedItemCoordinate( Index )
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings )
- local ThreatLevelA2G = DetectedItemUnit:GetThreatLevel( DetectedItem )
+ local ThreatLevelA2G = self:GetDetectedItemThreatLevel( DetectedItem )
local Report = REPORT:New()
Report:Add(DetectedItemID .. ", " .. DetectedItemCoordText)
- Report:Add( string.format( "Threat: [%s]", string.rep( "■", ThreatLevelA2G ) ) )
- Report:Add( string.format("Type: %s%s", UnitCategoryText, UnitDistanceText ) )
- return Report
- end
+ Report:Add( string.format( "Threat: [%s]", string.rep( "■", ThreatLevelA2G ) ) )
+ Report:Add( string.format("Type: %s%s", UnitCategoryText, UnitDistanceText ) )
+ return Report
end
return nil
end
@@ -1944,25 +2012,6 @@ do -- DETECTION_TYPES
return self
end
- --- Get the detected item coordinate.
- -- @param #DETECTION_TYPES self
- -- @param DetectedTypeName
- -- @return #Core.Point#COORDINATE
- function DETECTION_TYPES:GetDetectedItemCoordinate( DetectedTypeName )
- self:F( { DetectedTypeName = DetectedTypeName } )
-
- local DetectedItem = self:GetDetectedItem( DetectedTypeName )
- local DetectedSet = self:GetDetectedSet( DetectedTypeName )
-
- if DetectedItem then
- local DetectedItemUnit = DetectedSet:GetFirst()
- local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
- DetectedItemCoordinate:SetHeading( DetectedItemUnit:GetHeading() )
- return DetectedItemCoordinate
- end
- end
-
-
--- Make text documenting the changes of the detected zone.
-- @param #DETECTION_TYPES self
-- @param #DETECTION_TYPES.DetectedItem DetectedItem
@@ -2067,10 +2116,16 @@ do -- DETECTION_TYPES
local DetectedItem = DetectedItemData -- #DETECTION_BASE.DetectedItem
local DetectedSet = DetectedItem.Set
+ -- Set the last known coordinate.
+ local DetectedFirstUnit = DetectedSet:GetFirst()
+ local DetectedUnitCoord = DetectedFirstUnit:GetCoordinate()
+ self:SetDetectedItemCoordinate( DetectedItem, DetectedUnitCoord, DetectedFirstUnit )
+
self:ReportFriendliesNearBy( { DetectedItem = DetectedItem, ReportSetGroup = self.DetectionSetGroup } ) -- Fill the Friendlies table
--self:NearestFAC( DetectedItem )
end
+
end
@@ -2082,20 +2137,13 @@ do -- DETECTION_TYPES
self:F( DetectedTypeName )
local DetectedItem = self:GetDetectedItem( DetectedTypeName )
- local DetectedSet = self:GetDetectedSet( DetectedTypeName )
local DetectedItemID = self:GetDetectedItemID( DetectedTypeName )
- self:T( DetectedItem )
if DetectedItem then
- local DetectedItemUnit = DetectedSet:GetFirst()
-
- local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
+ local DetectedItemCoordinate = self:GetDetectedItemCoordinate( DetectedTypeName )
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup )
- --self:E( { DetectedItemID,
- -- DetectedItemCoordText } )
-
local ReportSummary = string.format(
"%s - %s",
DetectedItemID,
@@ -2123,13 +2171,11 @@ do -- DETECTION_TYPES
self:T( DetectedItem )
if DetectedItem then
- local ThreatLevelA2G = DetectedSet:CalculateThreatLevelA2G()
+ local ThreatLevelA2G = self:GetDetectedItemThreatLevel( DetectedTypeName )
local DetectedItemsCount = DetectedSet:Count()
local DetectedItemType = DetectedItem.TypeName
- local DetectedItemUnit = DetectedSet:GetFirst()
-
- local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
+ local DetectedItemCoordinate = self:GetDetectedItemCoordinate( DetectedTypeName )
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings )
local Report = REPORT:New()
@@ -2228,32 +2274,6 @@ do -- DETECTION_AREAS
return self
end
- --- Get the detected item coordinate.
- -- In this case, the coordinate is the center of the zone of the area, not the center unit!
- -- So if units move, the retrieved coordinate can be different from the units positions.
- -- @param #DETECTION_AREAS self
- -- @param Index
- -- @return Core.Point#COORDINATE The coordinate.
- function DETECTION_AREAS:GetDetectedItemCoordinate( Index )
- self:F( { Index = Index } )
-
- local DetectedItem = self:GetDetectedItem( Index )
- local DetectedItemSet = self:GetDetectedSet( Index )
- local FirstUnit = DetectedItemSet:GetFirst()
-
- if DetectedItem then
- local DetectedZone = self:GetDetectedItemZone( Index )
- -- TODO: Rework to COORDINATE. Problem with SetAlt.
- local DetectedItemCoordinate = DetectedZone:GetPointVec2()
- -- These need to be done to understand the heading and altitude of the first unit in the zone.
- DetectedItemCoordinate:SetHeading( FirstUnit:GetHeading() )
- DetectedItemCoordinate:SetAlt( FirstUnit:GetAltitude() )
-
- return DetectedItemCoordinate
- end
-
- return nil
- end
--- Menu of a detected item using a given numeric index.
-- @param #DETECTION_AREAS self
@@ -2305,7 +2325,7 @@ do -- DETECTION_AREAS
local DetectedItemCoordinate = DetectedZone:GetCoordinate()
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings )
- local ThreatLevelA2G = self:GetTreatLevelA2G( DetectedItem )
+ local ThreatLevelA2G = self:GetDetectedItemThreatLevel( Index )
local DetectedItemsCount = DetectedSet:Count()
local DetectedItemsTypes = DetectedSet:GetTypeNames()
@@ -2341,25 +2361,6 @@ do -- DETECTION_AREAS
end
- --- Calculate the maxium A2G threat level of the DetectedItem.
- -- @param #DETECTION_AREAS self
- -- @param #DETECTION_BASE.DetectedItem DetectedItem
- function DETECTION_AREAS:CalculateThreatLevelA2G( DetectedItem )
-
- local MaxThreatLevelA2G = 0
- for UnitName, UnitData in pairs( DetectedItem.Set:GetSet() ) do
- local ThreatUnit = UnitData -- Wrapper.Unit#UNIT
- local ThreatLevelA2G = ThreatUnit:GetThreatLevel()
- if ThreatLevelA2G > MaxThreatLevelA2G then
- MaxThreatLevelA2G = ThreatLevelA2G
- end
- end
-
- self:T3( MaxThreatLevelA2G )
- DetectedItem.MaxThreatLevelA2G = MaxThreatLevelA2G
-
- end
-
--- Calculate the optimal intercept point of the DetectedItem.
-- @param #DETECTION_AREAS self
-- @param #DETECTION_BASE.DetectedItem DetectedItem
@@ -2367,15 +2368,15 @@ do -- DETECTION_AREAS
if self.Intercept then
local DetectedSet = DetectedItem.Set
- local DetectedUnit = DetectedSet:GetFirst() -- Wrapper.Unit#UNIT
if DetectedUnit then
- local UnitSpeed = DetectedUnit:GetVelocityMPS()
- local UnitHeading = DetectedUnit:GetHeading()
- local UnitCoord = DetectedUnit:GetCoordinate()
+ -- todo: speed
+ local DetectedSpeed = DetectedItem.Coordinate.Speed
+ local DetectedHeading = DetectedItem.Coordinate.Heading
+ local DetectedCoord = DetectedItem.Coordinate
- local TranslateDistance = UnitSpeed * self.InterceptDelay
+ local TranslateDistance = DetectedSpeed * self.InterceptDelay
- local InterceptCoord = UnitCoord:Translate( TranslateDistance, UnitHeading )
+ local InterceptCoord = DetectedCoord:Translate( TranslateDistance, DetectedHeading )
DetectedItem.InterceptCoord = InterceptCoord
else
@@ -2415,18 +2416,6 @@ do -- DETECTION_AREAS
end
- --- Returns the A2G threat level of the units in the DetectedItem
- -- @param #DETECTION_AREAS self
- -- @param #DETECTION_BASE.DetectedItem DetectedItem
- -- @return #number a scale from 0 to 10.
- function DETECTION_AREAS:GetTreatLevelA2G( DetectedItem )
-
- self:T3( DetectedItem.MaxThreatLevelA2G )
- return DetectedItem.MaxThreatLevelA2G
- end
-
-
-
--- Smoke the detected units
-- @param #DETECTION_AREAS self
-- @return #DETECTION_AREAS self
@@ -2571,13 +2560,14 @@ do -- DETECTION_AREAS
-- First remove the center unit from the set.
DetectedSet:RemoveUnitsByName( DetectedItem.Zone.ZoneUNIT.UnitName )
- self:AddChangeItem( DetectedItem, 'RAU', "Dummy" )
+ self:AddChangeItem( DetectedItem, 'RAU', self:GetDetectedUnitTypeName( DetectedItem.Zone.ZoneUNIT ) )
-- Then search for a new center area unit within the set. Note that the new area unit candidate must be within the area range.
for DetectedUnitName, DetectedUnitData in pairs( DetectedSet:GetSet() ) do
local DetectedUnit = DetectedUnitData -- Wrapper.Unit#UNIT
local DetectedObject = self:GetDetectedObject( DetectedUnit.UnitName )
+ local DetectedUnitTypeName = self:GetDetectedUnitTypeName( DetectedUnit )
-- The DetectedObject can be nil when the DetectedUnit is not alive anymore or it is not in the DetectedObjects map.
-- If the DetectedUnit was already identified, DetectedObject will be nil.
@@ -2590,13 +2580,13 @@ do -- DETECTION_AREAS
-- Assign the Unit as the new center unit of the detected area.
DetectedItem.Zone = ZONE_UNIT:New( DetectedUnit:GetName(), DetectedUnit, self.DetectionZoneRange )
- self:AddChangeItem( DetectedItem, "AAU", DetectedItem.Zone.ZoneUNIT:GetTypeName() )
+ self:AddChangeItem( DetectedItem, "AAU", DetectedUnitTypeName )
-- 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() )
+ self:AddChangeUnit( DetectedItem, "RU", DetectedUnitTypeName )
end
end
end
@@ -2612,13 +2602,15 @@ do -- DETECTION_AREAS
for DetectedUnitName, DetectedUnitData in pairs( DetectedSet:GetSet() ) do
local DetectedUnit = DetectedUnitData -- Wrapper.Unit#UNIT
+ local DetectedUnitTypeName = self:GetDetectedUnitTypeName( DetectedUnit )
+
local DetectedObject = nil
if DetectedUnit:IsAlive() then
--self:E(DetectedUnit:GetName())
DetectedObject = self:GetDetectedObject( DetectedUnit:GetName() )
end
if DetectedObject then
-
+
-- Check if the DetectedUnit is within the DetectedItem.Zone
if DetectedUnit:IsInZone( DetectedItem.Zone ) then
@@ -2628,7 +2620,7 @@ do -- DETECTION_AREAS
else
-- No, the DetectedUnit is not within the DetectedItem.Zone, remove DetectedUnit from the Set.
DetectedSet:Remove( DetectedUnitName )
- self:AddChangeUnit( DetectedItem, "RU", DetectedUnit:GetTypeName() )
+ self:AddChangeUnit( DetectedItem, "RU", DetectedUnitTypeName )
end
else
@@ -2665,6 +2657,7 @@ do -- DETECTION_AREAS
-- We found an unidentified unit outside of any existing detection area.
local DetectedUnit = UNIT:FindByName( DetectedUnitName ) -- Wrapper.Unit#UNIT
+ local DetectedUnitTypeName = self:GetDetectedUnitTypeName( DetectedUnit )
local AddedToDetectionArea = false
@@ -2678,7 +2671,7 @@ do -- DETECTION_AREAS
self:IdentifyDetectedObject( DetectedObject )
DetectedSet:AddUnit( DetectedUnit )
AddedToDetectionArea = true
- self:AddChangeUnit( DetectedItem, "AU", DetectedUnit:GetTypeName() )
+ self:AddChangeUnit( DetectedItem, "AU", DetectedUnitTypeName )
end
end
end
@@ -2692,7 +2685,7 @@ do -- DETECTION_AREAS
)
--self:E( DetectedItem.Zone.ZoneUNIT.UnitName )
DetectedItem.Set:AddUnit( DetectedUnit )
- self:AddChangeItem( DetectedItem, "AA", DetectedUnit:GetTypeName() )
+ self:AddChangeItem( DetectedItem, "AA", DetectedUnitTypeName )
end
end
end
@@ -2704,13 +2697,19 @@ do -- DETECTION_AREAS
local DetectedItem = DetectedItemData -- #DETECTION_BASE.DetectedItem
local DetectedSet = DetectedItem.Set
+ local DetectedFirstUnit = DetectedSet:GetFirst()
local DetectedZone = DetectedItem.Zone
+
+ -- Set the last known coordinate to the detection item.
+ local DetectedZoneCoord = DetectedZone:GetCoordinate()
+ self:SetDetectedItemCoordinate( DetectedItem, DetectedZoneCoord, DetectedFirstUnit )
self:CalculateIntercept( DetectedItem )
self:ReportFriendliesNearBy( { DetectedItem = DetectedItem, ReportSetGroup = self.DetectionSetGroup } ) -- Fill the Friendlies table
- self:CalculateThreatLevelA2G( DetectedItem ) -- Calculate A2G threat level
+ self:SetDetectedItemThreatLevel( DetectedItem ) -- Calculate A2G threat level
self:NearestFAC( DetectedItem )
+
if DETECTION_AREAS._SmokeDetectedUnits or self._SmokeDetectedUnits then
DetectedZone.ZoneUNIT:SmokeRed()
diff --git a/Moose Development/Moose/Tasking/Mission.lua b/Moose Development/Moose/Tasking/Mission.lua
index 5d1bcfc38..8565078f2 100644
--- a/Moose Development/Moose/Tasking/Mission.lua
+++ b/Moose Development/Moose/Tasking/Mission.lua
@@ -860,8 +860,9 @@ end
--- Create a summary report of the Mission (one line).
-- @param #MISSION self
+-- @param Wrapper.Group#GROUP ReportGroup
-- @return #string
-function MISSION:ReportSummary()
+function MISSION:ReportSummary( ReportGroup )
local Report = REPORT:New()
@@ -874,9 +875,9 @@ function MISSION:ReportSummary()
Report:Add( string.format( '%s - %s - Task Overview Report', Name, Status ) )
-- Determine how many tasks are remaining.
- for TaskID, Task in pairs( self:GetTasks() ) do
+ for TaskID, Task in UTILS.spairs( self:GetTasks(), function( t, a, b ) return t[a]:ReportOrder( ReportGroup ) < t[b]:ReportOrder( ReportGroup ) end ) do
local Task = Task -- Tasking.Task#TASK
- Report:Add( "- " .. Task:ReportSummary() )
+ Report:Add( "- " .. Task:ReportSummary( ReportGroup ) )
end
return Report:Text()
@@ -898,13 +899,17 @@ function MISSION:ReportOverview( ReportGroup, TaskStatus )
Report:Add( string.format( '%s - %s - %s Tasks Report', Name, Status, TaskStatus ) )
-- Determine how many tasks are remaining.
- local TasksRemaining = 0
+ local Tasks = 0
for TaskID, Task in UTILS.spairs( self:GetTasks(), function( t, a, b ) return t[a]:ReportOrder( ReportGroup ) < t[b]:ReportOrder( ReportGroup ) end ) do
local Task = Task -- Tasking.Task#TASK
if Task:Is( TaskStatus ) then
Report:Add( string.rep( "-", 140 ) )
Report:Add( " - " .. Task:ReportOverview( ReportGroup ) )
end
+ Tasks = Tasks + 1
+ if Tasks >= 8 then
+ break
+ end
end
return Report:Text()
@@ -963,7 +968,7 @@ end
-- @param Wrapper.Group#GROUP ReportGroup
function MISSION:MenuReportTasksSummary( ReportGroup )
- local Report = self:ReportSummary()
+ local Report = self:ReportSummary( ReportGroup )
self:GetCommandCenter():MessageToGroup( Report, ReportGroup )
end
diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua
index b1da137fa..89c0e0bcd 100644
--- a/Moose Development/Moose/Tasking/Task.lua
+++ b/Moose Development/Moose/Tasking/Task.lua
@@ -1343,7 +1343,7 @@ function TASK:onbeforeTimeOut( From, Event, To )
return false
end
-do -- Dispatcher
+do -- Links
--- Set dispatcher of a task
-- @param #TASK self
@@ -1353,6 +1353,19 @@ do -- Dispatcher
self.Dispatcher = Dispatcher
end
+ --- Set detection of a task
+ -- @param #TASK self
+ -- @param Function.Detection#DETECTION_BASE Detection
+ -- @param #number DetectedItemIndex
+ -- @return #TASK
+ function TASK:SetDetection( Detection, DetectedItemIndex )
+
+ self:E({DetectedItemIndex,Detection})
+
+ self.Detection = Detection
+ self.DetectedItemIndex = DetectedItemIndex
+ end
+
end
do -- Reporting
@@ -1360,36 +1373,38 @@ do -- Reporting
--- Create a summary report of the Task.
-- List the Task Name and Status
-- @param #TASK self
+-- @param Wrapper.Group#GROUP ReportGroup
-- @return #string
-function TASK:ReportSummary() --R2.1 fixed report. Now nicely formatted and contains the info required.
+function TASK:ReportSummary( ReportGroup )
local Report = REPORT:New()
-- List the name of the Task.
- local Name = self:GetName()
+ Report:Add( self:GetName() )
-- Determine the status of the Task.
- local Status = "<" .. self:GetState() .. ">"
+ Report:Add( "State: <" .. self:GetState() .. ">" )
- Report:Add( 'Task ' .. Name .. ' - State ' .. Status )
-
- return Report:Text()
+ if self.TaskInfo["Coordinates"] then
+ local TaskInfoIDText = string.format( "%s: ", "Coordinate" )
+ local TaskCoord = self.TaskInfo["Coordinates"].TaskInfoText -- Core.Point#COORDINATE
+ Report:Add( TaskInfoIDText .. TaskCoord:ToString( ReportGroup, nil, self ) )
+ end
+
+ return Report:Text( ', ' )
end
--- Create an overiew report of the Task.
-- List the Task Name and Status
-- @param #TASK self
-- @return #string
-function TASK:ReportOverview( ReportGroup ) --R2.1 fixed report. Now nicely formatted and contains the info required.
+function TASK:ReportOverview( ReportGroup )
self:UpdateTaskInfo()
-- List the name of the Task.
local TaskName = self:GetName()
local Report = REPORT:New()
-
- -- Determine the status of the Task.
- local Status = "<" .. self:GetState() .. ">"
local Line = 0
local LineReport = REPORT:New()
@@ -1402,7 +1417,7 @@ function TASK:ReportOverview( ReportGroup ) --R2.1 fixed report. Now nicely form
if Line ~= 0 then
Report:AddIndent( LineReport:Text( ", " ) )
else
- Report:Add( TaskName .. " - " .. LineReport:Text( ", " ) )
+ Report:Add( TaskName .. ", " .. LineReport:Text( ", " ) )
end
LineReport = REPORT:New()
Line = math.floor( TaskInfo.TaskInfoOrder / 10 )
@@ -1414,7 +1429,6 @@ function TASK:ReportOverview( ReportGroup ) --R2.1 fixed report. Now nicely form
LineReport:Add( TaskInfoIDText .. TaskInfo.TaskInfoText )
elseif type(TaskInfo) == "table" then
if TaskInfoID == "Coordinates" then
- local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
--Report:Add( TaskInfoIDText )
LineReport:Add( TaskInfoIDText .. ToCoordinate:ToString( ReportGroup, nil, self ) )
@@ -1422,8 +1436,6 @@ function TASK:ReportOverview( ReportGroup ) --R2.1 fixed report. Now nicely form
else
end
end
-
-
end
Report:AddIndent( LineReport:Text( ", " ) )
diff --git a/Moose Development/Moose/Tasking/Task_A2A.lua b/Moose Development/Moose/Tasking/Task_A2A.lua
index cbef9d502..a40424276 100644
--- a/Moose Development/Moose/Tasking/Task_A2A.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A.lua
@@ -328,17 +328,39 @@ do -- TASK_A2A_INTERCEPT
"Intercept incoming intruders.\n"
)
- local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
- self:SetInfo( "Coordinates", TargetCoordinate, 10 )
-
- self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
- local DetectedItemsCount = TargetSetUnit:Count()
- local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
- self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 )
+ self:UpdateTaskInfo()
return self
end
+ function TASK_A2A_INTERCEPT:UpdateTaskInfo()
+
+ local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate()
+ self:SetInfo( "Coordinates", TargetCoordinate, 0 )
+
+ self:SetInfo( "Threat", "[" .. string.rep( "■", self.Detection and self.Detection:GetDetectedItemThreatLevel( self.DetectedItemIndex ) or self.TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
+
+ if self.Detection then
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local ReportTypes = REPORT:New()
+ local TargetTypes = {}
+ for TargetUnitName, TargetUnit in pairs( self.TargetSetUnit:GetSet() ) do
+ local TargetType = self.Detection:GetDetectedUnitTypeName( TargetUnit )
+ if not TargetTypes[TargetType] then
+ TargetTypes[TargetType] = TargetType
+ ReportTypes:Add( TargetType )
+ end
+ end
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, ReportTypes:Text( ", " ) ), 10 )
+ else
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
+ end
+
+ end
+
+
--- @param #TASK_A2A_INTERCEPT self
-- @param Wrapper.Group#GROUP ReportGroup
function TASK_A2A_INTERCEPT:ReportOrder( ReportGroup )
@@ -461,17 +483,40 @@ do -- TASK_A2A_SWEEP
"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, 10 )
-
- self:SetInfo( "Assumed Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
- local DetectedItemsCount = TargetSetUnit:Count()
- local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
- self:SetInfo( "Lost Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 )
-
+ self:UpdateTaskInfo()
+
return self
end
+
+ function TASK_A2A_SWEEP:UpdateTaskInfo()
+
+ local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate()
+ self:SetInfo( "Coordinates", TargetCoordinate, 0 )
+
+ self:SetInfo( "Assumed Threat", "[" .. string.rep( "■", self.Detection and self.Detection:GetDetectedItemThreatLevel( self.DetectedItemIndex ) or self.TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
+
+ if self.Detection then
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local ReportTypes = REPORT:New()
+ local TargetTypes = {}
+ for TargetUnitName, TargetUnit in pairs( self.TargetSetUnit:GetSet() ) do
+ local TargetType = self.Detection:GetDetectedUnitTypeName( TargetUnit )
+ if not TargetTypes[TargetType] then
+ TargetTypes[TargetType] = TargetType
+ ReportTypes:Add( TargetType )
+ end
+ end
+ self:SetInfo( "Lost Targets", string.format( "%d of %s", DetectedItemsCount, ReportTypes:Text( ", " ) ), 10 )
+ else
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
+ self:SetInfo( "Lost Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
+ end
+
+ end
+
+
function TASK_A2A_SWEEP:ReportOrder( ReportGroup )
local Coordinate = self.TaskInfo.Coordinates.TaskInfoText
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
@@ -587,17 +632,39 @@ do -- TASK_A2A_ENGAGE
"Bogeys are nearby! Players close by are ordered to ENGAGE the intruders!\n"
)
- local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
- self:SetInfo( "Coordinates", TargetCoordinate, 10 )
-
- self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
- local DetectedItemsCount = TargetSetUnit:Count()
- local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
- self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 )
+ self:UpdateTaskInfo()
return self
end
+
+ function TASK_A2A_ENGAGE:UpdateTaskInfo()
+
+ local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate()
+ self:SetInfo( "Coordinates", TargetCoordinate, 0 )
+
+ self:SetInfo( "Threat", "[" .. string.rep( "■", self.Detection and self.Detection:GetDetectedItemThreatLevel( self.DetectedItemIndex ) or self.TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
+
+ if self.Detection then
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local ReportTypes = REPORT:New()
+ local TargetTypes = {}
+ for TargetUnitName, TargetUnit in pairs( self.TargetSetUnit:GetSet() ) do
+ local TargetType = self.Detection:GetDetectedUnitTypeName( TargetUnit )
+ if not TargetTypes[TargetType] then
+ TargetTypes[TargetType] = TargetType
+ ReportTypes:Add( TargetType )
+ end
+ end
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, ReportTypes:Text( ", " ) ), 10 )
+ else
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
+ end
+
+ end
+
function TASK_A2A_ENGAGE:ReportOrder( ReportGroup )
local Coordinate = self.TaskInfo.Coordinates.TaskInfoText
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
index 018ba2910..f21928fdf 100644
--- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
@@ -382,9 +382,7 @@ do -- TASK_A2A_DISPATCHER
end
if DetectedItemChanged == true or Remove then
- --self:E( "Removing Tasking: " .. Task:GetTaskName() )
- Mission:RemoveTask( Task )
- self.Tasks[DetectedItemIndex] = nil
+ Task = self:RemoveTask( DetectedItemIndex )
end
end
end
@@ -482,6 +480,11 @@ do -- TASK_A2A_DISPATCHER
return PlayersCount, PlayerTypesReport
end
+ function TASK_A2A_DISPATCHER:RemoveTask( TaskIndex )
+ self.Mission:RemoveTask( self.Tasks[TaskIndex] )
+ self.Tasks[TaskIndex] = nil
+ end
+
--- Assigns tasks in relation to the detected items to the @{Set#SET_GROUP}.
-- @param #TASK_A2A_DISPATCHER self
@@ -510,8 +513,7 @@ do -- TASK_A2A_DISPATCHER
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
+ Task = self:RemoveTask( TaskIndex )
end
end
end
@@ -538,21 +540,24 @@ do -- TASK_A2A_DISPATCHER
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 )
+ Task:SetDetection( Detection, TaskIndex )
else
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 )
+ Task:SetDetection( Detection, TaskIndex )
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 )
+ Task:SetDetection( Detection, TaskIndex )
end
end
end
if Task then
self.Tasks[TaskIndex] = Task
- Task:SetTargetZone( DetectedZone, DetectedSet:GetFirst():GetAltitude(), DetectedSet:GetFirst():GetHeading() )
+ Task:SetTargetZone( DetectedZone, DetectedItem.Coordinate.y, DetectedItem.Coordinate.Heading )
Task:SetDispatcher( self )
Mission:AddTask( Task )
diff --git a/Moose Development/Moose/Tasking/Task_A2G.lua b/Moose Development/Moose/Tasking/Task_A2G.lua
index 7cdb72da3..9760326c4 100644
--- a/Moose Development/Moose/Tasking/Task_A2G.lua
+++ b/Moose Development/Moose/Tasking/Task_A2G.lua
@@ -317,7 +317,7 @@ do -- TASK_A2G_SEAD
-- @param Core.Set#SET_UNIT TargetSetUnit
-- @param #string TaskBriefing The briefing of the task.
-- @return #TASK_A2G_SEAD self
- function TASK_A2G_SEAD:New( Mission, SetGroup, TaskName, TargetSetUnit, TaskBriefing )
+ function TASK_A2G_SEAD:New( Mission, SetGroup, TaskName, TargetSetUnit, TaskBriefing)
local self = BASE:Inherit( self, TASK_A2G:New( Mission, SetGroup, TaskName, TargetSetUnit, "SEAD", TaskBriefing ) ) -- #TASK_A2G_SEAD
self:F()
@@ -335,13 +335,29 @@ do -- TASK_A2G_SEAD
function TASK_A2G_SEAD:UpdateTaskInfo()
- local TargetCoordinate = self.TargetSetUnit:GetFirst():GetCoordinate()
+
+ local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate()
self:SetInfo( "Coordinates", TargetCoordinate, 0 )
- self:SetInfo( "Threat", "[" .. string.rep( "■", self.TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
- local DetectedItemsCount = self.TargetSetUnit:Count()
- local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
- self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
+ self:SetInfo( "Threat", "[" .. string.rep( "■", self.Detection and self.Detection:GetDetectedItemThreatLevel( self.DetectedItemIndex ) or self.TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
+
+ if self.Detection then
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local ReportTypes = REPORT:New()
+ local TargetTypes = {}
+ for TargetUnitName, TargetUnit in pairs( self.TargetSetUnit:GetSet() ) do
+ local TargetType = self.Detection:GetDetectedUnitTypeName( TargetUnit )
+ if not TargetTypes[TargetType] then
+ TargetTypes[TargetType] = TargetType
+ ReportTypes:Add( TargetType )
+ end
+ end
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, ReportTypes:Text( ", " ) ), 10 )
+ else
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
+ end
end
@@ -462,13 +478,30 @@ do -- TASK_A2G_BAI
function TASK_A2G_BAI:UpdateTaskInfo()
- local TargetCoordinate = self.TargetSetUnit:GetFirst():GetCoordinate()
+ self:E({self.Detection, self.DetectedItemIndex})
+
+ local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate()
self:SetInfo( "Coordinates", TargetCoordinate, 0 )
- self:SetInfo( "Threat", "[" .. string.rep( "■", self.TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
- local DetectedItemsCount = self.TargetSetUnit:Count()
- local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
- self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
+ self:SetInfo( "Threat", "[" .. string.rep( "■", self.Detection and self.Detection:GetDetectedItemThreatLevel( self.DetectedItemIndex ) or self.TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
+
+ if self.Detection then
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local ReportTypes = REPORT:New()
+ local TargetTypes = {}
+ for TargetUnitName, TargetUnit in pairs( self.TargetSetUnit:GetSet() ) do
+ local TargetType = self.Detection:GetDetectedUnitTypeName( TargetUnit )
+ if not TargetTypes[TargetType] then
+ TargetTypes[TargetType] = TargetType
+ ReportTypes:Add( TargetType )
+ end
+ end
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, ReportTypes:Text( ", " ) ), 10 )
+ else
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
+ end
end
@@ -590,13 +623,28 @@ do -- TASK_A2G_CAS
function TASK_A2G_CAS:UpdateTaskInfo()
- local TargetCoordinate = self.TargetSetUnit:GetFirst():GetCoordinate()
+ local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate()
self:SetInfo( "Coordinates", TargetCoordinate, 0 )
- self:SetInfo( "Threat", "[" .. string.rep( "■", self.TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
- local DetectedItemsCount = self.TargetSetUnit:Count()
- local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
- self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
+ self:SetInfo( "Threat", "[" .. string.rep( "■", self.Detection and self.Detection:GetDetectedItemThreatLevel( self.DetectedItemIndex ) or self.TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
+
+ if self.Detection then
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local ReportTypes = REPORT:New()
+ local TargetTypes = {}
+ for TargetUnitName, TargetUnit in pairs( self.TargetSetUnit:GetSet() ) do
+ local TargetType = self.Detection:GetDetectedUnitTypeName( TargetUnit )
+ if not TargetTypes[TargetType] then
+ TargetTypes[TargetType] = TargetType
+ ReportTypes:Add( TargetType )
+ end
+ end
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, ReportTypes:Text( ", " ) ), 10 )
+ else
+ local DetectedItemsCount = self.TargetSetUnit:Count()
+ local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
+ self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
+ end
end
diff --git a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua
index 2234ef950..9de721ff4 100644
--- a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua
@@ -121,8 +121,9 @@ do -- TASK_A2G_DISPATCHER
-- Determine if the set has radar targets. If it does, construct a SEAD task.
local GroundUnitCount = DetectedSet:HasGroundUnits()
local FriendliesNearBy = self.Detection:IsFriendliesNearBy( DetectedItem )
+ local RadarCount = DetectedSet:HasSEAD()
- if GroundUnitCount > 0 and FriendliesNearBy == true then
+ if RadarCount == 0 and GroundUnitCount > 0 and FriendliesNearBy == true then
-- Copy the Set
local TargetSetUnit = SET_UNIT:New()
@@ -150,8 +151,9 @@ do -- TASK_A2G_DISPATCHER
-- Determine if the set has radar targets. If it does, construct a SEAD task.
local GroundUnitCount = DetectedSet:HasGroundUnits()
local FriendliesNearBy = self.Detection:IsFriendliesNearBy( DetectedItem )
+ local RadarCount = DetectedSet:HasSEAD()
- if GroundUnitCount > 0 and FriendliesNearBy == false then
+ if RadarCount == 0 and GroundUnitCount > 0 and FriendliesNearBy == false then
-- Copy the Set
local TargetSetUnit = SET_UNIT:New()
@@ -164,6 +166,12 @@ do -- TASK_A2G_DISPATCHER
return nil
end
+
+ function TASK_A2G_DISPATCHER:RemoveTask( TaskIndex )
+ self.Mission:RemoveTask( self.Tasks[TaskIndex] )
+ self.Tasks[TaskIndex] = nil
+ end
+
--- Evaluates the removal of the Task from the Mission.
-- Can only occur when the DetectedItem is Changed AND the state of the Task is "Planned".
-- @param #TASK_A2G_DISPATCHER self
@@ -177,8 +185,7 @@ do -- TASK_A2G_DISPATCHER
if Task then
if ( Task:IsStatePlanned() and DetectedItemChanged == true ) or Task:IsStateCancelled() then
--self:E( "Removing Tasking: " .. Task:GetTaskName() )
- Mission:RemoveTask( Task )
- self.Tasks[TaskIndex] = nil
+ self:RemoveTask( TaskIndex )
end
end
@@ -213,6 +220,7 @@ do -- TASK_A2G_DISPATCHER
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
+ Task = self:RemoveTask( TaskIndex )
Mission:RemoveTask( Task )
self.Tasks[TaskIndex] = nil
end
@@ -232,10 +240,11 @@ do -- TASK_A2G_DISPATCHER
local TaskIndex = DetectedItem.Index
local DetectedItemChanged = DetectedItem.Changed
+ self:E( { DetectedItemChanged = DetectedItemChanged, DetectedItemID = DetectedItemID, TaskIndex = TaskIndex } )
+
local Task = self.Tasks[TaskIndex] -- Tasking.Task_A2G#TASK_A2G
if Task then
-
-- If there is a Task and the task was assigned, then we check if the task was changed ... If it was, we need to reevaluate the targets.
if Task:IsStateAssigned() then
if DetectedItemChanged == true then -- The detection has changed, thus a new TargetSet is to be evaluated and set
@@ -254,24 +263,24 @@ do -- TASK_A2G_DISPATCHER
if TargetSetUnit then
if Task:IsInstanceOf( TASK_A2G_CAS ) then
Task:SetTargetSetUnit( TargetSetUnit )
+ Task:SetDetection( Detection, TaskIndex )
Task:UpdateTaskInfo()
TargetsReport:Add( Detection:GetChangeText( DetectedItem ) )
else
Task:Cancel()
- Task = nil
- self.Tasks[TaskIndex] = nil
+ Task = self:RemoveTask( TaskIndex )
end
else
local TargetSetUnit = self:EvaluateBAI( DetectedItem ) -- Returns a SetUnit if there are targets to be BAIed...
if TargetSetUnit then
if Task:IsInstanceOf( TASK_A2G_BAI ) then
Task:SetTargetSetUnit( TargetSetUnit )
+ Task:SetDetection( Detection, TaskIndex )
Task:UpdateTaskInfo()
TargetsReport:Add( Detection:GetChangeText( DetectedItem ) )
else
Task:Cancel()
- Task = nil
- self.Tasks[TaskIndex] = nil
+ Task = self:RemoveTask( TaskIndex )
end
end
end
@@ -288,14 +297,56 @@ do -- TASK_A2G_DISPATCHER
end
end
-
- Task = self:EvaluateRemoveTask( Mission, Task, TaskIndex, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
+ if Task then
+ if Task:IsStatePlanned() then
+ if DetectedItemChanged == true then -- The detection has changed, thus a new TargetSet is to be evaluated and set
+ if Task:IsInstanceOf( TASK_A2G_SEAD ) then
+ local TargetSetUnit = self:EvaluateSEAD( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed...
+ if TargetSetUnit then
+ Task:SetTargetSetUnit( TargetSetUnit )
+ Task:UpdateTaskInfo()
+ else
+ Task:Cancel()
+ Task = self:RemoveTask( TaskIndex )
+ end
+ else
+ if Task:IsInstanceOf( TASK_A2G_CAS ) then
+ local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be CASed...
+ if TargetSetUnit then
+ Task:SetTargetSetUnit( TargetSetUnit )
+ Task:SetDetection( Detection, TaskIndex )
+ Task:UpdateTaskInfo()
+ else
+ Task:Cancel()
+ Task = self:RemoveTask( TaskIndex )
+ end
+ else
+ if Task:IsInstanceOf( TASK_A2G_BAI ) then
+ local TargetSetUnit = self:EvaluateBAI( DetectedItem ) -- Returns a SetUnit if there are targets to be BAIed...
+ if TargetSetUnit then
+ Task:SetTargetSetUnit( TargetSetUnit )
+ Task:SetDetection( Detection, TaskIndex )
+ Task:UpdateTaskInfo()
+ else
+ Task:Cancel()
+ Task = self:RemoveTask( TaskIndex )
+ end
+ else
+ Task:Cancel()
+ Task = self:RemoveTask( TaskIndex )
+ end
+ end
+ end
+ end
+ end
+ end
-- Evaluate SEAD
if not Task then
local TargetSetUnit = self:EvaluateSEAD( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed...
if TargetSetUnit then
Task = TASK_A2G_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", DetectedItemID ), TargetSetUnit )
+ Task:SetDetection( Detection, TaskIndex )
end
-- Evaluate CAS
@@ -303,6 +354,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be CASed...
if TargetSetUnit then
Task = TASK_A2G_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", DetectedItemID ), TargetSetUnit )
+ Task:SetDetection( Detection, TaskIndex )
end
-- Evaluate BAI
@@ -310,6 +362,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateBAI( DetectedItem, self.Mission:GetCommandCenter():GetPositionable():GetCoalition() ) -- Returns a SetUnit if there are targets to be BAIed...
if TargetSetUnit then
Task = TASK_A2G_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", DetectedItemID ), TargetSetUnit )
+ Task:SetDetection( Detection, TaskIndex )
end
end
end
diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua
index aca0a5936..8d3a037a1 100644
--- a/Moose Development/Moose/Wrapper/Controllable.lua
+++ b/Moose Development/Moose/Wrapper/Controllable.lua
@@ -379,7 +379,7 @@ function CONTROLLABLE:SetTask( DCSTask, WaitTime )
end
if not WaitTime or WaitTime == 0 then
- self:SetTask( DCSTask )
+ SetTask( DCSTask )
else
self.TaskScheduler:Schedule( self, SetTask, { DCSTask }, WaitTime )
end
From 9dcda37703412ed57274883ceb5fa21408657b64 Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Tue, 15 Aug 2017 20:23:26 +0200
Subject: [PATCH 2/7] Updates
---
.../Moose/AI/AI_A2A_Dispatcher.lua | 24 ++++++++++++-----
.../Moose/Functional/Detection.lua | 27 +++++++++----------
2 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
index 22bc8bb26..c5880e09d 100644
--- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
@@ -1449,7 +1449,6 @@ do -- AI_A2A_DISPATCHER
-- @return #AI_A2A_DISPATCHER
function AI_A2A_DISPATCHER:SetSquadron( SquadronName, AirbaseName, SpawnTemplates, Resources )
- self:E( { SquadronName = SquadronName, AirbaseName = AirbaseName, SpawnTemplates = SpawnTemplates, Resources = Resources } )
self.DefenderSquadrons[SquadronName] = self.DefenderSquadrons[SquadronName] or {}
@@ -1473,6 +1472,8 @@ do -- AI_A2A_DISPATCHER
end
end
DefenderSquadron.Resources = Resources
+
+ self:E( { Squadron = {SquadronName, AirbaseName, SpawnTemplates, Resources } } )
return self
end
@@ -1537,6 +1538,8 @@ do -- AI_A2A_DISPATCHER
Cap.AltType = AltType
self:SetSquadronCapInterval( SquadronName, self.DefenderDefault.CapLimit, self.DefenderDefault.CapMinSeconds, self.DefenderDefault.CapMaxSeconds, 1 )
+
+ self:E( { CAP = { SquadronName, Zone, FloorAltitude, CeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, AltType } } )
return self
end
@@ -1684,6 +1687,8 @@ do -- AI_A2A_DISPATCHER
Intercept.Name = SquadronName
Intercept.EngageMinSpeed = EngageMinSpeed
Intercept.EngageMaxSpeed = EngageMaxSpeed
+
+ self:E( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed } } )
end
--- Defines the default amount of extra planes that will take-off as part of the defense system.
@@ -2637,6 +2642,8 @@ do -- AI_A2A_DISPATCHER
-- @param #AI_A2A_DISPATCHER self
function AI_A2A_DISPATCHER:onafterGCI( From, Event, To, DetectedItem, DefendersMissing, Friendlies )
+ self:F( { From, Event, To, DetectedItem.Index, DefendersMissing, Friendlies } )
+
local AttackerSet = DetectedItem.Set
local AttackerCount = AttackerSet:Count()
local DefendersCount = 0
@@ -2659,17 +2666,19 @@ do -- AI_A2A_DISPATCHER
local BreakLoop = false
while( DefendersCount > 0 and not BreakLoop ) do
-
+ self:F( { DefenderSquadrons = self.DefenderSquadrons } )
for SquadronName, DefenderSquadron in pairs( self.DefenderSquadrons or {} ) do
+ self:F( { GCI = DefenderSquadron.Gci } )
for InterceptID, Intercept in pairs( DefenderSquadron.Gci or {} ) do
- --self:E( { DefenderSquadron } )
+ self:F( { DefenderSquadron } )
local SpawnCoord = DefenderSquadron.Airbase:GetCoordinate() -- Core.Point#COORDINATE
--local TargetCoord = AttackerSet:GetFirst():GetCoordinate()
- local TargetCoord = DetectedItem.InterceptCoord
- if TargetCoord then
- local Distance = SpawnCoord:Get2DDistance( TargetCoord )
- self:F( { Distance = Distance, TargetCoord = TargetCoord } )
+ local InterceptCoord = DetectedItem.InterceptCoord
+ self:F({InterceptCoord = InterceptCoord})
+ if InterceptCoord then
+ local Distance = SpawnCoord:Get2DDistance( InterceptCoord )
+ self:F( { Distance = Distance, InterceptCoord = InterceptCoord } )
if ClosestDistance == 0 or Distance < ClosestDistance then
@@ -3455,6 +3464,7 @@ do
-- Setup squadrons
self:F( { Airbases = AirbaseNames } )
+ self.Templates:Flush()
for AirbaseID, AirbaseName in pairs( AirbaseNames ) do
local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index 71bf9a2ae..4ea071894 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -2366,24 +2366,21 @@ do -- DETECTION_AREAS
-- @param #DETECTION_BASE.DetectedItem DetectedItem
function DETECTION_AREAS:CalculateIntercept( DetectedItem )
+ local DetectedSpeed = DetectedItem.Coordinate.Speed
+ local DetectedHeading = DetectedItem.Coordinate.Heading
+ local DetectedCoord = DetectedItem.Coordinate
+
if self.Intercept then
local DetectedSet = DetectedItem.Set
- if DetectedUnit then
- -- todo: speed
- local DetectedSpeed = DetectedItem.Coordinate.Speed
- local DetectedHeading = DetectedItem.Coordinate.Heading
- local DetectedCoord = DetectedItem.Coordinate
-
- local TranslateDistance = DetectedSpeed * self.InterceptDelay
-
- local InterceptCoord = DetectedCoord:Translate( TranslateDistance, DetectedHeading )
-
- DetectedItem.InterceptCoord = InterceptCoord
- else
- DetectedItem.InterceptCoord = nil
- end
+ -- todo: speed
+
+ local TranslateDistance = DetectedSpeed * self.InterceptDelay
+
+ local InterceptCoord = DetectedCoord:Translate( TranslateDistance, DetectedHeading )
+
+ DetectedItem.InterceptCoord = InterceptCoord
else
- DetectedItem.InterceptCoord = nil
+ DetectedItem.InterceptCoord = DetectedCoord
end
end
From 608293f1cb801855f99af2198676098d2b193c40 Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Tue, 15 Aug 2017 20:39:32 +0200
Subject: [PATCH 3/7] Updates
---
Moose Development/Moose/Functional/Detection.lua | 2 +-
Moose Development/Moose/Wrapper/Identifiable.lua | 11 ++---------
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index 4ea071894..7908f1a43 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -1364,7 +1364,7 @@ do -- DETECTION_BASE
--- Gets a detected unit type name, taking into account the detection results.
-- @param #DETECTION_BASE self
- -- @param #Wrapper.Unit#UNIT DetectedUnit
+ -- @param Wrapper.Unit#UNIT DetectedUnit
-- @return #string The type name
function DETECTION_BASE:GetDetectedUnitTypeName( DetectedUnit )
--self:F2( ObjectName )
diff --git a/Moose Development/Moose/Wrapper/Identifiable.lua b/Moose Development/Moose/Wrapper/Identifiable.lua
index f863e9bd4..cd7243f4b 100644
--- a/Moose Development/Moose/Wrapper/Identifiable.lua
+++ b/Moose Development/Moose/Wrapper/Identifiable.lua
@@ -83,15 +83,8 @@ end
function IDENTIFIABLE:GetName()
self:F2( self.IdentifiableName )
- local DCSIdentifiable = self:GetDCSObject()
-
- if DCSIdentifiable then
- local IdentifiableName = self.IdentifiableName
- return IdentifiableName
- end
-
- self:E( self.ClassName .. " " .. self.IdentifiableName .. " not found!" )
- return nil
+ local IdentifiableName = self.IdentifiableName
+ return IdentifiableName
end
From 8bb3d5a76020b4a0dfaa145ae0291eeb1b91eeb1 Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Mon, 28 Aug 2017 11:33:37 +0200
Subject: [PATCH 4/7] Fixed CAP not counting correctly
* CAP now counts correctly per squadron. The specified amount of CAP
will work now.
* CAP now schedules at different start times, and have different repeat
times. More random.
---
.../Moose/AI/AI_A2A_Dispatcher.lua | 41 +++++++++++--------
1 file changed, 25 insertions(+), 16 deletions(-)
diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
index c5880e09d..8d62b61c8 100644
--- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
@@ -1348,11 +1348,12 @@ do -- AI_A2A_DISPATCHER
---
-- @param #AI_A2A_DISPATCHER self
- function AI_A2A_DISPATCHER:SetDefenderTask( Defender, Type, Fsm, Target )
+ function AI_A2A_DISPATCHER:SetDefenderTask( SquadronName, Defender, Type, Fsm, Target )
self.DefenderTasks[Defender] = self.DefenderTasks[Defender] or {}
self.DefenderTasks[Defender].Type = Type
self.DefenderTasks[Defender].Fsm = Fsm
+ self.DefenderTasks[Defender].SquadronName = SquadronName
if Target then
self:SetDefenderTaskTarget( Defender, Target )
@@ -1580,14 +1581,15 @@ do -- AI_A2A_DISPATCHER
local Scheduler = Cap.Scheduler -- Core.Scheduler#SCHEDULER
local ScheduleID = Cap.ScheduleID
local Variance = ( Cap.HighInterval - Cap.LowInterval ) / 2
- local Median = Cap.LowInterval + Variance
- local Randomization = Variance / Median
+ local Repeat = Cap.LowInterval + Variance
+ local Randomization = Variance / Repeat
local Start = math.random( 1, Cap.HighInterval )
if ScheduleID then
Scheduler:Stop( ScheduleID )
end
+ Cap.ScheduleID = Scheduler:Schedule( self, self.SchedulerCAP, { SquadronName }, Start, Repeat, Randomization )
else
error( "This squadron does not exist:" .. SquadronName )
end
@@ -2471,12 +2473,14 @@ do -- AI_A2A_DISPATCHER
local DefenderSquadron = self.DefenderSquadrons[SquadronName]
if DefenderSquadron then
for AIGroup, DefenderTask in pairs( self:GetDefenderTasks() ) do
- if DefenderTask.Type == "CAP" then
- if AIGroup:IsAlive() then
- -- Check if the CAP is patrolling or engaging. If not, this is not a valid CAP, even if it is alive!
- -- The CAP could be damaged, lost control, or out of fuel!
- if DefenderTask.Fsm:Is( "Patrolling" ) or DefenderTask.Fsm:Is( "Engaging" ) or DefenderTask.Fsm:Is( "Refuelling" )then
- CapCount = CapCount + 1
+ if DefenderTask.SquadronName == SquadronName then
+ if DefenderTask.Type == "CAP" then
+ if AIGroup:IsAlive() then
+ -- Check if the CAP is patrolling or engaging. If not, this is not a valid CAP, even if it is alive!
+ -- The CAP could be damaged, lost control, or out of fuel!
+ if DefenderTask.Fsm:Is( "Patrolling" ) or DefenderTask.Fsm:Is( "Engaging" ) or DefenderTask.Fsm:Is( "Refuelling" )then
+ CapCount = CapCount + 1
+ end
end
end
end
@@ -2494,12 +2498,17 @@ do -- AI_A2A_DISPATCHER
-- First, count the active AIGroups Units, targetting the DetectedSet
local AIUnitCount = 0
+ self:E( "Counting Defenders Engaged for Attacker:" )
+ local DetectedSet = Target.Set
+ DetectedSet:Flush()
+
local DefenderTasks = self:GetDefenderTasks()
for AIGroup, DefenderTask in pairs( DefenderTasks ) do
local AIGroup = AIGroup -- Wrapper.Group#GROUP
local DefenderTask = self:GetDefenderTaskTarget( AIGroup )
if DefenderTask and DefenderTask.Index == Target.Index then
AIUnitCount = AIUnitCount + AIGroup:GetSize()
+ self:E( "Defender Group Name: " .. AIGroup:GetName() .. ", Size: " .. AIGroup:GetSize() )
end
end
@@ -2587,7 +2596,7 @@ do -- AI_A2A_DISPATCHER
Fsm:Start()
Fsm:__Patrol( 2 )
- self:SetDefenderTask( DefenderCAP, "CAP", Fsm )
+ self:SetDefenderTask( SquadronName, DefenderCAP, "CAP", Fsm )
end
end
end
@@ -2742,7 +2751,7 @@ do -- AI_A2A_DISPATCHER
Fsm:__Engage( 2, DetectedItem.Set ) -- Engage on the TargetSetUnit
- self:SetDefenderTask( DefenderGCI, "GCI", Fsm, DetectedItem )
+ self:SetDefenderTask( ClosestDefenderSquadronName, DefenderGCI, "GCI", Fsm, DetectedItem )
function Fsm:onafterRTB( Defender, From, Event, To )
@@ -2875,14 +2884,14 @@ do -- AI_A2A_DISPATCHER
self:ClearDefenderTask( AIGroup )
else
if DefenderTask.Target then
- local Target = Detection:GetDetectedItem( DefenderTask.Target.Index )
- if not Target then
+ local AttackerItem = Detection:GetDetectedItem( DefenderTask.Target.Index )
+ if not AttackerItem then
self:F( { "Removing obsolete Target:", DefenderTask.Target.Index } )
self:ClearDefenderTaskTarget( AIGroup )
-
else
if DefenderTask.Target.Set then
- if DefenderTask.Target.Set:Count() == 0 then
+ local AttackerCount = DefenderTask.Target.Set:Count()
+ if AttackerCount == 0 then
self:F( { "All Targets destroyed in Target, removing:", DefenderTask.Target.Index } )
self:ClearDefenderTaskTarget( AIGroup )
end
@@ -2968,7 +2977,7 @@ do -- AI_A2A_DISPATCHER
end
Report:Add( string.format( "\n - %d Tasks", TaskCount ) )
- self:T( Report:Text( "\n" ) )
+ self:E( Report:Text( "\n" ) )
trigger.action.outText( Report:Text( "\n" ), 25 )
end
From 9784b694bad55732438715fab0e4156797ec7f1d Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Tue, 29 Aug 2017 09:00:43 +0200
Subject: [PATCH 5/7] Fixed detection problem with ESCORT
---
Moose Development/Moose/Functional/Escort.lua | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/Moose Development/Moose/Functional/Escort.lua b/Moose Development/Moose/Functional/Escort.lua
index 697a00e00..66496f973 100644
--- a/Moose Development/Moose/Functional/Escort.lua
+++ b/Moose Development/Moose/Functional/Escort.lua
@@ -1163,7 +1163,7 @@ function ESCORT:_ReportTargetsScheduler()
local ClientEscortTargets = EscortGroupData.Detection
--local EscortUnit = EscortGroupData:GetUnit( 1 )
- for DetectedItemID, DetectedItem in ipairs( DetectedItems ) do
+ for DetectedItemID, DetectedItem in pairs( DetectedItems ) do
self:E( { DetectedItemID, DetectedItem } )
-- Remove the sub menus of the Attack menu of the Escort for the EscortGroup.
@@ -1171,10 +1171,13 @@ function ESCORT:_ReportTargetsScheduler()
if ClientEscortGroupName == EscortGroupName then
- DetectedMsgs[#DetectedMsgs+1] = DetectedItemReportSummary:Text("\n")
+ local DetectedMsg = DetectedItemReportSummary:Text("\n")
+ DetectedMsgs[#DetectedMsgs+1] = DetectedMsg
+
+ self:T( DetectedMsg )
MENU_CLIENT_COMMAND:New( self.EscortClient,
- DetectedItemReportSummary,
+ DetectedMsg,
self.EscortMenuAttackNearbyTargets,
ESCORT._AttackTarget,
self,
@@ -1183,10 +1186,12 @@ function ESCORT:_ReportTargetsScheduler()
else
if self.EscortMenuTargetAssistance then
- self:T( DetectedItemReportSummary )
+ local DetectedMsg = DetectedItemReportSummary:Text("\n")
+ self:T( DetectedMsg )
+
local MenuTargetAssistance = MENU_CLIENT:New( self.EscortClient, EscortGroupData.EscortName, self.EscortMenuTargetAssistance )
MENU_CLIENT_COMMAND:New( self.EscortClient,
- DetectedItemReportSummary,
+ DetectedMsg,
MenuTargetAssistance,
ESCORT._AssistTarget,
self,
From 62ab859215f4047069f942fd3cc902d67bd6d5b3 Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Tue, 29 Aug 2017 21:48:11 +0200
Subject: [PATCH 6/7] DESIGNATE can now lase for specific codes
* DESIGNATE can now lase targets with specific laser codes upon request
by players. Methods :AddMenuLaserCode() and :RemoveMenuLaserCode()
added, which allow to set or delete specific additional menu options in
the lase menu for players to lase with specific codes. This comes in
handy for the SU-25T and the A-10A and other planes.
---
.../Moose/Functional/Designate.lua | 114 ++++-
docs/Documentation/AI_A2A_Dispatcher.html | 9 +-
docs/Documentation/AI_Patrol.html | 3 -
docs/Documentation/Designate.html | 478 +++++++++++++++++-
docs/Documentation/Detection.html | 427 ++++++++--------
docs/Documentation/Fsm.html | 3 +-
docs/Documentation/Menu.html | 100 ++++
docs/Documentation/Mission.html | 12 +-
docs/Documentation/Point.html | 46 +-
docs/Documentation/Positionable.html | 17 +-
docs/Documentation/Scheduler.html | 20 +
docs/Documentation/Set.html | 5 +
docs/Documentation/Settings.html | 293 +++++------
docs/Documentation/Spawn.html | 32 +-
docs/Documentation/SpawnStatic.html | 1 +
docs/Documentation/Spot.html | 4 -
docs/Documentation/Task.html | 89 +++-
docs/Documentation/Task_A2A.html | 57 +++
docs/Documentation/Task_A2A_Dispatcher.html | 27 +
docs/Documentation/Task_A2G_Dispatcher.html | 27 +
docs/Documentation/Task_Cargo.html | 4 +-
docs/Documentation/Zone.html | 39 ++
22 files changed, 1345 insertions(+), 462 deletions(-)
diff --git a/Moose Development/Moose/Functional/Designate.lua b/Moose Development/Moose/Functional/Designate.lua
index 13fdabfd7..78758e763 100644
--- a/Moose Development/Moose/Functional/Designate.lua
+++ b/Moose Development/Moose/Functional/Designate.lua
@@ -133,7 +133,7 @@ do -- DESIGNATE
--
-- ## 4. Laser codes
--
- -- ### 4.1 Set possible laser codes
+ -- ### 4.1. Set possible laser codes
--
-- An array of laser codes can be provided, that will be used by the DESIGNATE when lasing.
-- The laser code is communicated by the Recce when it is lasing a larget.
@@ -151,10 +151,19 @@ do -- DESIGNATE
--
-- The above sets a collection of possible laser codes that can be assigned. **Note the { } notation!**
--
- -- ### 4.2 Auto generate laser codes
+ -- ### 4.2. Auto generate laser codes
--
-- Use the method @{#DESIGNATE.GenerateLaserCodes}() to generate all possible laser codes. Logic implemented and advised by Ciribob!
--
+ -- ### 4.3. Add specific lase codes to the lase menu
+ --
+ -- Certain plane types can only drop laser guided ordonnance when targets are lased with specific laser codes.
+ -- The SU-25T needs targets to be lased using laser code 1113.
+ -- The A-10A needs targets to be lased using laser code 1680.
+ --
+ -- The method @{#DESIGNATE.AddMenuLaserCode}() to allow a player to lase a target using a specific laser code.
+ -- Remove such a lase menu option using @{#DESIGNATE.RemoveMenuLaserCode}().
+ --
-- ## 5. Autolase to automatically lase detected targets.
--
-- DetectionItems can be auto lased once detected by Recces. As such, there is almost no action required from the Players using the Designate Menu.
@@ -396,6 +405,8 @@ do -- DESIGNATE
self.LaserCodesUsed = {}
+ self.MenuLaserCodes = {} -- This map contains the laser codes that will be shown in the designate menu to lase with specific laser codes.
+
self.Detection:__Start( 2 )
self:__Detect( -15 )
@@ -491,6 +502,43 @@ do -- DESIGNATE
end
+ --- Add a specific lase code to the designate lase menu to lase targets with a specific laser code.
+ -- The MenuText will appear in the lase menu.
+ -- @param #DESIGNATE self
+ -- @param #number LaserCode The specific laser code to be added to the lase menu.
+ -- @param #string MenuText The text to be shown to the player. If you specify a %d in the MenuText, the %d will be replaced with the LaserCode specified.
+ -- @return #DESIGNATE
+ -- @usage
+ -- RecceDesignation:AddMenuLaserCode( 1113, "Lase with %d for Su-25T" )
+ -- RecceDesignation:AddMenuLaserCode( 1680, "Lase with %d for A-10A" )
+ --
+ function DESIGNATE:AddMenuLaserCode( LaserCode, MenuText )
+
+ self.MenuLaserCodes[LaserCode] = MenuText
+ self:SetDesignateMenu()
+
+ return self
+ end
+
+
+ --- Removes a specific lase code from the designate lase menu.
+ -- @param #DESIGNATE self
+ -- @param #number LaserCode The specific laser code that was set to be added to the lase menu.
+ -- @return #DESIGNATE
+ -- @usage
+ -- RecceDesignation:RemoveMenuLaserCode( 1113 )
+ --
+ function DESIGNATE:RemoveMenuLaserCode( LaserCode )
+
+ self.MenuLaserCodes[LaserCode] = nil
+ self:SetDesignateMenu()
+
+ return self
+ end
+
+
+
+
--- Set the name of the designation. The name will appear in the menu.
-- This method can be used to control different designations for different plane types.
-- @param #DESIGNATE self
@@ -811,8 +859,10 @@ do -- DESIGNATE
MenuText = "(-) " .. MenuText
local DetectedMenu = MENU_GROUP:New( AttackGroup, MenuText, MenuDesignate ):SetTime( MenuTime ):SetTag( self.DesignateName )
MENU_GROUP_COMMAND:New( AttackGroup, "Search other target", DetectedMenu, self.MenuForget, self, DesignateIndex ):SetTime( MenuTime ):SetTag( self.DesignateName )
- MENU_GROUP_COMMAND:New( AttackGroup, "Lase target 60 secs", DetectedMenu, self.MenuLaseOn, self, DesignateIndex, 60 ):SetTime( MenuTime ):SetTag( self.DesignateName )
- MENU_GROUP_COMMAND:New( AttackGroup, "Lase target 120 secs", DetectedMenu, self.MenuLaseOn, self, DesignateIndex, 120 ):SetTime( MenuTime ):SetTag( self.DesignateName )
+ for LaserCode, MenuText in pairs( self.MenuLaserCodes ) do
+ MENU_GROUP_COMMAND:New( AttackGroup, string.format( MenuText, LaserCode ), DetectedMenu, self.MenuLaseCode, self, DesignateIndex, 60, LaserCode ):SetTime( MenuTime ):SetTag( self.DesignateName )
+ end
+ MENU_GROUP_COMMAND:New( AttackGroup, "Lase targets", DetectedMenu, self.MenuLaseOn, self, DesignateIndex, 60 ):SetTime( MenuTime ):SetTag( self.DesignateName )
MENU_GROUP_COMMAND:New( AttackGroup, "Smoke red", DetectedMenu, self.MenuSmoke, self, DesignateIndex, SMOKECOLOR.Red ):SetTime( MenuTime ):SetTag( self.DesignateName )
MENU_GROUP_COMMAND:New( AttackGroup, "Smoke blue", DetectedMenu, self.MenuSmoke, self, DesignateIndex, SMOKECOLOR.Blue ):SetTime( MenuTime ):SetTag( self.DesignateName )
MENU_GROUP_COMMAND:New( AttackGroup, "Smoke green", DetectedMenu, self.MenuSmoke, self, DesignateIndex, SMOKECOLOR.Green ):SetTime( MenuTime ):SetTag( self.DesignateName )
@@ -912,6 +962,18 @@ do -- DESIGNATE
self:SetDesignateMenu()
end
+
+ ---
+ -- @param #DESIGNATE self
+ function DESIGNATE:MenuLaseCode( Index, Duration, LaserCode )
+
+ self:E( "Designate through Lase using " .. LaserCode )
+
+ self:__LaseOn( 1, Index, Duration, LaserCode )
+ self:SetDesignateMenu()
+ end
+
+
---
-- @param #DESIGNATE self
function DESIGNATE:MenuLaseOff( Index, Duration )
@@ -925,21 +987,22 @@ do -- DESIGNATE
---
-- @param #DESIGNATE self
- function DESIGNATE:onafterLaseOn( From, Event, To, Index, Duration )
+ function DESIGNATE:onafterLaseOn( From, Event, To, Index, Duration, LaserCode )
self.Designating[Index] = "Laser"
- self:__Lasing( -1, Index, Duration )
+ self:__Lasing( -1, Index, Duration, LaserCode )
end
---
-- @param #DESIGNATE self
-- @return #DESIGNATE
- function DESIGNATE:onafterLasing( From, Event, To, Index, Duration )
+ function DESIGNATE:onafterLasing( From, Event, To, Index, Duration, LaserCodeRequested )
+
local TargetSetUnit = self.Detection:GetDetectedSet( Index )
- local MarkedCount = 0
+ local MarkingCount = 0
local MarkedTypes = {}
local ReportTypes = REPORT:New()
local ReportLaserCodes = REPORT:New()
@@ -951,12 +1014,30 @@ do -- DESIGNATE
local Recce = RecceData -- Wrapper.Unit#UNIT
self:F( { TargetUnit = TargetUnit, Recce = Recce:GetName() } )
if not Recce:IsLasing() then
- local LaserCode = Recce:GetLaserCode() --(Not deleted when stopping with lasing).
+ local LaserCode = Recce:GetLaserCode() -- (Not deleted when stopping with lasing).
self:F( { ClearingLaserCode = LaserCode } )
self.LaserCodesUsed[LaserCode] = nil
self.Recces[TargetUnit] = nil
end
end
+
+ -- If a specific lasercode is requested, we disable one active lase!
+ if LaserCodeRequested then
+ for TargetUnit, RecceData in pairs( self.Recces ) do -- We break after the first has been processed.
+ local Recce = RecceData -- Wrapper.Unit#UNIT
+ self:F( { TargetUnit = TargetUnit, Recce = Recce:GetName() } )
+ if Recce:IsLasing() then
+ -- When a Recce is lasing, we switch the lasing off, and clear the references to the lasing in the DESIGNATE class.
+ Recce:LaseOff() -- Switch off the lasing.
+ local LaserCode = Recce:GetLaserCode() -- (Not deleted when stopping with lasing).
+ self:F( { ClearingLaserCode = LaserCode } )
+ self.LaserCodesUsed[LaserCode] = nil
+ self.Recces[TargetUnit] = nil
+ break
+ end
+ end
+ end
+
TargetSetUnit:ForEachUnitPerThreatLevel( 10, 0,
--- @param Wrapper.Unit#UNIT SmokeUnit
@@ -964,7 +1045,7 @@ do -- DESIGNATE
self:F( { TargetUnit = TargetUnit:GetName() } )
- if MarkedCount < self.MaximumMarkings then
+ if MarkingCount < self.MaximumMarkings then
if TargetUnit:IsAlive() then
@@ -991,6 +1072,11 @@ do -- DESIGNATE
local LaserCode = self.LaserCodes[LaserCodeIndex]
--self:F( { LaserCode = LaserCode, LaserCodeUsed = self.LaserCodesUsed[LaserCode] } )
+ if LaserCodeRequested and LaserCodeRequested ~= LaserCode then
+ LaserCode = LaserCodeRequested
+ LaserCodeRequested = nil
+ end
+
if not self.LaserCodesUsed[LaserCode] then
self.LaserCodesUsed[LaserCode] = LaserCodeIndex
@@ -1005,7 +1091,7 @@ do -- DESIGNATE
self.Recces[TargetUnit] = RecceUnit
RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.", 5, self.AttackSet, self.DesignateName )
-- OK. We have assigned for the Recce a TargetUnit. We can exit the function.
- MarkedCount = MarkedCount + 1
+ MarkingCount = MarkingCount + 1
local TargetUnitType = TargetUnit:GetTypeName()
if not MarkedTypes[TargetUnitType] then
MarkedTypes[TargetUnitType] = true
@@ -1029,7 +1115,7 @@ do -- DESIGNATE
Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() "out of LOS. Cancelling lase!", 5, self.AttackSet, self.DesignateName )
end
else
- MarkedCount = MarkedCount + 1
+ MarkingCount = MarkingCount + 1
local TargetUnitType = TargetUnit:GetTypeName()
if not MarkedTypes[TargetUnitType] then
MarkedTypes[TargetUnitType] = true
@@ -1041,7 +1127,7 @@ do -- DESIGNATE
end
end
else
- MarkedCount = MarkedCount + 1
+ MarkingCount = MarkingCount + 1
local TargetUnitType = TargetUnit:GetTypeName()
if not MarkedTypes[TargetUnitType] then
MarkedTypes[TargetUnitType] = true
@@ -1058,7 +1144,7 @@ do -- DESIGNATE
local MarkedTypesText = ReportTypes:Text(', ')
local MarkedLaserCodesText = ReportLaserCodes:Text(', ')
for MarkedType, MarketCount in pairs( MarkedTypes ) do
- self.CC:GetPositionable():MessageToSetGroup( "Marking " .. MarkedCount .. " x " .. MarkedTypesText .. " with lasers " .. MarkedLaserCodesText .. ".", 5, self.AttackSet, self.DesignateName )
+ self.CC:GetPositionable():MessageToSetGroup( "Marking " .. MarkingCount .. " x " .. MarkedTypesText .. " with lasers " .. MarkedLaserCodesText .. ".", 5, self.AttackSet, self.DesignateName )
end
self:__Lasing( -30, Index, Duration )
diff --git a/docs/Documentation/AI_A2A_Dispatcher.html b/docs/Documentation/AI_A2A_Dispatcher.html
index 14b161be1..a44b0d577 100644
--- a/docs/Documentation/AI_A2A_Dispatcher.html
+++ b/docs/Documentation/AI_A2A_Dispatcher.html
@@ -713,7 +713,7 @@ Per one, two, three, four?
- | AI_A2A_DISPATCHER:SetDefenderTask(Defender, Type, Fsm, Target) |
+ AI_A2A_DISPATCHER:SetDefenderTask(SquadronName, Defender, Type, Fsm, Target) |
|
@@ -3895,7 +3895,7 @@ A string defining the group name of the Tanker as defined within the Mission Edi
-AI_A2A_DISPATCHER:SetDefenderTask(Defender, Type, Fsm, Target)
+AI_A2A_DISPATCHER:SetDefenderTask(SquadronName, Defender, Type, Fsm, Target)
@@ -3906,6 +3906,11 @@ A string defining the group name of the Tanker as defined within the Mission Edi
diff --git a/docs/Documentation/Designate.html b/docs/Documentation/Designate.html
index a076cec3d..31210aea8 100644
--- a/docs/Documentation/Designate.html
+++ b/docs/Documentation/Designate.html
@@ -164,6 +164,12 @@ each detected set of potential targets can be lased or smoked...
+ | DESIGNATE:AddMenuLaserCode(LaserCode, MenuText) |
+
+ Add a specific lase code to the designate lase menu to lase targets with a specific laser code.
+ |
+
+
| DESIGNATE.AttackSet |
@@ -185,6 +191,12 @@ each detected set of potential targets can be lased or smoked...
| DESIGNATE:CoordinateLase() |
Coordinates the Auto Lase.
+ |
+
+
+ | DESIGNATE.DesignateName |
+
+
|
@@ -257,12 +269,42 @@ each detected set of potential targets can be lased or smoked...
| DESIGNATE.LaserCodesUsed |
+ |
+
+
+ | DESIGNATE.MarkScheduler |
+
+
|
| DESIGNATE.MaximumDesignations |
+ |
+
+
+ | DESIGNATE.MaximumDistanceAirDesignation |
+
+
+ |
+
+
+ | DESIGNATE.MaximumDistanceDesignations |
+
+
+ |
+
+
+ | DESIGNATE.MaximumDistanceGroundDesignation |
+
+
+ |
+
+
+ | DESIGNATE.MaximumMarkings |
+
+
|
@@ -293,6 +335,12 @@ each detected set of potential targets can be lased or smoked...
| DESIGNATE:MenuIlluminate(Index) |
+ |
+
+
+ | DESIGNATE:MenuLaseCode(Index, Duration, LaserCode) |
+
+
|
@@ -305,6 +353,12 @@ each detected set of potential targets can be lased or smoked...
| DESIGNATE:MenuLaseOn(Index, Duration) |
+ |
+
+
+ | DESIGNATE.MenuLaserCodes |
+
+
|
@@ -413,6 +467,12 @@ each detected set of potential targets can be lased or smoked...
| DESIGNATE.Recces |
+ |
+
+
+ | DESIGNATE:RemoveMenuLaserCode(LaserCode) |
+
+ Removes a specific lase code from the designate lase menu.
|
@@ -422,7 +482,7 @@ each detected set of potential targets can be lased or smoked...
- | DESIGNATE:SetAutoLase(AutoLase) |
+ DESIGNATE:SetAutoLase(AutoLase, Message) |
Set auto lase.
|
@@ -431,6 +491,12 @@ each detected set of potential targets can be lased or smoked...
DESIGNATE:SetDesignateMenu() |
Sets the Designate Menu.
+ |
+
+
+ | DESIGNATE:SetDesignateName(DesignateName) |
+
+ Set the name of the designation.
|
@@ -449,6 +515,30 @@ each detected set of potential targets can be lased or smoked...
| DESIGNATE:SetMaximumDesignations(MaximumDesignations) |
Set the maximum amount of designations.
+ |
+
+
+ | DESIGNATE:SetMaximumDistanceAirDesignation(MaximumDistanceAirDesignation) |
+
+ Set the maximum air designation distance.
+ |
+
+
+ | DESIGNATE:SetMaximumDistanceDesignations(MaximumDistanceDesignations) |
+
+ Set the overall maximum distance when designations can be accepted.
+ |
+
+
+ | DESIGNATE:SetMaximumDistanceGroundDesignation(MaximumDistanceGroundDesignation) |
+
+ Set the maximum ground designation distance.
+ |
+
+
+ | DESIGNATE:SetMaximumMarkings(MaximumMarkings) |
+
+ Set the maximum amount of markings FACs will do, per designated target group.
|
@@ -542,13 +632,13 @@ each detected set of potential targets can be lased or smoked...
- | DESIGNATE:onafterLaseOn(From, Event, To, Index, Duration) |
+ DESIGNATE:onafterLaseOn(From, Event, To, Index, Duration, LaserCode) |
|
- | DESIGNATE:onafterLasing(From, Event, To, Index, Duration) |
+ DESIGNATE:onafterLasing(From, Event, To, Index, Duration, LaserCodeRequested) |
|
@@ -685,7 +775,7 @@ Using the menu system, the player can "forget" a designation, so that gradually
4. Laser codes
-4.1 Set possible laser codes
+4.1. Set possible laser codes
An array of laser codes can be provided, that will be used by the DESIGNATE when lasing.
The laser code is communicated by the Recce when it is lasing a larget.
@@ -705,10 +795,19 @@ One laser code can be given or an sequence of laser codes through an table...
The above sets a collection of possible laser codes that can be assigned. Note the { } notation!
-4.2 Auto generate laser codes
+4.2. Auto generate laser codes
Use the method DESIGNATE.GenerateLaserCodes() to generate all possible laser codes. Logic implemented and advised by Ciribob!
+4.3. Add specific lase codes to the lase menu
+
+Certain plane types can only drop laser guided ordonnance when targets are lased with specific laser codes.
+The SU-25T needs targets to be lased using laser code 1113.
+The A-10A needs targets to be lased using laser code 1680.
+
+The method DESIGNATE.AddMenuLaserCode() to allow a player to lase a target using a specific laser code.
+Remove such a lase menu option using DESIGNATE.RemoveMenuLaserCode().
+
5. Autolase to automatically lase detected targets.
DetectionItems can be auto lased once detected by Recces. As such, there is almost no action required from the Players using the Designate Menu.
@@ -766,6 +865,47 @@ Use the method DESIGNATE.SetMission() to
-
+
+
+-
+
+
Add a specific lase code to the designate lase menu to lase targets with a specific laser code.
+
+
+The MenuText will appear in the lase menu.
+
+ Parameters
+
+ -
+
+
#number LaserCode :
+The specific laser code to be added to the lase menu.
+
+
+ -
+
+
#string MenuText :
+The text to be shown to the player. If you specify a %d in the MenuText, the %d will be replaced with the LaserCode specified.
+
+
+
+ Return value
+
+#DESIGNATE:
+
+
+ Usage:
+ RecceDesignation:AddMenuLaserCode( 1113, "Lase with %d for Su-25T" )
+ RecceDesignation:AddMenuLaserCode( 1680, "Lase with %d for A-10A" )
+
+
+
+
+
+-
+
DESIGNATE.AttackSet
@@ -780,7 +920,6 @@ Use the method DESIGNATE.SetMission() to
-
-
DESIGNATE.AutoLase
@@ -821,6 +960,19 @@ Use the method DESIGNATE.SetMission() to
#DESIGNATE:
+
+
+
+-
+
+
+DESIGNATE.DesignateName
+
+
+-
+
+
+
@@ -1000,6 +1152,20 @@ function below will use the range 1-7 just in case
+
+
+
+-
+
+
+
+DESIGNATE.MarkScheduler
+
+
+-
+
+
+
@@ -1014,6 +1180,62 @@ function below will use the range 1-7 just in case
+
+
+
+-
+
+
+
+DESIGNATE.MaximumDistanceAirDesignation
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+DESIGNATE.MaximumDistanceDesignations
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+DESIGNATE.MaximumDistanceGroundDesignation
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+DESIGNATE.MaximumMarkings
+
+
+-
+
+
+
@@ -1121,6 +1343,37 @@ function below will use the range 1-7 just in case
-
+
+
+-
+
+
+
+
Parameters
+
+ -
+
+
Index :
+
+
+ -
+
+
Duration :
+
+
+ -
+
+
LaserCode :
+
+
+
+
+
+
+-
+
@@ -1168,6 +1421,23 @@ function below will use the range 1-7 just in case
+
+
+
+-
+
+
+
+
+-
+
+
+
+
+
This map contains the laser codes that will be shown in the designate menu to lase with specific laser codes.
+
@@ -1710,6 +1980,37 @@ The Attack collection of GROUP objects to designate and report for.
+
+
+
+-
+
+
+
+-
+
+
Removes a specific lase code from the designate lase menu.
+
+ Parameter
+
+ Return value
+
+#DESIGNATE:
+
+
+ Usage:
+ RecceDesignation:RemoveMenuLaserCode( 1113 )
+
+
@@ -1753,7 +2054,7 @@ The time in seconds the report should be visible.
-
-DESIGNATE:SetAutoLase(AutoLase)
+DESIGNATE:SetAutoLase(AutoLase, Message)
-
@@ -1763,11 +2064,18 @@ The time in seconds the report should be visible.
Auto lase will start lasing targets immediately when these are in range.
- Parameter
+ Parameters
-
-
#boolean AutoLase :
+#boolean AutoLase :
+(optional) true sets autolase on, false off. Default is off.
+
+
+ -
+
+
#boolean Message :
+(optional) true is send message, false or nil won't send a message. Default is no message sent.
@@ -1794,6 +2102,36 @@ The time in seconds the report should be visible.
#DESIGNATE:
+
+
+
+-
+
+
+DESIGNATE:SetDesignateName(DesignateName)
+
+
+-
+
+
Set the name of the designation.
+
+
+The name will appear in the menu.
+This method can be used to control different designations for different plane types.
+
+ Parameter
+
+ -
+
+
#string DesignateName :
+
+
+
+ Return value
+
+#DESIGNATE:
+
+
@@ -1882,6 +2220,114 @@ number> LaserCodes
#DESIGNATE:
+
+
+
+-
+
+
+DESIGNATE:SetMaximumDistanceAirDesignation(MaximumDistanceAirDesignation)
+
+
+-
+
+
Set the maximum air designation distance.
+
+ Parameter
+
+ Return value
+
+#DESIGNATE:
+
+
+
+
+
+-
+
+
+DESIGNATE:SetMaximumDistanceDesignations(MaximumDistanceDesignations)
+
+
+-
+
+
Set the overall maximum distance when designations can be accepted.
+
+ Parameter
+
+ Return value
+
+#DESIGNATE:
+
+
+
+
+
+-
+
+
+DESIGNATE:SetMaximumDistanceGroundDesignation(MaximumDistanceGroundDesignation)
+
+
+-
+
+
Set the maximum ground designation distance.
+
+ Parameter
+
+ Return value
+
+#DESIGNATE:
+
+
+
+
+
+-
+
+
+DESIGNATE:SetMaximumMarkings(MaximumMarkings)
+
+
+-
+
+
Set the maximum amount of markings FACs will do, per designated target group.
+
+ Parameter
+
+ Return value
+
+#DESIGNATE:
+
+
@@ -2251,7 +2697,7 @@ The MISSION object.
-
-DESIGNATE:onafterLaseOn(From, Event, To, Index, Duration)
+DESIGNATE:onafterLaseOn(From, Event, To, Index, Duration, LaserCode)
-
@@ -2284,6 +2730,11 @@ The MISSION object.
Duration :
+
+ -
+
+
LaserCode :
+
@@ -2292,7 +2743,7 @@ The MISSION object.
-
-DESIGNATE:onafterLasing(From, Event, To, Index, Duration)
+DESIGNATE:onafterLasing(From, Event, To, Index, Duration, LaserCodeRequested)
-
@@ -2325,6 +2776,11 @@ The MISSION object.
Duration :
+
+ -
+
+
LaserCodeRequested :
+
Return value
diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html
index a73a97f0a..00b524902 100644
--- a/docs/Documentation/Detection.html
+++ b/docs/Documentation/Detection.html
@@ -190,12 +190,6 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu
DETECTION_AREAS:CalculateIntercept(DetectedItem) |
Calculate the optimal intercept point of the DetectedItem.
- |
-
-
- | DETECTION_AREAS:CalculateThreatLevelA2G(DetectedItem) |
-
- Calculate the maxium A2G threat level of the DetectedItem.
|
@@ -262,18 +256,6 @@ DETECTION uses the in-built detection capabilities of DCS World, but adds new fu
| DETECTION_AREAS:GetChangeText(DetectedItem) |
Make text documenting the changes of the detected zone.
- |
-
-
- | DETECTION_AREAS:GetDetectedItemCoordinate(Index) |
-
- Get the detected item coordinate.
- |
-
-
- | DETECTION_AREAS:GetTreatLevelA2G(DetectedItem) |
-
- Returns the A2G threat level of the units in the DetectedItem
|
@@ -583,6 +565,12 @@ The different values of Unit.Category can be:
| DETECTION_BASE:GetDetectedItemID(Index) |
Get a detected ItemID using a given numeric index.
+ |
+
+
+ | DETECTION_BASE:GetDetectedItemThreatLevel(Index) |
+
+ Get the detected item coordinate.
|
@@ -613,6 +601,12 @@ The different values of Unit.Category can be:
| DETECTION_BASE:GetDetectedSet(Index) |
Get the Set#SET_UNIT of a detecttion area using a given numeric index.
+ |
+
+
+ | DETECTION_BASE:GetDetectedUnitTypeName(DetectedUnit) |
+
+ Gets a detected unit type name, taking into account the detection results.
|
@@ -643,12 +637,6 @@ The different values of Unit.Category can be:
| DETECTION_BASE:GetPlayersNearBy(DetectedItem) |
Returns friendly units nearby the FAC units ...
- |
-
-
- | DETECTION_BASE:HasDetectedItemLOS(Index) |
-
- Has the detected item LOS (Line Of Sight) with one of the Recce?
|
@@ -865,6 +853,18 @@ The different values of Unit.Category can be:
| DETECTION_BASE:SetAlphaAngleProbability(AlphaAngleProbability) |
Upon a visual detection, the higher the unit is during the detecting process, the more likely the detected unit is to be detected properly.
+ |
+
+
+ | DETECTION_BASE:SetDetectedItemCoordinate(The, Coordinate, DetectedItemUnit, DetectedItem) |
+
+ Set the detected item coordinate.
+ |
+
+
+ | DETECTION_BASE:SetDetectedItemThreatLevel(The, DetectedItem) |
+
+ Set the detected item threatlevel.
|
@@ -995,6 +995,18 @@ The different values of Unit.Category can be:
| DETECTION_BASE.DetectedItem.Changes |
A list of the changes reported on the detected area. (It is up to the user of the detected area to consume those changes).
+ |
+
+
+ | DETECTION_BASE.DetectedItem.Coordinate |
+
+ The last known coordinate of the DetectedItem.
+ |
+
+
+ | DETECTION_BASE.DetectedItem.DistanceRecce |
+
+
|
@@ -1013,12 +1025,6 @@ The different values of Unit.Category can be:
| DETECTION_BASE.DetectedItem.InterceptCoord |
- |
-
-
- | DETECTION_BASE.DetectedItem.MaxThreatLevelA2G |
-
-
|
@@ -1031,6 +1037,12 @@ The different values of Unit.Category can be:
| DETECTION_BASE.DetectedItem.Set |
-- The Set of Units in the detected area.
+ |
+
+
+ | DETECTION_BASE.DetectedItem.ThreatLevel |
+
+
|
@@ -1147,12 +1159,6 @@ The different values of Unit.Category can be:
| DETECTION_TYPES:GetChangeText(DetectedItem) |
Make text documenting the changes of the detected zone.
- |
-
-
- | DETECTION_TYPES:GetDetectedItemCoordinate(DetectedTypeName) |
-
- Get the detected item coordinate.
|
@@ -1235,12 +1241,6 @@ The different values of Unit.Category can be:
| DETECTION_UNITS:GetChangeText(DetectedItem) |
Make text documenting the changes of the detected zone.
- |
-
-
- | DETECTION_UNITS:GetDetectedItemCoordinate(Index) |
-
- Get the detected item coordinate.
|
@@ -1571,8 +1571,6 @@ a DetectedItem. The default range is 6000 meters. For air detections, it is advi
-
-
# 4) DETECTION_AREAS class, extends Detection#DETECTION_BASE
@@ -1646,27 +1644,6 @@ self
-
-
-
--
-
-
-DETECTION_AREAS:CalculateThreatLevelA2G(DetectedItem)
-
-
--
-
-
Calculate the maxium A2G threat level of the DetectedItem.
-
- Parameter
-
+
+
+-
+
+
+DETECTION_BASE:SetDetectedItemCoordinate(The, Coordinate, DetectedItemUnit, DetectedItem)
+
+
+-
+
+
Set the detected item coordinate.
+
+ Parameters
+
+ Return value
+
+#DETECTION_BASE:
+
+
+
+
+
+-
+
+
+DETECTION_BASE:SetDetectedItemThreatLevel(The, DetectedItem)
+
+
+-
+
+
Set the detected item threatlevel.
+
+ Parameters
+
+ Return value
+
+#DETECTION_BASE:
+
+
@@ -4775,6 +4798,34 @@ The To State string.
A list of the changes reported on the detected area. (It is up to the user of the detected area to consume those changes).
+
+
+
+-
+
+ Core.Point#COORDINATE
+
+DETECTION_BASE.DetectedItem.Coordinate
+
+
+-
+
+
The last known coordinate of the DetectedItem.
+
+
+
+
+-
+
+
+
+DETECTION_BASE.DetectedItem.DistanceRecce
+
+
+-
+
+
+
@@ -4817,20 +4868,6 @@ The To State string.
-
-
-
--
-
-
-
-DETECTION_BASE.DetectedItem.MaxThreatLevelA2G
-
-
--
-
-
-
@@ -4859,6 +4896,20 @@ The To State string.
-- The Set of Units in the detected area.
+
+
+
+-
+
+
+
+DETECTION_BASE.DetectedItem.ThreatLevel
+
+
+-
+
+
+
@@ -5219,32 +5270,6 @@ The Changes text
-
-
-DETECTION_TYPES:GetDetectedItemCoordinate(DetectedTypeName)
-
-
--
-
-
Get the detected item coordinate.
-
- Parameter
-
- -
-
-
DetectedTypeName :
-
-
-
- Return value
-
-#Core.Point:
-COORDINATE
-
-
-
-
--
-
DETECTION_TYPES:New(DetectionSetGroup)
@@ -5523,32 +5548,6 @@ The group to generate the report for.
#string:
The Changes text
-
-
-
--
-
-
-DETECTION_UNITS:GetDetectedItemCoordinate(Index)
-
-
--
-
-
Get the detected item coordinate.
-
- Parameter
-
- Return value
-
-Core.Point#COORDINATE:
-
-
diff --git a/docs/Documentation/Fsm.html b/docs/Documentation/Fsm.html
index e0276d335..177f34281 100644
--- a/docs/Documentation/Fsm.html
+++ b/docs/Documentation/Fsm.html
@@ -1598,7 +1598,7 @@ A string defining the start state.
-
-
+ #string
FSM._StartState
@@ -1897,7 +1897,6 @@ A string defining the start state.
-
-
FSM.current
diff --git a/docs/Documentation/Menu.html b/docs/Documentation/Menu.html
index 3fab176c6..edded7fd7 100644
--- a/docs/Documentation/Menu.html
+++ b/docs/Documentation/Menu.html
@@ -194,6 +194,7 @@ On top, MOOSE implements variable parameter passing for command
The MENUCOMMANDBASE class defines the main MENU class where other MENU COMMAND_
classes are derived from, in order to set commands.
+
@@ -369,6 +370,24 @@ classes are derived from, in order to set commands.
| MENU_COMMAND_BASE.New(#, self, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArguments) |
Constructor
+ |
+
+
+ | MENU_COMMAND_BASE.SetCommandMenuArguments(#, self, CommandMenuArguments) |
+
+ This sets the new command arguments of a menu,
+so that if a menu is regenerated, or if command arguments change,
+that the arguments set for the menu are loosely coupled with the menu itself!!!
+If the arguments change, no new menu needs to be generated if the menu text is the same!!!
+ |
+
+
+ | MENU_COMMAND_BASE.SetCommandMenuFunction(#, self, CommandMenuFunction) |
+
+ This sets the new command function of a menu,
+so that if a menu is regenerated, or if command function changes,
+that the function set for the menu is loosely coupled with the menu itself!!!
+If the function changes, no new menu needs to be generated if the menu text is the same!!!
|
@@ -729,6 +748,7 @@ Using this object reference, you can then remove ALL the menus and submenus unde
The MENUCOMMANDBASE class defines the main MENU class where other MENU COMMAND_
classes are derived from, in order to set commands.
+
@@ -1452,6 +1472,86 @@ ENUCOMMANDBASE
#MENUCOMMANDBASE:
+
+
+
+-
+
+
+MENU_COMMAND_BASE.SetCommandMenuArguments(#, self, CommandMenuArguments)
+
+
+-
+
+
This sets the new command arguments of a menu,
+so that if a menu is regenerated, or if command arguments change,
+that the arguments set for the menu are loosely coupled with the menu itself!!!
+If the arguments change, no new menu needs to be generated if the menu text is the same!!!
+
+ Parameters
+
+ -
+
+
# :
+ENUCOMMANDBASE
+
+
+ -
+
+
self :
+
+
+ -
+
+
CommandMenuArguments :
+
+
+
+ Return value
+
+#MENUCOMMANDBASE:
+
+
+
+
+
+-
+
+
+MENU_COMMAND_BASE.SetCommandMenuFunction(#, self, CommandMenuFunction)
+
+
+-
+
+
This sets the new command function of a menu,
+so that if a menu is regenerated, or if command function changes,
+that the function set for the menu is loosely coupled with the menu itself!!!
+If the function changes, no new menu needs to be generated if the menu text is the same!!!
+
+ Parameters
+
+ -
+
+
# :
+ENUCOMMANDBASE
+
+
+ -
+
+
self :
+
+
+ -
+
+
CommandMenuFunction :
+
+
+
+ Return value
+
+#MENUCOMMANDBASE:
+
+
diff --git a/docs/Documentation/Mission.html b/docs/Documentation/Mission.html
index c0f6adf18..ce693c0a0 100644
--- a/docs/Documentation/Mission.html
+++ b/docs/Documentation/Mission.html
@@ -544,7 +544,7 @@
- | MISSION:ReportSummary() |
+ MISSION:ReportSummary(ReportGroup) |
Create a summary report of the Mission (one line).
|
@@ -2489,13 +2489,21 @@ self
-MISSION:ReportSummary()
+MISSION:ReportSummary(ReportGroup)
Create a summary report of the Mission (one line).
+ Parameter
+
Return value
#string:
diff --git a/docs/Documentation/Point.html b/docs/Documentation/Point.html
index 90f96d0c2..22a8976b5 100644
--- a/docs/Documentation/Point.html
+++ b/docs/Documentation/Point.html
@@ -416,9 +416,15 @@
- | COORDINATE:ToStringLL(Settings) |
+ COORDINATE:ToStringLLDDM(Settings) |
- Provides a Lat Lon string
+Provides a Lat Lon string in Degree Decimal Minute format.
+ |
+
+
+ | COORDINATE:ToStringLLDMS(Settings) |
+
+ Provides a Lat Lon string in Degree Minute Second format.
|
@@ -2111,13 +2117,13 @@ The coordinate Text in the configured coordinate system.
-
-
-COORDINATE:ToStringLL(Settings)
+
+COORDINATE:ToStringLLDDM(Settings)
-
-
Provides a Lat Lon string
+Provides a Lat Lon string in Degree Decimal Minute format.
Parameter
@@ -2131,7 +2137,34 @@ The coordinate Text in the configured coordinate system.
Return value
#string:
-The LL Text
+The LL DDM Text
+
+
+
+
+-
+
+
+COORDINATE:ToStringLLDMS(Settings)
+
+
+-
+
+
Provides a Lat Lon string in Degree Minute Second format.
+
+ Parameter
+
+ Return value
+
+#string:
+The LL DMS Text
@@ -2829,7 +2862,6 @@ The y coordinate.
-
-
POINT_VEC2.z
diff --git a/docs/Documentation/Positionable.html b/docs/Documentation/Positionable.html
index 27939a7dd..f5b1c4a9e 100644
--- a/docs/Documentation/Positionable.html
+++ b/docs/Documentation/Positionable.html
@@ -416,7 +416,7 @@
- | POSITIONABLE:Smoke(SmokeColor, Range) |
+ POSITIONABLE:Smoke(SmokeColor, Range, AddHeight) |
Smoke the POSITIONABLE.
|
@@ -1738,7 +1738,7 @@ self
-POSITIONABLE:Smoke(SmokeColor, Range)
+POSITIONABLE:Smoke(SmokeColor, Range, AddHeight)
@@ -1749,12 +1749,20 @@ self
-
-
SmokeColor :
+Utilities.Utils#SMOKECOLOR SmokeColor :
+The color to smoke to positionable.
-
-
Range :
+#number Range :
+The range in meters to randomize the smoking around the positionable.
+
+
+ -
+
+
#number AddHeight :
+The height in meters to add to the altitude of the positionable.
@@ -1828,6 +1836,7 @@ self
-
+ Core.Spot#SPOT
POSITIONABLE.Spot
diff --git a/docs/Documentation/Scheduler.html b/docs/Documentation/Scheduler.html
index 64e0a878f..e3681deff 100644
--- a/docs/Documentation/Scheduler.html
+++ b/docs/Documentation/Scheduler.html
@@ -172,6 +172,12 @@
| SCHEDULER:Clear() |
Clears all pending schedules.
+ |
+
+
+ | SCHEDULER.MasterObject |
+
+
|
@@ -414,6 +420,20 @@ The schedule will stop after 300 seconds.
Clears all pending schedules.
+
+
+
+-
+
+
+
+SCHEDULER.MasterObject
+
+
+-
+
+
+
diff --git a/docs/Documentation/Set.html b/docs/Documentation/Set.html
index ce59ab37f..7b343aea0 100644
--- a/docs/Documentation/Set.html
+++ b/docs/Documentation/Set.html
@@ -4567,6 +4567,11 @@ self
Calculate the maxium A2G threat level of the SET_UNIT.
+ Return value
+
+#number:
+The maximum threatlevel
+
diff --git a/docs/Documentation/Settings.html b/docs/Documentation/Settings.html
index 6836574d8..992d1808d 100644
--- a/docs/Documentation/Settings.html
+++ b/docs/Documentation/Settings.html
@@ -172,15 +172,9 @@
- | SETTINGS:GetLL_Accuracy() |
+ SETTINGS:GetLL_DDM_Accuracy() |
Gets the SETTINGS LL accuracy.
- |
-
-
- | SETTINGS:GetLL_DMS() |
-
- Gets the SETTINGS LL DMS.
|
@@ -202,9 +196,15 @@
- | SETTINGS:IsA2A_LL() |
+ SETTINGS:IsA2A_LL_DDM() |
- Is LL
+Is LL DDM
+ |
+
+
+ | SETTINGS:IsA2A_LL_DMS() |
+
+ Is LL DMS
|
@@ -220,9 +220,15 @@
- | SETTINGS:IsA2G_LL() |
+ SETTINGS:IsA2G_LL_DDM() |
- Is LL
+Is LL DDM
+ |
+
+
+ | SETTINGS:IsA2G_LL_DMS() |
+
+ Is LL DMS
|
@@ -274,13 +280,7 @@
- | SETTINGS:MenuGroupLL_AccuracySystem(PlayerUnit, PlayerGroup, PlayerName, LL_Accuracy) |
-
-
- |
-
-
- | SETTINGS:MenuGroupLL_DMSSystem(PlayerUnit, PlayerGroup, PlayerName, LL_DMS) |
+ SETTINGS:MenuGroupLL_DDM_AccuracySystem(PlayerUnit, PlayerGroup, PlayerName, LL_Accuracy) |
|
@@ -298,13 +298,7 @@
- | SETTINGS:MenuLL_Accuracy(MenuGroup, RootMenu, LL_Accuracy) |
-
-
- |
-
-
- | SETTINGS:MenuLL_DMS(MenuGroup, RootMenu, LL_DMS) |
+ SETTINGS:MenuLL_DDM_Accuracy(MenuGroup, RootMenu, LL_Accuracy) |
|
@@ -358,9 +352,15 @@
- | SETTINGS:SetA2A_LL() |
+ SETTINGS:SetA2A_LL_DDM() |
- Sets A2A LL
+Sets A2A LL DDM
+ |
+
+
+ | SETTINGS:SetA2A_LL_DMS() |
+
+ Sets A2A LL DMS
|
@@ -376,9 +376,15 @@
- | SETTINGS:SetA2G_LL() |
+ SETTINGS:SetA2G_LL_DDM() |
- Sets A2G LL
+Sets A2G LL DDM
+ |
+
+
+ | SETTINGS:SetA2G_LL_DMS() |
+
+ Sets A2G LL DMS
|
@@ -397,12 +403,6 @@
| SETTINGS:SetLL_Accuracy(LL_Accuracy) |
Sets the SETTINGS LL accuracy.
- |
-
-
- | SETTINGS:SetLL_DMS(LL_DMS) |
-
- Sets the SETTINGS LL DMS.
|
@@ -544,8 +544,8 @@
-
-
-SETTINGS:GetLL_Accuracy()
+
+SETTINGS:GetLL_DDM_Accuracy()
-
@@ -557,24 +557,6 @@
#number:
-
-
-
--
-
-
-SETTINGS:GetLL_DMS()
-
-
--
-
-
Gets the SETTINGS LL DMS.
-
- Return value
-
-#number:
-
-
@@ -634,18 +616,36 @@ true if BULLS
-
-
-SETTINGS:IsA2A_LL()
+
+SETTINGS:IsA2A_LL_DDM()
-
-
Is LL
+Is LL DDM
Return value
#boolean:
-true if LL
+true if LL DDM
+
+
+
+
+-
+
+
+SETTINGS:IsA2A_LL_DMS()
+
+
+-
+
+
Is LL DMS
+
+ Return value
+
+#boolean:
+true if LL DMS
@@ -688,18 +688,36 @@ true if BRA
-
-
-SETTINGS:IsA2G_LL()
+
+SETTINGS:IsA2G_LL_DDM()
-
-
Is LL
+Is LL DDM
Return value
#boolean:
-true if LL
+true if LL DDM
+
+
+
+
+-
+
+
+SETTINGS:IsA2G_LL_DMS()
+
+
+-
+
+
Is LL DMS
+
+ Return value
+
+#boolean:
+true if LL DMS
@@ -874,8 +892,8 @@ true if metric.
-
-
-
@@ -910,42 +928,6 @@ true if metric.
-
-
-
--
-
-
-
-
Parameters
-
- -
-
-
PlayerUnit :
-
-
- -
-
-
PlayerGroup :
-
-
- -
-
-
PlayerName :
-
-
- -
-
-
LL_DMS :
-
-
-
-
-
-
--
-
@@ -1018,8 +1000,8 @@ true if metric.
-
-
-
@@ -1049,37 +1031,6 @@ true if metric.
-
-
-
--
-
-
-
-
Parameters
-
- -
-
-
MenuGroup :
-
-
- -
-
-
RootMenu :
-
-
- -
-
-
LL_DMS :
-
-
-
-
-
-
--
-
@@ -1263,13 +1214,31 @@ true if metric.
-
-
-SETTINGS:SetA2A_LL()
+
+SETTINGS:SetA2A_LL_DDM()
-
-
Sets A2A LL
+Sets A2A LL DDM
+
+ Return value
+
+#SETTINGS:
+
+
+
+
+
+-
+
+
+SETTINGS:SetA2A_LL_DMS()
+
+
+-
+
+
Sets A2A LL DMS
Return value
@@ -1317,13 +1286,31 @@ true if metric.
-
-
-SETTINGS:SetA2G_LL()
+
+SETTINGS:SetA2G_LL_DDM()
-
-
Sets A2G LL
+Sets A2G LL DDM
+
+ Return value
+
+#SETTINGS:
+
+
+
+
+
+-
+
+
+SETTINGS:SetA2G_LL_DMS()
+
+
+-
+
+
Sets A2G LL DMS
Return value
@@ -1387,32 +1374,6 @@ true if metric.
#SETTINGS:
-
-
-
--
-
-
-SETTINGS:SetLL_DMS(LL_DMS)
-
-
--
-
-
Sets the SETTINGS LL DMS.
-
- Parameter
-
- -
-
-
#number LL_DMS :
-
-
-
- Return value
-
-#SETTINGS:
-
-
diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html
index 4229c2ac8..65835348c 100644
--- a/docs/Documentation/Spawn.html
+++ b/docs/Documentation/Spawn.html
@@ -822,12 +822,6 @@ and any spaces before and after the resulting name are removed.
| SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle) |
- |
-
-
- | SPAWN.uncontrolled |
-
-
|
@@ -2200,9 +2194,6 @@ The group that was spawned. You can use this group for further actions.
-
- Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
-
@@ -2755,9 +2746,6 @@ when nothing was spawned.
-
- By default, no InitLimit
-
@@ -2793,7 +2781,7 @@ when nothing was spawned.
-
- #number
+
SPAWN.SpawnMaxGroups
@@ -2810,7 +2798,7 @@ when nothing was spawned.
-
- #number
+
SPAWN.SpawnMaxUnitsAlive
@@ -3138,7 +3126,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
-
- #boolean
+
SPAWN.SpawnUnControlled
@@ -3742,20 +3730,6 @@ True = Continue Scheduler
-
-
-
--
-
-
-
-SPAWN.uncontrolled
-
-
--
-
-
-
diff --git a/docs/Documentation/SpawnStatic.html b/docs/Documentation/SpawnStatic.html
index bc91b9624..d8aa5e633 100644
--- a/docs/Documentation/SpawnStatic.html
+++ b/docs/Documentation/SpawnStatic.html
@@ -436,6 +436,7 @@ ptional) The name of the new static.
-
+ #number
SPAWNSTATIC.SpawnIndex
diff --git a/docs/Documentation/Spot.html b/docs/Documentation/Spot.html
index 5fdc3b305..ead3792db 100644
--- a/docs/Documentation/Spot.html
+++ b/docs/Documentation/Spot.html
@@ -765,7 +765,6 @@ true if it is lasing
-
-
SPOT.ScheduleID
@@ -779,7 +778,6 @@ true if it is lasing
-
-
SPOT.SpotIR
@@ -793,7 +791,6 @@ true if it is lasing
-
-
SPOT.SpotLaser
@@ -807,7 +804,6 @@ true if it is lasing
-
-
SPOT.Target
diff --git a/docs/Documentation/Task.html b/docs/Documentation/Task.html
index 26d342ef7..dd18375a7 100644
--- a/docs/Documentation/Task.html
+++ b/docs/Documentation/Task.html
@@ -183,6 +183,18 @@
| TASK:CrashGroup(PlayerUnit, PlayerGroup) |
A PlayerUnit crashed in a Task.
+ |
+
+
+ | TASK.DetectedItemIndex |
+
+
+ |
+
+
+ | TASK.Detection |
+
+
|
@@ -516,7 +528,7 @@
- | TASK:ReportSummary() |
+ TASK:ReportSummary(ReportGroup) |
Create a summary report of the Task.
|
@@ -537,6 +549,12 @@
TASK:SetBriefing(TaskBriefing) |
Sets a Task briefing.
+ |
+
+
+ | TASK:SetDetection(Detection, DetectedItemIndex) |
+
+ Set detection of a task
|
@@ -1156,6 +1174,34 @@ The CLIENT or UNIT of the Player aborting the Task.
#TASK:
+
+
+
+-
+
+
+
+TASK.DetectedItemIndex
+
+
+-
+
+
+
+
+
+
+-
+
+
+
+TASK.Detection
+
+
+-
+
+
+
@@ -2344,7 +2390,7 @@ self
-
-TASK:ReportSummary()
+TASK:ReportSummary(ReportGroup)
-
@@ -2354,6 +2400,14 @@ self
List the Task Name and Status
+ Parameter
+
Return value
#string:
@@ -2429,6 +2483,37 @@ self
#TASK:
self
+
+
+
+-
+
+
+TASK:SetDetection(Detection, DetectedItemIndex)
+
+
+-
+
+
Set detection of a task
+
+ Parameters
+
+ Return value
+
+#TASK:
+
+
diff --git a/docs/Documentation/Task_A2A.html b/docs/Documentation/Task_A2A.html
index a4ca3be69..53005ee57 100644
--- a/docs/Documentation/Task_A2A.html
+++ b/docs/Documentation/Task_A2A.html
@@ -274,6 +274,12 @@ based on the tasking capabilities defined in Task#TA
| TASK_A2A_ENGAGE.TargetSetUnit |
+ |
+
+
+ | TASK_A2A_ENGAGE:UpdateTaskInfo() |
+
+
|
@@ -320,6 +326,12 @@ based on the tasking capabilities defined in Task#TA
| TASK_A2A_INTERCEPT.TargetSetUnit |
+ |
+
+
+ | TASK_A2A_INTERCEPT:UpdateTaskInfo() |
+
+
|
@@ -366,6 +378,12 @@ based on the tasking capabilities defined in Task#TA
| TASK_A2A_SWEEP.TargetSetUnit |
+ |
+
+
+ | TASK_A2A_SWEEP:UpdateTaskInfo() |
+
+
|
@@ -1069,6 +1087,19 @@ The score in points.
+
+
+
+-
+
+
+TASK_A2A_ENGAGE:UpdateTaskInfo()
+
+
+-
+
+
+
@@ -1309,6 +1340,19 @@ The score in points.
+
+
+
+-
+
+
+TASK_A2A_INTERCEPT:UpdateTaskInfo()
+
+
+-
+
+
+
@@ -1549,6 +1593,19 @@ The score in points.
+
+
+
+-
+
+
+TASK_A2A_SWEEP:UpdateTaskInfo()
+
+
+-
+
+
+
diff --git a/docs/Documentation/Task_A2A_Dispatcher.html b/docs/Documentation/Task_A2A_Dispatcher.html
index e9ee5a1da..11141d207 100644
--- a/docs/Documentation/Task_A2A_Dispatcher.html
+++ b/docs/Documentation/Task_A2A_Dispatcher.html
@@ -199,6 +199,12 @@
| TASK_A2A_DISPATCHER:ProcessDetected(Detection) |
Assigns tasks in relation to the detected items to the Set#SET_GROUP.
+ |
+
+
+ | TASK_A2A_DISPATCHER:RemoveTask(TaskIndex) |
+
+
|
@@ -760,6 +766,27 @@ Return true if you want the task assigning to continue... false will cancel the
-
+
+TASK_A2A_DISPATCHER:RemoveTask(TaskIndex)
+
+
+-
+
+
+
+
Parameter
+
+
+
+
+-
+
TASK_A2A_DISPATCHER:SetEngageRadius(EngageRadius)
diff --git a/docs/Documentation/Task_A2G_Dispatcher.html b/docs/Documentation/Task_A2G_Dispatcher.html
index dca001ffa..19f576d02 100644
--- a/docs/Documentation/Task_A2G_Dispatcher.html
+++ b/docs/Documentation/Task_A2G_Dispatcher.html
@@ -183,6 +183,12 @@
| TASK_A2G_DISPATCHER:ProcessDetected(Detection) |
Assigns tasks in relation to the detected items to the Set#SET_GROUP.
+ |
+
+
+ | TASK_A2G_DISPATCHER:RemoveTask(TaskIndex) |
+
+
|
@@ -542,6 +548,27 @@ The detection created by the Detectio
#boolean:
Return true if you want the task assigning to continue... false will cancel the loop.
+
+
+
+-
+
+
+TASK_A2G_DISPATCHER:RemoveTask(TaskIndex)
+
+
+-
+
+
+
+
Parameter
+
diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html
index 5ccba6643..349f0de89 100644
--- a/docs/Documentation/Task_Cargo.html
+++ b/docs/Documentation/Task_Cargo.html
@@ -552,7 +552,7 @@ based on the tasking capabilities defined in Task#TA
-
- Core.Cargo#CARGO
+ Core.Cargo#CARGO_GROUP
FSM_PROCESS.Cargo
@@ -631,7 +631,7 @@ based on the tasking capabilities defined in Task#TA
-
-
+ #number
TASK_CARGO.CargoLimit
diff --git a/docs/Documentation/Zone.html b/docs/Documentation/Zone.html
index da7814e14..67e25dafa 100644
--- a/docs/Documentation/Zone.html
+++ b/docs/Documentation/Zone.html
@@ -386,6 +386,12 @@
+ | ZONE_GROUP:GetRandomPointVec2(inner, outer) |
+
+ Returns a Point#POINT_VEC2 object reflecting a random 2D location within the zone.
+ |
+
+
| ZONE_GROUP:GetRandomVec2() |
Returns a random location within the zone of the Group.
@@ -1425,6 +1431,39 @@ The smoke color.
-
+
+ZONE_GROUP:GetRandomPointVec2(inner, outer)
+
+
+-
+
+
Returns a Point#POINT_VEC2 object reflecting a random 2D location within the zone.
+
+ Parameters
+
+ Return value
+
+Core.Point#POINT_VEC2:
+The Point#POINT_VEC2 object reflecting the random 3D location within the zone.
+
+
+
+
+-
+
ZONE_GROUP:GetRandomVec2()
From d26a938ba4c16db4bef1e215d79f4af46d2adb73 Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Tue, 29 Aug 2017 22:20:38 +0200
Subject: [PATCH 7/7] Fixed detection reports
* Detection reports of DETECTION classes now are returned as a REPORT
object. So they can be streamed with various delimiters \n or , or
other...
* If a coordinate needs to be represented by BR or BRAA, then a "source"
controllable is required, which is usually the player aircraft. If not
given, the coordinate will be returned in MGRS mode!!!
---
Moose Development/Moose/Core/Point.lua | 17 +++++++++++++----
.../Moose/Functional/Detection.lua | 18 +++++++++---------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua
index d9e55dc04..7f9b04620 100644
--- a/Moose Development/Moose/Core/Point.lua
+++ b/Moose Development/Moose/Core/Point.lua
@@ -838,8 +838,12 @@ do -- COORDINATE
if ModeA2A then
if Settings:IsA2A_BRAA() then
- local Coordinate = Controllable:GetCoordinate()
- return self:ToStringBRA( Coordinate, Settings )
+ if Controllable then
+ local Coordinate = Controllable:GetCoordinate()
+ return self:ToStringBRA( Coordinate, Settings )
+ else
+ return self:ToStringMGRS( Settings )
+ end
end
if Settings:IsA2A_BULLS() then
local Coalition = Controllable:GetCoalition()
@@ -856,8 +860,13 @@ do -- COORDINATE
end
else
if Settings:IsA2G_BR() then
- local Coordinate = Controllable:GetCoordinate()
- return Controllable and self:ToStringBR( Coordinate, Settings ) or self:ToStringMGRS( Settings )
+ -- If no Controllable is given to calculate the BR from, then MGRS will be used!!!
+ if Controllable then
+ local Coordinate = Controllable:GetCoordinate()
+ return Controllable and self:ToStringBR( Coordinate, Settings ) or self:ToStringMGRS( Settings )
+ else
+ return self:ToStringMGRS( Settings )
+ end
end
if Settings:IsA2G_LL_DMS() then
return self:ToStringLLDMS( Settings )
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index 7908f1a43..b2ce1538b 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -1940,14 +1940,14 @@ do -- DETECTION_UNITS
end
end
- --TODO: solve Index reference
- local DetectedItemCoordinate = self:GetDetectedItemCoordinate( Index )
- local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings )
+ --TODO: solve Index reference
+ local DetectedItemCoordinate = self:GetDetectedItemCoordinate( Index )
+ local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings )
- local ThreatLevelA2G = self:GetDetectedItemThreatLevel( DetectedItem )
+ local ThreatLevelA2G = self:GetDetectedItemThreatLevel( Index )
- local Report = REPORT:New()
- Report:Add(DetectedItemID .. ", " .. DetectedItemCoordText)
+ local Report = REPORT:New()
+ Report:Add(DetectedItemID .. ", " .. DetectedItemCoordText)
Report:Add( string.format( "Threat: [%s]", string.rep( "■", ThreatLevelA2G ) ) )
Report:Add( string.format("Type: %s%s", UnitCategoryText, UnitDistanceText ) )
return Report
@@ -1968,7 +1968,7 @@ do -- DETECTION_UNITS
local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem
local ReportSummary = self:DetectedItemReportSummary( DetectedItemID, AttackGroup )
Report:SetTitle( "Detected units:" )
- Report:Add( ReportSummary )
+ Report:Add( ReportSummary:Text() )
end
local ReportText = Report:Text()
@@ -2198,7 +2198,7 @@ do -- DETECTION_TYPES
local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem
local ReportSummary = self:DetectedItemReportSummary( DetectedItemTypeName, AttackGroup )
Report:SetTitle( "Detected types:" )
- Report:Add( ReportSummary )
+ Report:Add( ReportSummary:Text() )
end
local ReportText = Report:Text()
@@ -2352,7 +2352,7 @@ do -- DETECTION_AREAS
local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem
local ReportSummary = self:DetectedItemReportSummary( DetectedItemIndex, AttackGroup )
Report:SetTitle( "Detected areas:" )
- Report:Add( ReportSummary )
+ Report:Add( ReportSummary:Text() )
end
local ReportText = Report:Text()
|