MoveInputEvent.cs 656 B

12345678910111213141516171819202122
  1. using Content.Shared.Movement.Components;
  2. using Content.Shared.Movement.Systems;
  3. namespace Content.Shared.Movement.Events;
  4. /// <summary>
  5. /// Raised on an entity whenever it has a movement input change.
  6. /// </summary>
  7. [ByRefEvent]
  8. public readonly struct MoveInputEvent
  9. {
  10. public readonly Entity<InputMoverComponent> Entity;
  11. public readonly MoveButtons OldMovement;
  12. public bool HasDirectionalMovement => (Entity.Comp.HeldMoveButtons & MoveButtons.AnyDirection) != MoveButtons.None;
  13. public MoveInputEvent(Entity<InputMoverComponent> entity, MoveButtons oldMovement)
  14. {
  15. Entity = entity;
  16. OldMovement = oldMovement;
  17. }
  18. }