From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Mon, 19 Aug 2024 03:02:38 +0000 (-0400) Subject: fix selfunremoveable component being bypassed by hand pickup verb (#31089) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=edc91621d34ecf900a7556734b325aadad6fd684;p=space-station-14.git fix selfunremoveable component being bypassed by hand pickup verb (#31089) * fix selfunremoveable component being bypassed by hand pickup verb * fix logic --- diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs index d1f41738e9..6d619460f4 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs @@ -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); } diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs index e48aafeab5..1fe66cd3cb 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs @@ -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!;