Fix walking in place animations when holding walk button (#37887)
Fix SpriteMovement playing when holding walk button
This commit is contained in:
@@ -37,6 +37,14 @@ namespace Content.Shared.Movement.Components
|
|||||||
|
|
||||||
public MoveButtons HeldMoveButtons = MoveButtons.None;
|
public MoveButtons HeldMoveButtons = MoveButtons.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Does our input indicate actual movement, and not just modifiers?
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This can be useful to filter out input from just pressing the walk button with no directions, for example.
|
||||||
|
/// </remarks>
|
||||||
|
public bool HasDirectionalMovement => (HeldMoveButtons & MoveButtons.AnyDirection) != MoveButtons.None;
|
||||||
|
|
||||||
// I don't know if we even need this networked? It's mostly so conveyors can calculate properly.
|
// I don't know if we even need this networked? It's mostly so conveyors can calculate properly.
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Direction to move this tick.
|
/// Direction to move this tick.
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Content.Shared.Movement.Systems
|
|||||||
RaiseLocalEvent(entity, ref moveEvent);
|
RaiseLocalEvent(entity, ref moveEvent);
|
||||||
Dirty(entity, entity.Comp);
|
Dirty(entity, entity.Comp);
|
||||||
|
|
||||||
var ev = new SpriteMoveEvent(entity.Comp.HeldMoveButtons != MoveButtons.None);
|
var ev = new SpriteMoveEvent(entity.Comp.HasDirectionalMovement);
|
||||||
RaiseLocalEvent(entity, ref ev);
|
RaiseLocalEvent(entity, ref ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ namespace Content.Shared.Movement.Systems
|
|||||||
entity.Comp.HeldMoveButtons = state.HeldMoveButtons;
|
entity.Comp.HeldMoveButtons = state.HeldMoveButtons;
|
||||||
RaiseLocalEvent(entity.Owner, ref moveEvent);
|
RaiseLocalEvent(entity.Owner, ref moveEvent);
|
||||||
|
|
||||||
var ev = new SpriteMoveEvent(entity.Comp.HeldMoveButtons != MoveButtons.None);
|
var ev = new SpriteMoveEvent(entity.Comp.HasDirectionalMovement);
|
||||||
RaiseLocalEvent(entity, ref ev);
|
RaiseLocalEvent(entity, ref ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user