mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-22 16:05:25 +00:00
FC
This commit is contained in:
@@ -1017,7 +1017,8 @@ function FLIGHTCONTROL:_CreatePlayerMenu(flight)
|
|||||||
|
|
||||||
local airbasename=self.airbasename
|
local airbasename=self.airbasename
|
||||||
|
|
||||||
local playermenu=flight.menu.atc --#FLIGHTCONTROL.PlayerMenu
|
--local playermenu=flight.menu.atc --#FLIGHTCONTROL.PlayerMenu
|
||||||
|
local playermenu=flight.menu.atc.root --#FLIGHTCONTROL.PlayerMenu
|
||||||
playermenu[airbasename] = playermenu[airbasename] or {}
|
playermenu[airbasename] = playermenu[airbasename] or {}
|
||||||
playermenu[airbasename].root = MENU_GROUP:New(group, airbasename, playermenu)
|
playermenu[airbasename].root = MENU_GROUP:New(group, airbasename, playermenu)
|
||||||
|
|
||||||
|
|||||||
@@ -952,9 +952,13 @@ end
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
function FLIGHTGROUP:onafterCheckZone(From, Event, To)
|
function FLIGHTGROUP:onafterCheckZone(From, Event, To)
|
||||||
|
|
||||||
self:_CheckInZones()
|
if self.group and self.group:IsAlive() then
|
||||||
|
self:_CheckInZones()
|
||||||
|
end
|
||||||
|
|
||||||
self:__CheckZone(-1)
|
if not self:IsDead() then
|
||||||
|
self:__CheckZone(-1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -1677,7 +1681,7 @@ function FLIGHTGROUP:onafterHold(From, Event, To, airbase, SpeedTo, SpeedHold, S
|
|||||||
self:SetFlightControl(fc)
|
self:SetFlightControl(fc)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Altitude above ground for a glide slope of 3°.
|
-- Altitude above ground for a glide slope of 3�.
|
||||||
local alpha=math.rad(3)
|
local alpha=math.rad(3)
|
||||||
local x1=UTILS.NMToMeters(10)
|
local x1=UTILS.NMToMeters(10)
|
||||||
local x2=UTILS.NMToMeters(5)
|
local x2=UTILS.NMToMeters(5)
|
||||||
@@ -2257,7 +2261,9 @@ function FLIGHTGROUP:GetHomebaseFromWaypoints()
|
|||||||
|
|
||||||
if wp then
|
if wp then
|
||||||
|
|
||||||
if wp and wp.action and wp.action==COORDINATE.WaypointAction.FromParkingArea or wp.action==COORDINATE.WaypointAction.FromParkingAreaHot or wp.action==COORDINATE.WaypointAction.FromRunway then
|
if wp and wp.action and wp.action==COORDINATE.WaypointAction.FromParkingArea
|
||||||
|
or wp.action==COORDINATE.WaypointAction.FromParkingAreaHot
|
||||||
|
or wp.action==COORDINATE.WaypointAction.FromRunway then
|
||||||
|
|
||||||
-- Get airbase ID depending on airbase category.
|
-- Get airbase ID depending on airbase category.
|
||||||
local airbaseID=wp.airdromeId or wp.helipadId
|
local airbaseID=wp.airdromeId or wp.helipadId
|
||||||
@@ -3596,6 +3602,66 @@ function FLIGHTGROUP:_GetTerminal(_attribute, _category)
|
|||||||
return _terminal
|
return _terminal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- MENU FUNCTIONS
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Get the proper terminal type based on generalized attribute of the group.
|
||||||
|
--@param #FLIGHTGROUP self
|
||||||
|
function FLIGHTGROUP:_UpdateMenu()
|
||||||
|
|
||||||
|
local position=self.group:GetCoordinate()
|
||||||
|
|
||||||
|
local fc={}
|
||||||
|
for airbasename,_flightcontrol in pairs(_DATABASE.FLIGHTCONTROLS) do
|
||||||
|
|
||||||
|
local airbase=AIRBASE:FindByName(airbasename)
|
||||||
|
|
||||||
|
local coord=airbase:GetCoordinate()
|
||||||
|
|
||||||
|
local dist=coord:Get2DDistance(position)
|
||||||
|
|
||||||
|
local fcitem={airbasename=airbasename, dist=dist}
|
||||||
|
|
||||||
|
table.insert(fc, fcitem)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Sort table wrt to distance
|
||||||
|
local function _sort(a,b)
|
||||||
|
return a.dist<b.dist
|
||||||
|
end
|
||||||
|
table.sort(fc, _sort)
|
||||||
|
|
||||||
|
--self.menu.atc
|
||||||
|
|
||||||
|
local playermenu=self.menu.atc.root --Ops.FlightControl#FLIGHTCONTROL.PlayerMenu
|
||||||
|
|
||||||
|
playermenu:RemoveSubMenus() --Core.Menu#MENU_GROUP
|
||||||
|
|
||||||
|
for i=1,math.min(#fc,8) do
|
||||||
|
self:_UpdateMenuFlightControl(fc[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Get the proper terminal type based on generalized attribute of the group.
|
||||||
|
--@param #FLIGHTGROUP self
|
||||||
|
--@param Ops.FlightControl#FLIGHTCONTROL flightcontrol Flight control object.
|
||||||
|
function FLIGHTGROUP:_UpdateMenuFlightControl(flightcontrol)
|
||||||
|
|
||||||
|
local playermenu=self.menu.atc.root --Ops.FlightControl#FLIGHTCONTROL.PlayerMenu
|
||||||
|
|
||||||
|
|
||||||
|
playermenu[flightcontrol.airbasename]=MENU_GROUP:New(self.group, flightcontrol.airbasename, playermenu)
|
||||||
|
|
||||||
|
MENU_GROUP:New(self.group,MenuText,ParentMenu)
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user