diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 762b5836e..9679cb091 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -567,7 +567,7 @@ end -- @param #number AngleRadians The angle in randians -- @param #number Distance The distance -- @return #string The BR Text -function POINT_VEC3:ToStringBR( AngleRadians, Distance ) +function POINT_VEC3:GetBRText( AngleRadians, Distance ) AngleRadians = UTILS.Round( UTILS.ToDegree( AngleRadians ), 0 ) if self:IsMetric() then @@ -595,17 +595,6 @@ function POINT_VEC3:GetAltitudeText() end end ---- Return a BR string from a POINT_VEC3 to the POINT_VEC3. --- @param #POINT_VEC3 self --- @param #POINT_VEC3 TargetPointVec3 The target POINT_VEC3. --- @return #string The BR text. -function POINT_VEC3:GetBRText( TargetPointVec3 ) - local DirectionVec3 = self:GetDirectionVec3( TargetPointVec3 ) - local AngleRadians = self:GetAngleRadians( DirectionVec3 ) - local Distance = self:Get2DDistance( TargetPointVec3 ) - return self:ToStringBR( AngleRadians, Distance ) -end - --- Sets the POINT_VEC3 metric or NM. -- @param #POINT_VEC3 self -- @param #boolean Metric true means metric, false means NM. @@ -1033,13 +1022,6 @@ function POINT_VEC2:DistanceFromVec2( Vec2Reference ) end ---- Return no text for the altitude of the POINT_VEC2. --- @param #POINT_VEC2 self --- @return #string Empty string. -function POINT_VEC2:GetAltitudeText() - return '' -end - --- Add a Distance in meters from the POINT_VEC2 orthonormal plane, with the given angle, and calculate the new POINT_VEC2. -- @param #POINT_VEC2 self -- @param Dcs.DCSTypes#Distance Distance The Distance to be added in meters. @@ -1098,7 +1080,41 @@ do -- COORDINATE return self end + --- Return a BR string from a COORDINATE to the COORDINATE. + -- @param #COORDINATE self + -- @param #COORDINATE TargetCoordinate The target COORDINATE. + -- @return #string The BR text. + function COORDINATE:ToStringBR( TargetCoordinate ) + local DirectionVec3 = self:GetDirectionVec3( TargetCoordinate ) + local AngleRadians = self:GetAngleRadians( DirectionVec3 ) + local Distance = self:Get2DDistance( TargetCoordinate ) + return "BR: " .. self:GetBRText( AngleRadians, Distance ) + end + --- Return a BRAA string from a COORDINATE to the COORDINATE. + -- @param #COORDINATE self + -- @param #COORDINATE TargetCoordinate The target COORDINATE. + -- @return #string The BR text. + function COORDINATE:ToStringBRAA( TargetCoordinate ) + local DirectionVec3 = self:GetDirectionVec3( TargetCoordinate ) + local AngleRadians = self:GetAngleRadians( DirectionVec3 ) + local Distance = self:Get2DDistance( TargetCoordinate ) + local Altitude = self:GetAltitudeText() + return "BRAA: " .. self:GetBRText( AngleRadians, Distance ) .. Altitude .. ", flanking" + end + + --- Return a BULLS string from a COORDINATE to the BULLS of the coalition. + -- @param #COORDINATE self + -- @param Dcs.DCSCoalition#coalition.side Coalition The coalition. + -- @return #string The BR text. + function COORDINATE:ToStringBULLS( Coalition ) + local TargetCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) ) + local DirectionVec3 = self:GetDirectionVec3( TargetCoordinate ) + local AngleRadians = self:GetAngleRadians( DirectionVec3 ) + local Distance = self:Get2DDistance( TargetCoordinate ) + local Altitude = self:GetAltitudeText() + return "BULLS: " .. self:GetBRText( AngleRadians, Distance ) .. Altitude .. ", flanking" + end --- Provides a Lat Lon string -- @param #COORDINATE self @@ -1110,7 +1126,7 @@ do -- COORDINATE LL_Accuracy = LL_Accuracy or self.LL_Accuracy LL_DMS = LL_DMS or self.LL_DMS local lat, lon = coord.LOtoLL( self:GetVec3() ) - return "LL:" .. UTILS.tostringLL( lat, lon, LL_Accuracy, LL_DMS ) + return "LL: " .. UTILS.tostringLL( lat, lon, LL_Accuracy, LL_DMS ) end --- Provides a MGRS string @@ -1128,7 +1144,7 @@ do -- COORDINATE MGRS_Accuracy = MGRS_Accuracy or self.MGRS_Accuracy local lat, lon = coord.LOtoLL( self:GetVec3() ) local MGRS = coord.LLtoMGRS( lat, lon ) - return "MGRS:" .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy ) + return "MGRS: " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy ) end --- Provides a coordinate string of the point, based on a coordinate format system: diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua index 8ac93731c..dbd55b26b 100644 --- a/Moose Development/Moose/Functional/Detection.lua +++ b/Moose Development/Moose/Functional/Detection.lua @@ -1302,6 +1302,32 @@ do -- DETECTION_BASE return nil end + + do -- Coordinates + + --- Get the COORDINATE of a detection item using a given numeric index. + -- @param #DETECTION_BASE self + -- @param #number Index + -- @return Core.Point#COORDINATE Coordinate + function DETECTION_BASE:GetDetectedItemCoordinate( Index ) + + -- If the Zone is set, return the coordinate of the Zone. + local DetectedZone = self:GetDetectedItemZone( Index ) + if DetectedZone then + return DetectedZone:GetCoordinate() + end + + -- If no Zone is set, return the coordinate of the first unit in the Set + local DetectedItemSet = self:GetDetectedSet( Index ) + local FirstUnit = DetectedItemSet:GetFirst() + if FirstUnit then + return FirstUnit:GetCoordinate() + end + + return nil + end + + end do -- Zones @@ -1309,13 +1335,15 @@ do -- DETECTION_BASE -- @param #DETECTION_BASE self -- @param #number Index -- @return Core.Zone#ZONE_UNIT DetectedZone - function DETECTION_BASE:GetDetectedZone( Index ) + function DETECTION_BASE:GetDetectedItemZone( Index ) local DetectedZone = self.DetectedItems[Index].Zone if DetectedZone then return DetectedZone end + local Detected + return nil end @@ -1977,7 +2005,7 @@ do -- DETECTION_AREAS local DetectedSet = self:GetDetectedSet( Index ) local ReportSummaryItem - local DetectedZone = self:GetDetectedZone( Index ) + local DetectedZone = self:GetDetectedItemZone( Index ) local DetectedItemCoordinate = DetectedZone:GetCoordinate() local DetectedItemCoordText = DetectedItemCoordinate:ToString() @@ -2007,7 +2035,7 @@ do -- DETECTION_AREAS local DetectedSet = self:GetDetectedSet( Index ) local ReportSummaryItem - local DetectedZone = self:GetDetectedZone( Index ) + local DetectedZone = self:GetDetectedItemZone( Index ) local DetectedItemCoordinate = DetectedZone:GetCoordinate() local DetectedItemCoordText = DetectedItemCoordinate:ToString() diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index b26ccd50e..6f8965951 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -825,7 +825,7 @@ end -- @param #TASK self function TASK:MenuTaskStatus( TaskGroup ) - local ReportText = self:ReportDetails() + local ReportText = self:ReportDetails( TaskGroup ) self:T( ReportText ) self:GetMission():GetCommandCenter():MessageToGroup( ReportText, TaskGroup ) @@ -1369,8 +1369,9 @@ end --- Create a detailed report of the Task. -- List the Task Status, and the Players assigned to the Task. -- @param #TASK self +-- @param Wrapper.Group#GROUP TaskGroup -- @return #string -function TASK:ReportDetails() --R2.1 fixed report. Now nicely formatted and contains the info required. +function TASK:ReportDetails( TaskGroup ) --R2.1 fixed report. Now nicely formatted and contains the info required. local Report = REPORT:New():SetIndent( 3 ) @@ -1389,16 +1390,29 @@ function TASK:ReportDetails() --R2.1 fixed report. Now nicely formatted and cont end local Players = PlayerReport:Text() - local Detection = self.TaskInfo["Detection"] or "" - local Changes = self.TaskInfo["Changes"] or "" - Report:Add( "Task: " .. Name .. " - " .. State .. " - Detailed Report" ) - Report:Add( "\n - Players:" ) + Report:Add( " - Players:" ) Report:AddIndent( Players ) - Report:Add( "\n - Detection:" ) - Report:AddIndent( Detection ) - Report:Add( "\n - Detection Changes:" ) - Report:AddIndent( Changes ) + + for TaskInfoID, TaskInfo in pairs( self.TaskInfo ) do + + local TaskInfoIDText = string.format( " - %s: ", TaskInfoID ) + + if type(TaskInfo) == "string" then + Report:Add( TaskInfoIDText .. TaskInfo ) + elseif type(TaskInfo) == "table" then + if TaskInfoID == "Coordinates" then + local FromCoordinate = TaskGroup:GetUnit(1):GetCoordinate() + Report:Add( TaskInfoIDText ) + Report:AddIndent( TaskInfo:ToStringLL() ) + Report:AddIndent( TaskInfo:ToStringMGRS() ) + Report:AddIndent( TaskInfo:ToStringBRAA( FromCoordinate ) ) + Report:AddIndent( TaskInfo:ToStringBULLS( TaskGroup:GetCoalition() ) ) + else + end + end + + end return Report:Text() end diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua index 7b7ef235d..503c8579c 100644 --- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua +++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua @@ -185,8 +185,11 @@ do -- TASK_A2A_DISPATCHER self.Tasks[DetectedID] = Task Task:SetTargetZone( DetectedZone ) Task:SetDispatcher( self ) - Task:SetInfo( "ThreatLevel", DetectedSet:CalculateThreatLevelA2G() ) - Task:SetInfo( "Detection", Detection:DetectedItemReportSummary( DetectedIndex ) ) + Task:SetInfo( "ThreatLevel", "[" .. string.rep( "■", DetectedSet:CalculateThreatLevelA2G() ) .. "]" ) + local DetectedItemsCount = DetectedSet:Count() + local DetectedItemsTypes = DetectedSet:GetTypeNames() + Task:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + Task:SetInfo( "Coordinates", Detection:GetDetectedItemCoordinate( DetectedIndex ) ) Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) ) Mission:AddTask( Task ) else