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 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 --
@ -491,7 +507,6 @@ do -- Object
-- @field SCENERY
-- @field CARGO
--- @type Object.Desc
-- @extends #Desc
-- @field #number life initial life level
@ -501,6 +516,10 @@ do -- Object
-- @param #Object self
-- @return #boolean
--- @function [parent=#Object] isActive
-- @param #Object self
-- @return #boolean
--- @function [parent=#Object] destroy
-- @param #Object self
@ -1133,6 +1152,11 @@ do -- Unit
-- @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
-- @param #Unit self
@ -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

View File

@ -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
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
@ -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
@ -1129,6 +1130,7 @@ end
-- @param #number Port SRS port. Default 5002.
-- @return #ATIS self
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)
@ -1136,9 +1138,13 @@ function ATIS:SetSRS( PathToSRS, Gender, Culture, Voice, Port )
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 ---
@ -2002,19 +2009,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
@ -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
@ -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()
function ATIS:GetActiveRunway(Takeoff)
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
local runway=nil --Wrapper.Airbase#AIRBASE.Runway
if Takeoff then
runway=self.airbase:GetActiveRunwayTakeoff()
else
runway=self.airbase:GetActiveRunwayLanding()
end
-- Was "L"eft or "R"ight given?
rwyLeft = self:GetRunwayLR( self.activerunway )
end
return runway, rwyLeft
return runway.name, runway.isLeft
end
--- 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 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

View File

@ -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",