From 729c1f5e3393151945fdc8243e17297998a9293a Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sat, 6 Jan 2024 18:22:18 +0100 Subject: [PATCH] Fixes for MSRS changes #STRATEGO * fix for an AB not having a zone --- .../Moose/Functional/Stratego.lua | 7 +++-- Moose Development/Moose/Ops/Awacs.lua | 27 +++++++++++-------- Moose Development/Moose/Ops/PlayerTask.lua | 24 ++++++++++------- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/Moose Development/Moose/Functional/Stratego.lua b/Moose Development/Moose/Functional/Stratego.lua index f8c9e8c07..43752ea7e 100644 --- a/Moose Development/Moose/Functional/Stratego.lua +++ b/Moose Development/Moose/Functional/Stratego.lua @@ -176,7 +176,7 @@ STRATEGO = { debug = false, drawzone = false, markzone = false, - version = "0.2.2", + version = "0.2.3", portweight = 3, POIweight = 1, maxrunways = 3, @@ -431,6 +431,9 @@ function STRATEGO:AnalyseBases() local numrwys = #runways if numrwys >= 1 then numrwys = numrwys * 0.5 end local abzone = ab:GetZone() + if not abzone then + abzone = ZONE_RADIUS:New(abname,ab:GetVec2(),500) + end local coa = ab:GetCoalition() + 1 local abtype = "AIRBASE" if ab:IsShip() then @@ -441,7 +444,7 @@ function STRATEGO:AnalyseBases() numrwys = 1 abtype = "FARP" end - local coord = abzone:GetCoordinate() + local coord = ab:GetCoordinate() if debug then abzone:DrawZone(-1,colors[coa],1,colors[coa],0.3,1) coord:TextToAll(tostring(numrwys),-1,{0,0,0},1,colors[coa],0.3,20) diff --git a/Moose Development/Moose/Ops/Awacs.lua b/Moose Development/Moose/Ops/Awacs.lua index 583a7f30f..4202e253f 100644 --- a/Moose Development/Moose/Ops/Awacs.lua +++ b/Moose Development/Moose/Ops/Awacs.lua @@ -2071,7 +2071,7 @@ function AWACS:AddGroupToDetection(Group) return self end ---- [User] Set AWACS SRS TTS details - see @{Sound.SRS} for details +--- [User] Set AWACS SRS TTS details - see @{Sound.SRS} for details. `SetSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible. -- @param #AWACS self -- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone" -- @param #string Gender Defaults to "male" @@ -2080,16 +2080,16 @@ end -- @param #string Voice (Optional) Use a specifc voice with the @{Sound.SRS#SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`. -- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS. -- @param #number Volume Volume - between 0.0 (silent) and 1.0 (loudest) --- @param #string PathToGoogleKey Path to your google key if you want to use google TTS --- @param #string AccessKey Your Google API access key. This is necessary if DCS-gRPC is used as backend. +-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS; if you use a config file for MSRS, hand in nil here. +-- @param #string AccessKey (Optional) Your Google API access key. This is necessary if DCS-gRPC is used as backend; if you use a config file for MSRS, hand in nil here. -- @return #AWACS self function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey) self:T(self.lid.."SetSRS") - self.PathToSRS = PathToSRS or "C:\\Program Files\\DCS-SimpleRadio-Standalone" - self.Gender = Gender or "male" - self.Culture = Culture or "en-US" - self.Port = Port or 5002 - self.Voice = Voice + self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" + self.Gender = Gender or MSRS.gender or "male" + self.Culture = Culture or MSRS.culture or "en-US" + self.Port = Port or MSRS.port or 5002 + self.Voice = Voice or MSRS.voice self.PathToGoogleKey = PathToGoogleKey self.AccessKey = AccessKey self.Volume = Volume or 1.0 @@ -2098,7 +2098,6 @@ function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey self.AwacsSRS:SetCoalition(self.coalition) self.AwacsSRS:SetGender(self.Gender) self.AwacsSRS:SetCulture(self.Culture) - self.AwacsSRS:SetVoice(self.Voice) self.AwacsSRS:SetPort(self.Port) self.AwacsSRS:SetLabel("AWACS") self.AwacsSRS:SetVolume(Volume) @@ -2106,7 +2105,13 @@ function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey --self.AwacsSRS:SetGoogle(self.PathToGoogleKey) self.AwacsSRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey) end - + -- Pre-configured Google? + if self.AwacsSRS:GetProvider() == MSRS.Provider.GOOGLE then + self.PathToGoogleKey = MSRS.poptions.gcloud.credentials + self.Voice = Voice or MSRS.poptions.gcloud.voice + self.AccessKey = AccessKey or MSRS.poptions.gcloud.key + end + self.AwacsSRS:SetVoice(self.Voice) return self end @@ -3669,7 +3674,7 @@ function AWACS:_CheckInAI(FlightGroup,Group,AuftragsNr) CAPVoice = self.CapVoices[math.floor(math.random(1,10))] end - FlightGroup:SetSRS(self.PathToSRS,self.CAPGender,self.CAPCulture,CAPVoice,self.Port,self.PathToGoogleKey,"FLIGHT") + FlightGroup:SetSRS(self.PathToSRS,self.CAPGender,self.CAPCulture,CAPVoice,self.Port,self.PathToGoogleKey,"FLIGHT",1) local checkai = self.gettext:GetEntry("CHECKINAI",self.locale) text = string.format(checkai,self.callsigntxt, managedgroup.CallSign, self.CAPTimeOnStation, self.AOName) diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index 79ffe5803..855b954ca 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -3993,7 +3993,7 @@ function PLAYERTASKCONTROLLER:SetupIntel(RecceName) return self end ---- [User] Set SRS TTS details - see @{Sound.SRS} for details +--- [User] Set SRS TTS details - see @{Sound.SRS} for details.`SetSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible. -- @param #PLAYERTASKCONTROLLER self -- @param #number Frequency Frequency to be used. Can also be given as a table of multiple frequencies, e.g. 271 or {127,251}. There needs to be exactly the same number of modulations! -- @param #number Modulation Modulation to be used. Can also be given as a table of multiple modulations, e.g. radio.modulation.AM or {radio.modulation.FM,radio.modulation.AM}. There needs to be exactly the same number of frequencies! @@ -4004,17 +4004,17 @@ end -- @param #string Voice (Optional) Use a specifc voice with the @{Sound.SRS#SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`. -- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS. -- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest) --- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS --- @param #string AccessKey Your Google API access key. This is necessary if DCS-gRPC is used as backend. +-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS; if you use a config file for MSRS, hand in nil here. +-- @param #string AccessKey (Optional) Your Google API access key. This is necessary if DCS-gRPC is used as backend; if you use a config file for MSRS, hand in nil here. -- @param Core.Point#COORDINATE Coordinate Coordinate from which the controller radio is sending -- @return #PLAYERTASKCONTROLLER self function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Coordinate) self:T(self.lid.."SetSRS") - self.PathToSRS = PathToSRS or "C:\\Program Files\\DCS-SimpleRadio-Standalone" -- - self.Gender = Gender or "male" -- - self.Culture = Culture or "en-US" -- - self.Port = Port or 5002 -- - self.Voice = Voice -- + self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" -- + self.Gender = Gender or MSRS.gender or "male" -- + self.Culture = Culture or MSRS.culture or "en-US" -- + self.Port = Port or MSRS.port or 5002 -- + self.Voice = Voice or MSRS.voice self.PathToGoogleKey = PathToGoogleKey -- self.AccessKey = AccessKey self.Volume = Volume or 1.0 -- @@ -4030,15 +4030,21 @@ function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Cultu self.SRS:SetGender(self.Gender) self.SRS:SetCulture(self.Culture) self.SRS:SetPort(self.Port) - self.SRS:SetVoice(self.Voice) self.SRS:SetVolume(self.Volume) if self.PathToGoogleKey then --self.SRS:SetGoogle(self.PathToGoogleKey) self.SRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey) + end + -- Pre-configured Google? + if self.SRS:GetProvider() == MSRS.Provider.GOOGLE then + self.PathToGoogleKey = MSRS.poptions.gcloud.credentials + self.Voice = Voice or MSRS.poptions.gcloud.voice + self.AccessKey = AccessKey or MSRS.poptions.gcloud.key end if Coordinate then self.SRS:SetCoordinate(Coordinate) end + self.SRS:SetVoice(self.Voice) self.SRSQueue = MSRSQUEUE:New(self.MenuName or self.Name) self.SRSQueue:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers) return self