Skip to content

Commit

Permalink
Fixed idle walk anim not playing on some underlings
Browse files Browse the repository at this point in the history
  • Loading branch information
Cibernet83 committed Sep 6, 2024
1 parent e22c6a7 commit 260a58d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- The Umbral Infiltrator no longer jitters when thrown by a void player
- Manually-spawned Lotus Flowers can no longer be hurt or killed by any damage source
- Lotus Flowers no longer push entities inside of them away
- Ogres and Basilisks no longer slide around when idling

### Contributors for this release

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private static PlayState idleAnimation(AnimationState<BasiliskEntity> state)

private static PlayState walkAnimation(AnimationState<BasiliskEntity> state)
{
if(!state.isMoving())
if(!state.getAnimatable().isMovingHorizontally())
{
return PlayState.STOP;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private static PlayState idleAnimation(AnimationState<GiclopsEntity> state)

private static PlayState walkAnimation(AnimationState<GiclopsEntity> state)
{
if(state.isMoving())
if(state.getAnimatable().isMovingHorizontally())
{
state.getController().setAnimation(WALK_ANIMATION);
return PlayState.CONTINUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void registerControllers(AnimatableManager.ControllerRegistrar controller

private static PlayState walkAnimation(AnimationState<OgreEntity> state)
{
if(state.isMoving())
if(state.getAnimatable().isMovingHorizontally())
{
state.getController().setAnimation(WALK_ANIMATION);
return PlayState.CONTINUE;
Expand All @@ -140,7 +140,7 @@ private static PlayState walkAnimation(AnimationState<OgreEntity> state)

private static PlayState walkArmsAnimation(AnimationState<OgreEntity> state)
{
if(state.isMoving() && !state.getAnimatable().isActive())
if(state.getAnimatable().isMovingHorizontally() && !state.getAnimatable().isActive())
{
state.getController().setAnimation(WALKARMS_ANIMATION);
return PlayState.CONTINUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ protected static void firstKillBonus(Entity killer, EcheladderBonusType type)
}
}

public boolean isMovingHorizontally()
{
return getDeltaMovement().horizontalDistanceSqr() > 0;
}

protected static class UnderlingData implements SpawnGroupData
{
public final GristType type;
Expand Down

0 comments on commit 260a58d

Please sign in to comment.