WiP movement prediction.

This commit is contained in:
Pieter-Jan Briers
2020-06-24 02:21:20 +02:00
parent 822436bb81
commit da45a52325
48 changed files with 1101 additions and 540 deletions

View File

@@ -1,5 +1,5 @@
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.Interfaces.GameObjects.Components.Movement;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Shared.GameObjects;
@@ -44,11 +44,11 @@ namespace Content.Server.GameObjects.Components.Movement
public float GrabRange => 0.0f;
public bool Sprinting { get; set; }
public Vector2 VelocityDir { get; } = Vector2.Zero;
public (Vector2 walking, Vector2 sprinting) VelocityDir { get; } = (Vector2.Zero, Vector2.Zero);
public GridCoordinates LastPosition { get; set; }
public float StepSoundDistance { get; set; }
public void SetVelocityDirection(Direction direction, bool enabled)
public void SetVelocityDirection(Direction direction, ushort subTick, bool enabled)
{
var gridId = Owner.Transform.GridID;
@@ -74,6 +74,11 @@ namespace Content.Server.GameObjects.Components.Movement
}
}
public void SetSprinting(ushort subTick, bool enabled)
{
// Shuttles can't sprint.
}
private Vector2 CalcNewVelocity(Direction direction, bool enabled)
{
switch (direction)