diff --git a/Content.Server/Interaction/InteractionSystem.cs b/Content.Server/Interaction/InteractionSystem.cs index ff49bc4bfe..3b03d56ee7 100644 --- a/Content.Server/Interaction/InteractionSystem.cs +++ b/Content.Server/Interaction/InteractionSystem.cs @@ -34,6 +34,8 @@ namespace Content.Server.Interaction base.Initialize(); SubscribeNetworkEvent(HandleDragDropRequestEvent); + + SubscribeLocalEvent(HandleUserInterfaceRangeCheck); } public override bool CanAccessViaStorage(EntityUid user, EntityUid target) @@ -91,5 +93,20 @@ namespace Content.Server.Interaction } #endregion + + private void HandleUserInterfaceRangeCheck(ref BoundUserInterfaceCheckRangeEvent ev) + { + if (ev.Player.AttachedEntity is not { } user) + return; + + if (InRangeUnobstructed(user, ev.Target, ev.UserInterface.InteractionRange)) + { + ev.Result = BoundUserInterfaceRangeResult.Pass; + } + else + { + ev.Result = BoundUserInterfaceRangeResult.Fail; + } + } } }