Fix two small ambient sound bugs. (#13249)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -15,18 +15,12 @@ namespace Content.Server.Audio
|
||||
|
||||
private void HandlePowerSupply(EntityUid uid, AmbientOnPoweredComponent component, ref PowerNetBatterySupplyEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent<AmbientSoundComponent>(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<AmbientSoundComponent>(uid, out var ambientSound)) return;
|
||||
if (ambientSound.Enabled == args.Powered) return;
|
||||
ambientSound.Enabled = args.Powered;
|
||||
Dirty(ambientSound);
|
||||
SetAmbience(uid, args.Powered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user