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

24 lines
646 B
C#
Raw Normal View History

2022-05-13 00:59:03 -07: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));
}
}
}