diff --git a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs index ce3bb5aba0..1a022b4ff9 100644 --- a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs +++ b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs @@ -4,10 +4,8 @@ using Content.Shared.DeviceNetwork; using Content.Shared.DeviceNetwork.Events; using Content.Shared.DeviceNetwork.Systems; using Content.Shared.Power; -using Content.Shared.UserInterface; using Content.Shared.SurveillanceCamera; using Robust.Server.GameObjects; -using Robust.Shared.Player; using Robust.Shared.Prototypes; namespace Content.Server.SurveillanceCamera; @@ -26,7 +24,6 @@ public sealed partial class SurveillanceCameraMonitorSystem : EntitySystem SubscribeLocalEvent(OnPowerChanged); SubscribeLocalEvent(OnShutdown); SubscribeLocalEvent(OnComponentStartup); - SubscribeLocalEvent(OnToggleInterface); Subs.BuiEvents(SurveillanceCameraMonitorUiKey.Key, subs => { subs.Event(OnRefreshCamerasMessage); @@ -35,6 +32,7 @@ public sealed partial class SurveillanceCameraMonitorSystem : EntitySystem subs.Event(OnSubnetRequest); subs.Event(OnSwitchMessage); subs.Event(OnBoundUiClose); + subs.Event(OnBoundUiOpen); }); } @@ -183,19 +181,17 @@ public sealed partial class SurveillanceCameraMonitorSystem : EntitySystem RemoveActiveCamera(uid, component); } - - private void OnToggleInterface(EntityUid uid, SurveillanceCameraMonitorComponent component, - AfterActivatableUIOpenEvent args) - { - AfterOpenUserInterface(uid, args.User, component); - } - // This is to ensure that there's no delay in ensuring that a camera is deactivated. private void OnSurveillanceCameraDeactivate(EntityUid uid, SurveillanceCameraMonitorComponent monitor, SurveillanceCameraDeactivateEvent args) { DisconnectCamera(uid, false, monitor); } + private void OnBoundUiOpen(EntityUid uid, SurveillanceCameraMonitorComponent component, BoundUIOpenedEvent args) + { + AddViewer(uid, args.Actor, component); + } + private void OnBoundUiClose(EntityUid uid, SurveillanceCameraMonitorComponent component, BoundUIClosedEvent args) { RemoveViewer(uid, args.Actor, component); @@ -445,19 +441,6 @@ public sealed partial class SurveillanceCameraMonitorSystem : EntitySystem UpdateUserInterface(uid, monitor); } - // This is public primarily because it might be useful to have the ability to - // have this component added to any entity, and have them open the BUI (somehow). - public void AfterOpenUserInterface(EntityUid uid, EntityUid player, SurveillanceCameraMonitorComponent? monitor = null, ActorComponent? actor = null) - { - if (!Resolve(uid, ref monitor) - || !Resolve(player, ref actor)) - { - return; - } - - AddViewer(uid, player); - } - private void UpdateUserInterface(EntityUid uid, SurveillanceCameraMonitorComponent? monitor = null, EntityUid? player = null) { if (!Resolve(uid, ref monitor))