Misc content xform changes (#12166)
This commit is contained in:
@@ -4,13 +4,6 @@ namespace Content.Server.Coordinates.Helpers
|
|||||||
{
|
{
|
||||||
public static class SnapgridHelper
|
public static class SnapgridHelper
|
||||||
{
|
{
|
||||||
public static void SnapToGrid(this EntityUid entity, IEntityManager? entMan = null, IMapManager? mapManager = null)
|
|
||||||
{
|
|
||||||
IoCManager.Resolve(ref entMan, ref mapManager);
|
|
||||||
var transform = entMan.GetComponent<TransformComponent>(entity);
|
|
||||||
transform.Coordinates = transform.Coordinates.SnapToGrid(entMan, mapManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entMan = null, IMapManager? mapManager = null)
|
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entMan = null, IMapManager? mapManager = null)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve(ref entMan, ref mapManager);
|
IoCManager.Resolve(ref entMan, ref mapManager);
|
||||||
|
|||||||
@@ -243,8 +243,10 @@ public sealed partial class PathfindingSystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldGridUid = ev.OldPosition.GetGridUid(EntityManager);
|
var gridUid = ev.Component.GridUid;
|
||||||
var gridUid = ev.NewPosition.GetGridUid(EntityManager);
|
var oldGridUid = ev.OldPosition.EntityId == ev.NewPosition.EntityId
|
||||||
|
? gridUid
|
||||||
|
: ev.OldPosition.GetGridUid(EntityManager);
|
||||||
|
|
||||||
// Not on a grid at all so just ignore.
|
// Not on a grid at all so just ignore.
|
||||||
if (oldGridUid == gridUid && oldGridUid == null)
|
if (oldGridUid == gridUid && oldGridUid == null)
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
namespace Content.Shared.Transform
|
|
||||||
{
|
|
||||||
public static class TransformExtensions
|
|
||||||
{
|
|
||||||
public static void AttachToGrandparent(this TransformComponent transform)
|
|
||||||
{
|
|
||||||
var grandParent = transform.Parent?.Parent;
|
|
||||||
|
|
||||||
if (grandParent == null)
|
|
||||||
{
|
|
||||||
transform.AttachToGridOrMap();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
transform.AttachParent(grandParent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AttachToGrandparent(this EntityUid entity)
|
|
||||||
{
|
|
||||||
AttachToGrandparent(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user