Fixed C4 unstick verb checks (#7870)

This commit is contained in:
Alex Evgrashin
2022-05-03 01:50:11 +03:00
committed by GitHub
parent 1aa73294d8
commit a527e07b2b

View File

@@ -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<Verb> 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)