Fix two small ambient sound bugs. (#13249)

This commit is contained in:
Leon Friedrich
2023-01-01 13:40:22 +13:00
committed by GitHub
parent c2d3aedc58
commit ccac9efc26
2 changed files with 3 additions and 8 deletions

View File

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