Files
tbd-station-14/Content.Shared/Physics/ConveyedController.cs
DrSmugleaf 5fcd13d0e3 Add IEntity.IsWeightless extension method (#2255)
Checking manually every time wasn't that cool
2020-10-14 22:37:25 +02:00

38 lines
979 B
C#

#nullable enable
using Content.Shared.GameObjects.Components.Movement;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.Physics;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
namespace Content.Shared.Physics
{
public class ConveyedController : VirtualController
{
public override IPhysicsComponent? ControlledComponent { protected get; set; }
public void Move(Vector2 velocityDirection, float speed)
{
if (ControlledComponent?.Owner.IsWeightless() ?? false)
{
return;
}
if (ControlledComponent?.Status == BodyStatus.InAir)
{
return;
}
LinearVelocity = velocityDirection * speed * 100;
}
public override void UpdateAfterProcessing()
{
base.UpdateAfterProcessing();
LinearVelocity = Vector2.Zero;
}
}
}