private void OnPowerChanged(EntityUid uid, ActivatableUIRequiresPowerComponent component, PowerChangedEvent args)
 {
     if (!args.Powered)
     {
         _activatableUISystem.CloseAll(uid);
     }
 }
예제 #2
0
 private void OnActivate(EntityUid uid, ActivatableUIRequiresPowerComponent component, ActivatableUIOpenAttemptEvent args)
 {
     if (args.Cancelled)
     {
         return;
     }
     if (EntityManager.TryGetComponent <ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
     {
         args.User.PopupMessageCursor(Loc.GetString("base-computer-ui-component-not-powered"));
         args.Cancel();
     }
 }
 private void OnActivate(EntityUid uid, ActivatableUIRequiresPowerComponent component, ActivatableUIOpenAttemptEvent args)
 {
     if (args.Cancelled)
     {
         return;
     }
     if (this.IsPowered(uid, EntityManager))
     {
         return;
     }
     if (TryComp <WiresComponent>(uid, out var wires) && wires.IsPanelOpen)
     {
         return;
     }
     args.User.PopupMessageCursor(Loc.GetString("base-computer-ui-component-not-powered", ("machine", uid)));
     args.Cancel();
 }