[ADDED] TARGET:GetObjects() and TARGET:GetCoordinates() in case of SET

This commit is contained in:
shaji 2025-05-24 11:18:41 +02:00
parent d0449265c1
commit d3b62d0260

View File

@ -1715,6 +1715,26 @@ function TARGET:GetAverageCoordinate()
return nil
end
--- Get coordinates of all targets. (e.g. for a SET_STATIC)
-- @param #TARGET self
-- @return #table Table with coordinates of all targets.
function TARGET:GetCoordinates()
local coordinates={}
for _,_target in pairs(self.targets) do
local target=_target --#TARGET.Object
local coordinate=self:GetTargetCoordinate(target)
if coordinate then
table.insert(coordinates, coordinate)
end
end
return coordinates
end
--- Get heading of target.
-- @param #TARGET self
-- @return #number Heading of the target in degrees.
@ -1968,6 +1988,21 @@ function TARGET:GetObject(RefCoordinate, Coalitions)
return nil
end
--- Get all target objects.
-- @param #TARGET self
-- @return #table List of target objects.
function TARGET:GetObjects()
local objects={}
for _,_target in pairs(self.targets) do
local target=_target --#TARGET.Object
table.insert(objects, target.Object)
end
return objects
end
--- Count alive objects.
-- @param #TARGET self
-- @param #TARGET.Object Target Target objective.