This commit is contained in:
FlightControl_Master 2018-03-17 08:02:25 +01:00
parent 9be9277a08
commit d672983c11
6 changed files with 14 additions and 12 deletions

View File

@ -2963,7 +2963,7 @@ do -- AI_A2A_DISPATCHER
end end
else else
if DefenderTask.Target then if DefenderTask.Target then
local AttackerItem = Detection:GetDetectedItem( DefenderTask.Target.Index ) local AttackerItem = Detection:GetDetectedItemByIndex( DefenderTask.Target.Index )
if not AttackerItem then if not AttackerItem then
self:F( { "Removing obsolete Target:", DefenderTask.Target.Index } ) self:F( { "Removing obsolete Target:", DefenderTask.Target.Index } )
self:ClearDefenderTaskTarget( AIGroup ) self:ClearDefenderTaskTarget( AIGroup )

View File

@ -938,7 +938,7 @@ do -- DESIGNATE
for DesignateIndex, Designating in pairs( self.Designating ) do for DesignateIndex, Designating in pairs( self.Designating ) do
local DetectedItem = self.Detection:GetDetectedItem( DesignateIndex ) local DetectedItem = self.Detection:GetDetectedItemByIndex( DesignateIndex )
if DetectedItem then if DetectedItem then

View File

@ -275,6 +275,7 @@ do -- DETECTION_BASE
DetectionRun = 0, DetectionRun = 0,
DetectedObjectsIdentified = {}, DetectedObjectsIdentified = {},
DetectedItems = {}, DetectedItems = {},
DetectedItemsByIndex = {},
} }
--- @type DETECTION_BASE.DetectedObjects --- @type DETECTION_BASE.DetectedObjects
@ -1470,7 +1471,7 @@ do -- DETECTION_BASE
if DetectedItemKey then if DetectedItemKey then
self.DetectedItems[DetectedItemKey] = DetectedItem self.DetectedItems[DetectedItemKey] = DetectedItem
else else
self.DetectedItemsByIndex[self.DetectedItemMax] = DetectedItem self.DetectedItems[self.DetectedItemMax] = DetectedItem
end end
self.DetectedItemsByIndex[self.DetectedItemMax] = DetectedItem self.DetectedItemsByIndex[self.DetectedItemMax] = DetectedItem

View File

@ -507,7 +507,7 @@ do -- TASK_A2A_DISPATCHER
for TaskIndex, TaskData in pairs( self.Tasks ) do for TaskIndex, TaskData in pairs( self.Tasks ) do
local Task = TaskData -- Tasking.Task#TASK local Task = TaskData -- Tasking.Task#TASK
if Task:IsStatePlanned() then if Task:IsStatePlanned() then
local DetectedItem = Detection:GetDetectedItem( TaskIndex ) local DetectedItem = Detection:GetDetectedItemByIndex( TaskIndex )
if not DetectedItem then if not DetectedItem then
local TaskText = Task:GetName() local TaskText = Task:GetName()
for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do

View File

@ -310,13 +310,13 @@ do -- TASK_A2G
function TASK_A2G:UpdateTaskInfo( DetectedItem ) function TASK_A2G:UpdateTaskInfo( DetectedItem )
if self:IsStatePlanned() or self:IsStateAssigned() then if self:IsStatePlanned() or self:IsStateAssigned() then
local TargetCoordinate = DetectedItem and self.Detection:GetDetectedItemCoordinate( self.DetectedItem ) or self.TargetSetUnit:GetFirst():GetCoordinate() local TargetCoordinate = DetectedItem and self.Detection:GetDetectedItemCoordinate( DetectedItem ) or self.TargetSetUnit:GetFirst():GetCoordinate()
self.TaskInfo:AddTaskName( 0, "MSOD" ) self.TaskInfo:AddTaskName( 0, "MSOD" )
self.TaskInfo:AddCoordinate( TargetCoordinate, 1, "SOD" ) self.TaskInfo:AddCoordinate( TargetCoordinate, 1, "SOD" )
local ThreatLevel, ThreatText local ThreatLevel, ThreatText
if DetectedItem then if DetectedItem then
ThreatLevel, ThreatText = self.Detection:GetDetectedItemThreatLevel( self.DetectedItem ) ThreatLevel, ThreatText = self.Detection:GetDetectedItemThreatLevel( DetectedItem )
else else
ThreatLevel, ThreatText = self.TargetSetUnit:CalculateThreatLevelA2G() ThreatLevel, ThreatText = self.TargetSetUnit:CalculateThreatLevelA2G()
end end

