Files
OldThink/Content.Server/_White/Animations/EmoteAnimationSystem.cs

36 lines
1.2 KiB
C#
Raw Normal View History

2023-05-05 18:31:39 +03:00
using Content.Server.Chat.Systems;
using Content.Shared.Chat.Prototypes;
using Content.Shared._White.Animations;
2024-01-17 19:34:15 +07:00
using Robust.Shared.GameStates;
using static Content.Shared._White.Animations.EmoteAnimationComponent;
2023-05-05 18:31:39 +03:00
namespace Content.Server._White.Animations;
2023-05-05 18:31:39 +03:00
2024-01-17 19:34:15 +07:00
public sealed class EmoteAnimationSystem : EntitySystem
2023-05-05 18:31:39 +03:00
{
public override void Initialize()
{
SubscribeLocalEvent<EmoteAnimationComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<EmoteAnimationComponent, EmoteEvent>(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)
{
2024-01-29 01:02:37 +07:00
if (args.Handled || !args.Emote.Category.HasFlag(EmoteCategory.Hands))
2023-05-05 18:31:39 +03:00
return;
PlayEmoteAnimation(uid, component, args.Emote.ID);
}
public void PlayEmoteAnimation(EntityUid uid, EmoteAnimationComponent component, string emoteId)
{
component.AnimationId = emoteId;
Dirty(component);
}
}