RadioDeviceSystem.cs 720 B

1234567891011121314151617181920212223
  1. using Content.Client.Radio.Ui;
  2. using Content.Shared.Radio;
  3. using Content.Shared.Radio.Components;
  4. using Robust.Client.GameObjects;
  5. namespace Content.Client.Radio.EntitySystems;
  6. public sealed class RadioDeviceSystem : EntitySystem
  7. {
  8. [Dependency] private readonly UserInterfaceSystem _ui = default!;
  9. /// <inheritdoc/>
  10. public override void Initialize()
  11. {
  12. SubscribeLocalEvent<IntercomComponent, AfterAutoHandleStateEvent>(OnAfterHandleState);
  13. }
  14. private void OnAfterHandleState(Entity<IntercomComponent> ent, ref AfterAutoHandleStateEvent args)
  15. {
  16. if (_ui.TryGetOpenUi<IntercomBoundUserInterface>(ent.Owner, IntercomUiKey.Key, out var bui))
  17. bui.Update(ent);
  18. }
  19. }