2023-01-25 17:29:41 +01:00
|
|
|
using Content.Server.Chat.Systems;
|
|
|
|
|
using Content.Shared.Chat.Prototypes;
|
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
|
|
|
|
using JetBrains.Annotations;
|
2023-06-04 16:45:02 -04:00
|
|
|
using Robust.Shared.Prototypes;
|
2023-01-25 17:29:41 +01:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Chemistry.ReagentEffects;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tries to force someone to emote (scream, laugh, etc).
|
|
|
|
|
/// </summary>
|
|
|
|
|
[UsedImplicitly]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class Emote : ReagentEffect
|
2023-01-25 17:29:41 +01:00
|
|
|
{
|
|
|
|
|
[DataField("emote", customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
|
|
|
|
|
public string? EmoteId;
|
|
|
|
|
|
2023-12-29 04:47:43 -08:00
|
|
|
[DataField]
|
2023-01-25 17:29:41 +01:00
|
|
|
public bool ShowInChat;
|
|
|
|
|
|
2023-06-04 16:45:02 -04:00
|
|
|
// JUSTIFICATION: Emoting is flavor, so same reason popup messages are not in here.
|
|
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
|
|
|
|
=> null;
|
|
|
|
|
|
2023-01-25 17:29:41 +01:00
|
|
|
public override void Effect(ReagentEffectArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (EmoteId == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var chatSys = args.EntityManager.System<ChatSystem>();
|
|
|
|
|
if (ShowInChat)
|
2023-05-04 20:08:08 +01:00
|
|
|
chatSys.TryEmoteWithChat(args.SolutionEntity, EmoteId, ChatTransmitRange.GhostRangeLimit);
|
2023-01-25 17:29:41 +01:00
|
|
|
else
|
|
|
|
|
chatSys.TryEmoteWithoutChat(args.SolutionEntity, EmoteId);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|