}
var xform = _entManager.GetComponent<TransformComponent>(playerEntity);
+ var xformSystem = _entManager.System<SharedTransformSystem>();
xform.Coordinates = coords;
- xform.AttachToGridOrMap();
+ xformSystem.AttachToGridOrMap(playerEntity, xform);
if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics))
{
_entManager.System<SharedPhysicsSystem>().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics);
return null;
// [Optional] Exit if the new entity's prototype is a parent of the original
- // E.g., if an entity with the 'AirlockCommand' prototype was to be replaced with a new entity that
- // had the 'Airlock' prototype, and DoNotReplaceInheritingEntities was true, the code block would
+ // E.g., if an entity with the 'AirlockCommand' prototype was to be replaced with a new entity that
+ // had the 'Airlock' prototype, and DoNotReplaceInheritingEntities was true, the code block would
// exit here because 'AirlockCommand' is derived from 'Airlock'
if (GetCurrentNode(uid, construction)?.DoNotReplaceInheritingEntities == true &&
metaData.EntityPrototype?.ID != null)
// Transform transferring.
var newTransform = Transform(newUid);
- newTransform.AttachToGridOrMap(); // in case in hands or a container
+ TransformSystem.AttachToGridOrMap(newUid, newTransform); // in case in hands or a container
newTransform.LocalRotation = transform.LocalRotation;
newTransform.Anchored = transform.Anchored;
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
+ [Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
/// <summary>
/// Get predicate for construction obstruction checks.
if (!_containerSystem.Insert(ent, container, containerXform: xform))
{
Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}.");
- Transform(ent).AttachToGridOrMap();
+ _transform.AttachToGridOrMap(ent);
break;
}
}