#4219 upgraded EmitSoundSystem to use SoundSpecifier

This commit is contained in:
Galactic Chimp
2021-07-10 11:20:23 +02:00
parent da41942daf
commit 4500b66f28
5 changed files with 66 additions and 61 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.Sound;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
@@ -6,13 +7,16 @@ namespace Content.Server.Sound.Components
{
/// <summary>
/// Base sound emitter which defines most of the data fields.
/// Default behavior is to first try to play the sound collection,
/// and if one isn't assigned, then try to play the single sound.
/// Accepts both single sounds and sound collections.
/// </summary>
public abstract class BaseEmitSoundComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)] [DataField("sound")] public string? SoundName { get; set; } = default!;
[ViewVariables(VVAccess.ReadWrite)] [DataField("variation")] public float PitchVariation { get; set; } = 0.0f;
[ViewVariables(VVAccess.ReadWrite)] [DataField("soundCollection")] public string? SoundCollectionName { get; set; } = default!;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("sound")]
public SoundSpecifier Sound { get; set; } = default!;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("variation")]
public float PitchVariation { get; set; } = 0.0f;
}
}