Use chat emotes for disease (#15134)
* Use chat emote system for disease * Use chat emotes in prototypes * Fix sound path * Fix prototype ids * Update Content.Server/Disease/DiseaseSystem.cs Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com> --------- Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.Audio;
|
||||
using Content.Shared.Chat.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Traits.Assorted;
|
||||
|
||||
@@ -9,14 +10,10 @@ namespace Content.Server.Traits.Assorted;
|
||||
public sealed class UncontrollableSnoughComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Message to play when snoughing.
|
||||
/// Emote to play when snoughing
|
||||
/// </summary>
|
||||
[DataField("snoughMessage")] public string SnoughMessage = "disease-sneeze";
|
||||
|
||||
/// <summary>
|
||||
/// Sound to play when snoughing.
|
||||
/// </summary>
|
||||
[DataField("snoughSound")] public SoundSpecifier? SnoughSound;
|
||||
[DataField("emote", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
|
||||
public string EmoteId = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The random time between incidents, (min, max).
|
||||
|
||||
@@ -27,7 +27,8 @@ public sealed class UncontrollableSnoughSystem : EntitySystem
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
foreach (var snough in EntityQuery<UncontrollableSnoughComponent>())
|
||||
var query = EntityQueryEnumerator<UncontrollableSnoughComponent>();
|
||||
while (query.MoveNext(out var ent, out var snough))
|
||||
{
|
||||
snough.NextIncidentTime -= frameTime;
|
||||
|
||||
@@ -38,7 +39,7 @@ public sealed class UncontrollableSnoughSystem : EntitySystem
|
||||
snough.NextIncidentTime +=
|
||||
_random.NextFloat(snough.TimeBetweenIncidents.X, snough.TimeBetweenIncidents.Y);
|
||||
|
||||
_diseaseSystem.SneezeCough(snough.Owner, null, snough.SnoughMessage, snough.SnoughSound, false);
|
||||
_diseaseSystem.SneezeCough(ent, null, snough.EmoteId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user