diff --git a/Content.Server/Clothing/Components/ClothingComponent.cs b/Content.Server/Clothing/Components/ClothingComponent.cs index 9785d3177d..3b78a97709 100644 --- a/Content.Server/Clothing/Components/ClothingComponent.cs +++ b/Content.Server/Clothing/Components/ClothingComponent.cs @@ -107,11 +107,6 @@ namespace Content.Server.Clothing.Components return false; } - if (EquipSound != null) - { - SoundSystem.Play(Filter.Pvs(Owner), EquipSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f)); - } - return true; } } diff --git a/Content.Server/Inventory/Components/InventoryComponent.cs b/Content.Server/Inventory/Components/InventoryComponent.cs index d70ba8be4e..f22bbf40cc 100644 --- a/Content.Server/Inventory/Components/InventoryComponent.cs +++ b/Content.Server/Inventory/Components/InventoryComponent.cs @@ -20,6 +20,7 @@ using Content.Shared.Verbs; using Robust.Server.Console; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Audio; using Robust.Shared.Console; using Robust.Shared.Containers; using Robust.Shared.GameObjects; @@ -27,6 +28,7 @@ using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Map; using Robust.Shared.Network; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.ViewVariables; using static Content.Shared.Inventory.EquipmentSlotDefines; @@ -262,6 +264,13 @@ namespace Content.Server.Inventory.Components return false; } + // TODO: Make clothing component not inherit ItemComponent, for fuck's sake. + // TODO: Make clothing component not required for playing a sound on equip... Move it to its own component. + if (item is ClothingComponent { EquipSound: {} equipSound }) + { + SoundSystem.Play(Filter.Pvs(Owner), equipSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f)); + } + _entitySystemManager.GetEntitySystem().EquippedInteraction(Owner, item.Owner, slot); OnItemChanged?.Invoke(); @@ -520,10 +529,14 @@ namespace Content.Server.Inventory.Components var hands = Owner.GetComponent(); var activeHand = hands.ActiveHand; var activeItem = hands.GetActiveHand; - if (activeHand != null && activeItem != null && activeItem.Owner.TryGetComponent(out ClothingComponent? clothing)) + if (activeHand != null && activeItem != null && activeItem.Owner.TryGetComponent(out ItemComponent? item)) { hands.TryDropNoInteraction(); - clothing.TryEquip(this, msg.Inventoryslot, Owner); + if (!Equip(msg.Inventoryslot, item, true, out var reason)) + { + hands.PutInHand(item); + Owner.PopupMessageCursor(reason); + } } break; diff --git a/Resources/Changelog/Parts/clothing.yml b/Resources/Changelog/Parts/clothing.yml new file mode 100644 index 0000000000..420e4b8eba --- /dev/null +++ b/Resources/Changelog/Parts/clothing.yml @@ -0,0 +1,4 @@ +author: Zumorica +changes: + - type: Fix + message: Fix bug which prevented players from equipping most items in their pockets.