From d672983c1161e360a5f499d7589e6813c48a92f8 Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Sat, 17 Mar 2018 08:02:25 +0100 Subject: [PATCH] Progress --- Moose Development/Moose/AI/AI_A2A_Dispatcher.lua | 2 +- Moose Development/Moose/Functional/Designate.lua | 2 +- Moose Development/Moose/Functional/Detection.lua | 3 ++- .../Moose/Tasking/Task_A2A_Dispatcher.lua | 2 +- Moose Development/Moose/Tasking/Task_A2G.lua | 4 ++-- .../Moose/Tasking/Task_A2G_Dispatcher.lua | 13 +++++++------ 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua index 076aa20a8..cb199fce0 100644 --- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua +++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua @@ -2963,7 +2963,7 @@ do -- AI_A2A_DISPATCHER end else if DefenderTask.Target then - local AttackerItem = Detection:GetDetectedItem( DefenderTask.Target.Index ) + local AttackerItem = Detection:GetDetectedItemByIndex( DefenderTask.Target.Index ) if not AttackerItem then self:F( { "Removing obsolete Target:", DefenderTask.Target.Index } ) self:ClearDefenderTaskTarget( AIGroup ) diff --git a/Moose Development/Moose/Functional/Designate.lua b/Moose Development/Moose/Functional/Designate.lua index 46aebc274..c42e1a7ed 100644 --- a/Moose Development/Moose/Functional/Designate.lua +++ b/Moose Development/Moose/Functional/Designate.lua @@ -938,7 +938,7 @@ do -- DESIGNATE for DesignateIndex, Designating in pairs( self.Designating ) do - local DetectedItem = self.Detection:GetDetectedItem( DesignateIndex ) + local DetectedItem = self.Detection:GetDetectedItemByIndex( DesignateIndex ) if DetectedItem then diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua index 50b97cce5..4b46516e7 100644 --- a/Moose Development/Moose/Functional/Detection.lua +++ b/Moose Development/Moose/Functional/Detection.lua @@ -275,6 +275,7 @@ do -- DETECTION_BASE DetectionRun = 0, DetectedObjectsIdentified = {}, DetectedItems = {}, + DetectedItemsByIndex = {}, } --- @type DETECTION_BASE.DetectedObjects @@ -1470,7 +1471,7 @@ do -- DETECTION_BASE if DetectedItemKey then self.DetectedItems[DetectedItemKey] = DetectedItem else - self.DetectedItemsByIndex[self.DetectedItemMax] = DetectedItem + self.DetectedItems[self.DetectedItemMax] = DetectedItem end self.DetectedItemsByIndex[self.DetectedItemMax] = DetectedItem diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua index c577919fd..99b429486 100644 --- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua +++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua @@ -507,7 +507,7 @@ do -- TASK_A2A_DISPATCHER for TaskIndex, TaskData in pairs( self.Tasks ) do local Task = TaskData -- Tasking.Task#TASK if Task:IsStatePlanned() then - local DetectedItem = Detection:GetDetectedItem( TaskIndex ) + local DetectedItem = Detection:GetDetectedItemByIndex( TaskIndex ) if not DetectedItem then local TaskText = Task:GetName() for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do diff --git a/Moose Development/Moose/Tasking/Task_A2G.lua b/Moose Development/Moose/Tasking/Task_A2G.lua index 4251495ce..78e19e562 100644 --- a/Moose Development/Moose/Tasking/Task_A2G.lua +++ b/Moose Development/Moose/Tasking/Task_A2G.lua @@ -310,13 +310,13 @@ do -- TASK_A2G function TASK_A2G:UpdateTaskInfo( DetectedItem ) 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:AddCoordinate( TargetCoordinate, 1, "SOD" ) local ThreatLevel, ThreatText if DetectedItem then - ThreatLevel, ThreatText = self.Detection:GetDetectedItemThreatLevel( self.DetectedItem ) + ThreatLevel, ThreatText = self.Detection:GetDetectedItemThreatLevel( DetectedItem ) else ThreatLevel, ThreatText = self.TargetSetUnit:CalculateThreatLevelA2G() end diff --git a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua index 058e25cb5..d6fbe0a95 100644 --- a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua +++ b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua @@ -575,7 +575,7 @@ do -- TASK_A2G_DISPATCHER for TaskIndex, TaskData in pairs( self.Tasks ) do local Task = TaskData -- Tasking.Task#TASK if Task:IsStatePlanned() then - local DetectedItem = Detection:GetDetectedItem( TaskIndex ) + local DetectedItem = Detection:GetDetectedItemByIndex( TaskIndex ) if not DetectedItem then local TaskText = Task:GetName() 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... if TargetSetUnit then Task:SetTargetSetUnit( TargetSetUnit ) + Task:SetDetection( Detection, DetectedItem ) Task:UpdateTaskInfo( DetectedItem ) else 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... if TargetSetUnit then Task:SetTargetSetUnit( TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) Task:UpdateTaskInfo( DetectedItem ) else 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... if TargetSetUnit then Task:SetTargetSetUnit( TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) Task:UpdateTaskInfo( DetectedItem ) else 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... if TargetSetUnit then Task = TASK_A2G_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", DetectedItemID ), TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) end -- 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... if TargetSetUnit then Task = TASK_A2G_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", DetectedItemID ), TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) end -- 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... if TargetSetUnit then 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