diff --git a/Content.Server/Sticky/Systems/StickySystem.cs b/Content.Server/Sticky/Systems/StickySystem.cs index 8e4b533141..6f6376e991 100644 --- a/Content.Server/Sticky/Systems/StickySystem.cs +++ b/Content.Server/Sticky/Systems/StickySystem.cs @@ -17,6 +17,7 @@ public sealed class StickySystem : EntitySystem [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; + [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; private const string StickerSlotId = "stickers_container"; @@ -40,7 +41,14 @@ public sealed class StickySystem : EntitySystem private void AddUnstickVerb(EntityUid uid, StickyComponent component, GetVerbsEvent args) { - if (component.StuckTo == null || !component.CanUnstick) + if (component.StuckTo == null || !component.CanUnstick || !args.CanInteract) + return; + + // we can't use args.CanAccess, because it stuck in another container + // we also need to ignore entity that it stuck to + var inRange = _interactionSystem.InRangeUnobstructed(uid, args.User, + predicate: entity => component.StuckTo == entity); + if (!inRange) return; args.Verbs.Add(new Verb @@ -131,8 +139,6 @@ public sealed class StickySystem : EntitySystem // if delay is zero - unstick entity immediately UnstickFromEntity(uid, user, component); } - - return; } private void OnUnstickSuccessful(UnstickSuccessfulEvent ev)