Skip to content

Commit

Permalink
Fix Clothing Quick-Equip (#507)
Browse files Browse the repository at this point in the history
# Description
For some reason, ClothingSystem.TryEquip would return false if there's a
do-after to equip the clothing. This had caused all quick-equip attempts
on SMALL ITEMS to fail and ended up with every SMALL clothing item being
equipped into one of the pocket slots (which have no equip delays).

Also fixes quick swap - see the comments below.

# Changelog

:cl:
- fix: Equipping clothing using the Z key works correctly again.
  • Loading branch information
Mnemotechnician authored Jul 3, 2024
1 parent 2dcab4d commit 2e8e56f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Content.Shared/Clothing/EntitySystems/ClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ private void QuickEquip(
{
foreach (var slotDef in userEnt.Comp1.Slots)
{
// Do not attempt to quick-equip clothing in pocket slots.
// We should probably add a special flag to SlotDefinition to skip quick equip if more similar slots get added.
if (slotDef.SlotFlags.HasFlag(SlotFlags.POCKET))
continue;

if (!_invSystem.CanEquip(userEnt, toEquipEnt, slotDef.Name, out _, slotDef, userEnt, toEquipEnt))
continue;

Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Inventory/InventorySystem.Equip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public bool TryEquip(EntityUid actor, EntityUid target, EntityUid itemUid, strin
};

_doAfter.TryStartDoAfter(args);
return false;
return true; // Changed to return true even if the item wasn't equipped instantly
}

if (!_containerSystem.Insert(itemUid, slotContainer))
Expand Down

0 comments on commit 2e8e56f

Please sign in to comment.