Files
tbd-station-14/Content.Server/Speech/EmotesMenuSystem.cs
Morb 16b3e2233a Emotes Menu (#26702)
* Basic emote radial menu

* Move out from corvax

* Move to UI controller & add to top menu bar and key bind

* Make emote play

* Add name localization for emotes

* Localize chat messages

* Fix emote menu

* Add categories localization

* Fixes

* Fix

* Add emotes entity blacklist

* Fix entity whitelist required all logic

* Remove unused wagging emote

* Revert sprite

* Set default texture for emote icon

* Update Resources/keybinds.yml

---------

Co-authored-by: Kara <lunarautomaton6@gmail.com>
2024-04-28 21:38:23 -07:00

31 lines
860 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) || proto.ChatTriggers.Count == 0)
return;
_chat.TryEmoteWithChat(player.Value, msg.ProtoId);
}
}