fix selfunremoveable component being bypassed by hand pickup verb (#31089)
* fix selfunremoveable component being bypassed by hand pickup verb * fix logic
This commit is contained in:
parent
6c9b29290a
commit
5af89eae4f
|
|
@ -1,3 +1,4 @@
|
|||
using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Item;
|
||||
|
|
@ -178,6 +179,17 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
|||
if (checkActionBlocker && !_actionBlocker.CanPickup(uid, entity))
|
||||
return false;
|
||||
|
||||
if (ContainerSystem.TryGetContainingContainer((entity, null, null), out var container))
|
||||
{
|
||||
if (!ContainerSystem.CanRemove(entity, container))
|
||||
return false;
|
||||
|
||||
if (_inventory.TryGetSlotEntity(uid, container.ID, out var slotEnt) &&
|
||||
slotEnt == entity &&
|
||||
!_inventory.CanUnequip(uid, entity, container.ID, out _))
|
||||
return false;
|
||||
}
|
||||
|
||||
// check can insert (including raising attempt events).
|
||||
return ContainerSystem.CanInsert(entity, handContainer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using Content.Shared.ActionBlocker;
|
|||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.VirtualItem;
|
||||
using Content.Shared.Storage.EntitySystems;
|
||||
using Robust.Shared.Containers;
|
||||
|
|
@ -17,6 +18,7 @@ public abstract partial class SharedHandsSystem
|
|||
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
||||
[Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly SharedStorageSystem _storage = default!;
|
||||
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
|
||||
[Dependency] private readonly SharedVirtualItemSystem _virtualSystem = default!;
|
||||
|
|
|
|||
Loading…
Reference in New Issue