Files
tbd-station-14/Content.Server/EntityEffects/Effects/Emote.cs
SlamBamActionman b9fa941ca6 Turn ReagentEffects into generic EntityEffects (#28168)
* Oh the possibilities

* Merge fixes

* Forgot to remote LavaSystem oops

* Changed EntityEffectArgs to EntityEffectBaseArgs and EntityEffectReagentArgs

* Throw exception for unimplemented effectargs

* Remove Json and overrideable datafields

* Fix test issues

* Actually fix the compiling issue

* Fix comments and remove EntityEffectArgs (no longer used, replaced with EntityEffectBaseArgs)
2024-06-30 13:43:43 +10:00

42 lines
1.4 KiB
C#

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);
}
}