Files
tbd-station-14/Content.Client/GameObjects/EntitySystems/MoverSystem.cs
DrSmugleaf 64672fdc31 Refactor to use the new multiple controller system (#1462)
* Transition code to new controller system

* Fix shuttles not moving

* Fix throwing

* Fix guns

* Change hands to use physics.Stop() and remove item fumble method
2020-07-23 18:33:37 +02:00

47 lines
1.3 KiB
C#

#nullable enable
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Physics;
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;
if (playerEnt == null || !playerEnt.TryGetComponent(out IMoverComponent mover))
{
return;
}
var physics = playerEnt.GetComponent<IPhysicsComponent>();
playerEnt.TryGetComponent(out ICollidableComponent? collidable);
physics.Predict = true;
UpdateKinematics(playerEnt.Transform, mover, physics, collidable);
}
public override void Update(float frameTime)
{
FrameUpdate(frameTime);
}
}
}