mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
NAV
This commit is contained in:
@@ -59,13 +59,15 @@ FLIGHTPLAN = {
|
|||||||
fixes = {}
|
fixes = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Type of navaid
|
--- Type of flightplan.
|
||||||
-- @type FLIGHTPLAN.Type
|
-- @type FLIGHTPLAN.Type
|
||||||
-- @field #string VOR VOR
|
-- @field #string IFRH Instrument Flying Rules High Altitude.
|
||||||
-- @field #string NDB NDB
|
-- @field #string IFRL Instrument Flying Rules Low Altitude.
|
||||||
|
-- @field #string VFR Visual Flight Rules.
|
||||||
FLIGHTPLAN.TYPE={
|
FLIGHTPLAN.TYPE={
|
||||||
VOR="VOR",
|
IFRH="IFR Heigh",
|
||||||
NDB="NDB",
|
IFRL="IFR Low",
|
||||||
|
VFR="VFR",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- FLIGHTPLAN class version.
|
--- FLIGHTPLAN class version.
|
||||||
@@ -198,6 +200,10 @@ end
|
|||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ NAVFIX.version="0.0.1"
|
|||||||
|
|
||||||
--- Create a new NAVFIX class instance.
|
--- Create a new NAVFIX class instance.
|
||||||
-- @param #NAVFIX self
|
-- @param #NAVFIX self
|
||||||
|
-- @param Core.Point#COORDINATE Coordinate of the fix.
|
||||||
|
-- @param #string Name Name of the fix. Should be unique!
|
||||||
-- @return #NAVFIX self
|
-- @return #NAVFIX self
|
||||||
function NAVFIX:New(Coordinate, Name)
|
function NAVFIX:New(Coordinate, Name)
|
||||||
|
|
||||||
@@ -133,7 +135,7 @@ function NAVFIX:SetCompulsory(Compulsory)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set whether this fix is compulsory.
|
--- Set whether this is a fly-over fix fix.
|
||||||
-- @param #NAVFIX self
|
-- @param #NAVFIX self
|
||||||
-- @param #boolean FlyOver If `true`, this is a fly over fix. If `false` or nil, it is not.
|
-- @param #boolean FlyOver If `true`, this is a fly over fix. If `false` or nil, it is not.
|
||||||
-- @return #NAVFIX self
|
-- @return #NAVFIX self
|
||||||
@@ -142,7 +144,7 @@ function NAVFIX:SetFlyOver(FlyOver)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set whether this is the intermediate fix.
|
--- Set whether this is the intermediate fix (IF).
|
||||||
-- @param #NAVFIX self
|
-- @param #NAVFIX self
|
||||||
-- @param #boolean IntermediateFix If `true`, this is an intermediate fix.
|
-- @param #boolean IntermediateFix If `true`, this is an intermediate fix.
|
||||||
-- @return #NAVFIX self
|
-- @return #NAVFIX self
|
||||||
|
|||||||
@@ -3900,6 +3900,7 @@ function FLIGHTGROUP:_InitGroup(Template)
|
|||||||
self.menu.atc=self.menu.atc or {} --#table
|
self.menu.atc=self.menu.atc or {} --#table
|
||||||
self.menu.atc.root=self.menu.atc.root or MENU_GROUP:New(self.group, "ATC") --Core.Menu#MENU_GROUP
|
self.menu.atc.root=self.menu.atc.root or MENU_GROUP:New(self.group, "ATC") --Core.Menu#MENU_GROUP
|
||||||
self.menu.atc.help=self.menu.atc.help or MENU_GROUP:New(self.group, "Help", self.menu.atc.root) --Core.Menu#MENU_GROUP
|
self.menu.atc.help=self.menu.atc.help or MENU_GROUP:New(self.group, "Help", self.menu.atc.root) --Core.Menu#MENU_GROUP
|
||||||
|
self.menu.nav.root=self.menu.nav.root or MENU_GROUP:New(self.group, "Navigation") --Core.Menu#MENU_GROUP
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Units of the group.
|
-- Units of the group.
|
||||||
@@ -5235,6 +5236,76 @@ function FLIGHTGROUP:_GetDistToParking(Spot, Coordinate)
|
|||||||
return dist
|
return dist
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Create player menu for Navigation.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @param Core.Menu#MENU_GROUP mainmenu Nav root menu table.
|
||||||
|
function FLIGHTGROUP:_CreatePlayerMenuNav(mainmenu)
|
||||||
|
|
||||||
|
-- Group info.
|
||||||
|
local group=self.group
|
||||||
|
local groupname=self.groupname
|
||||||
|
local gid=group:GetID()
|
||||||
|
|
||||||
|
-- Get player element.
|
||||||
|
local player=self:GetPlayerElement()
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
local text=string.format("Creating NAV player menu for flight %s: in state=%s, player=%s", tostring(self.groupname), self:GetState(), player.status)
|
||||||
|
self:T(self.lid..text)
|
||||||
|
|
||||||
|
|
||||||
|
-- Airbase root menu.
|
||||||
|
local flightplans=MENU_GROUP:New(group, "Flight Plans", mainmenu)
|
||||||
|
|
||||||
|
for i,_flightplan in pairs(self.flightplans or {}) do
|
||||||
|
local flightplan=_flightplan --#FLIGHTPLAN
|
||||||
|
MENU_GROUP_COMMAND:New(group, flightplan.alias, flightplans, self._PlayerSelectFlightplan, self, flightplan)
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.flightplan then
|
||||||
|
|
||||||
|
local flightplan=MENU_GROUP:New(group, "Current Flight Plan", mainmenu)
|
||||||
|
|
||||||
|
|
||||||
|
MENU_GROUP_COMMAND:New(group, "List NavFixes", flightplan, self._PlayerListNavfixes, self, self.flightplan)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Player selected flightplan from Menu.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @param Navigation.FlightPlan#FLIGHTPLAN flightplan The flightplan chosen.
|
||||||
|
function FLIGHTGROUP:_PlayerSelectFlightplan(flightplan)
|
||||||
|
|
||||||
|
self:_SetFlightPlan(flightplan)
|
||||||
|
|
||||||
|
self:_CreatePlayerMenuNav(self.menu.nav)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Player selected flightplan from Menu.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @param Navigation.FlightPlan#FLIGHTPLAN flightplan The flightplan chosen.
|
||||||
|
function FLIGHTGROUP:_PlayerListNavfixes(flightplan)
|
||||||
|
|
||||||
|
if flightplan then
|
||||||
|
|
||||||
|
local text="Nav Fixes:"
|
||||||
|
for i,_fix in pairs(flightplan.fixes) do
|
||||||
|
local fix=_fix --Navigation.NavFix#NAVFIX
|
||||||
|
|
||||||
|
--TODO: parameters of fix to output.
|
||||||
|
|
||||||
|
text=text..string.format("\n%s",fix.name)
|
||||||
|
end
|
||||||
|
MESSAGE:New(text, 60):ToGroup(self.group)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user