Make Inventory slots use hand interact events for unequipping clothing (#7800)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Clothing.Components;
|
using Content.Shared.Clothing.Components;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using Content.Shared.Hands.EntitySystems;
|
using Content.Shared.Hands.EntitySystems;
|
||||||
@@ -24,6 +25,7 @@ public abstract partial class InventorySystem
|
|||||||
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!;
|
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||||
|
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly INetManager _netMan = default!;
|
[Dependency] private readonly INetManager _netMan = default!;
|
||||||
@@ -117,15 +119,15 @@ public abstract partial class InventorySystem
|
|||||||
if (held != null && itemUid != null)
|
if (held != null && itemUid != null)
|
||||||
{
|
{
|
||||||
_interactionSystem.InteractUsing(actor, held.Value, itemUid.Value,
|
_interactionSystem.InteractUsing(actor, held.Value, itemUid.Value,
|
||||||
new EntityCoordinates());
|
Transform(itemUid.Value).Coordinates);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// un-equip to hands
|
// interact with an empty hand (usually just unequips the item).
|
||||||
if (itemUid != null)
|
if (itemUid != null)
|
||||||
{
|
{
|
||||||
if (_handsSystem.CanPickupAnyHand(actor, itemUid.Value, handsComp: hands) && TryUnequip(actor, ev.Slot, inventory: inventory))
|
if (_actionBlockerSystem.CanInteract(actor, itemUid.Value))
|
||||||
_handsSystem.TryPickup(actor, itemUid.Value, checkActionBlocker: false, handsComp: hands);
|
_interactionSystem.InteractHand(actor, itemUid.Value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user