mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
OPS
- Added method to reduce asset count for cohorts #2103 - Added tacview on legion level
This commit is contained in:
@@ -577,7 +577,7 @@ function COHORT:AddAsset(Asset)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove asset from chort.
|
||||
--- Remove specific asset from chort.
|
||||
-- @param #COHORT self
|
||||
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The asset.
|
||||
-- @return #COHORT self
|
||||
@@ -609,6 +609,40 @@ function COHORT:DelGroup(GroupName)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Remove assets from pool. Not that assets must not be spawned or already reserved or requested.
|
||||
-- @param #COHORT self
|
||||
-- @param #number N Number of assets to be removed. Default 1.
|
||||
-- @return #COHORT self
|
||||
function COHORT:RemoveAssets(N)
|
||||
self:T2(self.lid..string.format("Remove %d assets of Cohort", N))
|
||||
|
||||
N=N or 1
|
||||
|
||||
local n=0
|
||||
for i=#self.assets,1,-1 do
|
||||
local asset=self.assets[i] --Functional.Warehouse#WAREHOUSE.Assetitem
|
||||
|
||||
self:T2(self.lid..string.format("Checking removing asset %s", asset.spawngroupname))
|
||||
if not (asset.requested or asset.spawned or asset.isReserved) then
|
||||
self:T2(self.lid..string.format("Removing asset %s", asset.spawngroupname))
|
||||
table.remove(self.assets, i)
|
||||
n=n+1
|
||||
else
|
||||
self:T2(self.lid..string.format("Could NOT Remove asset %s", asset.spawngroupname))
|
||||
end
|
||||
|
||||
if n>=N then
|
||||
break
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self:T(self.lid..string.format("Removed %d/%d assets. New asset count=%d", n, N, #self.assets))
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Get name of the cohort.
|
||||
-- @param #COHORT self
|
||||
-- @return #string Name of the cohort.
|
||||
|
||||
Reference in New Issue
Block a user