mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Correct creation and interpretation of the HasRadar function for SET_UNIT.
Fixed SEAD_Process bug. Now the SEAD targets are correctly calculated.
This commit is contained in:
@@ -276,12 +276,14 @@ function TASK_DISPATCHER:EvaluateTaskSEAD( Mission, DetectedArea )
|
|||||||
-- Determine if the set has radar targets. If it does, construct a SEAD task.
|
-- Determine if the set has radar targets. If it does, construct a SEAD task.
|
||||||
local RadarCount = DetectedSet:HasRadar( Unit.RadarType.AS )
|
local RadarCount = DetectedSet:HasRadar( Unit.RadarType.AS )
|
||||||
DetectedArea.Tasks = DetectedArea.Tasks or {}
|
DetectedArea.Tasks = DetectedArea.Tasks or {}
|
||||||
|
self:E(RadarCount)
|
||||||
if RadarCount > 0 then
|
if RadarCount > 0 then
|
||||||
if not DetectedArea.Tasks.SEADTask 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.
|
-- 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()
|
local TargetSetUnit = SET_UNIT:New()
|
||||||
TargetSetUnit:CopyFilter( DetectedSet )
|
TargetSetUnit:CopyFilter( DetectedSet )
|
||||||
TargetSetUnit:FilterHasRadar( Unit.RadarType.AS )
|
TargetSetUnit:FilterHasRadar( Unit.RadarType.AS )
|
||||||
|
self:E( TargetSetUnit.Filter )
|
||||||
TargetSetUnit:FilterStart()
|
TargetSetUnit:FilterStart()
|
||||||
local Task = TASK_SEAD:New( Mission, TargetSetUnit, DetectedZone )
|
local Task = TASK_SEAD:New( Mission, TargetSetUnit, DetectedZone )
|
||||||
self.Mission:AddTask( Task )
|
self.Mission:AddTask( Task )
|
||||||
|
|||||||
@@ -1454,7 +1454,8 @@ function SET_UNIT:IsIncludeObject( MUnit )
|
|||||||
local MUnitRadar = false
|
local MUnitRadar = false
|
||||||
for RadarTypeID, RadarType in pairs( self.Filter.RadarTypes ) do
|
for RadarTypeID, RadarType in pairs( self.Filter.RadarTypes ) do
|
||||||
self:E( { "Radar:", RadarType } )
|
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
|
MUnitRadar = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -352,6 +352,7 @@ function UNIT:HasSensors( ... )
|
|||||||
local DCSUnit = self:GetDCSObject()
|
local DCSUnit = self:GetDCSObject()
|
||||||
|
|
||||||
if DCSUnit then
|
if DCSUnit then
|
||||||
|
self:E( arg )
|
||||||
local HasSensors = DCSUnit:hasSensors( unpack( arg ) )
|
local HasSensors = DCSUnit:hasSensors( unpack( arg ) )
|
||||||
return HasSensors
|
return HasSensors
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user