diff --git a/Content.Server/Clothing/Components/ClothingComponent.cs b/Content.Server/Clothing/Components/ClothingComponent.cs index 7e29bfd9bf..9785d3177d 100644 --- a/Content.Server/Clothing/Components/ClothingComponent.cs +++ b/Content.Server/Clothing/Components/ClothingComponent.cs @@ -5,8 +5,11 @@ using Content.Shared.Clothing; using Content.Shared.Interaction; using Content.Shared.Item; using Content.Shared.Notification.Managers; +using Content.Shared.Sound; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.GameStates; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -32,6 +35,9 @@ namespace Content.Server.Clothing.Components [DataField("HeatResistance")] private int _heatResistance = 323; + [DataField("EquipSound")] + public SoundSpecifier? EquipSound { get; set; } = default!; + [ViewVariables(VVAccess.ReadWrite)] public int HeatResistance => _heatResistance; @@ -91,7 +97,7 @@ namespace Content.Server.Clothing.Components return false; } - private bool TryEquip(InventoryComponent inv, Slots slot, IEntity user) + public bool TryEquip(InventoryComponent inv, Slots slot, IEntity user) { if (!inv.Equip(slot, this, true, out var reason)) { @@ -101,6 +107,11 @@ 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 8f1d0d7ad1..d70ba8be4e 100644 --- a/Content.Server/Inventory/Components/InventoryComponent.cs +++ b/Content.Server/Inventory/Components/InventoryComponent.cs @@ -520,14 +520,10 @@ 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 ItemComponent? clothing)) + if (activeHand != null && activeItem != null && activeItem.Owner.TryGetComponent(out ClothingComponent? clothing)) { hands.TryDropNoInteraction(); - if (!Equip(msg.Inventoryslot, clothing, true, out var reason)) - { - hands.PutInHand(clothing); - Owner.PopupMessageCursor(reason); - } + clothing.TryEquip(this, msg.Inventoryslot, Owner); } break; diff --git a/Resources/Audio/Items/belt_equip.ogg b/Resources/Audio/Items/belt_equip.ogg new file mode 100644 index 0000000000..0ef67a3fd6 Binary files /dev/null and b/Resources/Audio/Items/belt_equip.ogg differ diff --git a/Resources/Audio/Items/jumpsuit_equip.ogg b/Resources/Audio/Items/jumpsuit_equip.ogg new file mode 100644 index 0000000000..bdcc2bb3a6 Binary files /dev/null and b/Resources/Audio/Items/jumpsuit_equip.ogg differ diff --git a/Resources/Prototypes/Entities/Clothing/Belt/base.yml b/Resources/Prototypes/Entities/Clothing/Belt/base.yml index e79a0eb8f9..199a801e1a 100644 --- a/Resources/Prototypes/Entities/Clothing/Belt/base.yml +++ b/Resources/Prototypes/Entities/Clothing/Belt/base.yml @@ -9,3 +9,5 @@ Slots: [belt] size: 50 QuickEquip: false + EquipSound: + path: /Audio/Items/belt_equip.ogg diff --git a/Resources/Prototypes/Entities/Clothing/Uniforms/base.yml b/Resources/Prototypes/Entities/Clothing/Uniforms/base.yml index 795627181c..d6ad4e65e1 100644 --- a/Resources/Prototypes/Entities/Clothing/Uniforms/base.yml +++ b/Resources/Prototypes/Entities/Clothing/Uniforms/base.yml @@ -7,6 +7,8 @@ state: icon - type: Clothing Slots: [innerclothing] + EquipSound: + path: /Audio/Items/jumpsuit_equip.ogg - type: entity abstract: true @@ -18,3 +20,5 @@ - type: Clothing Slots: [innerclothing] femaleMask: UniformTop + EquipSound: + path: /Audio/Items/jumpsuit_equip.ogg