Fix emote animations
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Animations;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Shared.Animations;
|
||||
@@ -16,7 +17,7 @@ public class EmoteAnimationSystem : EntitySystem
|
||||
SubscribeLocalEvent<EmoteAnimationComponent, ComponentHandleState>(OnHandleState);
|
||||
|
||||
// EmoteFlip animation
|
||||
_emoteList.Add("EmoteFlip", (EntityUid uid) =>
|
||||
_emoteList.Add("EmoteFlip", uid =>
|
||||
{
|
||||
var animationKey = "emoteAnimationKeyId";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Linq;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Server.Actions;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Content.Shared.Animations;
|
||||
using static Content.Shared.Animations.EmoteAnimationComponent;
|
||||
using Content.Server.Chat.Systems;
|
||||
@@ -35,20 +35,15 @@ public class EmoteAnimationSystem : EntitySystem
|
||||
|
||||
private void OnMapInint(EntityUid uid, EmoteAnimationComponent component, MapInitEvent args)
|
||||
{
|
||||
foreach (var item in _proto.EnumeratePrototypes<InstantActionPrototype>())
|
||||
foreach (var item in _proto.EnumeratePrototypes<EntityPrototype>())
|
||||
{
|
||||
InstantAction? action;
|
||||
if (item.ID.Length > INSTANT_IDENTIFIER.Length &&
|
||||
item.ID[..INSTANT_IDENTIFIER.Length] == INSTANT_IDENTIFIER)
|
||||
action = new InstantAction(item);
|
||||
else
|
||||
if (item.ID.Length <= INSTANT_IDENTIFIER.Length ||
|
||||
item.ID[..INSTANT_IDENTIFIER.Length] != INSTANT_IDENTIFIER)
|
||||
continue;
|
||||
|
||||
if (action != null)
|
||||
{
|
||||
component.Actions.Add(action);
|
||||
_action.AddAction(uid, action, null);
|
||||
}
|
||||
EntityUid? action = null;
|
||||
component.Actions.Add(action);
|
||||
_action.AddAction(uid, ref action, item.ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -8,7 +7,7 @@ namespace Content.Shared.Animations;
|
||||
/// <summary>
|
||||
/// Event for playing animations
|
||||
/// </summary>
|
||||
public class EmoteActionEvent : InstantActionEvent
|
||||
public sealed partial class EmoteActionEvent : InstantActionEvent
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("emote", readOnly: true, required: true)]
|
||||
@@ -17,12 +16,12 @@ public class EmoteActionEvent : InstantActionEvent
|
||||
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
public class EmoteAnimationComponent : Component
|
||||
public sealed partial class EmoteAnimationComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string AnimationId = "none";
|
||||
|
||||
public readonly List<InstantAction> Actions = new();
|
||||
public readonly List<EntityUid?> Actions = new();
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class EmoteAnimationComponentState : ComponentState
|
||||
|
||||
@@ -1,29 +1,38 @@
|
||||
# flip animation
|
||||
- type: instantAction
|
||||
- type: entity
|
||||
id: EmoteActionFlip
|
||||
name: emote-flip-action-name
|
||||
description: emote-flip-action-description
|
||||
icon: Interface/Actions/blight.png
|
||||
event: !type:EmoteActionEvent
|
||||
emote: EmoteFlip
|
||||
nospawn: true
|
||||
components:
|
||||
- type: InstantAction
|
||||
icon: Interface/Actions/blight.png
|
||||
event: !type:EmoteActionEvent
|
||||
emote: EmoteFlip
|
||||
|
||||
# jump animation
|
||||
- type: instantAction
|
||||
- type: entity
|
||||
id: EmoteActionJump
|
||||
name: emote-jump-action-name
|
||||
description: emote-jump-action-description
|
||||
icon: Interface/Actions/blight.png
|
||||
event: !type:EmoteActionEvent
|
||||
emote: EmoteJump
|
||||
nospawn: true
|
||||
components:
|
||||
- type: InstantAction
|
||||
icon: Interface/Actions/blight.png
|
||||
event: !type:EmoteActionEvent
|
||||
emote: EmoteJump
|
||||
|
||||
# turn around in 4 directions animation
|
||||
- type: instantAction
|
||||
- type: entity
|
||||
id: EmoteActionTurn
|
||||
name: emote-turn-action-name
|
||||
description: emote-turn-action-description
|
||||
icon: Interface/Actions/blight.png
|
||||
event: !type:EmoteActionEvent
|
||||
emote: EmoteTurn
|
||||
nospawn: true
|
||||
components:
|
||||
- type: InstantAction
|
||||
icon: Interface/Actions/blight.png
|
||||
event: !type:EmoteActionEvent
|
||||
emote: EmoteTurn
|
||||
|
||||
|
||||
# Using EmoteAnimation from IC action chat
|
||||
|
||||
Reference in New Issue
Block a user