Adds footstep sound variety, makes diving and clown suits have unique footstep sounds!
https://puu.sh/yQ8fs/61e12f15c6.webm TODO: Get rid of the "damagesoundtype" system and replace it with simple "tag" checking to allow customizability from content pack side Fix damagemodifier sounds never being played (I've never once heard LimbArmor play on anything but mantis)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using FarseerPhysics;
|
||||
using Barotrauma.Items.Components;
|
||||
using FarseerPhysics;
|
||||
using FarseerPhysics.Dynamics;
|
||||
using FarseerPhysics.Dynamics.Joints;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -20,7 +21,12 @@ namespace Barotrauma
|
||||
if (impact > 3.0f && limb.HitSound != null && limb.SoundTimer <= 0.0f)
|
||||
{
|
||||
limb.SoundTimer = Limb.SoundInterval;
|
||||
limb.HitSound.Play(volume, impact * 100.0f, limb.WorldPosition);
|
||||
SoundPlayer.PlaySound(limb.HitSound, volume, impact * 100.0f, limb.WorldPosition);
|
||||
foreach(WearableSprite wearable in limb.WearingItems)
|
||||
{
|
||||
if (limb.type == wearable.Limb && wearable.Sound != null)
|
||||
SoundPlayer.PlaySound(wearable.Sound, volume, impact * 100.0f, limb.WorldPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (body.UserData is Limb || body == Collider.FarseerBody)
|
||||
|
||||
@@ -17,9 +17,9 @@ namespace Barotrauma
|
||||
private set;
|
||||
}
|
||||
|
||||
Sound hitSound;
|
||||
string hitSound;
|
||||
|
||||
public Sound HitSound
|
||||
public string HitSound
|
||||
{
|
||||
get { return hitSound; }
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace Barotrauma
|
||||
LightSource = new LightSource(subElement);
|
||||
break;
|
||||
case "sound":
|
||||
hitSound = Sound.Load(subElement.GetAttributeString("file", ""));
|
||||
hitSound = subElement.GetAttributeString("file", "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,10 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError("File \"" + file + "\" not found!");
|
||||
return null;
|
||||
}
|
||||
|
||||
Sound dupe = Sound.loadedSounds.Find(s => s.filePath == file);
|
||||
if (dupe != null)
|
||||
return dupe;
|
||||
|
||||
return new Sound(file, destroyOnGameEnd);
|
||||
}
|
||||
@@ -100,6 +104,9 @@ namespace Barotrauma
|
||||
{
|
||||
newSound.baseVolume = element.GetAttributeFloat("volume", 1.0f);
|
||||
newSound.range = element.GetAttributeFloat("range", 1000.0f);
|
||||
Sound dupe = Sound.loadedSounds.Find(s => s.filePath == filePath && s.baseVolume == newSound.baseVolume && s.range == newSound.range);
|
||||
if (dupe != null)
|
||||
return dupe;
|
||||
}
|
||||
|
||||
return newSound;
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace Barotrauma
|
||||
public static Sound GetSound(string soundTag)
|
||||
{
|
||||
var matchingSounds = miscSounds[soundTag].ToList();
|
||||
if (matchingSounds.Count == 0) return null;
|
||||
if (matchingSounds.Count == 0) return Sound.Load(soundTag);
|
||||
|
||||
return matchingSounds[Rand.Int(matchingSounds.Count)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user