Fix two small ambient sound bugs. (#13249)
This commit is contained in:
@@ -86,6 +86,7 @@ namespace Content.Client.Audio
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
UpdatesOutsidePrediction = true;
|
UpdatesOutsidePrediction = true;
|
||||||
|
UpdatesAfter.Add(typeof(AmbientSoundTreeSystem));
|
||||||
|
|
||||||
_cfg.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true);
|
_cfg.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true);
|
||||||
_cfg.OnValueChanged(CCVars.MaxAmbientSources, SetAmbientCount, 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)
|
private void HandlePowerSupply(EntityUid uid, AmbientOnPoweredComponent component, ref PowerNetBatterySupplyEvent args)
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetComponent<AmbientSoundComponent>(uid, out var ambientSound)) return;
|
SetAmbience(uid, args.Supply);
|
||||||
if (ambientSound.Enabled == args.Supply) return;
|
|
||||||
ambientSound.Enabled = args.Supply;
|
|
||||||
Dirty(ambientSound);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandlePowerChange(EntityUid uid, AmbientOnPoweredComponent component, ref PowerChangedEvent args)
|
private void HandlePowerChange(EntityUid uid, AmbientOnPoweredComponent component, ref PowerChangedEvent args)
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetComponent<AmbientSoundComponent>(uid, out var ambientSound)) return;
|
SetAmbience(uid, args.Powered);
|
||||||
if (ambientSound.Enabled == args.Powered) return;
|
|
||||||
ambientSound.Enabled = args.Powered;
|
|
||||||
Dirty(ambientSound);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user