mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Check if RecceGroup is alive before iterating...
This commit is contained in:
parent
6959f50777
commit
f628e720a9
@ -2453,13 +2453,15 @@ do -- DETECTION_AREAS
|
|||||||
local DistanceRecce = 1000000000 -- Units are not further than 1000000 km away from an area :-)
|
local DistanceRecce = 1000000000 -- Units are not further than 1000000 km away from an area :-)
|
||||||
|
|
||||||
for RecceGroupName, RecceGroup in pairs( self.DetectionSetGroup:GetSet() ) do
|
for RecceGroupName, RecceGroup in pairs( self.DetectionSetGroup:GetSet() ) do
|
||||||
for RecceUnit, RecceUnit in pairs( RecceGroup:GetUnits() ) do
|
if RecceGroup and RecceGroup:IsAlive() then
|
||||||
if RecceUnit:IsActive() then
|
for RecceUnit, RecceUnit in pairs( RecceGroup:GetUnits() ) do
|
||||||
local RecceUnitCoord = RecceUnit:GetCoordinate()
|
if RecceUnit:IsActive() then
|
||||||
local Distance = RecceUnitCoord:Get2DDistance( self:GetDetectedItemCoordinate( DetectedItem.Index ) )
|
local RecceUnitCoord = RecceUnit:GetCoordinate()
|
||||||
if Distance < DistanceRecce then
|
local Distance = RecceUnitCoord:Get2DDistance( self:GetDetectedItemCoordinate( DetectedItem.Index ) )
|
||||||
DistanceRecce = Distance
|
if Distance < DistanceRecce then
|
||||||
NearestRecce = RecceUnit
|
DistanceRecce = Distance
|
||||||
|
NearestRecce = RecceUnit
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user