From ccac9efc266af8c1645c261ec85f9744a4c21d06 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sun, 1 Jan 2023 13:40:22 +1300 Subject: [PATCH] Fix two small ambient sound bugs. (#13249) --- Content.Client/Audio/AmbientSoundSystem.cs | 1 + Content.Server/Audio/AmbientSoundSystem.cs | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Content.Client/Audio/AmbientSoundSystem.cs b/Content.Client/Audio/AmbientSoundSystem.cs index 15ab04636a..59f4108de9 100644 --- a/Content.Client/Audio/AmbientSoundSystem.cs +++ b/Content.Client/Audio/AmbientSoundSystem.cs @@ -86,6 +86,7 @@ namespace Content.Client.Audio { base.Initialize(); UpdatesOutsidePrediction = true; + UpdatesAfter.Add(typeof(AmbientSoundTreeSystem)); _cfg.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true); _cfg.OnValueChanged(CCVars.MaxAmbientSources, SetAmbientCount, true); diff --git a/Content.Server/Audio/AmbientSoundSystem.cs b/Content.Server/Audio/AmbientSoundSystem.cs index ea3ddf3621..2adf94f891 100644 --- a/Content.Server/Audio/AmbientSoundSystem.cs +++ b/Content.Server/Audio/AmbientSoundSystem.cs @@ -15,18 +15,12 @@ namespace Content.Server.Audio private void HandlePowerSupply(EntityUid uid, AmbientOnPoweredComponent component, ref PowerNetBatterySupplyEvent args) { - if (!EntityManager.TryGetComponent(uid, out var ambientSound)) return; - if (ambientSound.Enabled == args.Supply) return; - ambientSound.Enabled = args.Supply; - Dirty(ambientSound); + SetAmbience(uid, args.Supply); } private void HandlePowerChange(EntityUid uid, AmbientOnPoweredComponent component, ref PowerChangedEvent args) { - if (!EntityManager.TryGetComponent(uid, out var ambientSound)) return; - if (ambientSound.Enabled == args.Powered) return; - ambientSound.Enabled = args.Powered; - Dirty(ambientSound); + SetAmbience(uid, args.Powered); } } }