mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-11 03:43:38 +00:00
CVW
This commit is contained in:
@@ -38,6 +38,7 @@ CVW = {
|
||||
carriername = nil,
|
||||
menu = nil,
|
||||
squadrons = nil,
|
||||
taskqueue = {},
|
||||
}
|
||||
|
||||
--- Squadron
|
||||
@@ -75,7 +76,7 @@ CVW.Task={
|
||||
TANKER="Tanker",
|
||||
}
|
||||
|
||||
--- FlightControl class version.
|
||||
--- CVW class version.
|
||||
-- @field #string version
|
||||
CVW.version="0.0.5"
|
||||
|
||||
@@ -251,7 +252,7 @@ function CVW:GetSquadron(name)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Status
|
||||
-- Start & Status
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Start CVW FSM.
|
||||
@@ -285,6 +286,33 @@ function CVW:onafterAirwingStatus(From, Event, To)
|
||||
-- Info text.
|
||||
local text=string.format("State %s", fsmstate)
|
||||
self:I(self.sid..text)
|
||||
|
||||
local text="Squadrons:"
|
||||
for i,_squadron in pairs(self.squadrons) do
|
||||
local squadron=_squadron --#CVW.Squadron
|
||||
|
||||
|
||||
text=text..string.format("\n %s", squadron.name)
|
||||
|
||||
for j,_asset in pairs(squadron.assets) do
|
||||
local asset=_asset --Functional.Warehouse#WAREHOUSE.Assetitem
|
||||
local assignment=asset.assignment or "none"
|
||||
local name=asset.templatename
|
||||
local task=asset.CVWtask or "none"
|
||||
local spawned=tostring(asset.spawned)
|
||||
local groupname=asset.spawngroupname
|
||||
local group=nil --Wrapper.Group#GROUP
|
||||
local typename=asset.unittype
|
||||
local fuel=100
|
||||
if groupname then
|
||||
group=GROUP:FindByName(groupname)
|
||||
fuel=group:GetFuelMin()
|
||||
end
|
||||
|
||||
text=text..string.format("\n-[%d] %s*%d: spawned=%s, task=%s, fuel=%d", j, typename, asset.nunits, task)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
self:__AirwingStatus(-30)
|
||||
end
|
||||
@@ -315,6 +343,12 @@ function CVW:onafterRequestCAP(From, Event, To, coordinate, altitude, leg, headi
|
||||
function self:OnAfterSelfRequest(From,Event,To,Groupset,Request)
|
||||
local request=Request --Functional.Warehouse#WAREHOUSE.Pendingitem
|
||||
local groupset=Groupset --Core.Set#SET_GROUP
|
||||
|
||||
for _,_asset in pairs(request.assets) do
|
||||
local asset=_asset --Functional.Warehouse#WAREHOUSE.Assetitem
|
||||
|
||||
local a=asset.cargobay
|
||||
end
|
||||
|
||||
if Request.assignment==CVW.Task.CAP then
|
||||
|
||||
@@ -364,6 +398,18 @@ function CVW:LaunchCAP(group, capcoord, alt, leg, heading, speed)
|
||||
group:Route(wp)
|
||||
end
|
||||
|
||||
--- Create a new task name.
|
||||
-- @param #CVW self
|
||||
-- @param #string task Task of type @{#CVW.Task}.
|
||||
-- @string Task name, e.g. Task0001_CAP, Task0002_BAI, Task0003_INTERCEPT, ...
|
||||
function CVW:_NewTaskName(task)
|
||||
|
||||
self.ntasks=self.ntasks+1
|
||||
|
||||
local taskname=string.format("Task#%04d_%s", self.ntasks, task)
|
||||
|
||||
return taskname
|
||||
end
|
||||
|
||||
|
||||
--- Request Intercept.
|
||||
@@ -402,6 +448,10 @@ function CVW:onafterRequestIntercept(From, Event, To, bandits, squadron)
|
||||
|
||||
end
|
||||
|
||||
function CVW:OnAfterSelfRequest(From,Event,To,groupset,request)
|
||||
|
||||
end
|
||||
|
||||
--- Launch a flight group to intercept an intruder.
|
||||
-- @param #CVW self
|
||||
-- @param Wrapper.Group#GROUP group Interceptor flight group.
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
-- @field Functional.Warehouse#WAREHOUSE warehouse The warehouse of the carrier.
|
||||
-- @field Functional.Artillery#ARTY arty The artillery object of the carrier.
|
||||
-- @field #table intruders Table of intruders, i.e. groups inside the CCA. Each element is of type #SKIPPPER.Intruder.
|
||||
-- @field Ops.CarrierAirWing#CVW cvw Carrier Air Wing.
|
||||
-- @extends Ops.Airboss#AIRBOSS
|
||||
|
||||
--- Be surprised!
|
||||
@@ -44,6 +45,7 @@ SKIPPER = {
|
||||
warehouse = nil,
|
||||
arty = nil,
|
||||
intruders = {},
|
||||
cvw = nil,
|
||||
}
|
||||
|
||||
--- Intruder.
|
||||
|
||||
Reference in New Issue
Block a user