From f37d5c9f0f2d8cd1c4ea702f391e895deb6e76c8 Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Fri, 7 Feb 2025 03:49:22 -0800 Subject: [PATCH] Purge uses of TransformComponent.AttachToGridOrMap (#34940) Switches over all extant uses of TransformComponent.AttachToGridOrMap to use SharedTransformSystem.AttachToGridOrMap --- Content.Server/Administration/Commands/WarpCommand.cs | 3 ++- Content.Server/Construction/ConstructionSystem.Graph.cs | 6 +++--- Content.Shared/Construction/SharedConstructionSystem.cs | 1 + Content.Shared/Containers/ContainerFillSystem.cs | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Content.Server/Administration/Commands/WarpCommand.cs b/Content.Server/Administration/Commands/WarpCommand.cs index 0d6da0d993..c4aa41db20 100644 --- a/Content.Server/Administration/Commands/WarpCommand.cs +++ b/Content.Server/Administration/Commands/WarpCommand.cs @@ -118,8 +118,9 @@ namespace Content.Server.Administration.Commands } var xform = _entManager.GetComponent(playerEntity); + var xformSystem = _entManager.System(); xform.Coordinates = coords; - xform.AttachToGridOrMap(); + xformSystem.AttachToGridOrMap(playerEntity, xform); if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics)) { _entManager.System().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics); diff --git a/Content.Server/Construction/ConstructionSystem.Graph.cs b/Content.Server/Construction/ConstructionSystem.Graph.cs index 1b74fd9d4e..4c73cef703 100644 --- a/Content.Server/Construction/ConstructionSystem.Graph.cs +++ b/Content.Server/Construction/ConstructionSystem.Graph.cs @@ -304,8 +304,8 @@ namespace Content.Server.Construction 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) @@ -362,7 +362,7 @@ namespace Content.Server.Construction // 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; diff --git a/Content.Shared/Construction/SharedConstructionSystem.cs b/Content.Shared/Construction/SharedConstructionSystem.cs index 901b2f834d..a2b647ae92 100644 --- a/Content.Shared/Construction/SharedConstructionSystem.cs +++ b/Content.Shared/Construction/SharedConstructionSystem.cs @@ -10,6 +10,7 @@ namespace Content.Shared.Construction { [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] protected readonly IPrototypeManager PrototypeManager = default!; + [Dependency] protected readonly SharedTransformSystem TransformSystem = default!; /// /// Get predicate for construction obstruction checks. diff --git a/Content.Shared/Containers/ContainerFillSystem.cs b/Content.Shared/Containers/ContainerFillSystem.cs index 51c7c48e40..90eccb0341 100644 --- a/Content.Shared/Containers/ContainerFillSystem.cs +++ b/Content.Shared/Containers/ContainerFillSystem.cs @@ -40,7 +40,7 @@ public sealed class ContainerFillSystem : EntitySystem 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; } }