This commit is contained in:
Frank 2021-10-03 23:09:45 +02:00
parent fa6fbca67b
commit 1790d19809
3 changed files with 28 additions and 17 deletions

View File

@ -87,6 +87,7 @@
-- @field #number respawndelay Delay before respawn in seconds.
-- @field #number runwaydestroyed Time stamp timer.getAbsTime() when the runway was destroyed.
-- @field #number runwayrepairtime Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
-- @field Ops.FlightControl#FLIGHTCONTROL flightcontrol Flight control of this warehouse.
-- @extends Core.Fsm#FSM
--- Have your assets at the right place at the right time - or not!
@ -6217,9 +6218,11 @@ function WAREHOUSE:_RouteAir(aircraft)
self:T2(self.lid..string.format("RouteAir aircraft group %s alive=%s", aircraft:GetName(), tostring(aircraft:IsAlive())))
-- Give start command to activate uncontrolled aircraft within the next 60 seconds.
local starttime=math.random(60)
if not self.flightcontrol then
local starttime=math.random(60)
aircraft:StartUncontrolled(starttime)
aircraft:StartUncontrolled(starttime)
end
-- Debug info.
self:T2(self.lid..string.format("RouteAir aircraft group %s alive=%s (after start command)", aircraft:GetName(), tostring(aircraft:IsAlive())))

View File

@ -1,4 +1,4 @@
--- **OPS** - Manage recovery of aircraft at airdromes.
--- **OPS** - Manage launching and recovery of aircraft at airdromes.
--
--
--
@ -43,8 +43,6 @@
--
-- ===
--
-- ![Banner Image](..\Presentations\FLIGHTCONTROL\FlightControl_Main.jpg)
--
-- # The FLIGHTCONTROL Concept
--
--
@ -1536,7 +1534,7 @@ end
function FLIGHTCONTROL:_PlayerRequestInfo(groupname)
-- Get flight group.
local flight=_DATABASE:GetFlightGroup(groupname)
local flight=_DATABASE:GetOpsGroup(groupname)
if flight then
@ -1596,7 +1594,7 @@ end
function FLIGHTCONTROL:_PlayerRequestInfoQueues(groupname)
-- Get flight group.
local flight=_DATABASE:GetFlightGroup(groupname)
local flight=_DATABASE:GetOpsGroup(groupname)
if flight then
@ -1628,7 +1626,7 @@ end
function FLIGHTCONTROL:_PlayerInbound(groupname)
-- Get flight group.
local flight=_DATABASE:GetFlightGroup(groupname)
local flight=_DATABASE:GetOpsGroup(groupname)
if flight then
@ -1681,7 +1679,7 @@ end
function FLIGHTCONTROL:_PlayerHolding(groupname)
-- Get flight group.
local flight=_DATABASE:GetFlightGroup(groupname)
local flight=_DATABASE:GetOpsGroup(groupname)
if flight then
@ -1719,11 +1717,11 @@ end
function FLIGHTCONTROL:_PlayerMyStatus(groupname)
-- Get flight group.
local flight=_DATABASE:GetFlightGroup(groupname)
local flight=_DATABASE:GetOpsGroup(groupname)
if flight then
local fc=flight.flightcontrol
local fc=flight.flightcontrol --Ops.FlightControl#FLIGHTCONTROL
local text=string.format("My Status:")
text=text..string.format("\nFlight status: %s", tostring(flight:GetState()))
@ -1757,12 +1755,15 @@ function FLIGHTCONTROL:_PlayerRequestTaxi(groupname)
for _,_element in pairs(flight.elements) do
local element=_element --Ops.FlightGroup#FLIGHTGROUP.Element
env.info("FF 100")
if element.parking then
local spot=self:GetParkingSpotByID(element.parking.TerminalID)
if element.ai then
env.info("FF 200")
self:RemoveParkingGuard(spot, 30)
else
self:RemoveParkingGuard(spot, 3)
env.info("FF 300")
end
end
--flight:ElementTaxiing(element)
@ -1785,7 +1786,7 @@ function FLIGHTCONTROL:_PlayerRequestTakeoff(groupname)
MESSAGE:New("Request takeoff", 5):ToAll()
local flight=_DATABASE:GetFlightGroup(groupname)
local flight=_DATABASE:GetOpsGroup(groupname)
if flight then
@ -1819,7 +1820,7 @@ function FLIGHTCONTROL:_PlayerAbortTakeoff(groupname)
MESSAGE:New("Abort takeoff", 5):ToAll()
local flight=_DATABASE:GetFlightGroup(groupname)
local flight=_DATABASE:GetOpsGroup(groupname)
if flight then

View File

@ -6068,8 +6068,15 @@ function OPSGROUP:onafterStop(From, Event, To)
self.Scheduler:Clear()
end
-- Flightcontrol.
if self.flightcontrol then
self.flightcontrol:_RemoveFlight(self)
for _,_element in pairs(self.elements) do
local element=_element --#OPSGROUP.Element
if element.parking then
self.flightcontrol:SetParkingFree(element.parking)
end
end
end
if self:IsAlive() and not (self:IsDead() or self:IsStopped()) then
@ -10804,8 +10811,8 @@ function OPSGROUP:_AddElementByName(unitname)
if unit then
-- Get unit template.
--local unittemplate=unit:GetTemplate()
local unittemplate=_DATABASE:GetUnitTemplateFromUnitName(unitname)
local unittemplate=unit:GetTemplate()
--local unittemplate=_DATABASE:GetUnitTemplateFromUnitName(unitname)
-- Element table.
local element={} --#OPSGROUP.Element
@ -10897,7 +10904,7 @@ function OPSGROUP:_AddElementByName(unitname)
local text=string.format("Adding element %s: status=%s, skill=%s, life=%.1f/%.1f category=%s (%d), type=%s, size=%.1f (L=%.1f H=%.1f W=%.1f), weight=%.1f/%.1f (cargo=%.1f/%.1f)",
element.name, element.status, element.skill, element.life, element.life0, element.categoryname, element.category, element.typename,
element.size, element.length, element.height, element.width, element.weight, element.weightMaxTotal, element.weightCargo, element.weightMaxCargo)
self:T(self.lid..text)
self:I(self.lid..text)
-- Add element to table.
if not self:_IsElement(unitname) then