| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- 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;
- /// <summary>
- /// Tries to force someone to emote (scream, laugh, etc). Still respects whitelists/blacklists and other limits of the specified emote unless forced.
- /// </summary>
- [UsedImplicitly]
- public sealed partial class Emote : EntityEffect
- {
- [DataField("emote", customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
- public string? EmoteId;
- [DataField]
- public bool ShowInChat;
- [DataField]
- public bool Force = false;
- // JUSTIFICATION: Emoting is flavor, so same reason popup messages are not in here.
- protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
- => null;
- public override void Effect(EntityEffectBaseArgs args)
- {
- if (EmoteId == null)
- return;
- var chatSys = args.EntityManager.System<ChatSystem>();
- if (ShowInChat)
- chatSys.TryEmoteWithChat(args.TargetEntity, EmoteId, ChatTransmitRange.GhostRangeLimit, forceEmote: Force);
- else
- chatSys.TryEmoteWithoutChat(args.TargetEntity, EmoteId);
- }
- }
|