From 2e8e56f763a5cda63511a1aaae0d649ff64eedad Mon Sep 17 00:00:00 2001 From: Mnemotechnican <69920617+Mnemotechnician@users.noreply.github.com> Date: Wed, 3 Jul 2024 22:48:28 +0300 Subject: [PATCH] Fix Clothing Quick-Equip (#507) # 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. --- Content.Shared/Clothing/EntitySystems/ClothingSystem.cs | 5 +++++ Content.Shared/Inventory/InventorySystem.Equip.cs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs index f189db005bc..976682c9903 100644 --- a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs @@ -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; diff --git a/Content.Shared/Inventory/InventorySystem.Equip.cs b/Content.Shared/Inventory/InventorySystem.Equip.cs index 24006b0c9f9..7bdd17ee6fa 100644 --- a/Content.Shared/Inventory/InventorySystem.Equip.cs +++ b/Content.Shared/Inventory/InventorySystem.Equip.cs @@ -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))