Skip to content

Commit

Permalink
I am in misery (more Cvars)
Browse files Browse the repository at this point in the history
  • Loading branch information
Monotheonist committed Jan 9, 2025
1 parent bebd361 commit 978e690
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
5 changes: 3 additions & 2 deletions Content.Client/Options/UI/Tabs/AudioTab.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Client.Audio;
using Content.Shared.CCVar;
using Content.Shared._Impstation.CCVar;
using Robust.Client.Audio;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
Expand Down Expand Up @@ -52,7 +53,7 @@ public AudioTab()
scale: ContentAudioSystem.InterfaceMultiplier);

Control.AddOptionPercentSlider( //Impstation Random Announcer System port start
CCVars.AnnouncerVolume,
ImpCCVars.AnnouncerVolume,
SliderVolumeAnnouncer,
scale: ContentAudioSystem.AnnouncerMultiplier); //Impstation Random Announcer System port end

Expand All @@ -65,7 +66,7 @@ public AudioTab()
Control.AddOptionCheckBox(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox);
Control.AddOptionCheckBox(CCVars.RestartSoundsEnabled, RestartSoundsCheckBox);
Control.AddOptionCheckBox(CCVars.EventMusicEnabled, EventMusicCheckBox);
Control.AddOptionCheckBox(CCVars.AnnouncerDisableMultipleSounds, AnnouncerDisableMultipleSoundsCheckBox); //Impstation Random Announcer System
Control.AddOptionCheckBox(ImpCCVars.AnnouncerDisableMultipleSounds, AnnouncerDisableMultipleSoundsCheckBox); //Impstation Random Announcer System
Control.AddOptionCheckBox(CCVars.AdminSoundsEnabled, AdminSoundsCheckBox);

Control.Initialize();
Expand Down
13 changes: 7 additions & 6 deletions Content.Client/_EE/Announcements/Systems/AnnouncerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Shared._EE.Announcements.Events;
using Content.Shared._EE.Announcements.Systems;
using Content.Shared.CCVar;
using Content.Shared._Impstation.CCVar;
using Robust.Client.Audio;
using Robust.Client.Player;
using Robust.Client.ResourceManagement;
Expand All @@ -27,10 +28,10 @@ public override void Initialize()
{
base.Initialize();

AnnouncerVolume = _config.GetCVar(CCVars.AnnouncerVolume) * 100f / ContentAudioSystem.AnnouncerMultiplier;
AnnouncerVolume = _config.GetCVar(ImpCCVars.AnnouncerVolume) * 100f / ContentAudioSystem.AnnouncerMultiplier;

_config.OnValueChanged(CCVars.AnnouncerVolume, OnAnnouncerVolumeChanged);
_config.OnValueChanged(CCVars.AnnouncerDisableMultipleSounds, OnAnnouncerDisableMultipleSounds);
_config.OnValueChanged(ImpCCVars.AnnouncerVolume, OnAnnouncerVolumeChanged); // Impstation: Namespacing
_config.OnValueChanged(ImpCCVars.AnnouncerDisableMultipleSounds, OnAnnouncerDisableMultipleSounds);

SubscribeNetworkEvent<AnnouncementSendEvent>(OnAnnouncementReceived);
}
Expand All @@ -39,8 +40,8 @@ public override void Shutdown()
{
base.Shutdown();

_config.UnsubValueChanged(CCVars.AnnouncerVolume, OnAnnouncerVolumeChanged);
_config.UnsubValueChanged(CCVars.AnnouncerDisableMultipleSounds, OnAnnouncerDisableMultipleSounds);
_config.UnsubValueChanged(ImpCCVars.AnnouncerVolume, OnAnnouncerVolumeChanged); // Impstation: Namespacing
_config.UnsubValueChanged(ImpCCVars.AnnouncerDisableMultipleSounds, OnAnnouncerDisableMultipleSounds);
}


Expand Down Expand Up @@ -78,7 +79,7 @@ private void OnAnnouncementReceived(AnnouncementSendEvent ev)
source.Gain = AnnouncerVolume * SharedAudioSystem.VolumeToGain(ev.AudioParams.Volume);
source.Global = true;

if (_config.GetCVar(CCVars.AnnouncerDisableMultipleSounds))
if (_config.GetCVar(ImpCCVars.AnnouncerDisableMultipleSounds)) // Impstation: Namespacing
{
foreach (var audioSource in AnnouncerSources.ToList())
{
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Content.Server.Station.Systems;
using Content.Shared.Access.Systems;
using Content.Shared.CCVar;
using Content.Shared._Impstation.CCVar;
using Content.Shared.Database;
using Content.Shared.DeviceNetwork;
using Content.Shared.GameTicking;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private void OnRoundRestarting(RoundRestartCleanupEvent ev)
/// </summary>
private void NewAnnouncer()
{
var announcer = _config.GetCVar(CCVars.Announcer);
var announcer = _config.GetCVar(ImpCCVars.Announcer); //Impstation: Namespacing
if (string.IsNullOrEmpty(announcer) || !_proto.TryIndex<AnnouncerPrototype>(announcer, out _))
SetAnnouncer(PickAnnouncer());
else
Expand All @@ -33,8 +33,8 @@ private void NewAnnouncer()
/// </summary>
public AnnouncerPrototype PickAnnouncer()
{
var list = _proto.Index<WeightedRandomPrototype>(_config.GetCVar(CCVars.AnnouncerList));
var blacklist = _config.GetCVar(CCVars.AnnouncerBlacklist).Split(',').Select(a => a.Trim()).ToList();
var list = _proto.Index<WeightedRandomPrototype>(_config.GetCVar(ImpCCVars.AnnouncerList)); //Namespacing
var blacklist = _config.GetCVar(ImpCCVars.AnnouncerBlacklist).Split(',').Select(a => a.Trim()).ToList();
var modWeights = list.Weights.Where(a => !blacklist.Contains(a.Key));

list = new WeightedRandomPrototype();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override void Initialize()
base.Initialize();
NewAnnouncer();

_config.OnValueChanged(CCVars.Announcer, _ => NewAnnouncer());
_config.OnValueChanged(ImpCCVars.Announcer, _ => NewAnnouncer());

SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestarting);
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/_Impstation/CCVars/ImpCCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Content.Shared._Impstation.CCVar;

// ReSharper disable once InconsistentNaming - Shush you!!
[CVarDefs]
public sealed class CCVars : CVars
public sealed class ImpCCVars
{
/*
* Announcers
Expand Down

0 comments on commit 978e690

Please sign in to comment.