using Content.Shared.Chat;
using Content.Shared.Chat.Prototypes;
using Robust.Shared.Prototypes;
namespace Content.Shared.EntityEffects.Effects;
///
/// Makes this entity emote.
///
///
public sealed partial class EmoteEntityEffectSystem : EntityEffectSystem
{
[Dependency] private readonly SharedChatSystem _chat = default!;
protected override void Effect(Entity entity, ref EntityEffectEvent args)
{
if (args.Effect.ShowInChat)
_chat.TryEmoteWithChat(entity, args.Effect.EmoteId, ChatTransmitRange.GhostRangeLimit, forceEmote: args.Effect.Force);
else
_chat.TryEmoteWithoutChat(entity, args.Effect.EmoteId);
}
}
///
public sealed partial class Emote : EntityEffectBase
{
///
/// The emote the entity will preform.
///
[DataField("emote", required: true)]
public ProtoId 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;
public override string? EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
{
if (!ShowInGuidebook || !prototype.Resolve(EmoteId, out var emote))
return null; // JUSTIFICATION: Emoting is mostly flavor, so same reason popup messages are not in here.
return Loc.GetString("entity-effect-guidebook-emote", ("chance", Probability), ("emote", Loc.GetString(emote.Name)));
}
}