Audible emotes (#12708)
Co-authored-by: Visne <39844191+Visne@users.noreply.github.com>
This commit is contained in:
51
Content.Shared/Chat/Prototypes/EmotePrototype.cs
Normal file
51
Content.Shared/Chat/Prototypes/EmotePrototype.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Chat.Prototypes;
|
||||
|
||||
/// <summary>
|
||||
/// IC emotes (scream, smile, clapping, etc).
|
||||
/// Entities can activate emotes by chat input or code.
|
||||
/// </summary>
|
||||
[Prototype("emote")]
|
||||
public sealed class EmotePrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Different emote categories may be handled by different systems.
|
||||
/// Also may be used for filtering.
|
||||
/// </summary>
|
||||
[DataField("category")]
|
||||
public EmoteCategory Category = EmoteCategory.General;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of words that will be sent to chat if emote activates.
|
||||
/// Will be picked randomly from list.
|
||||
/// </summary>
|
||||
[DataField("chatMessages")]
|
||||
public List<string> ChatMessages = new();
|
||||
|
||||
/// <summary>
|
||||
/// Trigger words for emote. Case independent.
|
||||
/// When typed into players chat they will activate emote event.
|
||||
/// All words should be unique across all emote prototypes.
|
||||
/// </summary>
|
||||
[DataField("chatTriggers")]
|
||||
public HashSet<string> ChatTriggers = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IC emote category. Usually physical source of emote,
|
||||
/// like hands, voice, face, etc.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[Serializable, NetSerializable]
|
||||
public enum EmoteCategory : byte
|
||||
{
|
||||
Invalid = 0,
|
||||
Vocal = 1 << 0,
|
||||
Hands = 1 << 1,
|
||||
General = byte.MaxValue
|
||||
}
|
||||
36
Content.Shared/Chat/Prototypes/EmoteSoundsPrototype.cs
Normal file
36
Content.Shared/Chat/Prototypes/EmoteSoundsPrototype.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
|
||||
namespace Content.Shared.Chat.Prototypes;
|
||||
|
||||
/// <summary>
|
||||
/// Sounds collection for each <see cref="EmotePrototype"/>.
|
||||
/// Different entities may use different sounds collections.
|
||||
/// </summary>
|
||||
[Prototype("emoteSounds")]
|
||||
public sealed class EmoteSoundsPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Optional fallback sound that will play if collection
|
||||
/// doesn't have specific sound for this emote id.
|
||||
/// </summary>
|
||||
[DataField("sound")]
|
||||
public SoundSpecifier? FallbackSound;
|
||||
|
||||
/// <summary>
|
||||
/// Optional audio params that will be applied to ALL sounds.
|
||||
/// This will overwrite any params that may be set in sound specifiers.
|
||||
/// </summary>
|
||||
[DataField("params")]
|
||||
public AudioParams? GeneralParams;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of emote prototypes and their sounds.
|
||||
/// </summary>
|
||||
[DataField("sounds", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<SoundSpecifier, EmotePrototype>))]
|
||||
public Dictionary<string, SoundSpecifier> Sounds = new();
|
||||
}
|
||||
Reference in New Issue
Block a user