Files
OldThink/Content.Shared/Transform/TransformExtensions.cs

27 lines
705 B
C#
Raw Normal View History

using Robust.Shared.GameObjects;
2021-12-03 14:20:34 +01:00
using Robust.Shared.IoC;
2021-06-09 22:19:39 +02:00
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);
}
2021-12-04 12:59:44 +01:00
public static void AttachToGrandparent(this EntityUid entity)
{
2021-12-03 15:53:09 +01:00
AttachToGrandparent(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity));
}
}
}