mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-22 06:45:20 +00:00
Progress
This commit is contained in:
@@ -567,7 +567,7 @@ end
|
|||||||
-- @param #number AngleRadians The angle in randians
|
-- @param #number AngleRadians The angle in randians
|
||||||
-- @param #number Distance The distance
|
-- @param #number Distance The distance
|
||||||
-- @return #string The BR Text
|
-- @return #string The BR Text
|
||||||
function POINT_VEC3:ToStringBR( AngleRadians, Distance )
|
function POINT_VEC3:GetBRText( AngleRadians, Distance )
|
||||||
|
|
||||||
AngleRadians = UTILS.Round( UTILS.ToDegree( AngleRadians ), 0 )
|
AngleRadians = UTILS.Round( UTILS.ToDegree( AngleRadians ), 0 )
|
||||||
if self:IsMetric() then
|
if self:IsMetric() then
|
||||||
@@ -595,17 +595,6 @@ function POINT_VEC3:GetAltitudeText()
|
|||||||
end
|
end
|
||||||
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.
|
--- Sets the POINT_VEC3 metric or NM.
|
||||||
-- @param #POINT_VEC3 self
|
-- @param #POINT_VEC3 self
|
||||||
-- @param #boolean Metric true means metric, false means NM.
|
-- @param #boolean Metric true means metric, false means NM.
|
||||||
@@ -1033,13 +1022,6 @@ function POINT_VEC2:DistanceFromVec2( Vec2Reference )
|
|||||||
end
|
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.
|
--- 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 #POINT_VEC2 self
|
||||||
-- @param Dcs.DCSTypes#Distance Distance The Distance to be added in meters.
|
-- @param Dcs.DCSTypes#Distance Distance The Distance to be added in meters.
|
||||||
@@ -1098,7 +1080,41 @@ do -- COORDINATE
|
|||||||
return self
|
return self
|
||||||
end
|
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
|
--- Provides a Lat Lon string
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
@@ -1110,7 +1126,7 @@ do -- COORDINATE
|
|||||||
LL_Accuracy = LL_Accuracy or self.LL_Accuracy
|
LL_Accuracy = LL_Accuracy or self.LL_Accuracy
|
||||||
LL_DMS = LL_DMS or self.LL_DMS
|
LL_DMS = LL_DMS or self.LL_DMS
|
||||||
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
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
|
end
|
||||||
|
|
||||||
--- Provides a MGRS string
|
--- Provides a MGRS string
|
||||||
@@ -1128,7 +1144,7 @@ do -- COORDINATE
|
|||||||
MGRS_Accuracy = MGRS_Accuracy or self.MGRS_Accuracy
|
MGRS_Accuracy = MGRS_Accuracy or self.MGRS_Accuracy
|
||||||
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
||||||
local MGRS = coord.LLtoMGRS( lat, lon )
|
local MGRS = coord.LLtoMGRS( lat, lon )
|
||||||
return "MGRS:" .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
return "MGRS: " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Provides a coordinate string of the point, based on a coordinate format system:
|
--- Provides a coordinate string of the point, based on a coordinate format system:
|
||||||
|
|||||||
@@ -1302,6 +1302,32 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
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
|
do -- Zones
|
||||||
|
|
||||||
@@ -1309,13 +1335,15 @@ do -- DETECTION_BASE
|
|||||||
-- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
-- @param #number Index
|
-- @param #number Index
|
||||||
-- @return Core.Zone#ZONE_UNIT DetectedZone
|
-- @return Core.Zone#ZONE_UNIT DetectedZone
|
||||||
function DETECTION_BASE:GetDetectedZone( Index )
|
function DETECTION_BASE:GetDetectedItemZone( Index )
|
||||||
|
|
||||||
local DetectedZone = self.DetectedItems[Index].Zone
|
local DetectedZone = self.DetectedItems[Index].Zone
|
||||||
if DetectedZone then
|
if DetectedZone then
|
||||||
return DetectedZone
|
return DetectedZone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local Detected
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1977,7 +2005,7 @@ do -- DETECTION_AREAS
|
|||||||
local DetectedSet = self:GetDetectedSet( Index )
|
local DetectedSet = self:GetDetectedSet( Index )
|
||||||
local ReportSummaryItem
|
local ReportSummaryItem
|
||||||
|
|
||||||
local DetectedZone = self:GetDetectedZone( Index )
|
local DetectedZone = self:GetDetectedItemZone( Index )
|
||||||
local DetectedItemCoordinate = DetectedZone:GetCoordinate()
|
local DetectedItemCoordinate = DetectedZone:GetCoordinate()
|
||||||
local DetectedItemCoordText = DetectedItemCoordinate:ToString()
|
local DetectedItemCoordText = DetectedItemCoordinate:ToString()
|
||||||
|
|
||||||
@@ -2007,7 +2035,7 @@ do -- DETECTION_AREAS
|
|||||||
local DetectedSet = self:GetDetectedSet( Index )
|
local DetectedSet = self:GetDetectedSet( Index )
|
||||||
local ReportSummaryItem
|
local ReportSummaryItem
|
||||||
|
|
||||||
local DetectedZone = self:GetDetectedZone( Index )
|
local DetectedZone = self:GetDetectedItemZone( Index )
|
||||||
local DetectedItemCoordinate = DetectedZone:GetCoordinate()
|
local DetectedItemCoordinate = DetectedZone:GetCoordinate()
|
||||||
local DetectedItemCoordText = DetectedItemCoordinate:ToString()
|
local DetectedItemCoordText = DetectedItemCoordinate:ToString()
|
||||||
|
|
||||||
|
|||||||
@@ -825,7 +825,7 @@ end
|
|||||||
-- @param #TASK self
|
-- @param #TASK self
|
||||||
function TASK:MenuTaskStatus( TaskGroup )
|
function TASK:MenuTaskStatus( TaskGroup )
|
||||||
|
|
||||||
local ReportText = self:ReportDetails()
|
local ReportText = self:ReportDetails( TaskGroup )
|
||||||
|
|
||||||
self:T( ReportText )
|
self:T( ReportText )
|
||||||
self:GetMission():GetCommandCenter():MessageToGroup( ReportText, TaskGroup )
|
self:GetMission():GetCommandCenter():MessageToGroup( ReportText, TaskGroup )
|
||||||
@@ -1369,8 +1369,9 @@ end
|
|||||||
--- Create a detailed report of the Task.
|
--- Create a detailed report of the Task.
|
||||||
-- List the Task Status, and the Players assigned to the Task.
|
-- List the Task Status, and the Players assigned to the Task.
|
||||||
-- @param #TASK self
|
-- @param #TASK self
|
||||||
|
-- @param Wrapper.Group#GROUP TaskGroup
|
||||||
-- @return #string
|
-- @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 )
|
local Report = REPORT:New():SetIndent( 3 )
|
||||||
|
|
||||||
@@ -1389,16 +1390,29 @@ function TASK:ReportDetails() --R2.1 fixed report. Now nicely formatted and cont
|
|||||||
end
|
end
|
||||||
local Players = PlayerReport:Text()
|
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( "Task: " .. Name .. " - " .. State .. " - Detailed Report" )
|
||||||
Report:Add( "\n - Players:" )
|
Report:Add( " - Players:" )
|
||||||
Report:AddIndent( Players )
|
Report:AddIndent( Players )
|
||||||
Report:Add( "\n - Detection:" )
|
|
||||||
Report:AddIndent( Detection )
|
for TaskInfoID, TaskInfo in pairs( self.TaskInfo ) do
|
||||||
Report:Add( "\n - Detection Changes:" )
|
|
||||||
Report:AddIndent( Changes )
|
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()
|
return Report:Text()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -185,8 +185,11 @@ do -- TASK_A2A_DISPATCHER
|
|||||||
self.Tasks[DetectedID] = Task
|
self.Tasks[DetectedID] = Task
|
||||||
Task:SetTargetZone( DetectedZone )
|
Task:SetTargetZone( DetectedZone )
|
||||||
Task:SetDispatcher( self )
|
Task:SetDispatcher( self )
|
||||||
Task:SetInfo( "ThreatLevel", DetectedSet:CalculateThreatLevelA2G() )
|
Task:SetInfo( "ThreatLevel", "[" .. string.rep( "■", DetectedSet:CalculateThreatLevelA2G() ) .. "]" )
|
||||||
Task:SetInfo( "Detection", Detection:DetectedItemReportSummary( DetectedIndex ) )
|
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 ) )
|
Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) )
|
||||||
Mission:AddTask( Task )
|
Mission:AddTask( Task )
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user