]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Purge uses of TransformComponent.AttachToGridOrMap (#34940)
authorTemporalOroboros <TemporalOroboros@gmail.com>
Fri, 7 Feb 2025 11:49:22 +0000 (03:49 -0800)
committerGitHub <noreply@github.com>
Fri, 7 Feb 2025 11:49:22 +0000 (12:49 +0100)
Switches over all extant uses of TransformComponent.AttachToGridOrMap to use SharedTransformSystem.AttachToGridOrMap

Content.Server/Administration/Commands/WarpCommand.cs
Content.Server/Construction/ConstructionSystem.Graph.cs
Content.Shared/Construction/SharedConstructionSystem.cs
Content.Shared/Containers/ContainerFillSystem.cs

index 0d6da0d993735f65ab6248e96f3b92144f354710..c4aa41db20a0cffd016a4e4be35af8cd9acbf1de 100644 (file)
@@ -118,8 +118,9 @@ namespace Content.Server.Administration.Commands
                 }
 
                 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);
index 1b74fd9d4e5669b93d7ab064618aa98e3b5abd3b..4c73cef703d60e55c3668752310cbf2b9433df1d 100644 (file)
@@ -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;
 
index 901b2f834d1989e91478a0a6d3138bbc2d7dc622..a2b647ae927861ae44d2e35d6b39d2c6e96cb937 100644 (file)
@@ -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!;
 
         /// <summary>
         ///     Get predicate for construction obstruction checks.
index 51c7c48e40f08f7101b4921797ca5a643c6a5062..90eccb0341a39d01119a937be6c0568882810d7e 100644 (file)
@@ -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;
                 }
             }