Merge branch 'master' into develop

This commit is contained in:
Frank 2023-07-26 17:23:34 +02:00
commit 3c74aef378

View File

@ -1735,10 +1735,10 @@ AIRBOSS.Difficulty = {
-- @field #table trapsheet Groove data table recorded every 0.5 seconds. -- @field #table trapsheet Groove data table recorded every 0.5 seconds.
-- @field #boolean trapon If true, save trap sheets. -- @field #boolean trapon If true, save trap sheets.
-- @field #string debriefschedulerID Debrief scheduler ID. -- @field #string debriefschedulerID Debrief scheduler ID.
-- --
-- @field Sound.SRS#MSRS SRS -- @field Sound.SRS#MSRS SRS
-- @field Sound.SRS#MSRSQUEUE SRSQ -- @field Sound.SRS#MSRSQUEUE SRSQ
-- --
-- @extends #AIRBOSS.FlightGroup -- @extends #AIRBOSS.FlightGroup
--- Main group level radio menu: F10 Other/Airboss. --- Main group level radio menu: F10 Other/Airboss.
@ -3058,7 +3058,7 @@ end
-- @param #number Port Port of the SRS server, defaults to 5002. -- @param #number Port Port of the SRS server, defaults to 5002.
-- @param #string Culture (Optional, Airboss Culture) Culture, defaults to "en-US". -- @param #string Culture (Optional, Airboss Culture) Culture, defaults to "en-US".
-- @param #string Gender (Optional, Airboss Gender) Gender, e.g. "male" or "female". Defaults to "male". -- @param #string Gender (Optional, Airboss Gender) Gender, e.g. "male" or "female". Defaults to "male".
-- @param #string Voice (Optional, Airboss Voice) Set to use a specific voice. Will **override gender and culture** settings. -- @param #string Voice (Optional, Airboss Voice) Set to use a specific voice. Will **override gender and culture** settings.
-- @param #string GoogleCreds (Optional) Path to Google credentials, e.g. "C:\\Program Files\\DCS-SimpleRadio-Standalone\\yourgooglekey.json". -- @param #string GoogleCreds (Optional) Path to Google credentials, e.g. "C:\\Program Files\\DCS-SimpleRadio-Standalone\\yourgooglekey.json".
-- @param #number Volume (Optional) E.g. 0.75. Defaults to 1.0 (loudest). -- @param #number Volume (Optional) E.g. 0.75. Defaults to 1.0 (loudest).
-- @param #table AltBackend (Optional) See MSRS for details. -- @param #table AltBackend (Optional) See MSRS for details.
@ -3087,10 +3087,10 @@ function AIRBOSS:EnableSRS(PathToSRS,Port,Culture,Gender,Voice,GoogleCreds,Volum
-- SRSQUEUE -- SRSQUEUE
self.SRSQ = MSRSQUEUE:New("AIRBOSS") self.SRSQ = MSRSQUEUE:New("AIRBOSS")
self.SRSQ:SetTransmitOnlyWithPlayers(true) self.SRSQ:SetTransmitOnlyWithPlayers(true)
if not self.PilotRadio then if not self.PilotRadio then
self:SetSRSPilotVoice() self:SetSRSPilotVoice()
end end
return self return self
end end
--- Set LSO radio frequency and modulation. Default frequency is 264 MHz AM. --- Set LSO radio frequency and modulation. Default frequency is 264 MHz AM.
@ -5924,9 +5924,11 @@ function AIRBOSS:_ScanCarrierZone()
-- Get aircraft type name. -- Get aircraft type name.
local actype = group:GetTypeName() local actype = group:GetTypeName()
-- Create a new flight group
if knownflight then if knownflight then
-- Debug output.
self:T2(self.lid..string.format("Known flight group %s of type %s in CCA.", groupname, actype))
-- Check if flight is AI and if we want to handle it at all. -- Check if flight is AI and if we want to handle it at all.
if knownflight.ai and knownflight.flag == -100 and self.handleai then if knownflight.ai and knownflight.flag == -100 and self.handleai then
@ -5943,9 +5945,10 @@ function AIRBOSS:_ScanCarrierZone()
flight.airboss = self flight.airboss = self
end end
-- Send AI flight to marshal stack. -- Send AI flight to marshal stack if group closes in more than 5 and has initial flag value.
if putintomarshal then if putintomarshal then
-- Get the next free stack for current recovery case. -- Get the next free stack for current recovery case.
local stack = self:_GetFreeStack( knownflight.ai ) local stack = self:_GetFreeStack( knownflight.ai )
@ -11553,7 +11556,7 @@ function AIRBOSS:GetHeadingIntoWind( magnetic, coord )
local function adjustDegreesForWindSpeed(windSpeed) local function adjustDegreesForWindSpeed(windSpeed)
local degreesAdjustment = 0 local degreesAdjustment = 0
-- the windspeeds are in m/s -- the windspeeds are in m/s
-- +0 degrees at 15m/s = 37kts -- +0 degrees at 15m/s = 37kts
-- +0 degrees at 14m/s = 35kts -- +0 degrees at 14m/s = 35kts
-- +0 degrees at 13m/s = 33kts -- +0 degrees at 13m/s = 33kts
@ -11568,7 +11571,7 @@ function AIRBOSS:GetHeadingIntoWind( magnetic, coord )
-- +20 degrees at 4m/s = 26kts -- +20 degrees at 4m/s = 26kts
-- +20 degrees at 3m/s = 26kts -- +20 degrees at 3m/s = 26kts
-- +30 degrees at 2m/s = 26kts 1s -- +30 degrees at 2m/s = 26kts 1s
if windSpeed > 0 and windSpeed < 3 then if windSpeed > 0 and windSpeed < 3 then
degreesAdjustment = 30 degreesAdjustment = 30
elseif windSpeed >= 3 and windSpeed < 5 then elseif windSpeed >= 3 and windSpeed < 5 then
@ -11580,17 +11583,17 @@ function AIRBOSS:GetHeadingIntoWind( magnetic, coord )
elseif windSpeed >= 13 then elseif windSpeed >= 13 then
degreesAdjustment = 0 degreesAdjustment = 0
end end
return degreesAdjustment return degreesAdjustment
end end
-- Get direction the wind is blowing from. This is where we want to go. -- Get direction the wind is blowing from. This is where we want to go.
local windfrom, vwind = self:GetWind( nil, nil, coord ) local windfrom, vwind = self:GetWind( nil, nil, coord )
--self:I("windfrom="..windfrom.." vwind="..vwind) --self:I("windfrom="..windfrom.." vwind="..vwind)
vwind = vwind + adjustDegreesForWindSpeed(vwind) vwind = vwind + adjustDegreesForWindSpeed(vwind)
--self:I("windfrom="..windfrom.." (c)vwind="..vwind) --self:I("windfrom="..windfrom.." (c)vwind="..vwind)
-- Actually, we want the runway in the wind. -- Actually, we want the runway in the wind.
@ -14730,12 +14733,12 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
if radio == nil or call == nil then if radio == nil or call == nil then
return return
end end
if not self.SRS then if not self.SRS then
-- Create a new radio transmission item. -- Create a new radio transmission item.
local transmission = {} -- #AIRBOSS.Radioitem local transmission = {} -- #AIRBOSS.Radioitem
transmission.radio = radio transmission.radio = radio
transmission.call = call transmission.call = call
transmission.Tplay = timer.getAbsTime() + (delay or 0) transmission.Tplay = timer.getAbsTime() + (delay or 0)
@ -14743,58 +14746,58 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
transmission.isplaying = false transmission.isplaying = false
transmission.Tstarted = nil transmission.Tstarted = nil
transmission.loud = loud and call.loud transmission.loud = loud and call.loud
-- Player onboard number if sender has one. -- Player onboard number if sender has one.
if self:_IsOnboard( call.modexsender ) then if self:_IsOnboard( call.modexsender ) then
self:_Number2Radio( radio, call.modexsender, delay, 0.3, pilotcall ) self:_Number2Radio( radio, call.modexsender, delay, 0.3, pilotcall )
end end
-- Play onboard number if receiver has one. -- Play onboard number if receiver has one.
if self:_IsOnboard( call.modexreceiver ) then if self:_IsOnboard( call.modexreceiver ) then
self:_Number2Radio( radio, call.modexreceiver, delay, 0.3, pilotcall ) self:_Number2Radio( radio, call.modexreceiver, delay, 0.3, pilotcall )
end end
-- Add transmission to the right queue. -- Add transmission to the right queue.
local caller = "" local caller = ""
if radio.alias == "LSO" then if radio.alias == "LSO" then
table.insert( self.RQLSO, transmission ) table.insert( self.RQLSO, transmission )
caller = "LSOCall" caller = "LSOCall"
-- Schedule radio queue checks. -- Schedule radio queue checks.
if not self.RQLid then if not self.RQLid then
self:T( self.lid .. string.format( "Starting LSO radio queue." ) ) self:T( self.lid .. string.format( "Starting LSO radio queue." ) )
self.RQLid = self.radiotimer:Schedule( nil, AIRBOSS._CheckRadioQueue, { self, self.RQLSO, "LSO" }, 0.02, 0.05 ) self.RQLid = self.radiotimer:Schedule( nil, AIRBOSS._CheckRadioQueue, { self, self.RQLSO, "LSO" }, 0.02, 0.05 )
end end
elseif radio.alias == "MARSHAL" then elseif radio.alias == "MARSHAL" then
table.insert( self.RQMarshal, transmission ) table.insert( self.RQMarshal, transmission )
caller = "MarshalCall" caller = "MarshalCall"
if not self.RQMid then if not self.RQMid then
self:T( self.lid .. string.format( "Starting Marhal radio queue." ) ) self:T( self.lid .. string.format( "Starting Marhal radio queue." ) )
self.RQMid = self.radiotimer:Schedule( nil, AIRBOSS._CheckRadioQueue, { self, self.RQMarshal, "MARSHAL" }, 0.02, 0.05 ) self.RQMid = self.radiotimer:Schedule( nil, AIRBOSS._CheckRadioQueue, { self, self.RQMarshal, "MARSHAL" }, 0.02, 0.05 )
end end
end end
-- Append radio click sound at the end of the transmission. -- Append radio click sound at the end of the transmission.
if click then if click then
self:RadioTransmission( radio, self[caller].CLICK, false, delay ) self:RadioTransmission( radio, self[caller].CLICK, false, delay )
end end
else else
-- SRS transmission -- SRS transmission
local frequency = self.MarshalRadio.frequency local frequency = self.MarshalRadio.frequency
local modulation = self.MarshalRadio.modulation local modulation = self.MarshalRadio.modulation
local voice = nil local voice = nil
local gender = nil local gender = nil
local culture = nil local culture = nil
if radio.alias == "AIRBOSS" then if radio.alias == "AIRBOSS" then
frequency = self.AirbossRadio.frequency frequency = self.AirbossRadio.frequency
modulation = self.AirbossRadio.modulation modulation = self.AirbossRadio.modulation
@ -14802,13 +14805,13 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
gender = self.AirbossRadio.gender gender = self.AirbossRadio.gender
culture = self.AirbossRadio.culture culture = self.AirbossRadio.culture
end end
if radio.alias == "MARSHAL" then if radio.alias == "MARSHAL" then
voice = self.MarshalRadio.voice voice = self.MarshalRadio.voice
gender = self.MarshalRadio.gender gender = self.MarshalRadio.gender
culture = self.MarshalRadio.culture culture = self.MarshalRadio.culture
end end
if radio.alias == "LSO" then if radio.alias == "LSO" then
frequency = self.LSORadio.frequency frequency = self.LSORadio.frequency
modulation = self.LSORadio.modulation modulation = self.LSORadio.modulation
@ -14816,7 +14819,7 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
gender = self.LSORadio.gender gender = self.LSORadio.gender
culture = self.LSORadio.culture culture = self.LSORadio.culture
end end
if pilotcall then if pilotcall then
voice = self.PilotRadio.voice voice = self.PilotRadio.voice
gender = self.PilotRadio.gender gender = self.PilotRadio.gender
@ -14830,16 +14833,16 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
modulation = self.AirbossRadio.modulation modulation = self.AirbossRadio.modulation
radio.alias = "AIRBOSS" radio.alias = "AIRBOSS"
end end
local volume = nil local volume = nil
if loud then if loud then
volume = 1.0 volume = 1.0
end end
--local text = tostring(call.modexreceiver).."; "..radio.alias.."; "..call.subtitle --local text = tostring(call.modexreceiver).."; "..radio.alias.."; "..call.subtitle
local text = call.subtitle local text = call.subtitle
self:I(self.lid..text) self:I(self.lid..text)
local srstext = self:_GetNiceSRSText(text) local srstext = self:_GetNiceSRSText(text)
self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, tstart, 0.1, subgroups, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias) self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, tstart, 0.1, subgroups, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias)
end end
@ -14858,11 +14861,11 @@ function AIRBOSS:SetSRSPilotVoice( Voice, Gender, Culture )
self.PilotRadio.voice = Voice or MSRS.Voices.Microsoft.David self.PilotRadio.voice = Voice or MSRS.Voices.Microsoft.David
self.PilotRadio.gender = Gender or "male" self.PilotRadio.gender = Gender or "male"
self.PilotRadio.culture = Culture or "en-US" self.PilotRadio.culture = Culture or "en-US"
if (not Voice) and self.SRS and self.SRS.google then if (not Voice) and self.SRS and self.SRS.google then
self.PilotRadio.voice = MSRS.Voices.Google.Standard.en_US_Standard_J self.PilotRadio.voice = MSRS.Voices.Google.Standard.en_US_Standard_J
end end
return self return self
end end
@ -15176,44 +15179,44 @@ function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duratio
-- SCHEDULER:New(nil, self.MessageToPlayer, {self, playerData, message, sender, receiver, duration, clear}, delay) -- SCHEDULER:New(nil, self.MessageToPlayer, {self, playerData, message, sender, receiver, duration, clear}, delay)
self:ScheduleOnce( delay, self.MessageToPlayer, self, playerData, message, sender, receiver, duration, clear ) self:ScheduleOnce( delay, self.MessageToPlayer, self, playerData, message, sender, receiver, duration, clear )
else else
if not self.SRS then if not self.SRS then
-- Wait until previous sound finished. -- Wait until previous sound finished.
local wait = 0 local wait = 0
-- Onboard number to get the attention. -- Onboard number to get the attention.
if receiver == playerData.onboard then if receiver == playerData.onboard then
-- Which voice over number to use. -- Which voice over number to use.
if sender and (sender == "LSO" or sender == "MARSHAL" or sender == "AIRBOSS") then if sender and (sender == "LSO" or sender == "MARSHAL" or sender == "AIRBOSS") then
-- User sound of board number. -- User sound of board number.
wait = wait + self:_Number2Sound( playerData, sender, receiver ) wait = wait + self:_Number2Sound( playerData, sender, receiver )
end end
end end
-- Negative. -- Negative.
if string.find( text:lower(), "negative" ) then if string.find( text:lower(), "negative" ) then
local filename = self:_RadioFilename( self.MarshalCall.NEGATIVE, false, "MARSHAL" ) local filename = self:_RadioFilename( self.MarshalCall.NEGATIVE, false, "MARSHAL" )
USERSOUND:New( filename ):ToGroup( playerData.group, wait ) USERSOUND:New( filename ):ToGroup( playerData.group, wait )
wait = wait + self.MarshalCall.NEGATIVE.duration wait = wait + self.MarshalCall.NEGATIVE.duration
end end
-- Affirm. -- Affirm.
if string.find( text:lower(), "affirm" ) then if string.find( text:lower(), "affirm" ) then
local filename = self:_RadioFilename( self.MarshalCall.AFFIRMATIVE, false, "MARSHAL" ) local filename = self:_RadioFilename( self.MarshalCall.AFFIRMATIVE, false, "MARSHAL" )
USERSOUND:New( filename ):ToGroup( playerData.group, wait ) USERSOUND:New( filename ):ToGroup( playerData.group, wait )
wait = wait + self.MarshalCall.AFFIRMATIVE.duration wait = wait + self.MarshalCall.AFFIRMATIVE.duration
end end
-- Roger. -- Roger.
if string.find( text:lower(), "roger" ) then if string.find( text:lower(), "roger" ) then
local filename = self:_RadioFilename( self.MarshalCall.ROGER, false, "MARSHAL" ) local filename = self:_RadioFilename( self.MarshalCall.ROGER, false, "MARSHAL" )
USERSOUND:New( filename ):ToGroup( playerData.group, wait ) USERSOUND:New( filename ):ToGroup( playerData.group, wait )
wait = wait + self.MarshalCall.ROGER.duration wait = wait + self.MarshalCall.ROGER.duration
end end
-- Play click sound to end message. -- Play click sound to end message.
if wait > 0 then if wait > 0 then
local filename = self:_RadioFilename( self.MarshalCall.CLICK ) local filename = self:_RadioFilename( self.MarshalCall.CLICK )
@ -15226,7 +15229,7 @@ function AIRBOSS:MessageToPlayer( playerData, message, sender, receiver, duratio
local voice = self.MarshalRadio.voice local voice = self.MarshalRadio.voice
local gender = self.MarshalRadio.gender local gender = self.MarshalRadio.gender
local culture = self.MarshalRadio.culture local culture = self.MarshalRadio.culture
if not sender then sender = "AIRBOSS" end if not sender then sender = "AIRBOSS" end
if string.find(sender,"AIRBOSS" ) then if string.find(sender,"AIRBOSS" ) then