mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-22 06:45:20 +00:00
Updated various functions for tasking.
This commit is contained in:
@@ -1020,10 +1020,15 @@ end
|
|||||||
|
|
||||||
--- Sets the Information on the Task
|
--- Sets the Information on the Task
|
||||||
-- @param #TASK self
|
-- @param #TASK self
|
||||||
-- @param #string TaskInfo
|
-- @param #string TaskInfo The key and title of the task information.
|
||||||
function TASK:SetInfo( TaskInfo, TaskInfoText )
|
-- @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[TaskInfo] = TaskInfoText
|
self.TaskInfo = self.TaskInfo or {}
|
||||||
|
self.TaskInfo[TaskInfo] = self.TaskInfo[TaskInfo] or {}
|
||||||
|
self.TaskInfo[TaskInfo].TaskInfoText = TaskInfoText
|
||||||
|
self.TaskInfo[TaskInfo].TaskInfoOrder = TaskInfoOrder
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets the Type of the Task
|
--- Gets the Type of the Task
|
||||||
@@ -1365,26 +1370,41 @@ function TASK:ReportOverview( ReportGroup ) --R2.1 fixed report. Now nicely form
|
|||||||
|
|
||||||
-- Determine the status of the Task.
|
-- Determine the status of the Task.
|
||||||
local Status = "<" .. self:GetState() .. ">"
|
local Status = "<" .. self:GetState() .. ">"
|
||||||
|
|
||||||
|
local Line = 0
|
||||||
|
local LineReport = REPORT:New()
|
||||||
|
|
||||||
for TaskInfoID, TaskInfo in pairs( self.TaskInfo ) do
|
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
|
||||||
|
Report:AddIndent( LineReport:Text( ", " ) )
|
||||||
|
LineReport = REPORT:New()
|
||||||
|
Line = math.floor( TaskInfo.TaskInfoOrder / 10 )
|
||||||
|
end
|
||||||
|
|
||||||
local TaskInfoIDText = string.format( "%s: ", TaskInfoID )
|
local TaskInfoIDText = string.format( "%s: ", TaskInfoID )
|
||||||
|
|
||||||
if type(TaskInfo) == "string" then
|
if type( TaskInfo.TaskInfoText ) == "string" then
|
||||||
Report:Add( TaskInfoIDText .. TaskInfo )
|
LineReport:Add( TaskInfoIDText .. TaskInfo.TaskInfoText )
|
||||||
elseif type(TaskInfo) == "table" then
|
elseif type(TaskInfo) == "table" then
|
||||||
if TaskInfoID == "Coordinates" then
|
if TaskInfoID == "Coordinates" then
|
||||||
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
||||||
local ToCoordinate = TaskInfo -- Core.Point#COORDINATE
|
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
|
||||||
--Report:Add( TaskInfoIDText )
|
--Report:Add( TaskInfoIDText )
|
||||||
Report:Add( ToCoordinate:ToString( ReportGroup ) )
|
LineReport:Add( ToCoordinate:ToString( ReportGroup ) )
|
||||||
--Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
|
--Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
|
||||||
else
|
else
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Report:AddIndent( LineReport:Text( ", " ) )
|
||||||
|
|
||||||
return Report:Text( ", ")
|
return Report:Text()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create a count of the players in the Task.
|
--- Create a count of the players in the Task.
|
||||||
@@ -1457,16 +1477,16 @@ function TASK:ReportDetails( ReportGroup )
|
|||||||
Report:Add( " - Players:" )
|
Report:Add( " - Players:" )
|
||||||
Report:AddIndent( Players )
|
Report:AddIndent( Players )
|
||||||
|
|
||||||
for TaskInfoID, TaskInfo in pairs( self.TaskInfo ) do
|
for TaskInfoID, TaskInfo in pairs( self.TaskInfo, function( t, a, b ) return t[a].TaskInfoOrder < t[b].TaskInfoOrder end ) do
|
||||||
|
|
||||||
local TaskInfoIDText = string.format( " - %s: ", TaskInfoID )
|
local TaskInfoIDText = string.format( " - %s: ", TaskInfoID )
|
||||||
|
|
||||||
if type(TaskInfo) == "string" then
|
if type( TaskInfo.TaskInfoText ) == "string" then
|
||||||
Report:Add( TaskInfoIDText .. TaskInfo )
|
Report:Add( TaskInfoIDText .. TaskInfo.TaskInfoText )
|
||||||
elseif type(TaskInfo) == "table" then
|
elseif type(TaskInfo) == "table" then
|
||||||
if TaskInfoID == "Coordinates" then
|
if TaskInfoID == "Coordinates" then
|
||||||
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
||||||
local ToCoordinate = TaskInfo -- Core.Point#COORDINATE
|
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
|
||||||
Report:Add( TaskInfoIDText )
|
Report:Add( TaskInfoIDText )
|
||||||
Report:AddIndent( ToCoordinate:ToStringBRA( FromCoordinate ) .. ", " .. TaskInfo:ToStringAspect( FromCoordinate ) )
|
Report:AddIndent( ToCoordinate:ToStringBRA( FromCoordinate ) .. ", " .. TaskInfo:ToStringAspect( FromCoordinate ) )
|
||||||
Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
|
Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
|
||||||
|
|||||||
@@ -329,12 +329,12 @@ do -- TASK_A2A_INTERCEPT
|
|||||||
)
|
)
|
||||||
|
|
||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate, 10 )
|
||||||
|
|
||||||
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -452,12 +452,12 @@ do -- TASK_A2A_SWEEP
|
|||||||
)
|
)
|
||||||
|
|
||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate, 10 )
|
||||||
|
|
||||||
self:SetInfo( "Assumed Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Assumed Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Lost Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Lost Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -571,12 +571,12 @@ do -- TASK_A2A_ENGAGE
|
|||||||
)
|
)
|
||||||
|
|
||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate, 10 )
|
||||||
|
|
||||||
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -565,9 +565,9 @@ do -- TASK_A2A_DISPATCHER
|
|||||||
|
|
||||||
if Task then
|
if Task then
|
||||||
local FriendliesCount, FriendliesReport = self:GetFriendliesNearBy( DetectedItem )
|
local FriendliesCount, FriendliesReport = self:GetFriendliesNearBy( DetectedItem )
|
||||||
Task:SetInfo( "Friendlies", string.format( "%d ( %s )", FriendliesCount, FriendliesReport:Text( "," ) ) )
|
Task:SetInfo( "Friendlies", string.format( "%d ( %s )", FriendliesCount, FriendliesReport:Text( "," ) ), 30 )
|
||||||
local PlayersCount, PlayersReport = self:GetPlayerFriendliesNearBy( DetectedItem )
|
local PlayersCount, PlayersReport = self:GetPlayerFriendliesNearBy( DetectedItem )
|
||||||
Task:SetInfo( "Players", string.format( "%d ( %s )", PlayersCount, PlayersReport:Text( "," ) ) )
|
Task:SetInfo( "Players", string.format( "%d ( %s )", PlayersCount, PlayersReport:Text( "," ) ), 31 )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- OK, so the tasking has been done, now delete the changes reported for the area.
|
-- OK, so the tasking has been done, now delete the changes reported for the area.
|
||||||
|
|||||||
@@ -320,12 +320,12 @@ do -- TASK_A2G_SEAD
|
|||||||
)
|
)
|
||||||
|
|
||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate, 10 )
|
||||||
|
|
||||||
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -433,12 +433,12 @@ do -- TASK_A2G_BAI
|
|||||||
)
|
)
|
||||||
|
|
||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate, 10 )
|
||||||
|
|
||||||
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -546,12 +546,12 @@ do -- TASK_A2G_CAS
|
|||||||
)
|
)
|
||||||
|
|
||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate, 10 )
|
||||||
|
|
||||||
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]", 11 )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ), 0 )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20170701_1713' )
|
env.info( 'Moose Generation Timestamp: 20170702_1214' )
|
||||||
|
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user