mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-06 17:58:05 +02:00
RobustToolbox projects should be named Robust.* This PR changes the RobustToolbox projects from SS14.* to Robust.* Updates SS14.* prefixes/namespaces to Robust.* Updates SpaceStation14.sln to RobustToolbox.sln Updates MSBUILD/SS14.* to MSBUILD/Robust.* Updates CSProject and MSBuild references for the above Updates git_helper.py Removes Runserver and Runclient as they are unusable
61 lines
2.2 KiB
C#
61 lines
2.2 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// Play an audio file globally, without position.
|
|
/// </summary>
|
|
/// <param name="filename">The resource path to the OGG Vorbis file to play.</param>
|
|
/// <param name="audioParams"></param>
|
|
public void Play(string filename, AudioParams? audioParams = null)
|
|
{
|
|
var msg = new PlayAudioGlobalMessage
|
|
{
|
|
FileName = filename,
|
|
AudioParams = audioParams ?? AudioParams.Default
|
|
};
|
|
RaiseNetworkEvent(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Play an audio file following an entity.
|
|
/// </summary>
|
|
/// <param name="filename">The resource path to the OGG Vorbis file to play.</param>
|
|
/// <param name="entity">The entity "emitting" the audio.</param>
|
|
/// <param name="audioParams"></param>
|
|
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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Play an audio file at a static position.
|
|
/// </summary>
|
|
/// <param name="filename">The resource path to the OGG Vorbis file to play.</param>
|
|
/// <param name="coordinates">The coordinates at which to play the audio.</param>
|
|
/// <param name="audioParams"></param>
|
|
public void Play(string filename, GridCoordinates coordinates, AudioParams? audioParams = null)
|
|
{
|
|
var msg = new PlayAudioPositionalMessage
|
|
{
|
|
FileName = filename,
|
|
Coordinates = coordinates,
|
|
AudioParams = audioParams ?? AudioParams.Default
|
|
};
|
|
RaiseNetworkEvent(msg);
|
|
}
|
|
}
|
|
}
|