Re-organize all projects (#4166)
This commit is contained in:
26
Content.Shared/Transform/TransformExtensions.cs
Normal file
26
Content.Shared/Transform/TransformExtensions.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Transform
|
||||
{
|
||||
public static class TransformExtensions
|
||||
{
|
||||
public static void AttachToGrandparent(this ITransformComponent 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user