- pushing fix for issue with command center reporting.

- pushing fix for issue with markings in cargo tasking not displayed.
- i have removed the workaround for the DCS bug workaround, get the DCS API (getPlayerName()) for a unit is returning "" or nil.
This commit is contained in:
FlightControl 2018-09-29 15:34:21 +02:00
parent dc41852e45
commit a84f0e228a
5 changed files with 53 additions and 18 deletions

View File

@ -670,7 +670,7 @@ function COMMANDCENTER:ReportSummary( ReportGroup )
for MissionID, Mission in pairs( self.Missions ) do for MissionID, Mission in pairs( self.Missions ) do
local Mission = Mission -- Tasking.Mission#MISSION local Mission = Mission -- Tasking.Mission#MISSION
Report:Add( " - " .. Mission:ReportSummary() ) Report:Add( " - " .. Mission:ReportSummary( ReportGroup ) )
end end
self:MessageToGroup( Report:Text(), ReportGroup ) self:MessageToGroup( Report:Text(), ReportGroup )

View File

@ -1200,15 +1200,27 @@ function TASK:MenuMarkToGroup( TaskGroup )
self:UpdateTaskInfo( self.DetectedItem ) self:UpdateTaskInfo( self.DetectedItem )
local Report = REPORT:New():SetIndent( 0 ) local TargetCoordinates = self.TaskInfo:GetData( "Coordinates" ) -- Core.Point#COORDINATE
if TargetCoordinates then
self.TaskInfo:Report( Report, "M", TaskGroup ) for TargetCoordinateID, TargetCoordinate in pairs( TargetCoordinates ) do
local Report = REPORT:New():SetIndent( 0 )
local TargetCoordinate = self.TaskInfo:GetData( "Coordinate" ) -- Core.Point#COORDINATE self.TaskInfo:Report( Report, "M", TaskGroup, TargetCoordinateID )
local MarkText = Report:Text( ", " ) local MarkText = Report:Text( ", " )
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } ) self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
TargetCoordinate:MarkToGroup( MarkText, TaskGroup ) TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
--Coordinate:MarkToAll( Briefing ) --Coordinate:MarkToAll( Briefing )
end
else
local TargetCoordinate = self.TaskInfo:GetData( "Coordinate" ) -- Core.Point#COORDINATE
if TargetCoordinate then
local Report = REPORT:New():SetIndent( 0 )
self.TaskInfo:Report( Report, "M", TaskGroup )
local MarkText = Report:Text( ", " )
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
end
end
end end
--- Report the task status. --- Report the task status.

View File

@ -85,7 +85,7 @@ end
-- @return Data The data of the info. -- @return Data The data of the info.
function TASKINFO:GetData( Key ) function TASKINFO:GetData( Key )
local Object = self.Info:Get( Key ) local Object = self.Info:Get( Key )
return Object.Data return Object and Object.Data
end end
@ -130,6 +130,19 @@ function TASKINFO:AddCoordinate( Coordinate, Order, Detail, Keep )
end end
--- Add Coordinates.
-- @param #TASKINFO self
-- @param #list<Core.Point#COORDINATE> Coordinates
-- @param #number Order The display order, which is a number from 0 to 100.
-- @param #TASKINFO.Detail Detail The detail Level.
-- @param #boolean Keep (optional) If true, this would indicate that the planned taskinfo would be persistent when the task is completed, so that the original planned task info is used at the completed reports.
-- @return #TASKINFO self
function TASKINFO:AddCoordinates( Coordinates, Order, Detail, Keep )
self:AddInfo( "Coordinates", Coordinates, Order, Detail, Keep )
return self
end
--- Add Threat. --- Add Threat.
-- @param #TASKINFO self -- @param #TASKINFO self
@ -259,6 +272,7 @@ function TASKINFO:AddCargoSet( SetCargo, Order, Detail, Keep )
) )
self:AddInfo( "Cargo", CargoReport:Text(), Order, Detail, Keep ) self:AddInfo( "Cargo", CargoReport:Text(), Order, Detail, Keep )
return self return self
end end

View File

@ -1361,10 +1361,19 @@ do -- TASK_CARGO
end end
--- @param #TASK_CARGO self --- @param #TASK_CARGO self
function TASK_CARGO:UpdateTaskInfo( DetectedItem ) function TASK_CARGO:UpdateTaskInfo()
if self:IsStatePlanned() or self:IsStateAssigned() then if self:IsStatePlanned() or self:IsStateAssigned() then
self.TaskInfo:AddTaskName( 0, "MSOD" )
self.TaskInfo:AddCargoSet( self.SetCargo, 10, "SOD", true ) self.TaskInfo:AddCargoSet( self.SetCargo, 10, "SOD", true )
local Coordinates = {}
for CargoName, Cargo in pairs( self.SetCargo:GetSet() ) do
local Cargo = Cargo -- Cargo.Cargo#CARGO
if not Cargo:IsLoaded() then
Coordinates[#Coordinates+1] = Cargo:GetCoordinate()
end
end
self.TaskInfo:AddCoordinates( Coordinates, 1, "M" )
end end
end end

View File

@ -332,12 +332,12 @@ function UNIT:GetPlayerName()
local PlayerName = DCSUnit:getPlayerName() local PlayerName = DCSUnit:getPlayerName()
-- TODO Workaround DCS-BUG-3 - https://github.com/FlightControl-Master/MOOSE/issues/696 -- TODO Workaround DCS-BUG-3 - https://github.com/FlightControl-Master/MOOSE/issues/696
if PlayerName == nil or PlayerName == "" then -- if PlayerName == nil or PlayerName == "" then
local PlayerCategory = DCSUnit:getDesc().category -- local PlayerCategory = DCSUnit:getDesc().category
if PlayerCategory == Unit.Category.GROUND_UNIT or PlayerCategory == Unit.Category.SHIP then -- if PlayerCategory == Unit.Category.GROUND_UNIT or PlayerCategory == Unit.Category.SHIP then
PlayerName = "Player" .. DCSUnit:getID() -- PlayerName = "Player" .. DCSUnit:getID()
end -- end
end -- end
-- -- Good code -- -- Good code
-- if PlayerName == nil then -- if PlayerName == nil then
-- PlayerName = nil -- PlayerName = nil