mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
FLIGHTCONTROL v0.6.0
This commit is contained in:
@@ -52,7 +52,6 @@
|
||||
--- ATIS class.
|
||||
-- @type ATIS
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #boolean Debug Debug mode. Messages to all about status.
|
||||
-- @field #string lid Class id string for output to DCS log file.
|
||||
-- @field #string theatre DCS map name.
|
||||
-- @field #string airbasename The name of the airbase.
|
||||
@@ -309,7 +308,6 @@
|
||||
-- @field #ATIS
|
||||
ATIS = {
|
||||
ClassName = "ATIS",
|
||||
Debug = false,
|
||||
lid = nil,
|
||||
theatre = nil,
|
||||
airbasename = nil,
|
||||
@@ -614,26 +612,26 @@ ATIS.version="0.9.6"
|
||||
|
||||
--- Create a new ATIS class object for a specific aircraft carrier unit.
|
||||
-- @param #ATIS self
|
||||
-- @param #string airbasename Name of the airbase.
|
||||
-- @param #number frequency Radio frequency in MHz. Default 143.00 MHz.
|
||||
-- @param #number modulation Radio modulation: 0=AM, 1=FM. Default 0=AM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators
|
||||
-- @param #string AirbaseName Name of the airbase.
|
||||
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz.
|
||||
-- @param #number Modulation Radio modulation: 0=AM, 1=FM. Default 0=AM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators.
|
||||
-- @return #ATIS self
|
||||
function ATIS:New(airbasename, frequency, modulation)
|
||||
function ATIS:New(AirbaseName, Frequency, Modulation)
|
||||
|
||||
-- Inherit everything from FSM class.
|
||||
local self=BASE:Inherit(self, FSM:New()) -- #ATIS
|
||||
|
||||
self.airbasename=airbasename
|
||||
self.airbase=AIRBASE:FindByName(airbasename)
|
||||
self.airbasename=AirbaseName
|
||||
self.airbase=AIRBASE:FindByName(AirbaseName)
|
||||
|
||||
if self.airbase==nil then
|
||||
self:E("ERROR: Airbase %s for ATIS could not be found!", tostring(airbasename))
|
||||
self:E("ERROR: Airbase %s for ATIS could not be found!", tostring(AirbaseName))
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Default freq and modulation.
|
||||
self.frequency=frequency or 143.00
|
||||
self.modulation=modulation or 0
|
||||
self.frequency=Frequency or 143.00
|
||||
self.modulation=Modulation or 0
|
||||
|
||||
-- Get map.
|
||||
self.theatre=env.mission.theatre
|
||||
@@ -740,15 +738,6 @@ function ATIS:New(airbasename, frequency, modulation)
|
||||
-- @param #string To To state.
|
||||
-- @param #string Text Report text.
|
||||
|
||||
|
||||
-- Debug trace.
|
||||
if false then
|
||||
self.Debug=true
|
||||
BASE:TraceOnOff(true)
|
||||
BASE:TraceClass(self.ClassName)
|
||||
BASE:TraceLevel(1)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -809,6 +798,15 @@ function ATIS:SetRunwayLength()
|
||||
return self
|
||||
end
|
||||
|
||||
--- Give information on runway length.
|
||||
-- @param #ATIS self
|
||||
-- @return #ATIS self
|
||||
function ATIS:SetRunwayLength()
|
||||
self.rwylength=true
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Give information on airfield elevation
|
||||
-- @param #ATIS self
|
||||
-- @return #ATIS self
|
||||
@@ -1395,7 +1393,8 @@ function ATIS:onafterBroadcast(From, Event, To)
|
||||
--- Runway ---
|
||||
--------------
|
||||
|
||||
local runway, rwyLeft=self:GetActiveRunway()
|
||||
local runwayLanding, rwyLandingLeft=self:GetActiveRunway()
|
||||
local runwayTakeoff, rwyTakeoffLeft=self:GetActiveRunway(true)
|
||||
|
||||
------------
|
||||
--- Time ---
|
||||
@@ -2017,19 +2016,19 @@ function ATIS:onafterBroadcast(From, Event, To)
|
||||
alltext=alltext..";\n"..subtitle
|
||||
|
||||
-- Active runway.
|
||||
local subtitle=string.format("Active runway %s", runway)
|
||||
if rwyLeft==true then
|
||||
local subtitle=string.format("Active runway %s", runwayLanding)
|
||||
if rwyLandingLeft==true then
|
||||
subtitle=subtitle.." Left"
|
||||
elseif rwyLeft==false then
|
||||
elseif rwyLandingLeft==false then
|
||||
subtitle=subtitle.." Right"
|
||||
end
|
||||
local _RUNACT=subtitle
|
||||
if not self.useSRS then
|
||||
self:Transmission(ATIS.Sound.ActiveRunway, 1.0, subtitle)
|
||||
self.radioqueue:Number2Transmission(runway)
|
||||
if rwyLeft==true then
|
||||
self.radioqueue:Number2Transmission(runwayLanding)
|
||||
if rwyLandingLeft==true then
|
||||
self:Transmission(ATIS.Sound.Left, 0.2)
|
||||
elseif rwyLeft==false then
|
||||
elseif rwyLandingLeft==false then
|
||||
self:Transmission(ATIS.Sound.Right, 0.2)
|
||||
end
|
||||
end
|
||||
@@ -2141,7 +2140,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
||||
end
|
||||
|
||||
-- ILS
|
||||
local ils=self:GetNavPoint(self.ils, runway, rwyLeft)
|
||||
local ils=self:GetNavPoint(self.ils, runwayLanding, rwyLandingLeft)
|
||||
if ils then
|
||||
subtitle=string.format("ILS frequency %.2f MHz", ils.frequency)
|
||||
if not self.useSRS then
|
||||
@@ -2159,7 +2158,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
||||
end
|
||||
|
||||
-- Outer NDB
|
||||
local ndb=self:GetNavPoint(self.ndbouter, runway, rwyLeft)
|
||||
local ndb=self:GetNavPoint(self.ndbouter, runwayLanding, rwyLandingLeft)
|
||||
if ndb then
|
||||
subtitle=string.format("Outer NDB frequency %.2f MHz", ndb.frequency)
|
||||
if not self.useSRS then
|
||||
@@ -2177,7 +2176,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
||||
end
|
||||
|
||||
-- Inner NDB
|
||||
local ndb=self:GetNavPoint(self.ndbinner, runway, rwyLeft)
|
||||
local ndb=self:GetNavPoint(self.ndbinner, runwayLanding, rwyLandingLeft)
|
||||
if ndb then
|
||||
subtitle=string.format("Inner NDB frequency %.2f MHz", ndb.frequency)
|
||||
if not self.useSRS then
|
||||
@@ -2236,7 +2235,7 @@ function ATIS:onafterBroadcast(From, Event, To)
|
||||
end
|
||||
|
||||
-- PRMG
|
||||
local ndb=self:GetNavPoint(self.prmg, runway, rwyLeft)
|
||||
local ndb=self:GetNavPoint(self.prmg, runwayLanding, rwyLandingLeft)
|
||||
if ndb then
|
||||
subtitle=string.format("PRMG channel %d", ndb.frequency)
|
||||
if not self.useSRS then
|
||||
@@ -2363,39 +2362,19 @@ end
|
||||
|
||||
--- Get active runway runway.
|
||||
-- @param #ATIS self
|
||||
-- @param #boolean Takeoff If `true`, get runway for takeoff. Default is for landing.
|
||||
-- @return #string Active runway, e.g. "31" for 310 deg.
|
||||
-- @return #boolean Use Left=true, Right=false, or nil.
|
||||
function ATIS:GetActiveRunway()
|
||||
|
||||
local coord=self.airbase:GetCoordinate()
|
||||
local height=coord:GetLandHeight()
|
||||
|
||||
-- Get wind direction and speed in m/s.
|
||||
local windFrom, windSpeed=coord:GetWind(height+10)
|
||||
|
||||
-- Get active runway data based on wind direction.
|
||||
local runact=self.airbase:GetActiveRunway(self.runwaym2t)
|
||||
|
||||
-- Active runway "31".
|
||||
local runway=self:GetMagneticRunway(windFrom) or runact.idx
|
||||
|
||||
-- Left or right in case there are two runways with the same heading.
|
||||
local rwyLeft=nil
|
||||
|
||||
-- Check if user explicitly specified a runway.
|
||||
if self.activerunway then
|
||||
|
||||
-- Get explicit runway heading if specified.
|
||||
local runwayno=self:GetRunwayWithoutLR(self.activerunway)
|
||||
if runwayno~="" then
|
||||
runway=runwayno
|
||||
end
|
||||
|
||||
-- Was "L"eft or "R"ight given?
|
||||
rwyLeft=self:GetRunwayLR(self.activerunway)
|
||||
function ATIS:GetActiveRunway(Takeoff)
|
||||
|
||||
local runway=nil --Wrapper.Airbase#AIRBASE.Runway
|
||||
if Takeoff then
|
||||
runway=self.airbase:GetActiveRunwayTakeoff()
|
||||
else
|
||||
runway=self.airbase:GetActiveRunwayLanding()
|
||||
end
|
||||
|
||||
return runway, rwyLeft
|
||||
|
||||
return runway.name, runway.isLeft
|
||||
end
|
||||
|
||||
--- Get runway from user supplied magnetic heading.
|
||||
|
||||
Reference in New Issue
Block a user