mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
atc
This commit is contained in:
parent
0f764424e8
commit
43cbc93a96
@ -2771,4 +2771,54 @@ function RAT:_ModifySpawnTemplate(waypoints)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- @module Atc
|
||||||
|
--
|
||||||
|
--- ATC class
|
||||||
|
-- @type ATC
|
||||||
|
ATC={
|
||||||
|
aircraft={},
|
||||||
|
waypoints={},
|
||||||
|
departures={},
|
||||||
|
destinations={},
|
||||||
|
holding={},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ATC:Add(index, group, wp, departure, destination)
|
||||||
|
self.aircraft[index]=group
|
||||||
|
self.waypoints[index]=wp
|
||||||
|
self.departures[index]=departure
|
||||||
|
self.destinations[index]=destination
|
||||||
|
end
|
||||||
|
|
||||||
|
function ATC:Status(airports)
|
||||||
|
local function tally(t)
|
||||||
|
local freq = {}
|
||||||
|
for _, v in pairs(t) do
|
||||||
|
freq[v] = (freq[v] or 0) + 1
|
||||||
|
end
|
||||||
|
return freq
|
||||||
|
end
|
||||||
|
|
||||||
|
local _destinations=tally(self.sestinations)
|
||||||
|
for k,v in pairs(_destinations) do
|
||||||
|
local text=string.format("Destination %s: %d",k,v)
|
||||||
|
env.info(text)
|
||||||
|
end
|
||||||
|
|
||||||
|
for i,aircraft in pairs(self.aircraft) do
|
||||||
|
local hp=self.waypoints[i][5]
|
||||||
|
local hc={hp.x,hp.alt,hp.y}
|
||||||
|
local z=ZONE_RADIUS:New("holding", hc:GetVec2(), 3000)
|
||||||
|
local group=aircraft --Wrapper.Group#GROUP
|
||||||
|
local holding=group:IsCompletelyInZone(z)
|
||||||
|
if holding then
|
||||||
|
table.insert(self.holding[self.destination], group)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user