Files
OldThink/Content.Shared/Physics/MoverController.cs

34 lines
854 B
C#
Raw Normal View History

2020-07-22 09:50:39 +02:00
#nullable enable
using Content.Shared.GameObjects.Components.Movement;
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
{
public class MoverController : VirtualController
2020-05-23 01:23:36 +02:00
{
public override IPhysicsComponent? ControlledComponent { protected get; set; }
2020-05-23 01:23:36 +02:00
public void Move(Vector2 velocityDirection, float speed)
{
if (ControlledComponent?.Owner.IsWeightless() ?? false)
{
return;
}
2020-05-23 01:23:36 +02:00
Push(velocityDirection, speed);
}
public void Push(Vector2 velocityDirection, float speed)
{
LinearVelocity = velocityDirection * speed;
2020-05-23 01:23:36 +02:00
}
public void StopMoving()
{
LinearVelocity = Vector2.Zero;
2020-05-23 01:23:36 +02:00
}
}
}