]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add option to disable bwoink sound. (#33782)
authorc4llv07e <igor@c4llv07e.xyz>
Fri, 17 Jan 2025 07:24:50 +0000 (10:24 +0300)
committerGitHub <noreply@github.com>
Fri, 17 Jan 2025 07:24:50 +0000 (10:24 +0300)
* Add option to disable bwoink sound.

* Now it's working only with active admin status.

* No bwoink, only "notification sound"

* Moar changes

* Another one

Content.Client/Options/UI/Tabs/AudioTab.xaml
Content.Client/Options/UI/Tabs/AudioTab.xaml.cs
Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs
Content.Shared/CCVar/CCVars.Sounds.cs
Resources/Locale/en-US/escape-menu/ui/options-menu.ftl

index c374af31c588fb304d66ffb2ea5b7f1e48685d1e..5764755bb9af6fedfc0088629d2305ddfa2f9b74 100644 (file)
@@ -19,6 +19,7 @@
                 <CheckBox Name="RestartSoundsCheckBox" Text="{Loc 'ui-options-restart-sounds'}" />
                 <CheckBox Name="EventMusicCheckBox" Text="{Loc 'ui-options-event-music'}" />
                 <CheckBox Name="AdminSoundsCheckBox" Text="{Loc 'ui-options-admin-sounds'}" />
+                <CheckBox Name="BwoinkSoundCheckBox" Text="{Loc 'ui-options-bwoink-sound'}" />
             </BoxContainer>
         </BoxContainer>
         <ui:OptionsTabControlRow Name="Control" Access="Public" />
index 78186d446c76251c0d91049e0026d3bf8710ff5d..d57f36e74f8a271a12ec82539a211faaa9ab0f57 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Client.Administration.Managers;
 using Content.Client.Audio;
 using Content.Shared.CCVar;
 using Robust.Client.Audio;
@@ -12,8 +13,9 @@ namespace Content.Client.Options.UI.Tabs;
 [GenerateTypedNameReferences]
 public sealed partial class AudioTab : Control
 {
-    [Dependency] private readonly IConfigurationManager _cfg = default!;
     [Dependency] private readonly IAudioManager _audio = default!;
+    [Dependency] private readonly IClientAdminManager _admin = default!;
+    [Dependency] private readonly IConfigurationManager _cfg = default!;
 
     public AudioTab()
     {
@@ -61,10 +63,30 @@ public sealed partial class AudioTab : Control
         Control.AddOptionCheckBox(CCVars.RestartSoundsEnabled, RestartSoundsCheckBox);
         Control.AddOptionCheckBox(CCVars.EventMusicEnabled, EventMusicCheckBox);
         Control.AddOptionCheckBox(CCVars.AdminSoundsEnabled, AdminSoundsCheckBox);
+        Control.AddOptionCheckBox(CCVars.BwoinkSoundEnabled, BwoinkSoundCheckBox);
 
         Control.Initialize();
     }
 
+    protected override void EnteredTree()
+    {
+        base.EnteredTree();
+        _admin.AdminStatusUpdated += UpdateAdminButtonsVisibility;
+        UpdateAdminButtonsVisibility();
+    }
+
+    protected override void ExitedTree()
+    {
+        base.ExitedTree();
+        _admin.AdminStatusUpdated -= UpdateAdminButtonsVisibility;
+    }
+
+
+    private void UpdateAdminButtonsVisibility()
+    {
+        BwoinkSoundCheckBox.Visible = _admin.IsActive();
+    }
+
     private void OnMasterVolumeSliderChanged(float value)
     {
         // TODO: I was thinking of giving OptionsTabControlRow a flag to "set CVar immediately", but I'm deferring that
index 9f75b5cecde7ba6aaed955f5cce697c505e0fa8d..445bcc8601a7b372f8d359e810a46c89da02f581 100644 (file)
@@ -45,6 +45,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
     public IAHelpUIHandler? UIHelper;
     private bool _discordRelayActive;
     private bool _hasUnreadAHelp;
+    private bool _bwoinkSoundEnabled;
     private string? _aHelpSound;
 
     public override void Initialize()
@@ -56,6 +57,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
 
         _adminManager.AdminStatusUpdated += OnAdminStatusUpdated;
         _config.OnValueChanged(CCVars.AHelpSound, v => _aHelpSound = v, true);
+        _config.OnValueChanged(CCVars.BwoinkSoundEnabled, v => _bwoinkSoundEnabled = v, true);
     }
 
     public void UnloadButton()
@@ -135,7 +137,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
         }
         if (message.PlaySound && localPlayer.UserId != message.TrueSender)
         {
-            if (_aHelpSound != null)
+            if (_aHelpSound != null && (_bwoinkSoundEnabled || !_adminManager.IsActive()))
                 _audio.PlayGlobal(_aHelpSound, Filter.Local(), false);
             _clyde.RequestWindowAttention();
         }
index 73d9d3852f1f7adde1893808c610c8acdfd792a4..5e2a82518307c9c01a5db635353d28c152c1ba8a 100644 (file)
@@ -21,6 +21,9 @@ public sealed partial class CCVars
     public static readonly CVarDef<bool> AdminSoundsEnabled =
         CVarDef.Create("audio.admin_sounds_enabled", true, CVar.ARCHIVE | CVar.CLIENTONLY);
 
+    public static readonly CVarDef<bool> BwoinkSoundEnabled =
+        CVarDef.Create("audio.bwoink_sound_enabled", true, CVar.ARCHIVE | CVar.CLIENTONLY);
+
     public static readonly CVarDef<string> AdminChatSoundPath =
         CVarDef.Create("audio.admin_chat_sound_path",
             "/Audio/Items/pop.ogg",
index bcc5a994b8bd4f2e34f26868b21c1bdc624fa385..c13dbb516fc26f424b35d93ad5bd2af186150b01 100644 (file)
@@ -37,6 +37,7 @@ ui-options-lobby-music = Lobby & Round-end Music
 ui-options-restart-sounds = Round Restart Sounds
 ui-options-event-music = Event Music
 ui-options-admin-sounds = Play Admin Sounds
+ui-options-bwoink-sound = Play AHelp Notification Sound
 ui-options-volume-label = Volume
 
 ## Graphics menu