Пример #1
0
 private void HandlePowerChange(EntityUid uid, AmbientOnPoweredComponent component, PowerChangedEvent args)
 {
     if (!EntityManager.TryGetComponent <AmbientSoundComponent>(uid, out var ambientSound))
     {
         return;
     }
     if (ambientSound.Enabled == args.Powered)
     {
         return;
     }
     ambientSound.Enabled = args.Powered;
     Dirty(ambientSound);
 }
Пример #2
0
 private void HandlePowerSupply(EntityUid uid, AmbientOnPoweredComponent component, PowerNetBatterySupplyEvent args)
 {
     if (!EntityManager.TryGetComponent <AmbientSoundComponent>(uid, out var ambientSound))
     {
         return;
     }
     if (ambientSound.Enabled == args.Supply)
     {
         return;
     }
     ambientSound.Enabled = args.Supply;
     Dirty(ambientSound);
 }