Core/PrototypeAudio.cs
namespace Prototype;

public static class PrototypeAudio
{
    public static void PreloadWeapons()
    {
        Sound.Preload("sounds/prototype/rifle_fire.sound");
        Sound.Preload("sounds/prototype/scatter_fire.sound");
        Sound.Preload("sounds/prototype/hit_body.sound");
        Sound.Preload("sounds/prototype/hit_head.sound");
        Sound.Preload("sounds/prototype/player_hurt.sound");
    }

	public static void Play( string id, Vector3 position )
	{
		var soundEvent = ResourceLibrary.Get<SoundEvent>( $"sounds/prototype/{id}.sound" );
		if ( soundEvent is null ) { Log.Warning( $"Missing prototype sound event: {id}" ); return; }
		var handle = Sound.Play( soundEvent );
		if ( handle is null ) { Log.Warning( $"Failed to start prototype sound: {id}" ); return; }
		// Combat feedback must remain audible in first person. Spatial position is
		// still supplied, while ListenLocal prevents camera/listener desync muting it.
		handle.ListenLocal = true;
        handle.Volume = GameProfile.Settings.EffectsVolume * (id == "rifle_fire" || id == "scatter_fire" ? .2f : 1f);
	}
}