Files
tbd-station-14/Content.Shared/GameObjects/Components/Movement/MovementIgnoreGravityComponent.cs
DrSmugleaf ac3e9bc566 Fix weightlessness status effect appearing only after something checks if an entity is weightless (#2434)
* Revert "Add weightlessness status effect. (#2384)"

This reverts commit 9b751fc079.

* Bring back the icon and status

* Make weightless status track gravity and parent
2020-10-30 01:07:51 +01:00

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);
}
}
}