Files
tbd-station-14/Content.Server/Speech/EmotesMenuSystem.cs
slarticodefast ee9d1032bb Move ChatSystem.Emotes to shared (#40866)
* move to shared

* entity effect to shared

* refactor: whitespaces+xml-doc typo fixups

* refactor: a little bit more of xml-doc typos fixups

---------

Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
2025-10-13 18:06:01 +00:00

31 lines
859 B
C#

using Content.Shared.Chat;
using Content.Server.Chat.Systems;
using Robust.Shared.Prototypes;
namespace Content.Server.Speech;
public sealed partial class EmotesMenuSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ChatSystem _chat = default!;
public override void Initialize()
{
base.Initialize();
SubscribeAllEvent<PlayEmoteMessage>(OnPlayEmote);
}
private void OnPlayEmote(PlayEmoteMessage msg, EntitySessionEventArgs args)
{
var player = args.SenderSession.AttachedEntity;
if (!player.HasValue)
return;
if (!_prototypeManager.Resolve(msg.ProtoId, out var proto) || proto.ChatTriggers.Count == 0)
return;
_chat.TryEmoteWithChat(player.Value, msg.ProtoId);
}
}