using Content.Server.Chat.Systems; using Content.Shared.Chat.Prototypes; using Content.Shared._White.Animations; using Robust.Shared.GameStates; using static Content.Shared._White.Animations.EmoteAnimationComponent; namespace Content.Server._White.Animations; public sealed class EmoteAnimationSystem : EntitySystem { public override void Initialize() { SubscribeLocalEvent(OnGetState); SubscribeLocalEvent(OnEmote); } private void OnGetState(EntityUid uid, EmoteAnimationComponent component, ref ComponentGetState args) { args.State = new EmoteAnimationComponentState(component.AnimationId); } private void OnEmote(EntityUid uid, EmoteAnimationComponent component, ref EmoteEvent args) { if (args.Handled || !args.Emote.Category.HasFlag(EmoteCategory.Hands)) return; PlayEmoteAnimation(uid, component, args.Emote.ID); } public void PlayEmoteAnimation(EntityUid uid, EmoteAnimationComponent component, string emoteId) { component.AnimationId = emoteId; Dirty(component); } }