mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #1782 from FlightControl-Master/FF/MasterDevel
Updates from develop
This commit is contained in:
commit
994a36001f
@ -471,6 +471,22 @@ do -- Types
|
||||
--@field #boolean lateActivated
|
||||
--@field #boolean uncontrolled
|
||||
|
||||
--- DCS template data structure.
|
||||
-- @type Template
|
||||
-- @field #boolean uncontrolled Aircraft is uncontrolled.
|
||||
-- @field #boolean lateActivation Group is late activated.
|
||||
-- @field #number x 2D Position on x-axis in meters.
|
||||
-- @field #number y 2D Position on y-axis in meters.
|
||||
-- @field #table units Unit list.
|
||||
--
|
||||
|
||||
--- Unit data structure.
|
||||
--@type Template.Unit
|
||||
--@field #string name Name of the unit.
|
||||
--@field #number x
|
||||
--@field #number y
|
||||
--@field #number alt
|
||||
|
||||
end --
|
||||
|
||||
|
||||
@ -490,7 +506,6 @@ do -- Object
|
||||
-- @field BASE
|
||||
-- @field SCENERY
|
||||
-- @field CARGO
|
||||
|
||||
|
||||
--- @type Object.Desc
|
||||
-- @extends #Desc
|
||||
@ -500,6 +515,10 @@ do -- Object
|
||||
--- @function [parent=#Object] isExist
|
||||
-- @param #Object self
|
||||
-- @return #boolean
|
||||
|
||||
--- @function [parent=#Object] isActive
|
||||
-- @param #Object self
|
||||
-- @return #boolean
|
||||
|
||||
--- @function [parent=#Object] destroy
|
||||
-- @param #Object self
|
||||
@ -1132,6 +1151,11 @@ do -- Unit
|
||||
-- @function [parent=#Unit] getAmmo
|
||||
-- @param #Unit self
|
||||
-- @return #Unit.Ammo
|
||||
|
||||
--- Returns the number of infantry that can be embark onto the aircraft. Only returns a value if run on airplanes or helicopters. Returns nil if run on ground or ship units.
|
||||
-- @function [parent=#Unit] getDescentCapacity
|
||||
-- @param #Unit self
|
||||
-- @return #number Number of soldiers that embark.
|
||||
|
||||
--- Returns the unit sensors.
|
||||
-- @function [parent=#Unit] getSensors
|
||||
@ -1350,7 +1374,9 @@ do -- AI
|
||||
--- @type AI.Option.Ground
|
||||
-- @field #AI.Option.Ground.id id
|
||||
-- @field #AI.Option.Ground.val val
|
||||
|
||||
-- @field #AI.Option.Ground.mid mid
|
||||
-- @field #AI.Option.Ground.mval mval
|
||||
--
|
||||
--- @type AI.Option.Naval
|
||||
-- @field #AI.Option.Naval.id id
|
||||
-- @field #AI.Option.Naval.val val
|
||||
@ -1373,6 +1399,11 @@ do -- AI
|
||||
-- @field PROHIBIT_AG
|
||||
-- @field MISSILE_ATTACK
|
||||
-- @field PROHIBIT_WP_PASS_REPORT
|
||||
-- @field OPTION_RADIO_USAGE_CONTACT
|
||||
-- @field OPTION_RADIO_USAGE_ENGAGE
|
||||
-- @field OPTION_RADIO_USAGE_KILL
|
||||
-- @field JETT_TANKS_IF_EMPTY
|
||||
-- @field FORCED_ATTACK
|
||||
|
||||
--- @type AI.Option.Air.id.FORMATION
|
||||
-- @field LINE_ABREAST
|
||||
@ -1442,19 +1473,35 @@ do -- AI
|
||||
--- @type AI.Option.Ground.id
|
||||
-- @field NO_OPTION
|
||||
-- @field ROE @{#AI.Option.Ground.val.ROE}
|
||||
-- @field FORMATION
|
||||
-- @field DISPERSE_ON_ATTACK true or false
|
||||
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
|
||||
-- @field ENGAGE_AIR_WEAPONS
|
||||
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
|
||||
|
||||
--- @type AI.Option.Ground.mid -- Moose added
|
||||
-- @field RESTRICT_AAA_MIN 27
|
||||
-- @field RESTRICT_AAA_MAX 29
|
||||
-- @field RESTRICT_TARGETS @{#AI.Option.Ground.mval.ENGAGE_TARGETS} 28
|
||||
|
||||
--- @type AI.Option.Ground.val
|
||||
-- @field #AI.Option.Ground.val.ROE ROE
|
||||
-- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE
|
||||
-- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS
|
||||
|
||||
--- @type AI.Option.Ground.val.ROE
|
||||
-- @field OPEN_FIRE
|
||||
-- @field RETURN_FIRE
|
||||
-- @field WEAPON_HOLD
|
||||
|
||||
--- @type AI.Option.Ground.mval -- Moose added
|
||||
-- @field #AI.Option.Ground.mval.ENGAGE_TARGETS ENGAGE_TARGETS
|
||||
|
||||
--- @type AI.Option.Ground.mval.ENGAGE_TARGETS -- Moose added
|
||||
-- @field ANY_TARGET -- 0
|
||||
-- @field AIR_UNITS_ONLY -- 1
|
||||
-- @field GROUND_UNITS_ONLY -- 2
|
||||
|
||||
--- @type AI.Option.Ground.val.ALARM_STATE
|
||||
-- @field AUTO
|
||||
-- @field GREEN
|
||||
|
||||
@ -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,
|
||||
@ -613,26 +611,28 @@ 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 )
|
||||
local self=BASE:Inherit(self, FSM:New()) -- #ATIS
|
||||
|
||||
if self.airbase == nil then
|
||||
self:E( "ERROR: Airbase %s for ATIS could not be found!", tostring( 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))
|
||||
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
|
||||
@ -734,14 +734,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
|
||||
|
||||
@ -802,6 +794,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
|
||||
@ -1128,16 +1129,21 @@ end
|
||||
-- @param #string Voice Specific voice. Overrides `Gender` and `Culture`.
|
||||
-- @param #number Port SRS port. Default 5002.
|
||||
-- @return #ATIS self
|
||||
function ATIS:SetSRS( PathToSRS, Gender, Culture, Voice, Port )
|
||||
self.useSRS = true
|
||||
self.msrs = MSRS:New( PathToSRS, self.frequency, self.modulation )
|
||||
self.msrs:SetGender( Gender )
|
||||
self.msrs:SetCulture( Culture )
|
||||
self.msrs:SetVoice( Voice )
|
||||
self.msrs:SetPort( Port )
|
||||
self.msrs:SetCoalition( self:GetCoalition() )
|
||||
if self.dTQueueCheck <= 10 then
|
||||
self:SetQueueUpdateTime( 90 )
|
||||
function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port)
|
||||
if PathToSRS then
|
||||
self.useSRS=true
|
||||
self.msrs=MSRS:New(PathToSRS, self.frequency, self.modulation)
|
||||
self.msrs:SetGender(Gender)
|
||||
self.msrs:SetCulture(Culture)
|
||||
self.msrs:SetVoice(Voice)
|
||||
self.msrs:SetPort(Port)
|
||||
self.msrs:SetCoalition(self:GetCoalition())
|
||||
self.msrs:SetLabel("ATIS")
|
||||
if self.dTQueueCheck<=10 then
|
||||
self:SetQueueUpdateTime(90)
|
||||
end
|
||||
else
|
||||
self:E(self.lid..string.format("ERROR: No SRS path specified!"))
|
||||
end
|
||||
return self
|
||||
end
|
||||
@ -1378,7 +1384,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 ---
|
||||
@ -1444,8 +1451,8 @@ function ATIS:onafterBroadcast( From, Event, To )
|
||||
|
||||
-- Convert to °F.
|
||||
if self.TDegF then
|
||||
temperature = UTILS.CelsiusToFahrenheit( temperature )
|
||||
dewpoint = UTILS.CelsiusToFahrenheit( dewpoint )
|
||||
temperature=UTILS.CelsiusToFahrenheit(temperature)
|
||||
dewpoint=UTILS.CelsiusToFahrenheit(dewpoint)
|
||||
end
|
||||
|
||||
local TEMPERATURE = string.format( "%d", math.abs( temperature ) )
|
||||
@ -1740,10 +1747,10 @@ function ATIS:onafterBroadcast( From, Event, To )
|
||||
end
|
||||
|
||||
-- Wind
|
||||
-- Adding a space after each digit of WINDFROM to convert this to aviation-speak for TTS via SRS
|
||||
-- Adding a space after each digit of WINDFROM to convert this to aviation-speak for TTS via SRS
|
||||
if self.useSRS then
|
||||
WINDFROM = string.gsub(WINDFROM,".", "%1 ")
|
||||
end
|
||||
end
|
||||
if self.metric then
|
||||
subtitle = string.format( "Wind from %s at %s m/s", WINDFROM, WINDSPEED )
|
||||
else
|
||||
@ -2002,20 +2009,20 @@ function ATIS:onafterBroadcast( From, Event, To )
|
||||
alltext = alltext .. ";\n" .. subtitle
|
||||
|
||||
-- Active runway.
|
||||
local subtitle = string.format( "Active runway %s", runway )
|
||||
if rwyLeft == true then
|
||||
subtitle = subtitle .. " Left"
|
||||
elseif rwyLeft == false then
|
||||
subtitle = subtitle .. " Right"
|
||||
local subtitle=string.format("Active runway %s", runwayLanding)
|
||||
if rwyLandingLeft==true then
|
||||
subtitle=subtitle.." Left"
|
||||
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:Transmission( ATIS.Sound.Left, 0.2 )
|
||||
elseif rwyLeft == false then
|
||||
self:Transmission( ATIS.Sound.Right, 0.2 )
|
||||
self:Transmission(ATIS.Sound.ActiveRunway, 1.0, subtitle)
|
||||
self.radioqueue:Number2Transmission(runwayLanding)
|
||||
if rwyLandingLeft==true then
|
||||
self:Transmission(ATIS.Sound.Left, 0.2)
|
||||
elseif rwyLandingLeft==false then
|
||||
self:Transmission(ATIS.Sound.Right, 0.2)
|
||||
end
|
||||
end
|
||||
alltext = alltext .. ";\n" .. subtitle
|
||||
@ -2126,7 +2133,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
|
||||
@ -2144,7 +2151,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
|
||||
@ -2162,7 +2169,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
|
||||
@ -2201,7 +2208,7 @@ function ATIS:onafterBroadcast( From, Event, To )
|
||||
|
||||
-- TACAN
|
||||
if self.tacan then
|
||||
subtitle = string.format( "TACAN channel %dX Ray", self.tacan )
|
||||
subtitle=string.format("TACAN channel %dX Ray", self.tacan)
|
||||
if not self.useSRS then
|
||||
self:Transmission( ATIS.Sound.TACANChannel, 1.0, subtitle )
|
||||
self.radioqueue:Number2Transmission( tostring( self.tacan ), nil, 0.2 )
|
||||
@ -2221,7 +2228,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
|
||||
@ -2348,39 +2355,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.
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
-- @field #string tankergroupname Name of the late activated tanker template group.
|
||||
-- @field Wrapper.Group#GROUP tanker Tanker group.
|
||||
-- @field Wrapper.Airbase#AIRBASE airbase The home airbase object of the tanker. Normally the aircraft carrier.
|
||||
-- @field Core.Radio#BEACON beacon Tanker TACAN beacon.
|
||||
-- @field Core.Beacon#BEACON beacon Tanker TACAN beacon.
|
||||
-- @field #number TACANchannel TACAN channel. Default 1.
|
||||
-- @field #string TACANmode TACAN mode, i.e. "X" or "Y". Default "Y". Use only "Y" for AA TACAN stations!
|
||||
-- @field #string TACANmorse TACAN morse code. Three letters identifying the TACAN station. Default "TKR".
|
||||
@ -784,10 +784,11 @@ end
|
||||
-- @param #RECOVERYTANKER self
|
||||
-- @param #number channel TACAN channel. Default 1.
|
||||
-- @param #string morse TACAN morse code identifier. Three letters. Default "TKR".
|
||||
-- @param #string mode TACAN mode, which can be either "Y" (default) or "X".
|
||||
-- @return #RECOVERYTANKER self
|
||||
function RECOVERYTANKER:SetTACAN(channel, morse)
|
||||
function RECOVERYTANKER:SetTACAN(channel, morse, mode)
|
||||
self.TACANchannel=channel or 1
|
||||
self.TACANmode="Y"
|
||||
self.TACANmode=mode or "Y"
|
||||
self.TACANmorse=morse or "TKR"
|
||||
self.TACANon=true
|
||||
return self
|
||||
@ -1625,7 +1626,6 @@ function RECOVERYTANKER:_ActivateTACAN(delay)
|
||||
if delay and delay>0 then
|
||||
|
||||
-- Schedule TACAN activation.
|
||||
--SCHEDULER:New(nil, self._ActivateTACAN, {self}, delay)
|
||||
self:ScheduleOnce(delay, RECOVERYTANKER._ActivateTACAN, self)
|
||||
|
||||
else
|
||||
|
||||
@ -497,7 +497,7 @@ ENUMS.ReportingName =
|
||||
Mudhen = "F-15E",
|
||||
Viper = "F-16",
|
||||
Phantom = "F-4E",
|
||||
Tiger = "F-5", -- was thinking to name this MiG-25 ;)
|
||||
Tiger = "F-5", -- was thinkg to name this MiG-25 ;)
|
||||
Sabre = "F-86",
|
||||
Hornet = "A-18", -- avoiding the slash
|
||||
Hawk = "Hawk",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user