mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
DETECTION, SET, ARTY, WAREHOUSE, AIRBOSS, A2A_DISPATCHER
DETECTION - Fixed bug with late activated groups. ARTY v1.1.2 - Added attack group task for ships. - Added respawn option. WAREHOUSE v0.9.5 - Added respawn option. AIRBOSS v1.0.3 - Recovery time extended if flights are still in the pattern. SET - Added CountAlive() function. A2A_DISPATCHER - Bug fixes in :ParkDefender() function.
This commit is contained in:
@@ -1571,6 +1571,35 @@ do -- SET_GROUP
|
||||
return Count
|
||||
end
|
||||
|
||||
--- Iterate the SET_GROUP and count how many GROUPs and UNITs are alive.
|
||||
-- @param #SET_GROUP self
|
||||
-- @return #number The number of GROUPs completely in the Zone
|
||||
-- @return #number The number of UNITS alive.
|
||||
function SET_GROUP: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.
|
||||
for _,_unit in pairs(GroupData:GetUnits()) do
|
||||
local unit=_unit --Wrapper.Unit#UNIT
|
||||
if unit and unit:IsAlive() then
|
||||
CountU=CountU+1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return CountG,CountU
|
||||
end
|
||||
|
||||
----- Iterate the SET_GROUP and call an interator function for each **alive** player, providing the Group of the player and optional parameters.
|
||||
---- @param #SET_GROUP self
|
||||
---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a GROUP parameter.
|
||||
|
||||
Reference in New Issue
Block a user