#GROUP small fix for GetAverageCoordinate()

This commit is contained in:
Applevangelist 2024-01-31 17:49:59 +01:00
parent 7464406a17
commit 531132e8a7

View File

@ -1132,8 +1132,9 @@ function GROUP:GetAverageVec3()
-- Average. -- Average.
local Vec3={x=x/n, y=y/n, z=z/n} --DCS#Vec3 local Vec3={x=x/n, y=y/n, z=z/n} --DCS#Vec3
return Vec3 return Vec3
else
return self:GetVec3()
end end
return nil
end end
--- Returns a POINT_VEC2 object indicating the point in 2D of the first UNIT of the GROUP within the mission. --- Returns a POINT_VEC2 object indicating the point in 2D of the first UNIT of the GROUP within the mission.
@ -1167,8 +1168,13 @@ function GROUP:GetAverageCoordinate()
coord.Heading = Heading coord.Heading = Heading
return coord return coord
else else
BASE:E( { "Cannot GetAverageCoordinate", Group = self, Alive = self:IsAlive() } ) local coord = self:GetCoordinate()
return nil if coord then
return coord
else
BASE:E( { "Cannot GetAverageCoordinate", Group = self, Alive = self:IsAlive() } )
return nil
end
end end
end end