Files
crystall-punk-14/Content.Shared/Transform/TransformExtensions.cs

26 lines
617 B
C#
Raw Normal View History

using Robust.Shared.GameObjects;
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);
}
public static void AttachToGrandparent(this IEntity entity)
{
AttachToGrandparent(entity.Transform);
}
}
}