mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
[ADDED] SET_OPSGROUP:CountAlive
This commit is contained in:
parent
362652ac6c
commit
b51e758516
@ -7865,6 +7865,28 @@ do -- SET_OPSGROUP
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Iterate the SET_OPSGROUP and count how many GROUPs and UNITs are alive.
|
||||||
|
-- @param #SET_GROUP self
|
||||||
|
-- @return #number The number of GROUPs alive.
|
||||||
|
-- @return #number The number of UNITs alive.
|
||||||
|
function SET_OPSGROUP:CountAlive()
|
||||||
|
local CountG = 0
|
||||||
|
local CountU = 0
|
||||||
|
|
||||||
|
local Set = self:GetSet()
|
||||||
|
|
||||||
|
for GroupID, GroupData in pairs( Set ) do -- For each GROUP in SET_GROUP
|
||||||
|
if GroupData and GroupData:IsAlive() then
|
||||||
|
CountG = CountG + 1
|
||||||
|
-- Count Units.
|
||||||
|
CountU = CountU + GroupData:GetGroup():CountAliveUnits()
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return CountG, CountU
|
||||||
|
end
|
||||||
|
|
||||||
--- Finds an OPSGROUP based on the group name.
|
--- Finds an OPSGROUP based on the group name.
|
||||||
-- @param #SET_OPSGROUP self
|
-- @param #SET_OPSGROUP self
|
||||||
-- @param #string GroupName Name of the group.
|
-- @param #string GroupName Name of the group.
|
||||||
|
|||||||
@ -361,15 +361,17 @@ function POSITIONABLE:GetCoord()
|
|||||||
-- Get the current position.
|
-- Get the current position.
|
||||||
local PositionableVec3 = self:GetVec3()
|
local PositionableVec3 = self:GetVec3()
|
||||||
|
|
||||||
if self.coordinate then
|
if PositionableVec3 then
|
||||||
-- Update COORDINATE from 3D vector.
|
if self.coordinate then
|
||||||
self.coordinate:UpdateFromVec3( PositionableVec3 )
|
-- Update COORDINATE from 3D vector.
|
||||||
else
|
self.coordinate:UpdateFromVec3( PositionableVec3 )
|
||||||
-- New COORDINATE.
|
else
|
||||||
self.coordinate = COORDINATE:NewFromVec3( PositionableVec3 )
|
-- New COORDINATE.
|
||||||
end
|
self.coordinate = COORDINATE:NewFromVec3( PositionableVec3 )
|
||||||
|
end
|
||||||
|
|
||||||
return self.coordinate
|
return self.coordinate
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Error message.
|
-- Error message.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user