From 7742fbbd869348f1db0f027da7ffd3d1ad545d06 Mon Sep 17 00:00:00 2001 From: Morb0 <14136326+Morb0@users.noreply.github.com> Date: Mon, 13 May 2024 17:42:32 +0300 Subject: [PATCH] Hide TTS selectors if CVar disabled --- .../Corvax/TTS/HumanoidProfileEditor.TTS.cs | 2 +- .../Preferences/UI/HumanoidProfileEditor.xaml | 2 +- .../Preferences/UI/HumanoidProfileEditor.xaml.cs | 7 ++++++- .../VoiceMask/VoiceMaskNameChangeWindow.xaml | 2 +- .../VoiceMask/VoiceMaskNameChangeWindow.xaml.cs | 11 ++++++++++- Content.Shared/Corvax/CCCVars/CCCVars.cs | 2 +- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Content.Client/Corvax/TTS/HumanoidProfileEditor.TTS.cs b/Content.Client/Corvax/TTS/HumanoidProfileEditor.TTS.cs index 851fb9d4ec..b00997a16a 100644 --- a/Content.Client/Corvax/TTS/HumanoidProfileEditor.TTS.cs +++ b/Content.Client/Corvax/TTS/HumanoidProfileEditor.TTS.cs @@ -9,7 +9,7 @@ namespace Content.Client.Preferences.UI; public sealed partial class HumanoidProfileEditor { private ISharedSponsorsManager? _sponsorsMgr; - private List _voiceList = default!; + private List _voiceList = new(); private void InitializeVoice() { diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml index 029b7dad2c..108a34749f 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml @@ -94,7 +94,7 @@ - + - + diff --git a/Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs b/Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs index 57b40d5087..3e9ca02a26 100644 --- a/Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs +++ b/Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs @@ -1,9 +1,11 @@ using System.Linq; using Content.Shared.Corvax.TTS; using Content.Client.UserInterface.Controls; +using Content.Shared.Corvax.CCCVars; using Content.Shared.Speech; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.XAML; +using Robust.Shared.Configuration; using Robust.Shared.Prototypes; namespace Content.Client.VoiceMask; @@ -36,7 +38,14 @@ public sealed partial class VoiceMaskNameChangeWindow : FancyWindow }; ReloadVerbs(proto); - ReloadVoices(proto); // Corvax-TTS + + // Corvax-TTS-Start + if (IoCManager.Resolve().GetCVar(CCCVars.TTSEnabled)) + { + TTSContainer.Visible = true; + ReloadVoices(proto); + } + // Corvax-TTS-End AddVerbs(); } diff --git a/Content.Shared/Corvax/CCCVars/CCCVars.cs b/Content.Shared/Corvax/CCCVars/CCCVars.cs index ccded7e74d..4344107d00 100644 --- a/Content.Shared/Corvax/CCCVars/CCCVars.cs +++ b/Content.Shared/Corvax/CCCVars/CCCVars.cs @@ -23,7 +23,7 @@ public sealed class CCCVars /// URL of the TTS server API. /// public static readonly CVarDef TTSEnabled = - CVarDef.Create("tts.enabled", false, CVar.SERVERONLY | CVar.ARCHIVE); + CVarDef.Create("tts.enabled", false, CVar.SERVER | CVar.REPLICATED | CVar.ARCHIVE); /// /// URL of the TTS server API.