]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup warnings: Use TransformSystem for anchoring (#39778)
authorB_Kirill <153602297+B-Kirill@users.noreply.github.com>
Tue, 23 Sep 2025 02:52:51 +0000 (12:52 +1000)
committerGitHub <noreply@github.com>
Tue, 23 Sep 2025 02:52:51 +0000 (14:52 +1200)
* Cleanup

* Bonus

* I hope this helps

* Revert

Content.Client/Administration/UI/AdminCamera/AdminCameraWindow.xaml
Content.Server/StationEvents/Events/ImmovableRodRule.cs
Content.Shared/Coordinates/Helpers/SnapgridHelper.cs

index 87583cef974ddb6f2ac0c42fdfbfa5259cc3505a..a6ac34bb29c3460e75133aff12a6486ec5efde5f 100644 (file)
@@ -1,6 +1,5 @@
 <DefaultWindow xmlns="https://spacestation14.io"
     Title="{Loc admin-camera-window-title-placeholder}"
     SetSize="425 550"
-    MinSize="200 225"
-    Name="Window">
+    MinSize="200 225">
 </DefaultWindow>
index 5e324a529b8c508ade9da6aa72d045b6e948499a..83ab07723624620d058ed72c95cec663beaab5aa 100644 (file)
@@ -35,7 +35,8 @@ public sealed class ImmovableRodRule : StationEventSystem<ImmovableRodRuleCompon
             var speed = RobustRandom.NextFloat(rod.MinSpeed, rod.MaxSpeed);
             var angle = RobustRandom.NextAngle();
             var direction = angle.ToVec();
-            var spawnCoords = targetCoords.ToMap(EntityManager, _transform).Offset(-direction * speed * despawn.Lifetime / 2);
+            var mapCoords = _transform.ToMapCoordinates(targetCoords);
+            var spawnCoords = mapCoords.Offset(-direction * speed * despawn.Lifetime / 2);
             var ent = Spawn(protoName, spawnCoords);
             _gun.ShootProjectile(ent, direction, Vector2.Zero, uid, speed: speed);
         }
index 264b647afba277268e5bac83cc36f78db4e7c75d..aa2bd15586b7b8c610fa317dbac9ca34c66df21d 100644 (file)
@@ -9,12 +9,12 @@ namespace Content.Shared.Coordinates.Helpers
         public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entMan = null, IMapManager? mapManager = null)
         {
             IoCManager.Resolve(ref entMan, ref mapManager);
+            var xformSys = entMan.System<SharedTransformSystem>();
 
-            var gridId = coordinates.GetGridUid(entMan);
+            var gridId = xformSys.GetGrid(coordinates.EntityId);
 
             if (gridId == null)
             {
-                var xformSys = entMan.System<SharedTransformSystem>();
                 var mapPos = xformSys.ToMapCoordinates(coordinates);
                 var mapX = (int)Math.Floor(mapPos.X) + 0.5f;
                 var mapY = (int)Math.Floor(mapPos.Y) + 0.5f;
@@ -24,11 +24,11 @@ namespace Content.Shared.Coordinates.Helpers
 
             var grid = entMan.GetComponent<MapGridComponent>(gridId.Value);
             var tileSize = grid.TileSize;
-            var localPos = coordinates.WithEntityId(gridId.Value).Position;
+            var localPos = xformSys.WithEntityId(coordinates, gridId.Value).Position;
             var x = (int)Math.Floor(localPos.X / tileSize) + tileSize / 2f;
             var y = (int)Math.Floor(localPos.Y / tileSize) + tileSize / 2f;
             var gridPos = new EntityCoordinates(gridId.Value, new Vector2(x, y));
-            return gridPos.WithEntityId(coordinates.EntityId);
+            return xformSys.WithEntityId(gridPos, coordinates.EntityId);
         }
 
         public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, MapGridComponent grid)