Fixes for MSRS changes

#STRATEGO
* fix for an AB not having a zone
This commit is contained in:
Applevangelist
2024-01-06 18:22:18 +01:00
parent 2c695e187f
commit 729c1f5e33
3 changed files with 36 additions and 22 deletions

View File

@@ -176,7 +176,7 @@ STRATEGO = {
debug = false, debug = false,
drawzone = false, drawzone = false,
markzone = false, markzone = false,
version = "0.2.2", version = "0.2.3",
portweight = 3, portweight = 3,
POIweight = 1, POIweight = 1,
maxrunways = 3, maxrunways = 3,
@@ -431,6 +431,9 @@ function STRATEGO:AnalyseBases()
local numrwys = #runways local numrwys = #runways
if numrwys >= 1 then numrwys = numrwys * 0.5 end if numrwys >= 1 then numrwys = numrwys * 0.5 end
local abzone = ab:GetZone() local abzone = ab:GetZone()
if not abzone then
abzone = ZONE_RADIUS:New(abname,ab:GetVec2(),500)
end
local coa = ab:GetCoalition() + 1 local coa = ab:GetCoalition() + 1
local abtype = "AIRBASE" local abtype = "AIRBASE"
if ab:IsShip() then if ab:IsShip() then
@@ -441,7 +444,7 @@ function STRATEGO:AnalyseBases()
numrwys = 1 numrwys = 1
abtype = "FARP" abtype = "FARP"
end end
local coord = abzone:GetCoordinate() local coord = ab:GetCoordinate()
if debug then if debug then
abzone:DrawZone(-1,colors[coa],1,colors[coa],0.3,1) 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) coord:TextToAll(tostring(numrwys),-1,{0,0,0},1,colors[coa],0.3,20)

View File

@@ -2071,7 +2071,7 @@ function AWACS:AddGroupToDetection(Group)
return self return self
end 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 #AWACS self
-- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone" -- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone"
-- @param #string Gender Defaults to "male" -- @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")`. -- @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. -- 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 #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 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 Your Google API access key. This is necessary if DCS-gRPC is used as backend. -- @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 -- @return #AWACS self
function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey) function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey)
self:T(self.lid.."SetSRS") self:T(self.lid.."SetSRS")
self.PathToSRS = PathToSRS or "C:\\Program Files\\DCS-SimpleRadio-Standalone" self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
self.Gender = Gender or "male" self.Gender = Gender or MSRS.gender or "male"
self.Culture = Culture or "en-US" self.Culture = Culture or MSRS.culture or "en-US"
self.Port = Port or 5002 self.Port = Port or MSRS.port or 5002
self.Voice = Voice self.Voice = Voice or MSRS.voice
self.PathToGoogleKey = PathToGoogleKey self.PathToGoogleKey = PathToGoogleKey
self.AccessKey = AccessKey self.AccessKey = AccessKey
self.Volume = Volume or 1.0 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:SetCoalition(self.coalition)
self.AwacsSRS:SetGender(self.Gender) self.AwacsSRS:SetGender(self.Gender)
self.AwacsSRS:SetCulture(self.Culture) self.AwacsSRS:SetCulture(self.Culture)
self.AwacsSRS:SetVoice(self.Voice)
self.AwacsSRS:SetPort(self.Port) self.AwacsSRS:SetPort(self.Port)
self.AwacsSRS:SetLabel("AWACS") self.AwacsSRS:SetLabel("AWACS")
self.AwacsSRS:SetVolume(Volume) 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:SetGoogle(self.PathToGoogleKey)
self.AwacsSRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey) self.AwacsSRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey)
end 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 return self
end end
@@ -3669,7 +3674,7 @@ function AWACS:_CheckInAI(FlightGroup,Group,AuftragsNr)
CAPVoice = self.CapVoices[math.floor(math.random(1,10))] CAPVoice = self.CapVoices[math.floor(math.random(1,10))]
end 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) local checkai = self.gettext:GetEntry("CHECKINAI",self.locale)
text = string.format(checkai,self.callsigntxt, managedgroup.CallSign, self.CAPTimeOnStation, self.AOName) text = string.format(checkai,self.callsigntxt, managedgroup.CallSign, self.CAPTimeOnStation, self.AOName)

View File

@@ -3993,7 +3993,7 @@ function PLAYERTASKCONTROLLER:SetupIntel(RecceName)
return self return self
end 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 #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 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! -- @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")`. -- @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. -- 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 #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 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 Your Google API access key. This is necessary if DCS-gRPC is used as backend. -- @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 -- @param Core.Point#COORDINATE Coordinate Coordinate from which the controller radio is sending
-- @return #PLAYERTASKCONTROLLER self -- @return #PLAYERTASKCONTROLLER self
function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Coordinate) function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Coordinate)
self:T(self.lid.."SetSRS") self:T(self.lid.."SetSRS")
self.PathToSRS = PathToSRS or "C:\\Program Files\\DCS-SimpleRadio-Standalone" -- self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" --
self.Gender = Gender or "male" -- self.Gender = Gender or MSRS.gender or "male" --
self.Culture = Culture or "en-US" -- self.Culture = Culture or MSRS.culture or "en-US" --
self.Port = Port or 5002 -- self.Port = Port or MSRS.port or 5002 --
self.Voice = Voice -- self.Voice = Voice or MSRS.voice
self.PathToGoogleKey = PathToGoogleKey -- self.PathToGoogleKey = PathToGoogleKey --
self.AccessKey = AccessKey self.AccessKey = AccessKey
self.Volume = Volume or 1.0 -- 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:SetGender(self.Gender)
self.SRS:SetCulture(self.Culture) self.SRS:SetCulture(self.Culture)
self.SRS:SetPort(self.Port) self.SRS:SetPort(self.Port)
self.SRS:SetVoice(self.Voice)
self.SRS:SetVolume(self.Volume) self.SRS:SetVolume(self.Volume)
if self.PathToGoogleKey then if self.PathToGoogleKey then
--self.SRS:SetGoogle(self.PathToGoogleKey) --self.SRS:SetGoogle(self.PathToGoogleKey)
self.SRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey) 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 end
if Coordinate then if Coordinate then
self.SRS:SetCoordinate(Coordinate) self.SRS:SetCoordinate(Coordinate)
end end
self.SRS:SetVoice(self.Voice)
self.SRSQueue = MSRSQUEUE:New(self.MenuName or self.Name) self.SRSQueue = MSRSQUEUE:New(self.MenuName or self.Name)
self.SRSQueue:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers) self.SRSQueue:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers)
return self return self