fish-station/Content.Server/Speech/EmotesMenuSystem.cs
haiwwkes 5192d120ea
Новая панель эмоутов. (#891)
* wacky

* work

* work

* work

* work

* eff

* a
2024-12-24 23:27:09 +03:00

30 lines
827 B
C#

using Content.Server.Chat.Systems;
using Content.Shared.Chat;
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.TryIndex(msg.ProtoId, out var proto))
return;
_chat.TryEmoteWithChat(player.Value, msg.ProtoId);
}
}