Skip to content

Commit

Permalink
Ports /vg/ tile movement v1.0 from other repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
spess-empyrean committed Jan 11, 2025
1 parent 19e0b0c commit 2a4ab25
Show file tree
Hide file tree
Showing 2 changed files with 490 additions and 29 deletions.
58 changes: 58 additions & 0 deletions Content.Shared/Movement/Components/TileMovementComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System.Numerics;
using Content.Shared.Movement.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Map;

namespace Content.Shared.TileMovement;

/// <summary>
/// When attached to an entity with an InputMoverComponent, all mob movement on that entity will
/// be tile-based. Contains info used to facilitate that movement.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class TileMovementComponent : Component
{
/// <summary>
/// Whether a tile movement slide is currently in progress.
/// </summary>
[AutoNetworkedField]
public bool SlideActive;

/// <summary>
/// Local coordinates from which the current slide first began.
/// </summary>
[AutoNetworkedField]
public EntityCoordinates Origin;

/// <summary>
/// Local coordinates of the target of the current slide.
/// </summary>
[AutoNetworkedField]
public Vector2 Destination;

/// <summary>
/// This helps determine how long a slide should last. A slide will continue so long
/// as a movement key (WASD) is being held down, but if it was held down for less than
/// a certain time period then it will continue for a minimum period.
/// </summary>
[AutoNetworkedField]
public TimeSpan? MovementKeyInitialDownTime;

/// <summary>
/// Move buttons used to initiate the current slide.
/// </summary>
[AutoNetworkedField]
public MoveButtons CurrentSlideMoveButtons;

/// <summary>
/// Local coordinates of the entity on the last physics tick.
/// </summary>
[AutoNetworkedField]
public Vector2 LastTickPosition;

/// <summary>
/// Whether this entity was weightless last physics tick.
/// </summary>
[AutoNetworkedField]
public bool WasWeightlessLastTick;
}
Loading

0 comments on commit 2a4ab25

Please sign in to comment.