Fixed issue in TASK_A2A_DISPATCHER with taskupdates.

This commit is contained in:
FlightControl_Master 2018-03-22 06:10:06 +01:00
parent 52d783a0b7
commit cbb800de02
4 changed files with 57 additions and 52 deletions

View File

@ -100,7 +100,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
function( self, EventData ) function( self, EventData )
if EventData.IniObjectCategory == 1 then if EventData.IniObjectCategory == 1 then
local EventGroup = GROUP:Find( EventData.IniDCSGroup ) local EventGroup = GROUP:Find( EventData.IniDCSGroup )
self:E( { CommandCenter = self:GetName(), EventGroup = EventGroup, HasGroup = self:HasGroup( EventGroup ), EventData = EventData } ) self:E( { CommandCenter = self:GetName(), EventGroup = EventGroup:GetName(), HasGroup = self:HasGroup( EventGroup ), EventData = EventData } )
if EventGroup and self:HasGroup( EventGroup ) then if EventGroup and self:HasGroup( EventGroup ) then
local CommandCenterMenu = MENU_GROUP:New( EventGroup, "Command Center (" .. self:GetName() .. ")" ) local CommandCenterMenu = MENU_GROUP:New( EventGroup, "Command Center (" .. self:GetName() .. ")" )
local MenuReporting = MENU_GROUP:New( EventGroup, "Missions Reports", CommandCenterMenu ) local MenuReporting = MENU_GROUP:New( EventGroup, "Missions Reports", CommandCenterMenu )

View File

@ -739,57 +739,57 @@ function MISSION:ReportBriefing()
end end
--- Create a status report of the Mission. ----- Create a status report of the Mission.
-- This reports provides a one liner of the mission status. It indicates how many players and how many Tasks. ---- This reports provides a one liner of the mission status. It indicates how many players and how many Tasks.
----
---- Mission "<MissionName>" - Status "<MissionStatus>"
---- - Task Types: <TaskType>, <TaskType>
---- - <xx> Planned Tasks (xp)
---- - <xx> Assigned Tasks(xp)
---- - <xx> Success Tasks (xp)
---- - <xx> Hold Tasks (xp)
---- - <xx> Cancelled Tasks (xp)
---- - <xx> Aborted Tasks (xp)
---- - <xx> Failed Tasks (xp)
----
---- @param #MISSION self
---- @return #string
--function MISSION:ReportSummary()
-- --
-- Mission "<MissionName>" - Status "<MissionStatus>" -- local Report = REPORT:New()
-- - Task Types: <TaskType>, <TaskType>
-- - <xx> Planned Tasks (xp)
-- - <xx> Assigned Tasks(xp)
-- - <xx> Success Tasks (xp)
-- - <xx> Hold Tasks (xp)
-- - <xx> Cancelled Tasks (xp)
-- - <xx> Aborted Tasks (xp)
-- - <xx> Failed Tasks (xp)
-- --
-- @param #MISSION self -- -- List the name of the mission.
-- @return #string -- local Name = self:GetText()
function MISSION:ReportSummary() --
-- -- Determine the status of the mission.
local Report = REPORT:New() -- local Status = "<" .. self:GetState() .. ">"
--
-- List the name of the mission. -- Report:Add( string.format( '%s - Status "%s"', Name, Status ) )
local Name = self:GetText() --
-- local TaskTypes = self:GetTaskTypes()
-- Determine the status of the mission. --
local Status = "<" .. self:GetState() .. ">" -- Report:Add( string.format( " - Task Types: %s", table.concat(TaskTypes, ", " ) ) )
--
Report:Add( string.format( '%s - Status "%s"', Name, Status ) ) -- local TaskStatusList = { "Planned", "Assigned", "Success", "Hold", "Cancelled", "Aborted", "Failed" }
--
local TaskTypes = self:GetTaskTypes() -- for TaskStatusID, TaskStatus in pairs( TaskStatusList ) do
-- local TaskCount = 0
Report:Add( string.format( " - Task Types: %s", table.concat(TaskTypes, ", " ) ) ) -- local TaskPlayerCount = 0
-- -- Determine how many tasks are remaining.
local TaskStatusList = { "Planned", "Assigned", "Success", "Hold", "Cancelled", "Aborted", "Failed" } -- for TaskID, Task in pairs( self:GetTasks() ) do
-- local Task = Task -- Tasking.Task#TASK
for TaskStatusID, TaskStatus in pairs( TaskStatusList ) do -- if Task:Is( TaskStatus ) then
local TaskCount = 0 -- TaskCount = TaskCount + 1
local TaskPlayerCount = 0 -- TaskPlayerCount = TaskPlayerCount + Task:GetPlayerCount()
-- Determine how many tasks are remaining. -- end
for TaskID, Task in pairs( self:GetTasks() ) do -- end
local Task = Task -- Tasking.Task#TASK -- if TaskCount > 0 then
if Task:Is( TaskStatus ) then -- Report:Add( string.format( " - %02d %s Tasks (%dp)", TaskCount, TaskStatus, TaskPlayerCount ) )
TaskCount = TaskCount + 1 -- end
TaskPlayerCount = TaskPlayerCount + Task:GetPlayerCount() -- end
end --
end -- return Report:Text()
if TaskCount > 0 then --end
Report:Add( string.format( " - %02d %s Tasks (%dp)", TaskCount, TaskStatus, TaskPlayerCount ) )
end
end
return Report:Text()
end
--- Create an active player report of the Mission. --- Create an active player report of the Mission.

