* Revert "Add weightlessness status effect. (#2384)"
This reverts commit 9b751fc079.
* Bring back the icon and status
* Make weightless status track gravity and parent
26 lines
790 B
C#
26 lines
790 B
C#
#nullable enable
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using Robust.Shared.Interfaces.Physics;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Content.Shared.GameObjects.Components.Movement
|
|
{
|
|
[RegisterComponent]
|
|
public sealed class MovementIgnoreGravityComponent : Component
|
|
{
|
|
public override string Name => "MovementIgnoreGravity";
|
|
}
|
|
|
|
public static class GravityExtensions
|
|
{
|
|
public static bool IsWeightless(this IEntity entity, IPhysicsManager? physicsManager = null)
|
|
{
|
|
physicsManager ??= IoCManager.Resolve<IPhysicsManager>();
|
|
|
|
return !entity.HasComponent<MovementIgnoreGravityComponent>() &&
|
|
physicsManager.IsWeightless(entity.Transform.Coordinates);
|
|
}
|
|
}
|
|
}
|