Add option to disable bwoink sound. (#33782)
* Add option to disable bwoink sound. * Now it's working only with active admin status. * No bwoink, only "notification sound" * Moar changes * Another one
This commit is contained in:
@@ -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" />
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user