mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Publishing new Menu driven reporting structure for TASKING
-- Each group can now select from a menu to report a task overview or only the task with a specific state... -- Dactivate the flashing of the available tasks. A small message is displayed now.
This commit is contained in:
parent
8d6b1940bb
commit
0456deddd7
@ -1172,6 +1172,7 @@ do -- DETECTION_BASE
|
||||
|
||||
DetectedItem.Set = Set or SET_UNIT:New():FilterDeads():FilterCrashes()
|
||||
DetectedItem.ItemID = ItemPrefix .. "." .. self.DetectedItemMax
|
||||
DetectedItem.ID = self.DetectedItemMax
|
||||
DetectedItem.Removed = false
|
||||
|
||||
return DetectedItem
|
||||
@ -1239,7 +1240,7 @@ do -- DETECTION_BASE
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #number Index
|
||||
-- @return #string DetectedItemID
|
||||
function DETECTION_BASE:GetDetectedItemID( Index )
|
||||
function DETECTION_BASE:GetDetectedItemID( Index ) --R2.1
|
||||
|
||||
local DetectedItem = self.DetectedItems[Index]
|
||||
if DetectedItem then
|
||||
@ -1249,6 +1250,20 @@ do -- DETECTION_BASE
|
||||
return ""
|
||||
end
|
||||
|
||||
--- Get a detected ID using a given numeric index.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #number Index
|
||||
-- @return #string DetectedItemID
|
||||
function DETECTION_BASE:GetDetectedID( Index ) --R2.1
|
||||
|
||||
local DetectedItem = self.DetectedItems[Index]
|
||||
if DetectedItem then
|
||||
return DetectedItem.ID
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
--- Get the @{Set#SET_UNIT} of a detecttion area using a given numeric index.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #number Index
|
||||
|
||||
@ -162,6 +162,8 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
self:SetMenu()
|
||||
|
||||
return self
|
||||
end
|
||||
@ -220,12 +222,12 @@ function COMMANDCENTER:SetMenu()
|
||||
self.CommandCenterMenu = self.CommandCenterMenu or MENU_COALITION:New( self.CommandCenterCoalition, "Command Center (" .. self:GetName() .. ")" )
|
||||
|
||||
local MenuTime = timer.getTime()
|
||||
for MissionID, Mission in pairs( self:GetMissions() ) do
|
||||
for MissionID, Mission in pairs( self:GetMissions() or {} ) do
|
||||
local Mission = Mission -- Tasking.Mission#MISSION
|
||||
Mission:SetMenu( MenuTime )
|
||||
end
|
||||
|
||||
for MissionID, Mission in pairs( self:GetMissions() ) do
|
||||
for MissionID, Mission in pairs( self:GetMissions() or {} ) do
|
||||
local Mission = Mission -- Tasking.Mission#MISSION
|
||||
Mission:RemoveMenu( MenuTime )
|
||||
end
|
||||
|
||||
@ -406,9 +406,8 @@ end
|
||||
|
||||
--- Gets the mission menu for the coalition.
|
||||
-- @param #MISSION self
|
||||
-- @param Wrapper.Group#GROUP TaskGroup
|
||||
-- @return Core.Menu#MENU_COALITION self
|
||||
function MISSION:GetMenu( TaskGroup )
|
||||
function MISSION:GetMenu()
|
||||
|
||||
local CommandCenter = self:GetCommandCenter()
|
||||
local CommandCenterMenu = CommandCenter:GetMenu()
|
||||
@ -542,6 +541,21 @@ function MISSION:HasGroup( TaskGroup )
|
||||
return Has
|
||||
end
|
||||
|
||||
--- @param #MISSION self
|
||||
-- @return #number
|
||||
function MISSION:GetTasksRemaining()
|
||||
-- Determine how many tasks are remaining.
|
||||
local TasksRemaining = 0
|
||||
for TaskID, Task in pairs( self:GetTasks() ) do
|
||||
local Task = Task -- Tasking.Task#TASK
|
||||
if Task:IsStateSuccess() or Task:IsStateFailed() then
|
||||
else
|
||||
TasksRemaining = TasksRemaining + 1
|
||||
end
|
||||
end
|
||||
return TasksRemaining
|
||||
end
|
||||
|
||||
--- Create a summary report of the Mission (one line).
|
||||
-- @param #MISSION self
|
||||
-- @return #string
|
||||
@ -554,18 +568,15 @@ function MISSION:ReportSummary()
|
||||
|
||||
-- Determine the status of the mission.
|
||||
local Status = self:GetState()
|
||||
local TasksRemaining = self:GetTasksRemaining()
|
||||
|
||||
Report:Add( "Mission " .. Name .. " - " .. Status .. " - " .. TasksRemaining .. " tasks remaining." )
|
||||
|
||||
-- Determine how many tasks are remaining.
|
||||
local TasksRemaining = 0
|
||||
for TaskID, Task in pairs( self:GetTasks() ) do
|
||||
local Task = Task -- Tasking.Task#TASK
|
||||
if Task:IsStateSuccess() or Task:IsStateFailed() then
|
||||
else
|
||||
TasksRemaining = TasksRemaining + 1
|
||||
end
|
||||
Report:Add( "- " .. Task:ReportSummary() )
|
||||
end
|
||||
|
||||
Report:Add( "Mission " .. Name .. " - " .. Status .. " - " .. TasksRemaining .. " tasks remaining." )
|
||||
|
||||
return Report:Text()
|
||||
end
|
||||
@ -573,7 +584,7 @@ end
|
||||
--- Create a overview report of the Mission (multiple lines).
|
||||
-- @param #MISSION self
|
||||
-- @return #string
|
||||
function MISSION:ReportOverview()
|
||||
function MISSION:ReportOverview( TaskStatus )
|
||||
|
||||
local Report = REPORT:New()
|
||||
|
||||
@ -582,14 +593,17 @@ function MISSION:ReportOverview()
|
||||
|
||||
-- Determine the status of the mission.
|
||||
local Status = self:GetState()
|
||||
local TasksRemaining = self:GetTasksRemaining()
|
||||
|
||||
Report:Add( "Mission " .. Name .. " - State '" .. Status .. "'" )
|
||||
Report:Add( "Mission " .. Name .. " - " .. Status .. " Task Report ")
|
||||
|
||||
-- Determine how many tasks are remaining.
|
||||
local TasksRemaining = 0
|
||||
for TaskID, Task in pairs( self:GetTasks() ) do
|
||||
local Task = Task -- Tasking.Task#TASK
|
||||
Report:Add( "- " .. Task:ReportSummary() )
|
||||
if Task:Is( TaskStatus ) then
|
||||
Report:Add( "\n - " .. Task:ReportOverview() )
|
||||
end
|
||||
end
|
||||
|
||||
return Report:Text()
|
||||
@ -608,7 +622,7 @@ function MISSION:ReportDetails()
|
||||
-- Determine the status of the mission.
|
||||
local Status = self:GetState()
|
||||
|
||||
Report:Add( "Mission " .. Name .. " - State '" .. Status .. "'" )
|
||||
Report:Add( "Mission " .. Name .. " - " .. Status )
|
||||
|
||||
-- Determine how many tasks are remaining.
|
||||
local TasksRemaining = 0
|
||||
@ -631,5 +645,22 @@ function MISSION:GetTasks()
|
||||
|
||||
return self.Tasks
|
||||
end
|
||||
|
||||
|
||||
--- @param #MISSION self
|
||||
-- @param Wrapper.Group#GROUP ReportGroup
|
||||
function MISSION:MenuReportSummary( ReportGroup )
|
||||
|
||||
local Report = self:ReportSummary()
|
||||
|
||||
self:GetCommandCenter():MessageToGroup( Report, ReportGroup )
|
||||
end
|
||||
|
||||
--- @param #MISSION self
|
||||
-- @param #string TaskStatus The status
|
||||
-- @param Wrapper.Group#GROUP ReportGroup
|
||||
function MISSION:MenuReportOverview( ReportGroup, TaskStatus )
|
||||
|
||||
local Report = self:ReportOverview( TaskStatus )
|
||||
|
||||
self:GetCommandCenter():MessageToGroup( Report, ReportGroup )
|
||||
end
|
||||
|
||||
@ -191,6 +191,7 @@ function TASK:New( Mission, SetGroupAssign, TaskName, TaskType )
|
||||
|
||||
self.FsmTemplate = self.FsmTemplate or FSM_PROCESS:New()
|
||||
|
||||
self.TaskInfo = {}
|
||||
|
||||
return self
|
||||
end
|
||||
@ -546,8 +547,23 @@ function TASK:SetMenu( MenuTime )
|
||||
|
||||
self.SetGroup:Flush()
|
||||
for TaskGroupID, TaskGroupData in pairs( self.SetGroup:GetSet() ) do
|
||||
local TaskGroup = TaskGroupData -- Wrapper.Group#GROUP
|
||||
local TaskGroup = TaskGroupData -- Wrapper.Group#GROUP
|
||||
if TaskGroup:IsAlive() and TaskGroup:GetPlayerNames() then
|
||||
|
||||
-- Set Mission Menus
|
||||
|
||||
local Mission = self:GetMission()
|
||||
local MissionMenu = Mission:GetMenu()
|
||||
if MissionMenu then
|
||||
TaskGroup.MenuReports = MENU_GROUP:New( TaskGroup, "Reports", MissionMenu )
|
||||
MENU_GROUP_COMMAND:New( TaskGroup, "Report Tasks", TaskGroup.MenuReports, Mission.MenuReportSummary, Mission, TaskGroup )
|
||||
MENU_GROUP_COMMAND:New( TaskGroup, "Report Planned Tasks", TaskGroup.MenuReports, Mission.MenuReportOverview, Mission, TaskGroup, "Planned" )
|
||||
MENU_GROUP_COMMAND:New( TaskGroup, "Report Ongoing Tasks", TaskGroup.MenuReports, Mission.MenuReportOverview, Mission, TaskGroup, "Ongoing" )
|
||||
MENU_GROUP_COMMAND:New( TaskGroup, "Report Successful Tasks", TaskGroup.MenuReports, Mission.MenuReportOverview, Mission, TaskGroup, "Success" )
|
||||
MENU_GROUP_COMMAND:New( TaskGroup, "Report Failed Tasks", TaskGroup.MenuReports, Mission.MenuReportOverview, Mission, TaskGroup, "Failed" )
|
||||
MENU_GROUP_COMMAND:New( TaskGroup, "Report Held Tasks", TaskGroup.MenuReports, Mission.MenuReportOverview, Mission, TaskGroup, "Hold" )
|
||||
end
|
||||
|
||||
if self:IsStatePlanned() or self:IsStateReplanned() then
|
||||
self:SetMenuForGroup( TaskGroup, MenuTime )
|
||||
end
|
||||
@ -840,6 +856,14 @@ function TASK:SetType( TaskType )
|
||||
self.TaskType = TaskType
|
||||
end
|
||||
|
||||
--- Sets the Information on the Task
|
||||
-- @param #TASK self
|
||||
-- @param #string TaskInfo
|
||||
function TASK:SetInfo( TaskInfo, TaskInfoText )
|
||||
|
||||
self.TaskInfo[TaskInfo] = TaskInfoText
|
||||
end
|
||||
|
||||
--- Gets the Type of the Task
|
||||
-- @param #TASK self
|
||||
-- @return #string TaskType
|
||||
@ -1144,6 +1168,27 @@ function TASK:ReportSummary()
|
||||
return Report:Text()
|
||||
end
|
||||
|
||||
--- Create an overiew report of the Task.
|
||||
-- List the Task Name and Status
|
||||
-- @param #TASK self
|
||||
-- @return #string
|
||||
function TASK:ReportOverview()
|
||||
|
||||
local Report = REPORT:New()
|
||||
|
||||
-- List the name of the Task.
|
||||
local Name = self:GetName()
|
||||
|
||||
-- Determine the status of the Task.
|
||||
local State = self:GetState()
|
||||
|
||||
local Detection = self.TaskInfo["Detection"] and " - " .. self.TaskInfo["Detection"] or ""
|
||||
|
||||
Report:Add( "Task " .. Name .. Detection )
|
||||
|
||||
return Report:Text()
|
||||
end
|
||||
|
||||
|
||||
--- Create a detailed report of the Task.
|
||||
-- List the Task Status, and the Players assigned to the Task.
|
||||
@ -1161,17 +1206,23 @@ function TASK:ReportDetails()
|
||||
|
||||
-- Loop each Unit active in the Task, and find Player Names.
|
||||
local PlayerNames = {}
|
||||
local PlayerReport = REPORT:New( " - Players:" )
|
||||
local PlayerReport = REPORT:New( "\n Players:" )
|
||||
for PlayerGroupID, PlayerGroupData in pairs( self:GetGroups():GetSet() ) do
|
||||
local PlayerGroup = PlayerGroupData -- Wrapper.Group#GROUP
|
||||
PlayerNames = PlayerGroup:GetPlayerNames()
|
||||
if PlayerNames then
|
||||
PlayerReport:Add( " -- Group " .. PlayerGroup:GetCallsign() .. ": " .. table.concat( PlayerNames, ", " ) )
|
||||
PlayerReport:Add( " Group " .. PlayerGroup:GetCallsign() .. ": " .. table.concat( PlayerNames, ", " ) )
|
||||
end
|
||||
end
|
||||
|
||||
local Detection = self.TaskInfo["Detection"] and "\n Detection: " .. self.TaskInfo["Detection"] or ""
|
||||
local Changes = self.TaskInfo["Changes"] and "\n Changes: " .. self.TaskInfo["Changes"] or ""
|
||||
local Players = PlayerReport:Text()
|
||||
|
||||
Report:Add( "Task " .. Name .. Players .. Detection .. Changes )
|
||||
|
||||
-- Loop each Process in the Task, and find Reporting Details.
|
||||
Report:Add( string.format( " - Task %s\n -- State '%s'\n%s", Name, State, PlayerReport:Text() ) )
|
||||
Report:Add( string.format( "Task %s\n -- State '%s'\n%s", Name, State, PlayerReport:Text() ) )
|
||||
return Report:Text()
|
||||
end
|
||||
|
||||
|
||||
@ -208,10 +208,6 @@ do -- TASK_A2G_DISPATCHER
|
||||
local ChangeMsg = {}
|
||||
|
||||
local Mission = self.Mission
|
||||
local ReportSEAD = REPORT:New( "- SEAD Tasks:")
|
||||
local ReportCAS = REPORT:New( "- CAS Tasks:")
|
||||
local ReportBAI = REPORT:New( "- BAI Tasks:")
|
||||
local ReportChanges = REPORT:New( " - Changes:" )
|
||||
|
||||
--- First we need to the detected targets.
|
||||
for DetectedItemID, DetectedItem in pairs( Detection:GetDetectedItems() ) do
|
||||
@ -222,7 +218,7 @@ do -- TASK_A2G_DISPATCHER
|
||||
self:E( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } )
|
||||
DetectedSet:Flush()
|
||||
|
||||
local ItemID = DetectedItem.ItemID
|
||||
local ItemID = DetectedItem.ID
|
||||
|
||||
-- Evaluate SEAD Tasking
|
||||
local SEADTask = Mission:GetTask( string.format( "SEAD.%03d", ItemID ) )
|
||||
@ -233,12 +229,11 @@ do -- TASK_A2G_DISPATCHER
|
||||
local Task = TASK_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", ItemID ), TargetSetUnit )
|
||||
Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
Task:SetInfo( "Detection", Detection:DetectedItemReportSummary( DetectedItemID ) )
|
||||
Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) )
|
||||
SEADTask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
if SEADTask and SEADTask:IsStatePlanned() then
|
||||
ReportSEAD:Add( string.format( " - %s.%02d - %s", "SEAD", ItemID, Detection:DetectedItemReportSummary(DetectedItemID) ) )
|
||||
end
|
||||
|
||||
-- Evaluate CAS Tasking
|
||||
local CASTask = Mission:GetTask( string.format( "CAS.%03d", ItemID ) )
|
||||
@ -249,12 +244,11 @@ do -- TASK_A2G_DISPATCHER
|
||||
local Task = TASK_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", ItemID ), TargetSetUnit )
|
||||
Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
Task:SetInfo( "Detection", Detection:DetectedItemReportSummary( DetectedItemID ) )
|
||||
Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) )
|
||||
CASTask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
if CASTask and CASTask:IsStatePlanned() then
|
||||
ReportCAS:Add( string.format( " - %s.%02d - %s", "CAS", ItemID, Detection:DetectedItemReportSummary(DetectedItemID) ) )
|
||||
end
|
||||
|
||||
-- Evaluate BAI Tasking
|
||||
local BAITask = Mission:GetTask( string.format( "BAI.%03d", ItemID ) )
|
||||
@ -265,19 +259,12 @@ do -- TASK_A2G_DISPATCHER
|
||||
local Task = TASK_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", ItemID ), TargetSetUnit )
|
||||
Task:SetTargetZone( DetectedZone )
|
||||
Task:SetDispatcher( self )
|
||||
Task:SetInfo( "Detection", Detection:DetectedItemReportSummary( DetectedItemID ) )
|
||||
Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) )
|
||||
BAITask = Mission:AddTask( Task )
|
||||
end
|
||||
end
|
||||
if BAITask and BAITask:IsStatePlanned() then
|
||||
ReportBAI:Add( string.format( " - %s.%02d - %s", "BAI", ItemID, Detection:DetectedItemReportSummary(DetectedItemID) ) )
|
||||
end
|
||||
|
||||
|
||||
-- Loop through the changes ...
|
||||
local ChangeText = Detection:GetChangeText( DetectedItem )
|
||||
ReportChanges:Add( ChangeText )
|
||||
|
||||
|
||||
-- OK, so the tasking has been done, now delete the changes reported for the area.
|
||||
Detection:AcceptChanges( DetectedItem )
|
||||
|
||||
@ -287,14 +274,15 @@ do -- TASK_A2G_DISPATCHER
|
||||
Mission:GetCommandCenter():SetMenu()
|
||||
|
||||
for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
|
||||
Mission:GetCommandCenter():MessageToGroup( string.format( "There are %d tasks remaining for mission *%s*. Subscribe to a task using the menu.", Mission:GetTasksRemaining(), Mission:GetName() ), TaskGroup )
|
||||
if not TaskGroup:GetState( TaskGroup, "Assigned" ) then
|
||||
Mission:GetCommandCenter():MessageToGroup(
|
||||
string.format( "HQ Reporting - Planned tasks for mission '%s':\n%s\n",
|
||||
self.Mission:GetName(),
|
||||
string.format( "%s\n\n%s\n\n%s\n\n%s", ReportSEAD:Text(), ReportCAS:Text(), ReportBAI:Text(), ReportChanges:Text()
|
||||
)
|
||||
), TaskGroup
|
||||
)
|
||||
-- Mission:GetCommandCenter():MessageToGroup(
|
||||
-- string.format( "HQ Reporting - Planned tasks for mission '%s':\n\n%s\n",
|
||||
-- self.Mission:GetName(),
|
||||
-- string.format( "%s\n\n%s\n\n%s\n\n%s", ReportSEAD:Text(), ReportCAS:Text(), ReportBAI:Text(), ReportChanges:Text()
|
||||
-- )
|
||||
-- ), TaskGroup
|
||||
-- )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user