mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-20 23:41:13 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
30 lines
841 B
C#
30 lines
841 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 IPrototypeManager _prototypeManager = default!;
|
|
[Dependency] private 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);
|
|
}
|
|
}
|