Add AutoEmote comp/system, updates to zombie code (#13932)
* Add AutoEmote comp/system * Reduce groan chance so it's the same as before Old code did 0.2 and then 0.5, now it's just one Prob(0.1) * Fix typo, curTime var, don't log Resolve * Maybe fix pausing? * Fix mistake * Update NextEmoteTime if an auto emote is removed * Fix stuff Get CurTime outside update loop Use MapInit instead of ComponentInit Fix a typo in a comment Debug assert prototype ID in RemoveEmote Do += PausedTime in OnUnpaused Add prototype as arg to ResetTimer to avoid an indexing
This commit is contained in:
43
Content.Shared/Chat/Prototypes/AutoEmotePrototype.cs
Normal file
43
Content.Shared/Chat/Prototypes/AutoEmotePrototype.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
namespace Content.Shared.Chat.Prototypes;
|
||||
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
[Prototype("autoEmote")]
|
||||
public sealed class AutoEmotePrototype : IPrototype
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the emote prototype.
|
||||
/// </summary>
|
||||
[DataField("emote", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
|
||||
public string EmoteId = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// How often an attempt at the emote will be made.
|
||||
/// </summary>
|
||||
[DataField("interval", required: true)]
|
||||
public TimeSpan Interval;
|
||||
|
||||
/// <summary>
|
||||
/// Probability of performing the emote each interval.
|
||||
/// <summary>
|
||||
[DataField("chance")]
|
||||
public float Chance = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Also send the emote in chat.
|
||||
/// <summary>
|
||||
[DataField("withChat")]
|
||||
public bool WithChat = true;
|
||||
|
||||
/// <summary>
|
||||
/// Hide the chat message from the chat window, only showing the popup.
|
||||
/// This does nothing if WithChat is false.
|
||||
/// <summary>
|
||||
[DataField("hiddenFromChatWindow")]
|
||||
public bool HiddenFromChatWindow = false;
|
||||
}
|
||||
Reference in New Issue
Block a user