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

This commit is contained in:
Joonas Rikkonen
2018-02-24 20:55:30 +02:00
parent 6fcf2f573b
commit eaafc022f2

View File

@@ -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);
}
}
}
}