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); } } }