Add IEntity.IsWeightless extension method (#2255)
Checking manually every time wasn't that cool
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
#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;
|
||||
|
||||
@@ -10,14 +8,11 @@ namespace Content.Shared.Physics
|
||||
{
|
||||
public class MoverController : VirtualController
|
||||
{
|
||||
[Dependency] private readonly IPhysicsManager _physicsManager = default!;
|
||||
|
||||
public override IPhysicsComponent? ControlledComponent { protected get; set; }
|
||||
|
||||
public void Move(Vector2 velocityDirection, float speed)
|
||||
{
|
||||
if (ControlledComponent?.Owner.HasComponent<MovementIgnoreGravityComponent>() == false
|
||||
&& _physicsManager.IsWeightless(ControlledComponent.Owner.Transform.Coordinates))
|
||||
if (ControlledComponent?.Owner.IsWeightless() ?? false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user