using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
namespace Robust.Server.GameObjects.EntitySystems
{
public class AudioSystem : EntitySystem
{
///
/// Play an audio file globally, without position.
///
/// The resource path to the OGG Vorbis file to play.
///
public void Play(string filename, AudioParams? audioParams = null)
{
var msg = new PlayAudioGlobalMessage
{
FileName = filename,
AudioParams = audioParams ?? AudioParams.Default
};
RaiseNetworkEvent(msg);
}
///
/// Play an audio file following an entity.
///
/// The resource path to the OGG Vorbis file to play.
/// The entity "emitting" the audio.
///
public void Play(string filename, IEntity entity, AudioParams? audioParams = null)
{
var msg = new PlayAudioEntityMessage
{
FileName = filename,
EntityUid = entity.Uid,
AudioParams = audioParams ?? AudioParams.Default
};
RaiseNetworkEvent(msg);
}
///
/// Play an audio file at a static position.
///
/// The resource path to the OGG Vorbis file to play.
/// The coordinates at which to play the audio.
///
public void Play(string filename, GridCoordinates coordinates, AudioParams? audioParams = null)
{
var msg = new PlayAudioPositionalMessage
{
FileName = filename,
Coordinates = coordinates,
AudioParams = audioParams ?? AudioParams.Default
};
RaiseNetworkEvent(msg);
}
}
}