2021-07-17 02:37:09 +02:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-10-10 15:25:13 +02:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Shared.Transform
|
2020-10-10 15:25:13 +02:00
|
|
|
|
{
|
|
|
|
|
|
public static class TransformExtensions
|
|
|
|
|
|
{
|
2021-11-08 12:37:32 +01:00
|
|
|
|
public static void AttachToGrandparent(this TransformComponent transform)
|
2020-10-10 15:25:13 +02:00
|
|
|
|
{
|
|
|
|
|
|
var grandParent = transform.Parent?.Parent;
|
|
|
|
|
|
|
|
|
|
|
|
if (grandParent == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
transform.AttachToGridOrMap();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
transform.AttachParent(grandParent);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void AttachToGrandparent(this IEntity entity)
|
|
|
|
|
|
{
|
|
|
|
|
|
AttachToGrandparent(entity.Transform);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|