From def75889ad58673e0462db16b49fe5001a4db9f1 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sun, 10 Jul 2016 15:03:25 +0200 Subject: [PATCH] Correct creation and interpretation of the HasRadar function for SET_UNIT. Fixed SEAD_Process bug. Now the SEAD targets are correctly calculated. --- Moose Development/Moose/DetectionManager.lua | 2 ++ Moose Development/Moose/Set.lua | 3 ++- Moose Development/Moose/Unit.lua | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/DetectionManager.lua b/Moose Development/Moose/DetectionManager.lua index a2a9fd869..aeaf51fd6 100644 --- a/Moose Development/Moose/DetectionManager.lua +++ b/Moose Development/Moose/DetectionManager.lua @@ -276,12 +276,14 @@ function TASK_DISPATCHER:EvaluateTaskSEAD( Mission, DetectedArea ) -- Determine if the set has radar targets. If it does, construct a SEAD task. local RadarCount = DetectedSet:HasRadar( Unit.RadarType.AS ) DetectedArea.Tasks = DetectedArea.Tasks or {} + self:E(RadarCount) if RadarCount > 0 then if not DetectedArea.Tasks.SEADTask then -- Here we're doing something advanced... We're copying the DetectedSet, but making a new Set only with Radar units in it. local TargetSetUnit = SET_UNIT:New() TargetSetUnit:CopyFilter( DetectedSet ) TargetSetUnit:FilterHasRadar( Unit.RadarType.AS ) + self:E( TargetSetUnit.Filter ) TargetSetUnit:FilterStart() local Task = TASK_SEAD:New( Mission, TargetSetUnit, DetectedZone ) self.Mission:AddTask( Task ) diff --git a/Moose Development/Moose/Set.lua b/Moose Development/Moose/Set.lua index b4555773f..b01e8203b 100644 --- a/Moose Development/Moose/Set.lua +++ b/Moose Development/Moose/Set.lua @@ -1454,7 +1454,8 @@ function SET_UNIT:IsIncludeObject( MUnit ) local MUnitRadar = false for RadarTypeID, RadarType in pairs( self.Filter.RadarTypes ) do self:E( { "Radar:", RadarType } ) - if MUnit:HasSensors( Unit.SensorType.RADAR, RadarType ) then + if MUnit:HasSensors( Unit.SensorType.RADAR, RadarType ) == true then + self:E( "RADAR Found" ) MUnitRadar = true end end diff --git a/Moose Development/Moose/Unit.lua b/Moose Development/Moose/Unit.lua index 58eb8923e..2202e7022 100644 --- a/Moose Development/Moose/Unit.lua +++ b/Moose Development/Moose/Unit.lua @@ -352,6 +352,7 @@ function UNIT:HasSensors( ... ) local DCSUnit = self:GetDCSObject() if DCSUnit then + self:E( arg ) local HasSensors = DCSUnit:hasSensors( unpack( arg ) ) return HasSensors end