Adds the ability to assign equip sounds in ClothingComponent (#4485)
* Initial * Works (Kinda) * Polish * Reviews
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user