mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
OPS
- Added method to reduce asset count for cohorts #2103 - Added tacview on legion level
This commit is contained in:
parent
f74c0e29a5
commit
1a0e2e0ea1
@ -1042,6 +1042,9 @@ function AIRWING:onafterStatus(From, Event, To)
|
|||||||
-- Check Recon missions.
|
-- Check Recon missions.
|
||||||
self:CheckRECON()
|
self:CheckRECON()
|
||||||
|
|
||||||
|
-- Display tactival overview.
|
||||||
|
self:_TacticalOverview()
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
-- Transport ---
|
-- Transport ---
|
||||||
----------------
|
----------------
|
||||||
|
|||||||
@ -491,6 +491,9 @@ function BRIGADE:onafterStatus(From, Event, To)
|
|||||||
-- Info ---
|
-- Info ---
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
-- Display tactival overview.
|
||||||
|
self:_TacticalOverview()
|
||||||
|
|
||||||
-- General info:
|
-- General info:
|
||||||
if self.verbose>=1 then
|
if self.verbose>=1 then
|
||||||
|
|
||||||
|
|||||||
@ -577,7 +577,7 @@ function COHORT:AddAsset(Asset)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Remove asset from chort.
|
--- Remove specific asset from chort.
|
||||||
-- @param #COHORT self
|
-- @param #COHORT self
|
||||||
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The asset.
|
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The asset.
|
||||||
-- @return #COHORT self
|
-- @return #COHORT self
|
||||||
@ -609,6 +609,40 @@ function COHORT:DelGroup(GroupName)
|
|||||||
return self
|
return self
|
||||||
end
|
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.
|
--- Get name of the cohort.
|
||||||
-- @param #COHORT self
|
-- @param #COHORT self
|
||||||
-- @return #string Name of the cohort.
|
-- @return #string Name of the cohort.
|
||||||
|
|||||||
@ -334,6 +334,9 @@ function FLEET:onafterStatus(From, Event, To)
|
|||||||
-- Info ---
|
-- Info ---
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
-- Display tactival overview.
|
||||||
|
self:_TacticalOverview()
|
||||||
|
|
||||||
-- General info:
|
-- General info:
|
||||||
if self.verbose>=1 then
|
if self.verbose>=1 then
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
-- @field #table cohorts Cohorts of this legion.
|
-- @field #table cohorts Cohorts of this legion.
|
||||||
-- @field Ops.Commander#COMMANDER commander Commander of this legion.
|
-- @field Ops.Commander#COMMANDER commander Commander of this legion.
|
||||||
-- @field Ops.Chief#CHIEF chief Chief of this legion.
|
-- @field Ops.Chief#CHIEF chief Chief of this legion.
|
||||||
|
-- @field #boolean tacview If `true`, show tactical overview on status update.
|
||||||
-- @extends Functional.Warehouse#WAREHOUSE
|
-- @extends Functional.Warehouse#WAREHOUSE
|
||||||
|
|
||||||
--- *Per aspera ad astra.*
|
--- *Per aspera ad astra.*
|
||||||
@ -322,6 +323,14 @@ function LEGION:SetVerbosity(VerbosityLevel)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set tactical overview on.
|
||||||
|
-- @param #LEGION self
|
||||||
|
-- @return #LEGION self
|
||||||
|
function LEGION:SetTacticalOverviewOn()
|
||||||
|
self.tacview=true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Add a mission for the legion. It will pick the best available assets for the mission and lauch it when ready.
|
--- Add a mission for the legion. It will pick the best available assets for the mission and lauch it when ready.
|
||||||
-- @param #LEGION self
|
-- @param #LEGION self
|
||||||
-- @param Ops.Auftrag#AUFTRAG Mission Mission for this legion.
|
-- @param Ops.Auftrag#AUFTRAG Mission Mission for this legion.
|
||||||
@ -1772,7 +1781,7 @@ end
|
|||||||
-- Mission Functions
|
-- Mission Functions
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- Create a new flight group after an asset was spawned.
|
--- Create a new OPS group after an asset was spawned.
|
||||||
-- @param #LEGION self
|
-- @param #LEGION self
|
||||||
-- @param Functional.Warehouse#WAREHOUSE.Assetitem asset The asset.
|
-- @param Functional.Warehouse#WAREHOUSE.Assetitem asset The asset.
|
||||||
-- @return Ops.FlightGroup#FLIGHTGROUP The created flightgroup object.
|
-- @return Ops.FlightGroup#FLIGHTGROUP The created flightgroup object.
|
||||||
@ -1836,6 +1845,53 @@ function LEGION:_CreateFlightGroup(asset)
|
|||||||
return opsgroup
|
return opsgroup
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Display tactical overview.
|
||||||
|
-- @param #LEGION self
|
||||||
|
function LEGION:_TacticalOverview()
|
||||||
|
|
||||||
|
if self.tacview then
|
||||||
|
|
||||||
|
local NassetsTotal=self:CountAssets(nil)
|
||||||
|
local NassetsStock=self:CountAssets(true)
|
||||||
|
local NassetsActiv=self:CountAssets(false)
|
||||||
|
|
||||||
|
local NmissionsTotal=#self.missionqueue
|
||||||
|
local NmissionsRunni=self:CountMissionsInQueue()
|
||||||
|
|
||||||
|
-- Info message
|
||||||
|
local text=string.format("Tactical Overview %s\n", self.alias)
|
||||||
|
text=text..string.format("===================================\n")
|
||||||
|
|
||||||
|
-- Asset info.
|
||||||
|
text=text..string.format("Assets: %d [Active=%d, Stock=%d]\n", NassetsTotal, NassetsActiv, NassetsStock)
|
||||||
|
|
||||||
|
-- Mission info.
|
||||||
|
text=text..string.format("Missions: %d [Running=%d]\n", NmissionsTotal, NmissionsRunni)
|
||||||
|
for _,mtype in pairs(AUFTRAG.Type) do
|
||||||
|
local n=self:CountMissionsInQueue(mtype)
|
||||||
|
if n>0 then
|
||||||
|
local N=self:CountMissionsInQueue(mtype)
|
||||||
|
text=text..string.format(" - %s: %d [Running=%d]\n", mtype, n, N)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local Ntransports=#self.transportqueue
|
||||||
|
if Ntransports>0 then
|
||||||
|
text=text..string.format("Transports: %d\n", Ntransports)
|
||||||
|
for _,_transport in pairs(self.transportqueue) do
|
||||||
|
local transport=_transport --Ops.OpsTransport#OPSTRANSPORT
|
||||||
|
text=text..string.format(" - %s", transport:GetState())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Message to coalition.
|
||||||
|
MESSAGE:New(text, 60, nil, true):ToCoalition(self:GetCoalition())
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- Check if an asset is currently on a mission (STARTED or EXECUTING).
|
--- Check if an asset is currently on a mission (STARTED or EXECUTING).
|
||||||
-- @param #LEGION self
|
-- @param #LEGION self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user