This commit is contained in:
funkyfranky
2019-08-07 16:49:26 +02:00
parent eb37f9b18c
commit 414196afc6
2 changed files with 54 additions and 2 deletions
+52 -2
View File
@@ -38,6 +38,7 @@ CVW = {
carriername = nil, carriername = nil,
menu = nil, menu = nil,
squadrons = nil, squadrons = nil,
taskqueue = {},
} }
--- Squadron --- Squadron
@@ -75,7 +76,7 @@ CVW.Task={
TANKER="Tanker", TANKER="Tanker",
} }
--- FlightControl class version. --- CVW class version.
-- @field #string version -- @field #string version
CVW.version="0.0.5" CVW.version="0.0.5"
@@ -251,7 +252,7 @@ function CVW:GetSquadron(name)
end end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Status -- Start & Status
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Start CVW FSM. --- Start CVW FSM.
@@ -286,6 +287,33 @@ function CVW:onafterAirwingStatus(From, Event, To)
local text=string.format("State %s", fsmstate) local text=string.format("State %s", fsmstate)
self:I(self.sid..text) 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) self:__AirwingStatus(-30)
end end
@@ -316,6 +344,12 @@ function CVW:onafterRequestCAP(From, Event, To, coordinate, altitude, leg, headi
local request=Request --Functional.Warehouse#WAREHOUSE.Pendingitem local request=Request --Functional.Warehouse#WAREHOUSE.Pendingitem
local groupset=Groupset --Core.Set#SET_GROUP 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 if Request.assignment==CVW.Task.CAP then
for _,_group in pairs(groupset:GetSet()) do for _,_group in pairs(groupset:GetSet()) do
@@ -364,6 +398,18 @@ function CVW:LaunchCAP(group, capcoord, alt, leg, heading, speed)
group:Route(wp) group:Route(wp)
end 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. --- Request Intercept.
@@ -402,6 +448,10 @@ function CVW:onafterRequestIntercept(From, Event, To, bandits, squadron)
end end
function CVW:OnAfterSelfRequest(From,Event,To,groupset,request)
end
--- Launch a flight group to intercept an intruder. --- Launch a flight group to intercept an intruder.
-- @param #CVW self -- @param #CVW self
-- @param Wrapper.Group#GROUP group Interceptor flight group. -- @param Wrapper.Group#GROUP group Interceptor flight group.
+2
View File
@@ -22,6 +22,7 @@
-- @field Functional.Warehouse#WAREHOUSE warehouse The warehouse of the carrier. -- @field Functional.Warehouse#WAREHOUSE warehouse The warehouse of the carrier.
-- @field Functional.Artillery#ARTY arty The artillery object 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 #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 -- @extends Ops.Airboss#AIRBOSS
--- Be surprised! --- Be surprised!
@@ -44,6 +45,7 @@ SKIPPER = {
warehouse = nil, warehouse = nil,
arty = nil, arty = nil,
intruders = {}, intruders = {},
cvw = nil,
} }
--- Intruder. --- Intruder.