* 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>
31 lines
859 B
C#
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);
|
|
}
|
|
}
|