Merge pull request #471 from FlightControl-Master/386-ai-designate

386 ai designate
This commit is contained in:
Sven Van de Velde 2017-04-25 21:14:01 +02:00 committed by GitHub
commit 292642c1f5
3 changed files with 42 additions and 14 deletions

View File

@ -1778,8 +1778,11 @@ do -- DETECTION_TYPES
local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
local DetectedItemCoordText = DetectedItemCoordinate:ToString()
self:E( { DetectedItemID,
DetectedItemCoordText } )
local ReportSummary = string.format(
"%S - %s",
"%s - %s",
DetectedItemID,
DetectedItemCoordText
)
@ -1813,7 +1816,7 @@ do -- DETECTION_TYPES
local DetectedItemCoordText = DetectedItemCoordinate:ToString()
local ReportSummary = string.format(
"%S - %s - Threat:[%s](%2d) - %2d of %s",
"%s - %s - Threat:[%s](%2d) - %2d of %s",
DetectedItemID,
DetectedItemCoordText,
string.rep( "", ThreatLevelA2G ),

View File

@ -17,7 +17,7 @@ REPORT = {
-- @return #REPORT
function REPORT:New( Title )
local self = BASE:Inherit( self, BASE:New() )
local self = BASE:Inherit( self, BASE:New() ) -- #REPORT
self.Report = {}
if Title then
@ -27,13 +27,32 @@ function REPORT:New( Title )
return self
end
--- Set indent of a REPORT.
-- @param #REPORT self
-- @param #number Indent
-- @return #REPORT
function REPORT:SetIndent( Indent )
self.Indent = Indent
return self
end
--- Add a new line to a REPORT.
-- @param #REPORT self
-- @param #string Text
-- @return #REPORT
function REPORT:Add( Text )
self.Report[#self.Report+1] = Text
return self.Report[#self.Report]
return self
end
--- Add a new line to a REPORT.
-- @param #REPORT self
-- @param #string Text
-- @return #REPORT
function REPORT:AddIndent( Text )
self.Report[#self.Report+1] = string.rep(" ", self.Indent ) .. Text
return self
end
--- Produces the text of the report, taking into account an optional delimeter, which is \n by default.

View File

@ -1196,7 +1196,7 @@ end
-- @return #string
function TASK:ReportDetails()
local Report = REPORT:New()
local Report = REPORT:New():SetIndent( 3 )
-- List the name of the Task.
local Name = self:GetName()
@ -1206,23 +1206,29 @@ function TASK:ReportDetails()
-- Loop each Unit active in the Task, and find Player Names.
local PlayerNames = {}
local PlayerReport = REPORT:New( "\n Players:" )
local PlayerReport = REPORT:New()
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 )
local Detection = self.TaskInfo["Detection"] or ""
local Changes = self.TaskInfo["Changes"] or ""
Report:Add( "Task: " .. Name .. " - " .. State .. " - Detailed Report" )
Report:Add( " - Players: " )
Report:AddIndent( Players )
Report:Add( " - Detection: " )
Report:AddIndent( Detection )
Report:Add( " - Detection Changes: \n" )
Report:AddIndent( 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() ) )
return Report:Text()
end