View File

@ -1401,6 +1401,8 @@ do -- Reporting
-- @return #string -- @return #string
function TASK:ReportSummary( ReportGroup ) function TASK:ReportSummary( ReportGroup )
self:UpdateTaskInfo( self.DetectedItem )
local Report = REPORT:New() local Report = REPORT:New()
-- List the name of the Task. -- List the name of the Task.

View File

@ -539,16 +539,19 @@ do -- TASK_A2A_DISPATCHER
if TargetSetUnit then if TargetSetUnit then
Task = TASK_A2A_ENGAGE:New( Mission, self.SetGroup, string.format( "ENGAGE.%03d", DetectedID ), TargetSetUnit ) Task = TASK_A2A_ENGAGE:New( Mission, self.SetGroup, string.format( "ENGAGE.%03d", DetectedID ), TargetSetUnit )
Task:SetDetection( Detection, DetectedItem ) Task:SetDetection( Detection, DetectedItem )
Task:UpdateTaskInfo( DetectedItem )
else else
local TargetSetUnit = self:EvaluateINTERCEPT( DetectedItem ) -- Returns a SetUnit if there are targets to be INTERCEPTed... local TargetSetUnit = self:EvaluateINTERCEPT( DetectedItem ) -- Returns a SetUnit if there are targets to be INTERCEPTed...
if TargetSetUnit then if TargetSetUnit then
Task = TASK_A2A_INTERCEPT:New( Mission, self.SetGroup, string.format( "INTERCEPT.%03d", DetectedID ), TargetSetUnit ) Task = TASK_A2A_INTERCEPT:New( Mission, self.SetGroup, string.format( "INTERCEPT.%03d", DetectedID ), TargetSetUnit )
Task:SetDetection( Detection, DetectedItem ) Task:SetDetection( Detection, DetectedItem )
Task:UpdateTaskInfo( DetectedItem )
else else
local TargetSetUnit = self:EvaluateSWEEP( DetectedItem ) -- Returns a SetUnit local TargetSetUnit = self:EvaluateSWEEP( DetectedItem ) -- Returns a SetUnit
if TargetSetUnit then if TargetSetUnit then
Task = TASK_A2A_SWEEP:New( Mission, self.SetGroup, string.format( "SWEEP.%03d", DetectedID ), TargetSetUnit ) Task = TASK_A2A_SWEEP:New( Mission, self.SetGroup, string.format( "SWEEP.%03d", DetectedID ), TargetSetUnit )
Task:SetDetection( Detection, DetectedItem ) Task:SetDetection( Detection, DetectedItem )
Task:UpdateTaskInfo( DetectedItem )
end end
end end
end end