using Content.Server.Chat.Systems; using Content.Shared.Chat.Prototypes; using Content.Shared.EntityEffects; using JetBrains.Annotations; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Server.EntityEffects.Effects; /// /// Tries to force someone to emote (scream, laugh, etc). Still respects whitelists/blacklists and other limits unless specially forced. /// [UsedImplicitly] public sealed partial class Emote : EntityEffect { /// /// The emote the entity will preform. /// [DataField("emote", required: true, customTypeSerializer: typeof(PrototypeIdSerializer))] public string EmoteId; /// /// If the emote should be recorded in chat. /// [DataField] public bool ShowInChat; /// /// If the forced emote will be listed in the guidebook. /// [DataField] public bool ShowInGuidebook; /// /// If true, the entity will preform the emote even if they normally can't. /// [DataField] public bool Force = false; protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) { if (!ShowInGuidebook) return null; // JUSTIFICATION: Emoting is mostly flavor, so same reason popup messages are not in here. return Loc.GetString("reagent-effect-guidebook-emote", ("chance", Probability), ("emote", EmoteId)); } public override void Effect(EntityEffectBaseArgs args) { var chatSys = args.EntityManager.System(); if (ShowInChat) chatSys.TryEmoteWithChat(args.TargetEntity, EmoteId, ChatTransmitRange.GhostRangeLimit, forceEmote: Force); else chatSys.TryEmoteWithoutChat(args.TargetEntity, EmoteId); } }