Pepper makes you cough (#36358)

This commit is contained in:
āda
2025-05-19 13:23:38 -05:00
committed by GitHub
parent 69354f59c8
commit 41a129e749
9 changed files with 143 additions and 9 deletions

View File

@@ -8,34 +8,49 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
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.
/// Tries to force someone to emote (scream, laugh, etc). Still respects whitelists/blacklists and other limits unless specially forced.
/// </summary>
[UsedImplicitly]
public sealed partial class Emote : EntityEffect
{
[DataField("emote", customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
public string? EmoteId;
/// <summary>
/// The emote the entity will preform.
/// </summary>
[DataField("emote", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
public string EmoteId;
/// <summary>
/// If the emote should be recorded in chat.
/// </summary>
[DataField]
public bool ShowInChat;
/// <summary>
/// If the forced emote will be listed in the guidebook.
/// </summary>
[DataField]
public bool ShowInGuidebook;
/// <summary>
/// If true, the entity will preform the emote even if they normally can't.
/// </summary>
[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;
{
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)
{
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);
}
}