diff --git a/Content.Server/Sound/Components/EmitSoundOnDropComponent.cs b/Content.Server/Sound/Components/EmitSoundOnDropComponent.cs new file mode 100644 index 0000000000..6653d50693 --- /dev/null +++ b/Content.Server/Sound/Components/EmitSoundOnDropComponent.cs @@ -0,0 +1,10 @@ +namespace Content.Server.Sound.Components +{ + /// + /// Simple sound emitter that emits sound on entity drop + /// + [RegisterComponent] + public sealed class EmitSoundOnDropComponent : BaseEmitSoundComponent + { + } +} diff --git a/Content.Server/Sound/Components/EmitSoundOnPickupComponent.cs b/Content.Server/Sound/Components/EmitSoundOnPickupComponent.cs new file mode 100644 index 0000000000..9018565d9a --- /dev/null +++ b/Content.Server/Sound/Components/EmitSoundOnPickupComponent.cs @@ -0,0 +1,10 @@ +namespace Content.Server.Sound.Components +{ + /// + /// Simple sound emitter that emits sound on entity pickup + /// + [RegisterComponent] + public sealed class EmitSoundOnPickupComponent : BaseEmitSoundComponent + { + } +} diff --git a/Content.Server/Sound/EmitSoundSystem.cs b/Content.Server/Sound/EmitSoundSystem.cs index 84b4deed38..5b19f60ae3 100644 --- a/Content.Server/Sound/EmitSoundSystem.cs +++ b/Content.Server/Sound/EmitSoundSystem.cs @@ -4,8 +4,10 @@ using Content.Server.Sound.Components; using Content.Server.Throwing; using Content.Server.UserInterface; using Content.Server.Popups; +using Content.Shared.Hands; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; +using Content.Shared.Item; using Content.Shared.Maps; using Content.Shared.Throwing; using JetBrains.Annotations; @@ -58,6 +60,8 @@ namespace Content.Server.Sound SubscribeLocalEvent(HandleEmitSoundOnActivateInWorld); SubscribeLocalEvent(HandleEmitSoundOnTrigger); SubscribeLocalEvent(HandleEmitSoundOnUIOpen); + SubscribeLocalEvent(HandleEmitSoundOnPickup); + SubscribeLocalEvent(HandleEmitSoundOnDrop); } private void HandleEmitSoundOnTrigger(EntityUid uid, EmitSoundOnTriggerComponent component, TriggerEvent args) @@ -106,6 +110,16 @@ namespace Content.Server.Sound TryEmitSound(component); } + private void HandleEmitSoundOnPickup(EntityUid uid, EmitSoundOnPickupComponent component, GotEquippedHandEvent args) + { + TryEmitSound(component); + } + + private void HandleEmitSoundOnDrop(EntityUid uid, EmitSoundOnDropComponent component, DroppedEvent args) + { + TryEmitSound(component); + } + private void TryEmitSound(BaseEmitSoundComponent component) { _audioSystem.PlayPvs(component.Sound, component.Owner, component.Sound.Params.AddVolume(-2f));