View File

@ -575,7 +575,7 @@ do -- TASK_A2G_DISPATCHER
for TaskIndex, TaskData in pairs( self.Tasks ) do for TaskIndex, TaskData in pairs( self.Tasks ) do
local Task = TaskData -- Tasking.Task#TASK local Task = TaskData -- Tasking.Task#TASK
if Task:IsStatePlanned() then if Task:IsStatePlanned() then
local DetectedItem = Detection:GetDetectedItem( TaskIndex ) local DetectedItem = Detection:GetDetectedItemByIndex( TaskIndex )
if not DetectedItem then if not DetectedItem then
local TaskText = Task:GetName() local TaskText = Task:GetName()
for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
@ -663,6 +663,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateSEAD( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed... local TargetSetUnit = self:EvaluateSEAD( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed...
if TargetSetUnit then if TargetSetUnit then
Task:SetTargetSetUnit( TargetSetUnit ) Task:SetTargetSetUnit( TargetSetUnit )
Task:SetDetection( Detection, DetectedItem )
Task:UpdateTaskInfo( DetectedItem ) Task:UpdateTaskInfo( DetectedItem )
else else
Task:Cancel() Task:Cancel()
@ -673,7 +674,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be CASed... local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be CASed...
if TargetSetUnit then if TargetSetUnit then
Task:SetTargetSetUnit( TargetSetUnit ) Task:SetTargetSetUnit( TargetSetUnit )
Task:SetDetection( Detection, TaskIndex ) Task:SetDetection( Detection, DetectedItem )
Task:UpdateTaskInfo( DetectedItem ) Task:UpdateTaskInfo( DetectedItem )
else else
Task:Cancel() Task:Cancel()
@ -684,7 +685,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateBAI( DetectedItem ) -- Returns a SetUnit if there are targets to be BAIed... local TargetSetUnit = self:EvaluateBAI( DetectedItem ) -- Returns a SetUnit if there are targets to be BAIed...
if TargetSetUnit then if TargetSetUnit then
Task:SetTargetSetUnit( TargetSetUnit ) Task:SetTargetSetUnit( TargetSetUnit )
Task:SetDetection( Detection, TaskIndex ) Task:SetDetection( Detection, DetectedItem )
Task:UpdateTaskInfo( DetectedItem ) Task:UpdateTaskInfo( DetectedItem )
else else
Task:Cancel() Task:Cancel()
@ -705,7 +706,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateSEAD( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed... local TargetSetUnit = self:EvaluateSEAD( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed...
if TargetSetUnit then if TargetSetUnit then
Task = TASK_A2G_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", DetectedItemID ), TargetSetUnit ) Task = TASK_A2G_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", DetectedItemID ), TargetSetUnit )
Task:SetDetection( Detection, TaskIndex ) Task:SetDetection( Detection, DetectedItem )
end end
-- Evaluate CAS -- Evaluate CAS
@ -713,7 +714,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be CASed... local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be CASed...
if TargetSetUnit then if TargetSetUnit then
Task = TASK_A2G_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", DetectedItemID ), TargetSetUnit ) Task = TASK_A2G_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", DetectedItemID ), TargetSetUnit )
Task:SetDetection( Detection, TaskIndex ) Task:SetDetection( Detection, DetectedItem )
end end
-- Evaluate BAI -- Evaluate BAI
@ -721,7 +722,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateBAI( DetectedItem, self.Mission:GetCommandCenter():GetPositionable():GetCoalition() ) -- Returns a SetUnit if there are targets to be BAIed... local TargetSetUnit = self:EvaluateBAI( DetectedItem, self.Mission:GetCommandCenter():GetPositionable():GetCoalition() ) -- Returns a SetUnit if there are targets to be BAIed...
if TargetSetUnit then if TargetSetUnit then
Task = TASK_A2G_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", DetectedItemID ), TargetSetUnit ) Task = TASK_A2G_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", DetectedItemID ), TargetSetUnit )
Task:SetDetection( Detection, TaskIndex ) Task:SetDetection( Detection, DetectedItem )
end end
end end
end end