Merge branch '20-06-24-movement-prediction' into 20-06-24-foobar

This commit is contained in:
Pieter-Jan Briers
2020-06-24 21:00:55 +02:00
64 changed files with 1127 additions and 561 deletions

View File

@@ -0,0 +1,54 @@
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Physics;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Physics;
using Robust.Client.Player;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.IoC;
using Robust.Shared.Physics;
#nullable enable
namespace Content.Client.GameObjects.EntitySystems
{
[UsedImplicitly]
public class MoverSystem : SharedMoverSystem
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
public override void Initialize()
{
base.Initialize();
UpdatesBefore.Add(typeof(PhysicsSystem));
}
public override void FrameUpdate(float frameTime)
{
var playerEnt = _playerManager.LocalPlayer?.ControlledEntity;
if (playerEnt == null || !playerEnt.TryGetComponent(out IMoverComponent mover))
{
return;
}
var physics = playerEnt.GetComponent<PhysicsComponent>();
playerEnt.TryGetComponent(out CollidableComponent? collidable);
physics.Predict = true;
UpdateKinematics(playerEnt.Transform, mover, physics, collidable);
}
public override void Update(float frameTime)
{
FrameUpdate(frameTime);
}
protected override void SetController(SharedPhysicsComponent physics)
{
((PhysicsComponent)physics).SetController<MoverController>();
}
}
}

View File

@@ -444,7 +444,7 @@ namespace Content.Client.GameObjects.EntitySystems
var func = args.Function;
var funcId = _master._inputManager.NetworkBindMap.KeyFunctionID(args.Function);
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, funcId, BoundKeyState.Down,
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction, funcId, BoundKeyState.Down,
_entity.Transform.GridPosition,
args.PointerLocation, _entity.Uid);