mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Solves a bug in GROUP:IsPartlyInZone()
If only the first UNITs of the GROUP where outside the ZONE, the function would still return false This behaviour is fixed by this commit.
This commit is contained in:
@@ -555,22 +555,23 @@ end
|
||||
function GROUP:IsPartlyInZone( Zone )
|
||||
self:F2( { self.GroupName, Zone } )
|
||||
|
||||
local PartlyInZone = false
|
||||
local IsOneUnitInZone = false
|
||||
local IsOneUnitOutsideZone = false
|
||||
|
||||
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
||||
local Unit = UnitData -- Wrapper.Unit#UNIT
|
||||
if Zone:IsVec3InZone( Unit:GetVec3() ) then
|
||||
PartlyInZone = true
|
||||
IsOneUnitInZone = true
|
||||
else
|
||||
-- So, if there were groups in the zone found, and suddenly one NOT in the zone,
|
||||
-- then the group is partialy in the zone :-)
|
||||
if PartlyInZone == true then
|
||||
return true
|
||||
end
|
||||
IsOneUnitOutsideZone = true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
if IsOneUnitInZone and IsOneUnitOutsideZone then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- Returns true if none of the group units of the group are within a @{Zone}.
|
||||
|
||||
Reference in New Issue
Block a user