From bf6c44cd59781b3db35b50625398711c8d38e2de Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sun, 1 May 2022 09:19:29 +1200 Subject: [PATCH] Make Inventory slots use hand interact events for unequipping clothing (#7800) --- Content.Shared/Inventory/InventorySystem.Equip.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Content.Shared/Inventory/InventorySystem.Equip.cs b/Content.Shared/Inventory/InventorySystem.Equip.cs index 93d4661669..6f618491a2 100644 --- a/Content.Shared/Inventory/InventorySystem.Equip.cs +++ b/Content.Shared/Inventory/InventorySystem.Equip.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using Content.Shared.ActionBlocker; using Content.Shared.Clothing.Components; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; @@ -24,6 +25,7 @@ public abstract partial class InventorySystem [Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; + [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly INetManager _netMan = default!; @@ -117,15 +119,15 @@ public abstract partial class InventorySystem if (held != null && itemUid != null) { _interactionSystem.InteractUsing(actor, held.Value, itemUid.Value, - new EntityCoordinates()); + Transform(itemUid.Value).Coordinates); return; } - // un-equip to hands + // interact with an empty hand (usually just unequips the item). if (itemUid != null) { - if (_handsSystem.CanPickupAnyHand(actor, itemUid.Value, handsComp: hands) && TryUnequip(actor, ev.Slot, inventory: inventory)) - _handsSystem.TryPickup(actor, itemUid.Value, checkActionBlocker: false, handsComp: hands); + if (_actionBlockerSystem.CanInteract(actor, itemUid.Value)) + _interactionSystem.InteractHand(actor, itemUid.Value); return; }