2020-07-08 01:41:20 +02:00
|
|
|
|
#nullable enable
|
|
|
|
|
|
using Content.Shared.GameObjects.Components.Movement;
|
2020-06-24 02:21:20 +02:00
|
|
|
|
using Content.Shared.GameObjects.EntitySystems;
|
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
using Robust.Client.Physics;
|
|
|
|
|
|
using Robust.Client.Player;
|
|
|
|
|
|
using Robust.Shared.GameObjects.Components;
|
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
2020-10-17 18:12:16 +02:00
|
|
|
|
if (playerEnt == null || !playerEnt.TryGetComponent(out IMoverComponent? mover) || !playerEnt.TryGetComponent(out IPhysicsComponent? physics))
|
2020-06-24 02:21:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-11 16:36:58 +02:00
|
|
|
|
physics.Predict = true;
|
2020-06-24 02:21:20 +02:00
|
|
|
|
|
2020-10-11 16:36:58 +02:00
|
|
|
|
UpdateKinematics(playerEnt.Transform, mover, physics);
|
2020-06-24 02:21:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
FrameUpdate(frameTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|