* #1462 extracted MapGrid's HasGravity property to separate Content component * #1462 - PR suggestions * Merge to master Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Gravity;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
@@ -14,7 +15,7 @@ namespace Content.Shared.Movement.Components
|
||||
|
||||
public static class GravityExtensions
|
||||
{
|
||||
public static bool IsWeightless(this IEntity entity, PhysicsComponent? body = null, EntityCoordinates? coords = null, IMapManager? mapManager = null)
|
||||
public static bool IsWeightless(this IEntity entity, PhysicsComponent? body = null, EntityCoordinates? coords = null, IMapManager? mapManager = null, IEntityManager? entityManager = null)
|
||||
{
|
||||
if (body == null)
|
||||
entity.TryGetComponent(out body);
|
||||
@@ -34,8 +35,11 @@ namespace Content.Shared.Movement.Components
|
||||
|
||||
mapManager ??= IoCManager.Resolve<IMapManager>();
|
||||
var grid = mapManager.GetGrid(gridId);
|
||||
var gridEntityId = grid.GridEntityId;
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
var gridEntity = entityManager.GetEntity(gridEntityId);
|
||||
|
||||
if (!grid.HasGravity)
|
||||
if (!gridEntity.GetComponent<GravityComponent>().Enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user