mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
27 lines
709 B
C#
27 lines
709 B
C#
using Content.Shared.Chat;
|
|
|
|
namespace Content.Shared.Speech.EntitySystems;
|
|
|
|
public sealed partial class EmotesMenuSystem : EntitySystem
|
|
{
|
|
[Dependency] private SharedChatSystem _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 (!ProtoMan.Resolve(msg.ProtoId, out var proto) || proto.ChatTriggers.Count == 0)
|
|
return;
|
|
|
|
_chat.TryEmoteWithChat(player.Value, msg.ProtoId);
|
|
}
|
|
}
|