mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Reworked heavily the generation of reports and text on map coordinates.
This commit is contained in:
@@ -943,7 +943,7 @@ function MISSION:ReportOverview( ReportGroup, TaskStatus )
|
||||
local Task = Task -- Tasking.Task#TASK
|
||||
if Task:Is( TaskStatus ) then
|
||||
Report:Add( string.rep( "-", 140 ) )
|
||||
Report:Add( " - " .. Task:ReportOverview( ReportGroup ) )
|
||||
Report:Add( Task:ReportOverview( ReportGroup ) )
|
||||
end
|
||||
Tasks = Tasks + 1
|
||||
if Tasks >= 8 then
|
||||
@@ -973,6 +973,7 @@ function MISSION:ReportDetails( ReportGroup )
|
||||
local TasksRemaining = 0
|
||||
for TaskID, Task in pairs( self:GetTasks() ) do
|
||||
local Task = Task -- Tasking.Task#TASK
|
||||
Report:Add( string.rep( "-", 140 ) )
|
||||
Report:Add( Task:ReportDetails( ReportGroup ) )
|
||||
end
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
-- @field Core.Fsm#FSM_PROCESS FsmTemplate
|
||||
-- @field Tasking.Mission#MISSION Mission
|
||||
-- @field Tasking.CommandCenter#COMMANDCENTER CommandCenter
|
||||
-- @field Tasking.TaskInfo#TASKINFO TaskInfo
|
||||
-- @extends Core.Fsm#FSM_TASK
|
||||
|
||||
---
|
||||
@@ -230,7 +231,7 @@ function TASK:New( Mission, SetGroupAssign, TaskName, TaskType, TaskBriefing )
|
||||
|
||||
self.FsmTemplate = self.FsmTemplate or FSM_PROCESS:New()
|
||||
|
||||
self.TaskInfo = {}
|
||||
self.TaskInfo = TASKINFO:New( self )
|
||||
|
||||
self.TaskProgress = {}
|
||||
|
||||
@@ -732,8 +733,6 @@ function TASK:SetPlannedMenuForGroup( TaskGroup, MenuTime )
|
||||
local CommandCenterMenu = CommandCenter:GetMenu()
|
||||
|
||||
local TaskType = self:GetType()
|
||||
-- local TaskThreatLevel = self.TaskInfo["ThreatLevel"]
|
||||
-- local TaskThreatLevelString = TaskThreatLevel and " [" .. string.rep( "■", TaskThreatLevel ) .. "]" or " []"
|
||||
local TaskPlayerCount = self:GetPlayerCount()
|
||||
local TaskPlayerString = string.format( " (%dp)", TaskPlayerCount )
|
||||
-- local TaskText = string.format( "%s%s", self:GetName(), TaskPlayerString ) --, TaskThreatLevelString )
|
||||
@@ -774,8 +773,6 @@ function TASK:SetAssignedMenuForGroup( TaskGroup, MenuTime )
|
||||
local CommandCenterMenu = CommandCenter:GetMenu()
|
||||
|
||||
local TaskType = self:GetType()
|
||||
-- local TaskThreatLevel = self.TaskInfo["ThreatLevel"]
|
||||
-- local TaskThreatLevelString = TaskThreatLevel and " [" .. string.rep( "■", TaskThreatLevel ) .. "]" or " []"
|
||||
local TaskPlayerCount = self:GetPlayerCount()
|
||||
local TaskPlayerString = string.format( " (%dp)", TaskPlayerCount )
|
||||
local TaskText = string.format( "%s%s", self:GetName(), TaskPlayerString ) --, TaskThreatLevelString )
|
||||
@@ -881,19 +878,9 @@ function TASK:MenuMarkToGroup( TaskGroup )
|
||||
|
||||
local Report = REPORT:New():SetIndent( 0 )
|
||||
|
||||
-- List the name of the Task.
|
||||
local Name = self:GetName()
|
||||
Report:Add( "Task " .. Name .. ": " .. self:GetTaskBriefing() .. "\n" )
|
||||
self.TaskInfo:Report( Report, "M", TaskGroup )
|
||||
|
||||
for TaskInfoID, TaskInfo in pairs( self.TaskInfo, function( t, a, b ) return t[a].TaskInfoOrder < t[b].TaskInfoOrder end ) do
|
||||
|
||||
local ReportText = self:GetMarkInfo( TaskInfoID, TaskInfo )
|
||||
if ReportText then
|
||||
Report:Add( ReportText )
|
||||
end
|
||||
end
|
||||
|
||||
local TargetCoordinate = self:GetInfo( "Coordinate" ) -- Core.Point#COORDINATE
|
||||
local TargetCoordinate = self.TaskInfo:Get( "Coordinate" ).Data -- Core.Point#COORDINATE
|
||||
local MarkText = Report:Text( ", " )
|
||||
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
||||
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
||||
@@ -1061,30 +1048,6 @@ function TASK:SetType( TaskType )
|
||||
self.TaskType = TaskType
|
||||
end
|
||||
|
||||
--- Sets the Information on the Task
|
||||
-- @param #TASK self
|
||||
-- @param #string TaskInfo The key and title of the task information.
|
||||
-- @param #string TaskInfoText The Task info text.
|
||||
-- @param #number TaskInfoOrder The ordering, a number between 0 and 99.
|
||||
function TASK:SetInfo( TaskInfo, TaskInfoText, TaskInfoOrder )
|
||||
|
||||
self.TaskInfo = self.TaskInfo or {}
|
||||
self.TaskInfo[TaskInfo] = self.TaskInfo[TaskInfo] or {}
|
||||
self.TaskInfo[TaskInfo].TaskInfoText = TaskInfoText
|
||||
self.TaskInfo[TaskInfo].TaskInfoOrder = TaskInfoOrder
|
||||
end
|
||||
|
||||
--- Gets the Information of the Task
|
||||
-- @param #TASK self
|
||||
-- @param #string TaskInfo The key and title of the task information.
|
||||
-- @return #string TaskInfoText The Task info text.
|
||||
function TASK:GetInfo( TaskInfo )
|
||||
|
||||
self.TaskInfo = self.TaskInfo or {}
|
||||
self.TaskInfo[TaskInfo] = self.TaskInfo[TaskInfo] or {}
|
||||
return self.TaskInfo[TaskInfo].TaskInfoText
|
||||
end
|
||||
|
||||
--- Gets the Type of the Task
|
||||
-- @param #TASK self
|
||||
-- @return #string TaskType
|
||||
@@ -1445,11 +1408,7 @@ function TASK:ReportSummary( ReportGroup )
|
||||
-- Determine the status of the Task.
|
||||
Report:Add( "State: <" .. self:GetState() .. ">" )
|
||||
|
||||
if self.TaskInfo["Coordinate"] then
|
||||
local TaskInfoIDText = string.format( "%s: ", "Coordinate" )
|
||||
local TaskCoord = self.TaskInfo["Coordinate"].TaskInfoText -- Core.Point#COORDINATE
|
||||
Report:Add( TaskInfoIDText .. TaskCoord:ToString( ReportGroup, nil, self ) )
|
||||
end
|
||||
self.TaskInfo:Report( Report, "S", ReportGroup )
|
||||
|
||||
return Report:Text( ', ' )
|
||||
end
|
||||
@@ -1465,40 +1424,8 @@ function TASK:ReportOverview( ReportGroup )
|
||||
-- List the name of the Task.
|
||||
local TaskName = self:GetName()
|
||||
local Report = REPORT:New()
|
||||
|
||||
local Line = 0
|
||||
local LineReport = REPORT:New()
|
||||
|
||||
for TaskInfoID, TaskInfo in UTILS.spairs( self.TaskInfo, function( t, a, b ) return t[a].TaskInfoOrder < t[b].TaskInfoOrder end ) do
|
||||
|
||||
self:F( { TaskInfo = TaskInfo } )
|
||||
|
||||
if Line < math.floor( TaskInfo.TaskInfoOrder / 10 ) then
|
||||
if Line ~= 0 then
|
||||
Report:AddIndent( LineReport:Text( ", " ) )
|
||||
else
|
||||
Report:Add( "Task " .. TaskName .. ", " .. LineReport:Text( ", " ) )
|
||||
end
|
||||
LineReport = REPORT:New()
|
||||
Line = math.floor( TaskInfo.TaskInfoOrder / 10 )
|
||||
end
|
||||
|
||||
local TaskInfoIDText = string.format( "%s: ", TaskInfoID )
|
||||
|
||||
if type( TaskInfo.TaskInfoText ) == "string" then
|
||||
LineReport:Add( TaskInfoIDText .. TaskInfo.TaskInfoText )
|
||||
elseif type(TaskInfo) == "table" then
|
||||
if TaskInfoID == "Coordinate" then
|
||||
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
|
||||
--Report:Add( TaskInfoIDText )
|
||||
LineReport:Add( TaskInfoIDText .. ToCoordinate:ToString( ReportGroup, nil, self ) )
|
||||
--Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Report:AddIndent( LineReport:Text( ", " ) )
|
||||
self.TaskInfo:Report( Report, "O", ReportGroup )
|
||||
|
||||
return Report:Text()
|
||||
end
|
||||
@@ -1574,19 +1501,12 @@ function TASK:ReportDetails( ReportGroup )
|
||||
local Players = PlayerReport:Text()
|
||||
|
||||
if Players ~= "" then
|
||||
Report:Add( " - Players assigned:" )
|
||||
Report:AddIndent( "Players assigned:", "-" )
|
||||
Report:AddIndent( Players )
|
||||
end
|
||||
|
||||
for TaskInfoID, TaskInfo in pairs( self.TaskInfo, function( t, a, b ) return t[a].TaskInfoOrder < t[b].TaskInfoOrder end ) do
|
||||
|
||||
local ReportText = self:GetReportDetail( ReportGroup, TaskInfoID, TaskInfo )
|
||||
if ReportText then
|
||||
Report:Add( ReportText )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self.TaskInfo:Report( Report, "D", ReportGroup )
|
||||
|
||||
return Report:Text()
|
||||
end
|
||||
|
||||
|
||||
256
Moose Development/Moose/Tasking/TaskInfo.lua
Normal file
256
Moose Development/Moose/Tasking/TaskInfo.lua
Normal file
@@ -0,0 +1,256 @@
|
||||
--- **Tasking** -- Controls the information of a Task.
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- ### Author: **Sven Van de Velde (FlightControl)**
|
||||
--
|
||||
-- ### Contributions:
|
||||
--
|
||||
-- ====
|
||||
--
|
||||
-- @module TaskInfo
|
||||
|
||||
--- @type TASKINFO
|
||||
-- @extends Core.Set#SET_BASE
|
||||
|
||||
---
|
||||
-- # TASKINFO class, extends @{Set#SET}
|
||||
--
|
||||
-- ## The TASKINFO class implements the methods to contain information and display information of a task.
|
||||
--
|
||||
-- @field #TASKINFO
|
||||
TASKINFO = {
|
||||
ClassName = "TASKINFO",
|
||||
}
|
||||
|
||||
--- @type #TASKINFO.Detail #string A string that flags to document which level of detail needs to be shown in the report.
|
||||
--
|
||||
-- - "M" for Markings on the Map (F10).
|
||||
-- - "S" for Summary Reports.
|
||||
-- - "O" for Overview Reports.
|
||||
-- - "D" for Detailed Reports.
|
||||
TASKINFO.Detail = ""
|
||||
|
||||
--- Instantiates a new TASKINFO.
|
||||
-- @param #TASKINFO self
|
||||
-- @param Tasking.Task#TASK Task The task owning the information.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:New( Task )
|
||||
|
||||
local self = BASE:Inherit( self, SET_BASE:New() ) -- Core.Set#SET
|
||||
|
||||
self.Task = Task
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Add taskinfo.
|
||||
-- @param #TASKINFO self
|
||||
-- @param #string The info key.
|
||||
-- @param Data The data of the info.
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddInfo( Key, Data, Order, Detail )
|
||||
self:Add( Key, { Data = Data, Order = Order, Detail = Detail } )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Get taskinfo.
|
||||
-- @param #TASKINFO self
|
||||
-- @param #string The info key.
|
||||
-- @return Data The data of the info.
|
||||
-- @return #number Order The display order, which is a number from 0 to 100.
|
||||
-- @return #TASKINFO.Detail Detail The detail Level.
|
||||
function TASKINFO:GetInfo( Key )
|
||||
local Object = self:Get( Key )
|
||||
return Object.Data, Object.Order, Object.Detail
|
||||
end
|
||||
|
||||
|
||||
--- Get data.
|
||||
-- @param #TASKINFO self
|
||||
-- @param #string The info key.
|
||||
-- @return Data The data of the info.
|
||||
function TASKINFO:GetData( Key )
|
||||
local Object = self:Get( Key )
|
||||
return Object.Data
|
||||
end
|
||||
|
||||
|
||||
--- Add Text.
|
||||
-- @param #TASKINFO self
|
||||
-- @param #string Key The key.
|
||||
-- @param #string Text The text.
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddText( Key, Text, Order, Detail )
|
||||
self:AddInfo( Key, Text, Order, Detail )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Add the task name.
|
||||
-- @param #TASKINFO self
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddTaskName( Order, Detail )
|
||||
self:AddInfo( "TaskName", self.Task:GetName(), Order, Detail )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--- Add a Coordinate.
|
||||
-- @param #TASKINFO self
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddCoordinate( Coordinate, Order, Detail )
|
||||
self:AddInfo( "Coordinate", Coordinate, Order, Detail )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Add Threat.
|
||||
-- @param #TASKINFO self
|
||||
-- @param #string ThreatText The text of the Threat.
|
||||
-- @param #string ThreatLevel The level of the Threat.
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddThreat( ThreatText, ThreatLevel, Order, Detail )
|
||||
self:AddInfo( "Threat", ThreatText .. " [" .. string.rep( "■", ThreatLevel ) .. string.rep( "□", 10 - ThreatLevel ) .. "]", Order, Detail )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Add the Target count.
|
||||
-- @param #TASKINFO self
|
||||
-- @param #number TargetCount The amount of targets.
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddTargetCount( TargetCount, Order, Detail )
|
||||
self:AddInfo( "Counting", string.format( "%d", TargetCount ), Order, Detail )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add the Targets.
|
||||
-- @param #TASKINFO self
|
||||
-- @param #number TargetCount The amount of targets.
|
||||
-- @param #string TargetTypes The text containing the target types.
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddTargets( TargetCount, TargetTypes, Order, Detail )
|
||||
self:AddInfo( "Targets", string.format( "%d of %s", TargetCount, TargetTypes ), Order, Detail )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add the QFE at a Coordinate.
|
||||
-- @param #TASKINFO self
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddQFEAtCoordinate( Coordinate, Order, Detail )
|
||||
self:AddInfo( "QFE", Coordinate, Order, Detail )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add the Temperature at a Coordinate.
|
||||
-- @param #TASKINFO self
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddTemperatureAtCoordinate( Coordinate, Order, Detail )
|
||||
self:AddInfo( "Temperature", Coordinate, Order, Detail )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add the Wind at a Coordinate.
|
||||
-- @param #TASKINFO self
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddWindAtCoordinate( Coordinate, Order, Detail )
|
||||
self:AddInfo( "Wind", Coordinate, Order, Detail )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Create the taskinfo Report
|
||||
-- @param #TASKINFO self
|
||||
-- @param Core.Report#REPORT Report
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @param Wrapper.Group#GROUP ReportGroup
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:Report( Report, Detail, ReportGroup )
|
||||
|
||||
local Line = 0
|
||||
local LineReport = REPORT:New()
|
||||
|
||||
for Key, Data in UTILS.spairs( self.Set, function( t, a, b ) return t[a].Order < t[b].Order end ) do
|
||||
|
||||
self:E( { Key = Key, Detail = Detail, Data = Data } )
|
||||
|
||||
if Data.Detail:find( Detail ) then
|
||||
local Text = ""
|
||||
if Key == "TaskName" then
|
||||
Key = nil
|
||||
Text = Data.Data
|
||||
end
|
||||
if Key == "Coordinate" then
|
||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||
Text = Coordinate:ToString( ReportGroup:GetUnit(1), nil, self )
|
||||
end
|
||||
if Key == "Threat" then
|
||||
local DataText = Data.Data -- #string
|
||||
Text = DataText
|
||||
end
|
||||
if Key == "Counting" then
|
||||
local DataText = Data.Data -- #string
|
||||
Text = DataText
|
||||
end
|
||||
if Key == "Targets" then
|
||||
local DataText = Data.Data -- #string
|
||||
Text = DataText
|
||||
end
|
||||
if Key == "QFE" then
|
||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||
Text = Coordinate:ToStringPressure( ReportGroup:GetUnit(1), nil, self )
|
||||
end
|
||||
if Key == "Temperature" then
|
||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||
Text = Coordinate:ToStringTemperature( ReportGroup:GetUnit(1), nil, self )
|
||||
end
|
||||
if Key == "Wind" then
|
||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||
Text = Coordinate:ToStringWind( ReportGroup:GetUnit(1), nil, self )
|
||||
end
|
||||
|
||||
if Line < math.floor( Data.Order / 10 ) then
|
||||
if Line == 0 then
|
||||
Report:AddIndent( LineReport:Text( ", " ), "-" )
|
||||
else
|
||||
Report:AddIndent( LineReport:Text( ", " ) )
|
||||
end
|
||||
LineReport = REPORT:New()
|
||||
Line = math.floor( Data.Order / 10 )
|
||||
end
|
||||
|
||||
LineReport:Add( ( Key and ( Key .. ":" ) or "" ) .. Text )
|
||||
end
|
||||
end
|
||||
Report:AddIndent( LineReport:Text( ", " ) )
|
||||
|
||||
end
|
||||
@@ -156,33 +156,6 @@ do -- TASK_ZONE_GOAL
|
||||
return self.GoalTotal
|
||||
end
|
||||
|
||||
function TASK_ZONE_GOAL:GetMarkInfo( TaskInfoID, TaskInfo )
|
||||
|
||||
if type( TaskInfo.TaskInfoText ) == "string" then
|
||||
return string.format( "%s: %s", TaskInfoID, TaskInfo.TaskInfoText )
|
||||
elseif type( TaskInfo ) == "table" then
|
||||
if TaskInfoID == "Coordinate" then
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
function TASK_ZONE_GOAL:GetReportDetail( ReportGroup, TaskInfoID, TaskInfo )
|
||||
|
||||
if type( TaskInfo.TaskInfoText ) == "string" then
|
||||
return string.format( " - %s: %s", TaskInfoID, TaskInfo.TaskInfoText )
|
||||
elseif type(TaskInfo) == "table" then
|
||||
if TaskInfoID == "Coordinate" then
|
||||
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
||||
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
|
||||
return string.format( " - %s: %s", TaskInfoID, ToCoordinate:ToString( ReportGroup:GetUnit( 1 ), nil, self ) )
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -244,14 +217,14 @@ do -- TASK_ZONE_CAPTURE
|
||||
|
||||
|
||||
local ZoneCoordinate = self.ZoneGoal:GetZone():GetCoordinate()
|
||||
self:SetInfo( "Coordinate", ZoneCoordinate, 0 )
|
||||
self:SetInfo( "Zone Name", self.ZoneGoal:GetZoneName(), 10 )
|
||||
self:SetInfo( "Zone Coalition", self.ZoneGoal:GetCoalitionName(), 11 )
|
||||
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" )
|
||||
end
|
||||
|
||||
|
||||
function TASK_ZONE_CAPTURE:ReportOrder( ReportGroup )
|
||||
local Coordinate = self:GetInfo( "Coordinate" )
|
||||
local Coordinate = self:GetData( "Coordinate" )
|
||||
--local Coordinate = self.TaskInfo.Coordinates.TaskInfoText
|
||||
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
|
||||
|
||||
|
||||
@@ -277,37 +277,6 @@ do -- TASK_A2A
|
||||
return self.GoalTotal
|
||||
end
|
||||
|
||||
function TASK_A2A:GetMarkInfo( TaskInfoID, TaskInfo )
|
||||
|
||||
if type( TaskInfo.TaskInfoText ) == "string" then
|
||||
if TaskInfoID == "Targets" then
|
||||
else
|
||||
return string.format( "%s: %s", TaskInfoID, TaskInfo.TaskInfoText )
|
||||
end
|
||||
elseif type( TaskInfo ) == "table" then
|
||||
if TaskInfoID == "Coordinate" then
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
function TASK_A2A:GetReportDetail( ReportGroup, TaskInfoID, TaskInfo )
|
||||
|
||||
if type( TaskInfo.TaskInfoText ) == "string" then
|
||||
return string.format( "%s: %s", TaskInfoID, TaskInfo.TaskInfoText )
|
||||
elseif type(TaskInfo) == "table" then
|
||||
if TaskInfoID == "Coordinate" then
|
||||
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
||||
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
|
||||
return string.format( " - %s: %s", TaskInfoID, ToCoordinate:ToString( ReportGroup:GetUnit(1), nil, self ) )
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -286,41 +286,10 @@ do -- TASK_A2G
|
||||
return self.GoalTotal
|
||||
end
|
||||
|
||||
function TASK_A2G:GetMarkInfo( TaskInfoID, TaskInfo )
|
||||
|
||||
if type( TaskInfo.TaskInfoText ) == "string" then
|
||||
if TaskInfoID == "Targets" then
|
||||
else
|
||||
return string.format( "%s: %s", TaskInfoID, TaskInfo.TaskInfoText )
|
||||
end
|
||||
elseif type( TaskInfo ) == "table" then
|
||||
if TaskInfoID == "Coordinate" then
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
function TASK_A2G:GetReportDetail( ReportGroup, TaskInfoID, TaskInfo )
|
||||
|
||||
if type( TaskInfo.TaskInfoText ) == "string" then
|
||||
return string.format( "%s: %s", TaskInfoID, TaskInfo.TaskInfoText )
|
||||
elseif type(TaskInfo) == "table" then
|
||||
if TaskInfoID == "Coordinate" then
|
||||
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
||||
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
|
||||
return string.format( " - %s: %s", TaskInfoID, ToCoordinate:ToString( ReportGroup:GetUnit(1), nil, self ) )
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Return the relative distance to the target vicinity from the player, in order to sort the targets in the reports per distance from the threats.
|
||||
-- @param #TASK_A2G self
|
||||
function TASK_A2G:ReportOrder( ReportGroup )
|
||||
local Coordinate = self:GetInfo( "Coordinate" )
|
||||
local Coordinate = self:GetData( "Coordinate" )
|
||||
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
|
||||
|
||||
return Distance
|
||||
@@ -339,13 +308,13 @@ do -- TASK_A2G
|
||||
self:__Goal( -10 )
|
||||
end
|
||||
|
||||
|
||||
--- @param #TASK_A2G self
|
||||
function TASK_A2G:UpdateTaskInfo()
|
||||
|
||||
if self:IsStatePlanned() or self:IsStateAssigned() then
|
||||
local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate()
|
||||
self:SetInfo( "Coordinate", TargetCoordinate, 0 )
|
||||
self.TaskInfo:AddTaskName( 0, "MSOD" )
|
||||
self.TaskInfo:AddCoordinate( TargetCoordinate, 1, "SOD" )
|
||||
|
||||
local ThreatLevel, ThreatText
|
||||
if self.Detection then
|
||||
@@ -353,7 +322,7 @@ do -- TASK_A2G
|
||||
else
|
||||
ThreatLevel, ThreatText = self.TargetSetUnit:CalculateThreatLevelA2G()
|
||||
end
|
||||
self:SetInfo( "Threat", ThreatText .. " [" .. string.rep( "■", ThreatLevel ) .. string.rep( "□", 10 - ThreatLevel ) .. "]", 11 )
|
||||
self.TaskInfo:AddThreat( ThreatText, ThreatLevel, 10, "MOD", true )
|
||||
|
||||
if self.Detection then
|
||||
local DetectedItemsCount = self.TargetSetUnit:Count()
|
||||
@@ -366,28 +335,19 @@ do -- TASK_A2G
|
||||
ReportTypes:Add( TargetType )
|
||||
end
|
||||
end
|
||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, ReportTypes:Text( ", " ) ), 10 )
|
||||
self:SetInfo( "QFE", string.format( "%d", TargetCoordinate:GetPressure() ), 12 )
|
||||
self:SetInfo( "°C", string.format( "%d", TargetCoordinate:GetTemperature() ), 12 )
|
||||
self:SetInfo( "Wind", string.format( "%d", TargetCoordinate:GetWind() ), 12 )
|
||||
self.TaskInfo:AddTargetCount( DetectedItemsCount, 11, "O", true )
|
||||
self.TaskInfo:AddTargets( DetectedItemsCount, ReportTypes:Text( ", " ), 20, "D", true )
|
||||
self.TaskInfo:AddQFEAtCoordinate( TargetCoordinate, 30, "MOD" )
|
||||
self.TaskInfo:AddTemperatureAtCoordinate( TargetCoordinate, 31, "MD" )
|
||||
self.TaskInfo:AddWindAtCoordinate( TargetCoordinate, 32, "MD" )
|
||||
else
|
||||
local DetectedItemsCount = self.TargetSetUnit:Count()
|
||||
local DetectedItemsTypes = self.TargetSetUnit:GetTypeNames()
|
||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 10 )
|
||||
self.TaskInfo:AddTargetCount( DetectedItemsCount, 11, "O", true )
|
||||
self.TaskInfo:AddTargets( string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 20, "D", true )
|
||||
end
|
||||
end
|
||||
|
||||
--- Keep Threat and Targets of a task is planned for later use when the task is completed.
|
||||
if self:IsStatePlanned() then
|
||||
self.InitialThreat = self:GetInfo( "Threat" )
|
||||
self.InitialTargets = self:GetInfo( "Targets" )
|
||||
end
|
||||
|
||||
if not self:IsStatePlanned() and not self:IsStateAssigned() then
|
||||
self:SetInfo( "Targets", self.InitialTargets, 10 )
|
||||
self:SetInfo( "Threat", self.InitialThreat, 10 )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user