mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Fixed error in Escort, Reports were not shown
-- Fixed reports to be shown in ESCORT class. SETTINGS now also are working in ESCORT reports. MGRS, LL, BR, metric, imperial are now supported.
This commit is contained in:
parent
a6830237f4
commit
600166fd80
@ -1540,14 +1540,17 @@ do -- DETECTION_BASE
|
||||
--- Report summary of a detected item using a given numeric index.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param Index
|
||||
-- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for.
|
||||
-- @param Core.Settings#SETTINGS Settings Message formatting settings to use.
|
||||
-- @return #string
|
||||
function DETECTION_BASE:DetectedItemReportSummary( Index, AttackGroup )
|
||||
function DETECTION_BASE:DetectedItemReportSummary( Index, AttackGroup, Settings )
|
||||
self:F( Index )
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Report detailed of a detectedion result.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for.
|
||||
-- @return #string
|
||||
function DETECTION_BASE:DetectedReportDetailed( AttackGroup )
|
||||
self:F()
|
||||
@ -1783,8 +1786,10 @@ do -- DETECTION_UNITS
|
||||
--- Report summary of a DetectedItem using a given numeric index.
|
||||
-- @param #DETECTION_UNITS self
|
||||
-- @param Index
|
||||
-- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for.
|
||||
-- @param Core.Settings#SETTINGS Settings Message formatting settings to use.
|
||||
-- @return #string
|
||||
function DETECTION_UNITS:DetectedItemReportSummary( Index, AttackGroup )
|
||||
function DETECTION_UNITS:DetectedItemReportSummary( Index, AttackGroup, Settings )
|
||||
self:F( { Index, self.DetectedItems } )
|
||||
|
||||
local DetectedItem = self:GetDetectedItem( Index )
|
||||
@ -1826,16 +1831,15 @@ do -- DETECTION_UNITS
|
||||
end
|
||||
|
||||
local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
|
||||
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup )
|
||||
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings )
|
||||
|
||||
local ThreatLevelA2G = DetectedItemUnit:GetThreatLevel( DetectedItem )
|
||||
|
||||
ReportSummary = string.format(
|
||||
"%s - %s - Threat:[%s](%2d) - %s%s",
|
||||
"%s - %s\n - Threat: [%s]\n - Type: %s%s",
|
||||
DetectedItemID,
|
||||
DetectedItemCoordText,
|
||||
string.rep( "■", ThreatLevelA2G ),
|
||||
ThreatLevelA2G,
|
||||
UnitCategoryText,
|
||||
UnitDistanceText
|
||||
)
|
||||
@ -1850,14 +1854,16 @@ do -- DETECTION_UNITS
|
||||
|
||||
--- Report detailed of a detection result.
|
||||
-- @param #DETECTION_UNITS self
|
||||
-- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for.
|
||||
-- @return #string
|
||||
function DETECTION_UNITS:DetectedReportDetailed( AttackGroup )
|
||||
self:F()
|
||||
|
||||
local Report = REPORT:New( "Detected units:" )
|
||||
local Report = REPORT:New()
|
||||
for DetectedItemID, DetectedItem in pairs( self.DetectedItems ) do
|
||||
local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem
|
||||
local ReportSummary = self:DetectedItemReportSummary( DetectedItemID, AttackGroup )
|
||||
Report:SetTitle( "Detected units:" )
|
||||
Report:Add( ReportSummary )
|
||||
end
|
||||
|
||||
@ -2048,8 +2054,10 @@ do -- DETECTION_TYPES
|
||||
--- Report summary of a DetectedItem using a given numeric index.
|
||||
-- @param #DETECTION_TYPES self
|
||||
-- @param Index
|
||||
-- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for.
|
||||
-- @param Core.Settings#SETTINGS Settings Message formatting settings to use.
|
||||
-- @return #string
|
||||
function DETECTION_TYPES:DetectedItemReportSummary( DetectedTypeName, AttackGroup )
|
||||
function DETECTION_TYPES:DetectedItemReportSummary( DetectedTypeName, AttackGroup, Settings )
|
||||
self:F( DetectedTypeName )
|
||||
|
||||
local DetectedItem = self:GetDetectedItem( DetectedTypeName )
|
||||
@ -2066,14 +2074,13 @@ do -- DETECTION_TYPES
|
||||
local DetectedItemUnit = DetectedSet:GetFirst()
|
||||
|
||||
local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
|
||||
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup )
|
||||
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings )
|
||||
|
||||
local ReportSummary = string.format(
|
||||
"%s - %s - Threat:[%s](%2d) - %2d of %s",
|
||||
"%s - %s\n - Threat: [%s]\n - Type: %2d of %s",
|
||||
DetectedItemID,
|
||||
DetectedItemCoordText,
|
||||
string.rep( "■", ThreatLevelA2G ),
|
||||
ThreatLevelA2G,
|
||||
DetectedItemsCount,
|
||||
DetectedItemType
|
||||
)
|
||||
@ -2085,14 +2092,16 @@ do -- DETECTION_TYPES
|
||||
|
||||
--- Report detailed of a detection result.
|
||||
-- @param #DETECTION_TYPES self
|
||||
-- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for.
|
||||
-- @return #string
|
||||
function DETECTION_TYPES:DetectedReportDetailed( AttackGroup )
|
||||
self:F()
|
||||
|
||||
local Report = REPORT:New( "Detected types:" )
|
||||
local Report = REPORT:New()
|
||||
for DetectedItemTypeName, DetectedItem in pairs( self.DetectedItems ) do
|
||||
local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem
|
||||
local ReportSummary = self:DetectedItemReportSummary( DetectedItemTypeName, AttackGroup )
|
||||
Report:SetTitle( "Detected types:" )
|
||||
Report:Add( ReportSummary )
|
||||
end
|
||||
|
||||
@ -2202,8 +2211,10 @@ do -- DETECTION_AREAS
|
||||
--- Report summary of a detected item using a given numeric index.
|
||||
-- @param #DETECTION_AREAS self
|
||||
-- @param Index
|
||||
-- @param Wrapper.Group#GROUP AttackGroup The group to get the settings for.
|
||||
-- @param Core.Settings#SETTINGS Settings (Optional) Message formatting settings to use.
|
||||
-- @return #string
|
||||
function DETECTION_AREAS:DetectedItemReportSummary( Index, AttackGroup )
|
||||
function DETECTION_AREAS:DetectedItemReportSummary( Index, AttackGroup, Settings )
|
||||
self:F( Index )
|
||||
|
||||
local DetectedItem = self:GetDetectedItem( Index )
|
||||
@ -2215,18 +2226,17 @@ do -- DETECTION_AREAS
|
||||
|
||||
local DetectedZone = self:GetDetectedItemZone( Index )
|
||||
local DetectedItemCoordinate = DetectedZone:GetCoordinate()
|
||||
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup )
|
||||
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings )
|
||||
|
||||
local ThreatLevelA2G = self:GetTreatLevelA2G( DetectedItem )
|
||||
local DetectedItemsCount = DetectedSet:Count()
|
||||
local DetectedItemsTypes = DetectedSet:GetTypeNames()
|
||||
|
||||
local ReportSummary = string.format(
|
||||
"%s - %s - Threat:[%s](%2d)\n %2d of %s",
|
||||
"%s - %s\n - Threat: [%s]\n - Type: %2d of %s",
|
||||
DetectedItemID,
|
||||
DetectedItemCoordText,
|
||||
string.rep( "■", ThreatLevelA2G ),
|
||||
ThreatLevelA2G,
|
||||
DetectedItemsCount,
|
||||
DetectedItemsTypes
|
||||
)
|
||||
@ -2239,14 +2249,16 @@ do -- DETECTION_AREAS
|
||||
|
||||
--- Report detailed of a detection result.
|
||||
-- @param #DETECTION_AREAS self
|
||||
-- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for.
|
||||
-- @return #string
|
||||
function DETECTION_AREAS:DetectedReportDetailed( AttackGroup) --R2.1 Fixed missing report
|
||||
function DETECTION_AREAS:DetectedReportDetailed( AttackGroup ) --R2.1 Fixed missing report
|
||||
self:F()
|
||||
|
||||
local Report = REPORT:New( "Detected areas:" )
|
||||
local Report = REPORT:New()
|
||||
for DetectedItemIndex, DetectedItem in pairs( self.DetectedItems ) do
|
||||
local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem
|
||||
local ReportSummary = self:DetectedItemReportSummary( DetectedItemIndex, AttackGroup )
|
||||
Report:SetTitle( "Detected areas:" )
|
||||
Report:Add( ReportSummary )
|
||||
end
|
||||
|
||||
|
||||
@ -1161,12 +1161,13 @@ function ESCORT:_ReportTargetsScheduler()
|
||||
for ClientEscortGroupName, EscortGroupData in pairs( self.EscortClient._EscortGroups ) do
|
||||
|
||||
local ClientEscortTargets = EscortGroupData.Detection
|
||||
--local EscortUnit = EscortGroupData:GetUnit( 1 )
|
||||
|
||||
for DetectedItemID, DetectedItem in ipairs( DetectedItems ) do
|
||||
self:E( { DetectedItemID, DetectedItem } )
|
||||
-- Remove the sub menus of the Attack menu of the Escort for the EscortGroup.
|
||||
|
||||
local DetectedItemReportSummary = self.Detection:DetectedItemReportSummary( DetectedItemID, EscortGroupData )
|
||||
local DetectedItemReportSummary = self.Detection:DetectedItemReportSummary( DetectedItemID, EscortGroupData.EscortGroup, _DATABASE:GetPlayerSettings( self.EscortClient:GetPlayerName() ) )
|
||||
|
||||
if ClientEscortGroupName == EscortGroupName then
|
||||
|
||||
@ -1201,7 +1202,7 @@ function ESCORT:_ReportTargetsScheduler()
|
||||
end
|
||||
self:E( DetectedMsgs )
|
||||
if DetectedTargets then
|
||||
self.EscortGroup:MessageToClient( "Detected targets:\n" .. table.concat( DetectedMsgs, "\n" ), 20, self.EscortClient )
|
||||
self.EscortGroup:MessageToClient( "Reporting detected targets:\n" .. table.concat( DetectedMsgs, "\n" ), 20, self.EscortClient )
|
||||
else
|
||||
self.EscortGroup:MessageToClient( "No targets detected.", 10, self.EscortClient )
|
||||
end
|
||||
|
||||
@ -30,12 +30,8 @@ function REPORT:New( Title )
|
||||
local self = BASE:Inherit( self, BASE:New() ) -- #REPORT
|
||||
|
||||
self.Report = {}
|
||||
|
||||
Title = Title or ""
|
||||
if Title then
|
||||
self.Title = Title
|
||||
end
|
||||
|
||||
|
||||
self:SetTitle( Title or "" )
|
||||
self:SetIndent( 3 )
|
||||
|
||||
return self
|
||||
@ -88,6 +84,23 @@ function REPORT:Text( Delimiter )
|
||||
return ReportText
|
||||
end
|
||||
|
||||
--- Sets the title of the report.
|
||||
-- @param #REPORT self
|
||||
-- @param #string Title The title of the report.
|
||||
-- @return #REPORT
|
||||
function REPORT:SetTitle( Title )
|
||||
self.Title = Title
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets the amount of report items contained in the report.
|
||||
-- @param #REPORT self
|
||||
-- @return #number Returns the number of report items contained in the report. 0 is returned if no report items are contained in the report. The title is not counted for.
|
||||
function REPORT:GetCount()
|
||||
return #self.Report
|
||||
end
|
||||
|
||||
|
||||
--- The COMMANDCENTER class
|
||||
-- @type COMMANDCENTER
|
||||
-- @field Wrapper.Group#GROUP HQ
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user