mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/master' into branch
# Conflicts: # Moose Development/Moose/Functional/RAT.lua
This commit is contained in:
commit
977df39ac9
@ -5543,10 +5543,10 @@ end
|
|||||||
function RAT._ATCInit(airports_map)
|
function RAT._ATCInit(airports_map)
|
||||||
|
|
||||||
if not RAT.ATC.init then
|
if not RAT.ATC.init then
|
||||||
local text
|
|
||||||
text="Starting RAT ATC.\nSimultanious = "..RAT.ATC.Nclearance.."\n".."Delay = "..RAT.ATC.delay
|
local text="Starting RAT ATC.\nSimultanious = "..RAT.ATC.Nclearance.."\n".."Delay = "..RAT.ATC.delay
|
||||||
BASE:T2(RAT.id..text)
|
BASE:I(RAT.id..text)
|
||||||
RAT.ATC.init=true
|
|
||||||
for _,ap in pairs(airports_map) do
|
for _,ap in pairs(airports_map) do
|
||||||
local airbase=ap --Wrapper.Airbase#AIRBASE
|
local airbase=ap --Wrapper.Airbase#AIRBASE
|
||||||
local name=airbase:GetName()
|
local name=airbase:GetName()
|
||||||
@ -5583,12 +5583,18 @@ end
|
|||||||
-- @param #string name Group name of the flight.
|
-- @param #string name Group name of the flight.
|
||||||
-- @param #string dest Name of the destination airport.
|
-- @param #string dest Name of the destination airport.
|
||||||
function RAT:_ATCAddFlight(name, dest)
|
function RAT:_ATCAddFlight(name, dest)
|
||||||
BASE:T2(string.format("%sATC %s: Adding flight %s with destination %s.", RAT.id, dest, name, dest))
|
-- Debug info
|
||||||
RAT.ATC.flight[name]={}
|
BASE:I(RAT.id..string.format("ATC %s: Adding flight %s with destination %s.", dest, name, dest))
|
||||||
RAT.ATC.flight[name].destination=dest
|
|
||||||
RAT.ATC.flight[name].Tarrive=-1
|
-- Create new flight
|
||||||
RAT.ATC.flight[name].holding=-1
|
local flight={} --#RAT.AtcFlight
|
||||||
RAT.ATC.flight[name].Tonfinal=-1
|
flight.destination=dest
|
||||||
|
flight.Tarrive=-1
|
||||||
|
flight.holding=-1
|
||||||
|
flight.Tarrive=-1
|
||||||
|
--flight.Tonfinal=-1
|
||||||
|
|
||||||
|
RAT.ATC.flight[name]=flight
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Deletes a flight from ATC lists after it landed.
|
--- Deletes a flight from ATC lists after it landed.
|
||||||
@ -5607,8 +5613,8 @@ end
|
|||||||
-- @param #RAT self
|
-- @param #RAT self
|
||||||
-- @param #string name Group name of the flight.
|
-- @param #string name Group name of the flight.
|
||||||
-- @param #number time Time the fight first registered.
|
-- @param #number time Time the fight first registered.
|
||||||
function RAT:_ATCRegisterFlight(name, time)
|
function RAT._ATCRegisterFlight(name, time)
|
||||||
BASE:T2(RAT.id.."Flight ".. name.." registered at ATC for landing clearance.")
|
BASE:I(RAT.id..string.format("Flight %s registered at ATC for landing clearance.", name))
|
||||||
RAT.ATC.flight[name].Tarrive=time
|
RAT.ATC.flight[name].Tarrive=time
|
||||||
RAT.ATC.flight[name].holding=0
|
RAT.ATC.flight[name].holding=0
|
||||||
end
|
end
|
||||||
@ -5661,27 +5667,6 @@ function RAT._ATCStatus()
|
|||||||
else
|
else
|
||||||
BASE:E(RAT.id.."ERROR: Unknown holding time in RAT:_ATCStatus().")
|
BASE:E(RAT.id.."ERROR: Unknown holding time in RAT:_ATCStatus().")
|
||||||
end
|
end
|
||||||
else
|
|
||||||
busy="Runway is currently clear"
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Aircraft is holding.
|
|
||||||
local text=string.format("ATC %s: Flight %s is holding for %i:%02d. %s.", dest, name, hold/60, hold%60, busy)
|
|
||||||
BASE:T2(RAT.id..text)
|
|
||||||
|
|
||||||
elseif hold==RAT.ATC.onfinal then
|
|
||||||
|
|
||||||
-- Aircarft is on final approach for landing.
|
|
||||||
local Tfinal=Tnow-RAT.ATC.flight[name].Tonfinal
|
|
||||||
|
|
||||||
local text=string.format("ATC %s: Flight %s is on final. Waiting %i:%02d for landing event.", dest, name, Tfinal/60, Tfinal%60)
|
|
||||||
BASE:T2(RAT.id..text)
|
|
||||||
|
|
||||||
elseif hold==RAT.ATC.unregistered then
|
|
||||||
|
|
||||||
-- Aircraft has not arrived at holding point.
|
|
||||||
--self:T(string.format("ATC %s: Flight %s is not registered yet (hold %d).", dest, name, hold))
|
|
||||||
|
|
||||||
else
|
else
|
||||||
-- Not a RAT.ATC airport (should be managed by a FLIGHTCONTROL)
|
-- Not a RAT.ATC airport (should be managed by a FLIGHTCONTROL)
|
||||||
end
|
end
|
||||||
@ -5724,13 +5709,15 @@ function RAT._ATCCheck()
|
|||||||
flight.holding=Tnow-flight.Tarrive
|
flight.holding=Tnow-flight.Tarrive
|
||||||
|
|
||||||
-- Debug message.
|
-- Debug message.
|
||||||
local text=string.format("ATC %s: Flight %s runway is busy. You are #%d of %d in landing queue. Your holding time is %i:%02d.", name, flight,qID, nqueue, RAT.ATC.flight[flight].holding/60, RAT.ATC.flight[flight].holding%60)
|
local text=string.format("ATC %s: Flight %s runway is busy. You are #%d of %d in landing queue. Your holding time is %i:%02d.",
|
||||||
BASE:T2(RAT.id..text)
|
airportname, flightname, qID, nqueue, flight.holding/60, flight.holding%60)
|
||||||
|
BASE:I(RAT.id..text)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
local text=string.format("ATC %s: Flight %s was cleared for landing. Your holding time was %i:%02d.", name, flight, RAT.ATC.flight[flight].holding/60, RAT.ATC.flight[flight].holding%60)
|
local text=string.format("ATC %s: Flight %s was cleared for landing. Your holding time was %i:%02d.",
|
||||||
BASE:T2(RAT.id..text)
|
airportname, flightname, flight.holding/60, flight.holding%60)
|
||||||
|
BASE:I(RAT.id..text)
|
||||||
|
|
||||||
-- Clear flight for landing.
|
-- Clear flight for landing.
|
||||||
RAT._ATCClearForLanding(airportname, flightname)
|
RAT._ATCClearForLanding(airportname, flightname)
|
||||||
@ -5796,9 +5783,7 @@ function RAT._ATCClearForLanding(airportname, flightname)
|
|||||||
else
|
else
|
||||||
BASE:E("Could not clear flight for landing!")
|
BASE:E("Could not clear flight for landing!")
|
||||||
end
|
end
|
||||||
local text2=string.format("ATC %s: Flight %s you are cleared for landing.", airport, flight)
|
|
||||||
BASE:T2( RAT.id..text1)
|
|
||||||
MESSAGE:New(text2, 10):ToAllIf(RAT.ATC.messages)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Takes care of organisational stuff after a plane has landed.
|
--- Takes care of organisational stuff after a plane has landed.
|
||||||
@ -5838,17 +5823,15 @@ function RAT._ATCFlightLanded(name)
|
|||||||
local TrafficPerHour=airport.traffic/(timer.getTime()-RAT.ATC.T0)*3600
|
local TrafficPerHour=airport.traffic/(timer.getTime()-RAT.ATC.T0)*3600
|
||||||
|
|
||||||
-- Debug info
|
-- Debug info
|
||||||
local text1=string.format("ATC %s: Flight %s landed. Tholding = %i:%02d, Tfinal = %i:%02d.", dest, name, Thold/60, Thold%60, Tfinal/60, Tfinal%60)
|
BASE:I(RAT.id..string.format("ATC %s: Flight %s landed. Tholding = %i:%02d, Tfinal = %i:%02d.", dest, name, Thold/60, Thold%60, Tfinal/60, Tfinal%60))
|
||||||
local text2=string.format("ATC %s: Number of flights still on final %d.", dest, RAT.ATC.airport[dest].Nonfinal)
|
BASE:I(RAT.id..string.format("ATC %s: Number of flights still on final %d.", dest, airport.Nonfinal))
|
||||||
local text3=string.format("ATC %s: Traffic report: Number of planes landed in total %d. Flights/hour = %3.2f.", dest, RAT.ATC.airport[dest].traffic, TrafficPerHour)
|
BASE:I(RAT.id..string.format("ATC %s: Traffic report: Number of planes landed in total %d. Flights/hour = %3.2f.", dest, airport.traffic, TrafficPerHour))
|
||||||
if string.find(name,"#") then
|
|
||||||
name = string.match(name,"^(.+)#")
|
if string.find(name,"#") then
|
||||||
end
|
name = string.match(name,"^(.+)#")
|
||||||
local text4=string.format("ATC %s: Flight %s landed. Welcome to %s.", dest, name, dest)
|
end
|
||||||
BASE:T2(RAT.id..text1)
|
local text=string.format("ATC %s: Flight %s landed. Welcome to %s.", dest, name, dest)
|
||||||
BASE:T2(RAT.id..text2)
|
MESSAGE:New(text, 10):ToAllIf(RAT.ATC.messages)
|
||||||
BASE:T2(RAT.id..text3)
|
|
||||||
MESSAGE:New(text4, 10):ToAllIf(RAT.ATC.messages)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user