Add an audio option to mute the round restart sound (#10258)
This commit is contained in:
@@ -63,6 +63,7 @@
|
|||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
<Control MinSize="0 8" />
|
<Control MinSize="0 8" />
|
||||||
<CheckBox Name="LobbyMusicCheckBox" Text="{Loc 'ui-options-lobby-music'}" />
|
<CheckBox Name="LobbyMusicCheckBox" Text="{Loc 'ui-options-lobby-music'}" />
|
||||||
|
<CheckBox Name="RestartSoundsCheckBox" Text="{Loc 'ui-options-restart-sounds'}" />
|
||||||
<CheckBox Name="EventMusicCheckBox" Text="{Loc 'ui-options-event-music'}" />
|
<CheckBox Name="EventMusicCheckBox" Text="{Loc 'ui-options-event-music'}" />
|
||||||
<CheckBox Name="AdminSoundsCheckBox" Text="{Loc 'ui-options-admin-sounds'}" />
|
<CheckBox Name="AdminSoundsCheckBox" Text="{Loc 'ui-options-admin-sounds'}" />
|
||||||
<CheckBox Name="StationAmbienceCheckBox" Text="{Loc 'ui-options-station-ambience'}" />
|
<CheckBox Name="StationAmbienceCheckBox" Text="{Loc 'ui-options-station-ambience'}" />
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
||||||
|
RestartSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.RestartSoundsEnabled);
|
||||||
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
|
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
|
||||||
AdminSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AdminSoundsEnabled);
|
AdminSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AdminSoundsEnabled);
|
||||||
StationAmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.StationAmbienceEnabled);
|
StationAmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.StationAmbienceEnabled);
|
||||||
@@ -34,6 +35,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
AmbienceVolumeSlider.OnValueChanged += OnAmbienceVolumeSliderChanged;
|
AmbienceVolumeSlider.OnValueChanged += OnAmbienceVolumeSliderChanged;
|
||||||
AmbienceSoundsSlider.OnValueChanged += OnAmbienceSoundsSliderChanged;
|
AmbienceSoundsSlider.OnValueChanged += OnAmbienceSoundsSliderChanged;
|
||||||
LobbyMusicCheckBox.OnToggled += OnLobbyMusicCheckToggled;
|
LobbyMusicCheckBox.OnToggled += OnLobbyMusicCheckToggled;
|
||||||
|
RestartSoundsCheckBox.OnToggled += OnRestartSoundsCheckToggled;
|
||||||
EventMusicCheckBox.OnToggled += OnEventMusicCheckToggled;
|
EventMusicCheckBox.OnToggled += OnEventMusicCheckToggled;
|
||||||
AdminSoundsCheckBox.OnToggled += OnAdminSoundsCheckToggled;
|
AdminSoundsCheckBox.OnToggled += OnAdminSoundsCheckToggled;
|
||||||
StationAmbienceCheckBox.OnToggled += OnStationAmbienceCheckToggled;
|
StationAmbienceCheckBox.OnToggled += OnStationAmbienceCheckToggled;
|
||||||
@@ -80,7 +82,10 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
{
|
{
|
||||||
UpdateChanges();
|
UpdateChanges();
|
||||||
}
|
}
|
||||||
|
private void OnRestartSoundsCheckToggled(BaseButton.ButtonEventArgs args)
|
||||||
|
{
|
||||||
|
UpdateChanges();
|
||||||
|
}
|
||||||
private void OnEventMusicCheckToggled(BaseButton.ButtonEventArgs args)
|
private void OnEventMusicCheckToggled(BaseButton.ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
UpdateChanges();
|
UpdateChanges();
|
||||||
@@ -108,6 +113,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
_cfg.SetCVar(CCVars.AmbienceVolume, LV100ToDB(AmbienceVolumeSlider.Value));
|
_cfg.SetCVar(CCVars.AmbienceVolume, LV100ToDB(AmbienceVolumeSlider.Value));
|
||||||
_cfg.SetCVar(CCVars.MaxAmbientSources, (int)AmbienceSoundsSlider.Value);
|
_cfg.SetCVar(CCVars.MaxAmbientSources, (int)AmbienceSoundsSlider.Value);
|
||||||
_cfg.SetCVar(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox.Pressed);
|
||||||
|
_cfg.SetCVar(CCVars.RestartSoundsEnabled, RestartSoundsCheckBox.Pressed);
|
||||||
_cfg.SetCVar(CCVars.EventMusicEnabled, EventMusicCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.EventMusicEnabled, EventMusicCheckBox.Pressed);
|
||||||
_cfg.SetCVar(CCVars.AdminSoundsEnabled, AdminSoundsCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.AdminSoundsEnabled, AdminSoundsCheckBox.Pressed);
|
||||||
_cfg.SetCVar(CCVars.StationAmbienceEnabled, StationAmbienceCheckBox.Pressed);
|
_cfg.SetCVar(CCVars.StationAmbienceEnabled, StationAmbienceCheckBox.Pressed);
|
||||||
@@ -128,6 +134,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
AmbienceVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume));
|
AmbienceVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume));
|
||||||
AmbienceSoundsSlider.Value = _cfg.GetCVar(CCVars.MaxAmbientSources);
|
AmbienceSoundsSlider.Value = _cfg.GetCVar(CCVars.MaxAmbientSources);
|
||||||
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
||||||
|
RestartSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.RestartSoundsEnabled);
|
||||||
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
|
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
|
||||||
AdminSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AdminSoundsEnabled);
|
AdminSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AdminSoundsEnabled);
|
||||||
StationAmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.StationAmbienceEnabled);
|
StationAmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.StationAmbienceEnabled);
|
||||||
@@ -158,11 +165,12 @@ namespace Content.Client.EscapeMenu.UI.Tabs
|
|||||||
Math.Abs(AmbienceVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume))) < 0.01f;
|
Math.Abs(AmbienceVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume))) < 0.01f;
|
||||||
var isAmbientSoundsSame = (int)AmbienceSoundsSlider.Value == _cfg.GetCVar(CCVars.MaxAmbientSources);
|
var isAmbientSoundsSame = (int)AmbienceSoundsSlider.Value == _cfg.GetCVar(CCVars.MaxAmbientSources);
|
||||||
var isLobbySame = LobbyMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
var isLobbySame = LobbyMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
||||||
|
var isRestartSoundsSame = RestartSoundsCheckBox.Pressed == _cfg.GetCVar(CCVars.RestartSoundsEnabled);
|
||||||
var isEventSame = EventMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.EventMusicEnabled);
|
var isEventSame = EventMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.EventMusicEnabled);
|
||||||
var isAdminSoundsSame = AdminSoundsCheckBox.Pressed == _cfg.GetCVar(CCVars.AdminSoundsEnabled);
|
var isAdminSoundsSame = AdminSoundsCheckBox.Pressed == _cfg.GetCVar(CCVars.AdminSoundsEnabled);
|
||||||
var isStationAmbienceSame = StationAmbienceCheckBox.Pressed == _cfg.GetCVar(CCVars.StationAmbienceEnabled);
|
var isStationAmbienceSame = StationAmbienceCheckBox.Pressed == _cfg.GetCVar(CCVars.StationAmbienceEnabled);
|
||||||
var isSpaceAmbienceSame = SpaceAmbienceCheckBox.Pressed == _cfg.GetCVar(CCVars.SpaceAmbienceEnabled);
|
var isSpaceAmbienceSame = SpaceAmbienceCheckBox.Pressed == _cfg.GetCVar(CCVars.SpaceAmbienceEnabled);
|
||||||
var isEverythingSame = isMasterVolumeSame && isMidiVolumeSame && isAmbientVolumeSame && isAmbientSoundsSame && isLobbySame && isEventSame && isAdminSoundsSame && isStationAmbienceSame && isSpaceAmbienceSame;
|
var isEverythingSame = isMasterVolumeSame && isMidiVolumeSame && isAmbientVolumeSame && isAmbientSoundsSame && isLobbySame && isRestartSoundsSame && isEventSame && isAdminSoundsSame && isStationAmbienceSame && isSpaceAmbienceSame;
|
||||||
ApplyButton.Disabled = isEverythingSame;
|
ApplyButton.Disabled = isEverythingSame;
|
||||||
ResetButton.Disabled = isEverythingSame;
|
ResetButton.Disabled = isEverythingSame;
|
||||||
MasterVolumeLabel.Text =
|
MasterVolumeLabel.Text =
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ using Content.Client.Audio;
|
|||||||
using Content.Client.Lobby;
|
using Content.Client.Lobby;
|
||||||
using Content.Client.RoundEnd;
|
using Content.Client.RoundEnd;
|
||||||
using Content.Client.Viewport;
|
using Content.Client.Viewport;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.GameWindow;
|
using Content.Shared.GameWindow;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.State;
|
using Robust.Client.State;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -19,6 +21,7 @@ namespace Content.Client.GameTicking.Managers
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||||
|
|
||||||
[ViewVariables] private bool _initialized;
|
[ViewVariables] private bool _initialized;
|
||||||
private Dictionary<EntityUid, Dictionary<string, uint?>> _jobsAvailable = new();
|
private Dictionary<EntityUid, Dictionary<string, uint?>> _jobsAvailable = new();
|
||||||
@@ -147,6 +150,12 @@ namespace Content.Client.GameTicking.Managers
|
|||||||
if (string.IsNullOrEmpty(RestartSound))
|
if (string.IsNullOrEmpty(RestartSound))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!_configManager.GetCVar(CCVars.RestartSoundsEnabled))
|
||||||
|
{
|
||||||
|
RestartSound = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SoundSystem.Play(RestartSound, Filter.Empty());
|
SoundSystem.Play(RestartSound, Filter.Empty());
|
||||||
|
|
||||||
// Cleanup the sound, we only want it to play when the round restarts after it ends normally.
|
// Cleanup the sound, we only want it to play when the round restarts after it ends normally.
|
||||||
|
|||||||
@@ -437,6 +437,14 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<bool> EventMusicEnabled =
|
public static readonly CVarDef<bool> EventMusicEnabled =
|
||||||
CVarDef.Create("ambience.event_music_enabled", true, CVar.ARCHIVE | CVar.CLIENTONLY);
|
CVarDef.Create("ambience.event_music_enabled", true, CVar.ARCHIVE | CVar.CLIENTONLY);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Specific Sounds
|
||||||
|
*/
|
||||||
|
// Round end sound (APC Destroyed)
|
||||||
|
public static readonly CVarDef<bool> RestartSoundsEnabled =
|
||||||
|
CVarDef.Create("ambience.restart_sounds_enabled", true, CVar.ARCHIVE | CVar.CLIENTONLY);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Admin sounds
|
* Admin sounds
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ ui-options-midi-volume = MIDI (Instrument) Volume:
|
|||||||
ui-options-ambience-volume = Ambience volume:
|
ui-options-ambience-volume = Ambience volume:
|
||||||
ui-options-ambience-max-sounds = Ambience simultaneous sounds:
|
ui-options-ambience-max-sounds = Ambience simultaneous sounds:
|
||||||
ui-options-lobby-music = Lobby & Round-end Music
|
ui-options-lobby-music = Lobby & Round-end Music
|
||||||
|
ui-options-restart-sounds = Round Restart Sounds
|
||||||
ui-options-event-music = Event Music
|
ui-options-event-music = Event Music
|
||||||
ui-options-admin-sounds = Play Admin Sounds
|
ui-options-admin-sounds = Play Admin Sounds
|
||||||
ui-options-station-ambience = Station Ambience
|
ui-options-station-ambience = Station Ambience
|
||||||
|
|||||||
Reference in New Issue
Block a user