2020-07-22 09:50:39 +02:00
|
|
|
|
#nullable enable
|
|
|
|
|
|
using Content.Shared.GameObjects.Components.Movement;
|
2020-07-01 12:03:19 -07:00
|
|
|
|
using Robust.Shared.GameObjects.Components;
|
2020-05-23 01:23:36 +02:00
|
|
|
|
using Robust.Shared.Maths;
|
|
|
|
|
|
using Robust.Shared.Physics;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Physics
|
|
|
|
|
|
{
|
2020-05-24 11:40:49 +02:00
|
|
|
|
public class MoverController : VirtualController
|
2020-05-23 01:23:36 +02:00
|
|
|
|
{
|
2020-10-11 16:36:58 +02:00
|
|
|
|
public override IPhysicsComponent? ControlledComponent { protected get; set; }
|
2020-05-23 01:23:36 +02:00
|
|
|
|
|
|
|
|
|
|
public void Move(Vector2 velocityDirection, float speed)
|
|
|
|
|
|
{
|
2020-10-14 22:37:25 +02:00
|
|
|
|
if (ControlledComponent?.Owner.IsWeightless() ?? false)
|
2020-07-23 18:33:37 +02:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-05-23 01:23:36 +02:00
|
|
|
|
Push(velocityDirection, speed);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Push(Vector2 velocityDirection, float speed)
|
|
|
|
|
|
{
|
2020-07-23 18:33:37 +02:00
|
|
|
|
LinearVelocity = velocityDirection * speed;
|
2020-05-23 01:23:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void StopMoving()
|
|
|
|
|
|
{
|
2020-07-23 18:33:37 +02:00
|
|
|
|
LinearVelocity = Vector2.Zero;
|
2020-05-23 01:23:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|