Fixed several sound-related issues that have been bothering me for ages, e.g.

* Sounds not playing when the structure is fully destroyed
* Glass windows using wrong sound effects
* Only one glassBreak sound was used despite there being 3
This commit is contained in:
Alex Noir
2017-12-17 18:05:05 +03:00
parent 0eacbce313
commit 714b52dce8
3 changed files with 12 additions and 11 deletions
@@ -453,10 +453,11 @@ namespace Barotrauma
{
damage = MathHelper.Clamp(damage+Rand.Range(-10.0f, 10.0f), 0.0f, 100.0f);
var sounds = damageSounds.FindAll(s =>
damage >= s.damageRange.X &&
damage <= s.damageRange.Y &&
s.damageRange == null ||
(damage >= s.damageRange.X &&
damage <= s.damageRange.Y) &&
s.damageType == damageType &&
(string.IsNullOrEmpty(s.requiredTag) || (tags != null && tags.Contains(s.requiredTag))));
(tags == null ? string.IsNullOrEmpty(s.requiredTag) : tags.Contains(s.requiredTag)));
if (!sounds.Any()) return;