Skip to content

Commit

Permalink
Merge pull request #1347 from Darkmajia/crawling-flip
Browse files Browse the repository at this point in the history
crawling flip fix
  • Loading branch information
mqole authored Jan 14, 2025
2 parents fda9a86 + 1641336 commit 963a895
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Content.Client/_Goobstation/Emoting/AnimatedEmotesSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
using System.Numerics;
using Robust.Shared.Prototypes;
using Content.Shared.Chat.Prototypes;
using Content.Shared.Rotation;

namespace Content.Client.Emoting;

public sealed partial class AnimatedEmotesSystem : SharedAnimatedEmotesSystem
{
[Dependency] private readonly AnimationPlayerSystem _anim = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly IPrototypeManager _prot = default!;

public override void Initialize()
Expand Down Expand Up @@ -45,6 +47,20 @@ private void OnHandleState(EntityUid uid, AnimatedEmotesComponent component, ref

private void OnFlip(Entity<AnimatedEmotesComponent> ent, ref AnimationFlipEmoteEvent args)
{
var angle = Angle.Zero;

if (TryComp<RotationVisualsComponent>(ent, out var rotation))
{
_appearance.TryGetData<RotationState>(ent, RotationVisuals.RotationState, out var state);

angle = state switch
{
RotationState.Vertical => rotation.VerticalRotation,
RotationState.Horizontal => rotation.HorizontalRotation,
_ => Angle.Zero
};
}

var a = new Animation
{
Length = TimeSpan.FromMilliseconds(500),
Expand All @@ -57,9 +73,9 @@ private void OnFlip(Entity<AnimatedEmotesComponent> ent, ref AnimationFlipEmoteE
InterpolationMode = AnimationInterpolationMode.Linear,
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(Angle.Zero, 0f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(180), 0.25f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(360), 0.25f),
new AnimationTrackProperty.KeyFrame(angle, 0f),
new AnimationTrackProperty.KeyFrame(angle + Angle.FromDegrees(180), 0.25f),
new AnimationTrackProperty.KeyFrame(angle + Angle.FromDegrees(360), 0.25f),
}
}
}
Expand Down

0 comments on commit 963a895

Please sign in to comment.