From d5628fd0044aecb1d4a1f5b5d6df8036a0eb5290 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 7 Jul 2022 13:34:17 +1000 Subject: [PATCH] Fix stunbaton stun sounds (#9511) --- Content.Server/Damage/Events/StaminaDamageOnHitAttemptEvent.cs | 3 +++ Content.Server/Damage/Systems/StaminaSystem.cs | 1 + Content.Server/Stunnable/Systems/StunbatonSystem.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Content.Server/Damage/Events/StaminaDamageOnHitAttemptEvent.cs b/Content.Server/Damage/Events/StaminaDamageOnHitAttemptEvent.cs index 40bb1ae1a8..1564a7843d 100644 --- a/Content.Server/Damage/Events/StaminaDamageOnHitAttemptEvent.cs +++ b/Content.Server/Damage/Events/StaminaDamageOnHitAttemptEvent.cs @@ -1,3 +1,5 @@ +using Content.Shared.Sound; + namespace Content.Server.Damage.Events; /// @@ -7,4 +9,5 @@ namespace Content.Server.Damage.Events; public struct StaminaDamageOnHitAttemptEvent { public bool Cancelled; + public SoundSpecifier? HitSoundOverride; } diff --git a/Content.Server/Damage/Systems/StaminaSystem.cs b/Content.Server/Damage/Systems/StaminaSystem.cs index dc906711e2..5139945675 100644 --- a/Content.Server/Damage/Systems/StaminaSystem.cs +++ b/Content.Server/Damage/Systems/StaminaSystem.cs @@ -59,6 +59,7 @@ public sealed class StaminaSystem : EntitySystem if (ev.Cancelled) return; + args.HitSoundOverride = ev.HitSoundOverride; var stamQuery = GetEntityQuery(); var toHit = new ValueList(); diff --git a/Content.Server/Stunnable/Systems/StunbatonSystem.cs b/Content.Server/Stunnable/Systems/StunbatonSystem.cs index 2dd6f67469..a93ac44485 100644 --- a/Content.Server/Stunnable/Systems/StunbatonSystem.cs +++ b/Content.Server/Stunnable/Systems/StunbatonSystem.cs @@ -50,6 +50,8 @@ namespace Content.Server.Stunnable.Systems return; } + args.HitSoundOverride = component.StunSound; + if (battery.CurrentCharge < component.EnergyPerUse) { SoundSystem.Play(component.SparksSound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), uid, AudioHelpers.WithVariation(0.25f));