Merge pull request #1782 from FlightControl-Master/FF/MasterDevel

Updates from develop
This commit is contained in:
Frank 2022-09-11 13:38:00 +02:00 committed by GitHub
commit 994a36001f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 122 additions and 88 deletions

View File

@ -471,6 +471,22 @@ do -- Types
--@field #boolean lateActivated --@field #boolean lateActivated
--@field #boolean uncontrolled --@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 -- end --
@ -491,7 +507,6 @@ do -- Object
-- @field SCENERY -- @field SCENERY
-- @field CARGO -- @field CARGO
--- @type Object.Desc --- @type Object.Desc
-- @extends #Desc -- @extends #Desc
-- @field #number life initial life level -- @field #number life initial life level
@ -501,6 +516,10 @@ do -- Object
-- @param #Object self -- @param #Object self
-- @return #boolean -- @return #boolean
--- @function [parent=#Object] isActive
-- @param #Object self
-- @return #boolean
--- @function [parent=#Object] destroy --- @function [parent=#Object] destroy
-- @param #Object self -- @param #Object self
@ -1133,6 +1152,11 @@ do -- Unit
-- @param #Unit self -- @param #Unit self
-- @return #Unit.Ammo -- @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. --- Returns the unit sensors.
-- @function [parent=#Unit] getSensors -- @function [parent=#Unit] getSensors
-- @param #Unit self -- @param #Unit self
@ -1350,7 +1374,9 @@ do -- AI
--- @type AI.Option.Ground --- @type AI.Option.Ground
-- @field #AI.Option.Ground.id id -- @field #AI.Option.Ground.id id
-- @field #AI.Option.Ground.val val -- @field #AI.Option.Ground.val val
-- @field #AI.Option.Ground.mid mid
-- @field #AI.Option.Ground.mval mval
--
--- @type AI.Option.Naval --- @type AI.Option.Naval
-- @field #AI.Option.Naval.id id -- @field #AI.Option.Naval.id id
-- @field #AI.Option.Naval.val val -- @field #AI.Option.Naval.val val
@ -1373,6 +1399,11 @@ do -- AI
-- @field PROHIBIT_AG -- @field PROHIBIT_AG
-- @field MISSILE_ATTACK -- @field MISSILE_ATTACK
-- @field PROHIBIT_WP_PASS_REPORT -- @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 --- @type AI.Option.Air.id.FORMATION
-- @field LINE_ABREAST -- @field LINE_ABREAST
@ -1442,19 +1473,35 @@ do -- AI
--- @type AI.Option.Ground.id --- @type AI.Option.Ground.id
-- @field NO_OPTION -- @field NO_OPTION
-- @field ROE @{#AI.Option.Ground.val.ROE} -- @field ROE @{#AI.Option.Ground.val.ROE}
-- @field FORMATION
-- @field DISPERSE_ON_ATTACK true or false -- @field DISPERSE_ON_ATTACK true or false
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE} -- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
-- @field ENGAGE_AIR_WEAPONS -- @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 --- @type AI.Option.Ground.val
-- @field #AI.Option.Ground.val.ROE ROE -- @field #AI.Option.Ground.val.ROE ROE
-- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE -- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE
-- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS
--- @type AI.Option.Ground.val.ROE --- @type AI.Option.Ground.val.ROE
-- @field OPEN_FIRE -- @field OPEN_FIRE
-- @field RETURN_FIRE -- @field RETURN_FIRE
-- @field WEAPON_HOLD -- @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 --- @type AI.Option.Ground.val.ALARM_STATE
-- @field AUTO -- @field AUTO
-- @field GREEN -- @field GREEN

View File

@ -52,7 +52,6 @@
--- ATIS class. --- ATIS class.
-- @type ATIS -- @type ATIS
-- @field #string ClassName Name of the class. -- @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 lid Class id string for output to DCS log file.
-- @field #string theatre DCS map name. -- @field #string theatre DCS map name.
-- @field #string airbasename The name of the airbase. -- @field #string airbasename The name of the airbase.
@ -309,7 +308,6 @@
-- @field #ATIS -- @field #ATIS
ATIS = { ATIS = {
ClassName = "ATIS", ClassName = "ATIS",
Debug = false,
lid = nil, lid = nil,
theatre = nil, theatre = nil,
airbasename = nil, airbasename = nil,
@ -613,26 +611,28 @@ ATIS.version = "0.9.6"
--- Create a new ATIS class object for a specific aircraft carrier unit. --- Create a new ATIS class object for a specific aircraft carrier unit.
-- @param #ATIS self -- @param #ATIS self
-- @param #string airbasename Name of the airbase. -- @param #string AirbaseName Name of the airbase.
-- @param #number frequency Radio frequency in MHz. Default 143.00 MHz. -- @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 #number Modulation Radio modulation: 0=AM, 1=FM. Default 0=AM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators.
-- @return #ATIS self -- @return #ATIS self
function ATIS:New( airbasename, frequency, modulation ) function ATIS:New(AirbaseName, Frequency, Modulation)
-- Inherit everything from FSM class. -- Inherit everything from FSM class.
local self = BASE:Inherit( self, FSM:New() ) -- #ATIS local self = BASE:Inherit( self, FSM:New() ) -- #ATIS
self.airbasename = airbasename local self=BASE:Inherit(self, FSM:New()) -- #ATIS
self.airbase = AIRBASE:FindByName( airbasename )
if self.airbase == nil then self.airbasename=AirbaseName
self:E( "ERROR: Airbase %s for ATIS could not be found!", tostring( 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 return nil
end end
-- Default freq and modulation. -- Default freq and modulation.
self.frequency = frequency or 143.00 self.frequency=Frequency or 143.00
self.modulation = modulation or 0 self.modulation=Modulation or 0
-- Get map. -- Get map.
self.theatre = env.mission.theatre self.theatre = env.mission.theatre
@ -734,14 +734,6 @@ function ATIS:New( airbasename, frequency, modulation )
-- @param #string To To state. -- @param #string To To state.
-- @param #string Text Report text. -- @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 return self
end end
@ -802,6 +794,15 @@ function ATIS:SetRunwayLength()
return self return self
end 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 --- Give information on airfield elevation
-- @param #ATIS self -- @param #ATIS self
-- @return #ATIS self -- @return #ATIS self
@ -1128,16 +1129,21 @@ end
-- @param #string Voice Specific voice. Overrides `Gender` and `Culture`. -- @param #string Voice Specific voice. Overrides `Gender` and `Culture`.
-- @param #number Port SRS port. Default 5002. -- @param #number Port SRS port. Default 5002.
-- @return #ATIS self -- @return #ATIS self
function ATIS:SetSRS( PathToSRS, Gender, Culture, Voice, Port ) function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port)
self.useSRS = true if PathToSRS then
self.msrs = MSRS:New( PathToSRS, self.frequency, self.modulation ) self.useSRS=true
self.msrs:SetGender( Gender ) self.msrs=MSRS:New(PathToSRS, self.frequency, self.modulation)
self.msrs:SetCulture( Culture ) self.msrs:SetGender(Gender)
self.msrs:SetVoice( Voice ) self.msrs:SetCulture(Culture)
self.msrs:SetPort( Port ) self.msrs:SetVoice(Voice)
self.msrs:SetCoalition( self:GetCoalition() ) self.msrs:SetPort(Port)
if self.dTQueueCheck <= 10 then self.msrs:SetCoalition(self:GetCoalition())
self:SetQueueUpdateTime( 90 ) 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 end
return self return self
end end
@ -1378,7 +1384,8 @@ function ATIS:onafterBroadcast( From, Event, To )
--- Runway --- --- Runway ---
-------------- --------------
local runway, rwyLeft = self:GetActiveRunway() local runwayLanding, rwyLandingLeft=self:GetActiveRunway()
local runwayTakeoff, rwyTakeoffLeft=self:GetActiveRunway(true)
------------ ------------
--- Time --- --- Time ---
@ -1444,8 +1451,8 @@ function ATIS:onafterBroadcast( From, Event, To )
-- Convert to °F. -- Convert to °F.
if self.TDegF then if self.TDegF then
temperature = UTILS.CelsiusToFahrenheit( temperature ) temperature=UTILS.CelsiusToFahrenheit(temperature)
dewpoint = UTILS.CelsiusToFahrenheit( dewpoint ) dewpoint=UTILS.CelsiusToFahrenheit(dewpoint)
end end
local TEMPERATURE = string.format( "%d", math.abs( temperature ) ) local TEMPERATURE = string.format( "%d", math.abs( temperature ) )
@ -1740,10 +1747,10 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
-- Wind -- 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 if self.useSRS then
WINDFROM = string.gsub(WINDFROM,".", "%1 ") WINDFROM = string.gsub(WINDFROM,".", "%1 ")
end end
if self.metric then if self.metric then
subtitle = string.format( "Wind from %s at %s m/s", WINDFROM, WINDSPEED ) subtitle = string.format( "Wind from %s at %s m/s", WINDFROM, WINDSPEED )
else else
@ -2002,20 +2009,20 @@ function ATIS:onafterBroadcast( From, Event, To )
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
-- Active runway. -- Active runway.
local subtitle = string.format( "Active runway %s", runway ) local subtitle=string.format("Active runway %s", runwayLanding)
if rwyLeft == true then if rwyLandingLeft==true then
subtitle = subtitle .. " Left" subtitle=subtitle.." Left"
elseif rwyLeft == false then elseif rwyLandingLeft==false then
subtitle = subtitle .. " Right" subtitle=subtitle.." Right"
end end
local _RUNACT = subtitle local _RUNACT = subtitle
if not self.useSRS then if not self.useSRS then
self:Transmission( ATIS.Sound.ActiveRunway, 1.0, subtitle ) self:Transmission(ATIS.Sound.ActiveRunway, 1.0, subtitle)
self.radioqueue:Number2Transmission( runway ) self.radioqueue:Number2Transmission(runwayLanding)
if rwyLeft == true then if rwyLandingLeft==true then
self:Transmission( ATIS.Sound.Left, 0.2 ) self:Transmission(ATIS.Sound.Left, 0.2)
elseif rwyLeft == false then elseif rwyLandingLeft==false then
self:Transmission( ATIS.Sound.Right, 0.2 ) self:Transmission(ATIS.Sound.Right, 0.2)
end end
end end
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
@ -2126,7 +2133,7 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
-- ILS -- ILS
local ils = self:GetNavPoint( self.ils, runway, rwyLeft ) local ils=self:GetNavPoint(self.ils, runwayLanding, rwyLandingLeft)
if ils then if ils then
subtitle = string.format( "ILS frequency %.2f MHz", ils.frequency ) subtitle = string.format( "ILS frequency %.2f MHz", ils.frequency )
if not self.useSRS then if not self.useSRS then
@ -2144,7 +2151,7 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
-- Outer NDB -- Outer NDB
local ndb = self:GetNavPoint( self.ndbouter, runway, rwyLeft ) local ndb=self:GetNavPoint(self.ndbouter, runwayLanding, rwyLandingLeft)
if ndb then if ndb then
subtitle = string.format( "Outer NDB frequency %.2f MHz", ndb.frequency ) subtitle = string.format( "Outer NDB frequency %.2f MHz", ndb.frequency )
if not self.useSRS then if not self.useSRS then
@ -2162,7 +2169,7 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
-- Inner NDB -- Inner NDB
local ndb = self:GetNavPoint( self.ndbinner, runway, rwyLeft ) local ndb=self:GetNavPoint(self.ndbinner, runwayLanding, rwyLandingLeft)
if ndb then if ndb then
subtitle = string.format( "Inner NDB frequency %.2f MHz", ndb.frequency ) subtitle = string.format( "Inner NDB frequency %.2f MHz", ndb.frequency )
if not self.useSRS then if not self.useSRS then
@ -2201,7 +2208,7 @@ function ATIS:onafterBroadcast( From, Event, To )
-- TACAN -- TACAN
if self.tacan then 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 if not self.useSRS then
self:Transmission( ATIS.Sound.TACANChannel, 1.0, subtitle ) self:Transmission( ATIS.Sound.TACANChannel, 1.0, subtitle )
self.radioqueue:Number2Transmission( tostring( self.tacan ), nil, 0.2 ) self.radioqueue:Number2Transmission( tostring( self.tacan ), nil, 0.2 )
@ -2221,7 +2228,7 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
-- PRMG -- PRMG
local ndb = self:GetNavPoint( self.prmg, runway, rwyLeft ) local ndb=self:GetNavPoint(self.prmg, runwayLanding, rwyLandingLeft)
if ndb then if ndb then
subtitle = string.format( "PRMG channel %d", ndb.frequency ) subtitle = string.format( "PRMG channel %d", ndb.frequency )
if not self.useSRS then if not self.useSRS then
@ -2348,39 +2355,19 @@ end
--- Get active runway runway. --- Get active runway runway.
-- @param #ATIS self -- @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 #string Active runway, e.g. "31" for 310 deg.
-- @return #boolean Use Left=true, Right=false, or nil. -- @return #boolean Use Left=true, Right=false, or nil.
function ATIS:GetActiveRunway() function ATIS:GetActiveRunway(Takeoff)
local coord = self.airbase:GetCoordinate() local runway=nil --Wrapper.Airbase#AIRBASE.Runway
local height = coord:GetLandHeight() if Takeoff then
runway=self.airbase:GetActiveRunwayTakeoff()
-- Get wind direction and speed in m/s. else
local windFrom, windSpeed = coord:GetWind( height + 10 ) runway=self.airbase:GetActiveRunwayLanding()
-- 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 )
end end
return runway, rwyLeft return runway.name, runway.isLeft
end end
--- Get runway from user supplied magnetic heading. --- Get runway from user supplied magnetic heading.

View File

@ -31,7 +31,7 @@
-- @field #string tankergroupname Name of the late activated tanker template group. -- @field #string tankergroupname Name of the late activated tanker template group.
-- @field Wrapper.Group#GROUP tanker Tanker 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 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 #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 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". -- @field #string TACANmorse TACAN morse code. Three letters identifying the TACAN station. Default "TKR".
@ -784,10 +784,11 @@ end
-- @param #RECOVERYTANKER self -- @param #RECOVERYTANKER self
-- @param #number channel TACAN channel. Default 1. -- @param #number channel TACAN channel. Default 1.
-- @param #string morse TACAN morse code identifier. Three letters. Default "TKR". -- @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 -- @return #RECOVERYTANKER self
function RECOVERYTANKER:SetTACAN(channel, morse) function RECOVERYTANKER:SetTACAN(channel, morse, mode)
self.TACANchannel=channel or 1 self.TACANchannel=channel or 1
self.TACANmode="Y" self.TACANmode=mode or "Y"
self.TACANmorse=morse or "TKR" self.TACANmorse=morse or "TKR"
self.TACANon=true self.TACANon=true
return self return self
@ -1625,7 +1626,6 @@ function RECOVERYTANKER:_ActivateTACAN(delay)
if delay and delay>0 then if delay and delay>0 then
-- Schedule TACAN activation. -- Schedule TACAN activation.
--SCHEDULER:New(nil, self._ActivateTACAN, {self}, delay)
self:ScheduleOnce(delay, RECOVERYTANKER._ActivateTACAN, self) self:ScheduleOnce(delay, RECOVERYTANKER._ActivateTACAN, self)
else else

View File

@ -497,7 +497,7 @@ ENUMS.ReportingName =
Mudhen = "F-15E", Mudhen = "F-15E",
Viper = "F-16", Viper = "F-16",
Phantom = "F-4E", 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", Sabre = "F-86",
Hornet = "A-18", -- avoiding the slash Hornet = "A-18", -- avoiding the slash
Hawk = "Hawk", Hawk = "Hawk",