From eaafc022f2a48881707c74bf0e3688abff852fc4 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sat, 24 Feb 2018 20:55:30 +0200 Subject: [PATCH] Fixed Ragdoll.ImpactProjSpecific attempting to play limb/wearable hitsounds even if the sound tag is empty, wearable items can cause hit sounds to be played even if the limb has no hit sound configured. Closes #280 --- .../Source/Characters/Animation/Ragdoll.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs index 2b387ceb2..eaa73302b 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs @@ -18,14 +18,19 @@ namespace Barotrauma { Limb limb = (Limb)body.UserData; - if (impact > 3.0f && limb.HitSound != null && limb.SoundTimer <= 0.0f) + if (impact > 3.0f && limb.SoundTimer <= 0.0f) { limb.SoundTimer = Limb.SoundInterval; - SoundPlayer.PlaySound(limb.HitSound, volume, impact * 100.0f, limb.WorldPosition); - foreach(WearableSprite wearable in limb.WearingItems) + if (!string.IsNullOrWhiteSpace(limb.HitSound)) { - if (limb.type == wearable.Limb && wearable.Sound != null) + SoundPlayer.PlaySound(limb.HitSound, volume, impact * 100.0f, limb.WorldPosition); + } + foreach (WearableSprite wearable in limb.WearingItems) + { + if (limb.type == wearable.Limb && !string.IsNullOrWhiteSpace(wearable.Sound)) + { SoundPlayer.PlaySound(wearable.Sound, volume, impact * 100.0f, limb.WorldPosition); + } } } }