Skip to content

Commit

Permalink
fix: animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison committed Aug 24, 2024
1 parent fe5b269 commit 2dec3fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 1 addition & 7 deletions Content.Client/_White/Animations/FlipOnHitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected override void PlayAnimation(EntityUid user)

var animation = new Animation
{
Length = TimeSpan.FromMilliseconds(1600),
Length = TimeSpan.FromMilliseconds(400),
AnimationTracks =
{
new AnimationTrackComponentProperty
Expand All @@ -64,12 +64,6 @@ protected override void PlayAnimation(EntityUid user)
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees - 10), 0f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 180), 0.2f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 360), 0.2f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 540), 0.2f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 720), 0.2f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 900), 0.2f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 1080), 0.2f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 1260), 0.2f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 1440), 0.2f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees), 0f)
}
}
Expand Down
5 changes: 5 additions & 0 deletions Content.Shared/_White/Animations/SharedFlipOnHitSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Item.ItemToggle.Components;
using Content.Shared.Standing;
using Content.Shared.Weapons.Melee.Events;
using Robust.Shared.Serialization;
using Robust.Shared.Timing;
Expand All @@ -8,6 +9,7 @@ namespace Content.Shared._White.Animations;
public abstract class SharedFlipOnHitSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly StandingStateSystem _standingState = default!;

public override void Initialize()
{
Expand All @@ -27,6 +29,9 @@ private void OnHit(Entity<FlipOnHitComponent> ent, ref MeleeHitEvent args)
if (TryComp(ent, out ItemToggleComponent? itemToggle) && !itemToggle.Activated)
return;

if (_standingState.IsDown(args.User))
return;

PlayAnimation(args.User);
}

Expand Down

0 comments on commit 2dec3fa

Please sign in to comment.