Improvements on reporting.

This commit is contained in:
FlightControl 2019-03-16 12:13:39 +01:00
parent fb23ac1d55
commit cff4f60923
3 changed files with 37 additions and 41 deletions

View File

@ -306,65 +306,51 @@ function TASKINFO:Report( Report, Detail, ReportGroup, Task )
for Key, Data in UTILS.spairs( self.Info.Set, function( t, a, b ) return t[a].Order < t[b].Order end ) do
self:F( { Key = Key, Detail = Detail, Data = Data } )
if Data.Detail:find( Detail ) then
local Text = ""
if Key == "TaskName" then
if Key == "TaskName" then
Key = nil
Text = Data.Data
end
if Key == "Coordinate" then
elseif Key == "Coordinate" then
local Coordinate = Data.Data -- Core.Point#COORDINATE
Text = Coordinate:ToString( ReportGroup:GetUnit(1), nil, Task )
end
if Key == "Threat" then
elseif Key == "Threat" then
local DataText = Data.Data -- #string
Text = DataText
end
if Key == "Counting" then
elseif Key == "Counting" then
local DataText = Data.Data -- #string
Text = DataText
end
if Key == "Targets" then
elseif Key == "Targets" then
local DataText = Data.Data -- #string
Text = DataText
end
if Key == "QFE" then
elseif Key == "QFE" then
local Coordinate = Data.Data -- Core.Point#COORDINATE
Text = Coordinate:ToStringPressure( ReportGroup:GetUnit(1), nil, Task )
end
if Key == "Temperature" then
elseif Key == "Temperature" then
local Coordinate = Data.Data -- Core.Point#COORDINATE
Text = Coordinate:ToStringTemperature( ReportGroup:GetUnit(1), nil, Task )
end
if Key == "Wind" then
elseif Key == "Wind" then
local Coordinate = Data.Data -- Core.Point#COORDINATE
Text = Coordinate:ToStringWind( ReportGroup:GetUnit(1), nil, Task )
end
if Key == "Cargo" then
elseif Key == "Cargo" then
local DataText = Data.Data -- #string
Text = DataText
elseif Key == "Friendlies" then
local DataText = Data.Data -- #string
Text = DataText
elseif Key == "Players" then
local DataText = Data.Data -- #string
Text = DataText
else
local DataText = Data.Data -- #string
Text = DataText
end
if Key == "Friendlies" then
local DataText = Data.Data -- #string
Text = DataText
end
if Key == "Players" then
local DataText = Data.Data -- #string
Text = DataText
end
if Line < math.floor( Data.Order / 10 ) then
if Line == 0 then
if Text ~= "" then
Report:AddIndent( LineReport:Text( ", " ), "-" )
end
Report:AddIndent( LineReport:Text( ", " ), "-" )
else
if Text ~= "" then
Report:AddIndent( LineReport:Text( ", " ) )
end
Report:AddIndent( LineReport:Text( ", " ) )
end
LineReport = REPORT:New()
Line = math.floor( Data.Order / 10 )
@ -373,8 +359,9 @@ function TASKINFO:Report( Report, Detail, ReportGroup, Task )
if Text ~= "" then
LineReport:Add( ( Key and ( Key .. ":" ) or "" ) .. Text )
end
end
end
Report:AddIndent( LineReport:Text( ", " ) )
end

View File

@ -246,6 +246,7 @@ do -- TASK_CAPTURE_DISPATCHER
-- Here we need to check if the pilot is still existing.
-- Task = self:RemoveTask( TaskIndex )
end
end
-- Now that all obsolete tasks are removed, loop through the Zone tasks.
@ -257,25 +258,32 @@ do -- TASK_CAPTURE_DISPATCHER
CaptureZone.Task.TaskPrefix = CaptureZone.TaskPrefix -- We keep the TaskPrefix for further reference!
Mission:AddTask( CaptureZone.Task )
TaskReport:Add( TaskName )
CaptureZone.Task:UpdateTaskInfo()
function CaptureZone.Task.OnEnterSuccess( Task, From, Event, To )
self:Success( Task )
CaptureZone.Task:UpdateTaskInfo()
end
function CaptureZone.Task.OnEnterCancelled( Task, From, Event, To )
self:Cancelled( Task )
CaptureZone.Task:UpdateTaskInfo()
end
function CaptureZone.Task.OnEnterFailed( Task, From, Event, To )
self:Failed( Task )
CaptureZone.Task:UpdateTaskInfo()
end
function CaptureZone.Task.OnEnterAborted( Task, From, Event, To )
self:Aborted( Task )
CaptureZone.Task:UpdateTaskInfo()
end
-- Now broadcast the onafterCargoPickedUp event to the Task Cargo Dispatcher.
function CaptureZone.Task.OnAfterCaptured( Task, From, Event, To, TaskUnit )
self:Captured( Task, Task.TaskPrefix, TaskUnit )
CaptureZone.Task:UpdateTaskInfo()
end
end

View File

@ -219,12 +219,13 @@ do -- TASK_CAPTURE_ZONE
--- Instantiates a new TASK_CAPTURE_ZONE.
-- @param #TASK_CAPTURE_ZONE self
function TASK_CAPTURE_ZONE:UpdateTaskInfo()
function TASK_CAPTURE_ZONE:UpdateTaskInfo( DetectedItem )
local ZoneCoordinate = self.ZoneGoal:GetZone():GetCoordinate()
self.TaskInfo:AddCoordinate( ZoneCoordinate, 0, "SOD" )
self.TaskInfo:AddText( "Zone Name", self.ZoneGoal:GetZoneName(), 10, "MOD" )
self.TaskInfo:AddText( "Zone Coalition", self.ZoneGoal:GetCoalitionName(), 11, "MOD" )
self.TaskInfo:AddTaskName( 0, "MSOD", true )
self.TaskInfo:AddCoordinate( ZoneCoordinate, 1, "SOD", true )
self.TaskInfo:AddText( "Zone Name", self.ZoneGoal:GetZoneName(), 10, "MOD", true )
self.TaskInfo:AddText( "Zone Coalition", self.ZoneGoal:GetCoalitionName(), 11, "MOD", true )
end