]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Replace obsolete FromMap calls with ToCoordinates (#35304)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Thu, 20 Feb 2025 12:03:42 +0000 (07:03 -0500)
committerGitHub <noreply@github.com>
Thu, 20 Feb 2025 12:03:42 +0000 (23:03 +1100)
Content.Client/Gameplay/GameplayStateBase.cs
Content.Client/Weapons/Misc/TetherGunSystem.cs
Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.cs
Content.Shared/Coordinates/Helpers/SnapgridHelper.cs
Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs
Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs
Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs

index 1e6fd485b38408ea74d0ed27dfa8bc353f24f831..162c45d4125c8a90bb0273964bf7c5f2a96253c7 100644 (file)
@@ -219,10 +219,12 @@ namespace Content.Client.Gameplay
                 {
                     entityToClick = GetClickedEntity(mousePosWorld);
                 }
+                var transformSystem = _entitySystemManager.GetEntitySystem<SharedTransformSystem>();
+                var mapSystem = _entitySystemManager.GetEntitySystem<MapSystem>();
 
-                coordinates = _mapManager.TryFindGridAt(mousePosWorld, out _, out var grid) ?
-                    grid.MapToGrid(mousePosWorld) :
-                    EntityCoordinates.FromMap(_mapManager, mousePosWorld);
+                coordinates = _mapManager.TryFindGridAt(mousePosWorld, out var uid, out _) ?
+                    mapSystem.MapToGrid(uid, mousePosWorld) :
+                    transformSystem.ToCoordinates(mousePosWorld);
             }
             else
             {
index 398aeabb839b357a89e33605e1d40e005590409b..3471fcc1fc428fa9c37646e7d86646cda90fa535 100644 (file)
@@ -16,6 +16,7 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
     [Dependency] private readonly IMapManager _mapManager = default!;
     [Dependency] private readonly IOverlayManager _overlay = default!;
     [Dependency] private readonly IPlayerManager _player = default!;
+    [Dependency] private readonly MapSystem _mapSystem = default!;
 
     public override void Initialize()
     {
@@ -73,11 +74,11 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
 
         if (_mapManager.TryFindGridAt(mouseWorldPos, out var gridUid, out _))
         {
-            coords = EntityCoordinates.FromMap(gridUid, mouseWorldPos, TransformSystem);
+            coords = TransformSystem.ToCoordinates(gridUid, mouseWorldPos);
         }
         else
         {
-            coords = EntityCoordinates.FromMap(_mapManager.GetMapEntityId(mouseWorldPos.MapId), mouseWorldPos, TransformSystem);
+            coords = TransformSystem.ToCoordinates(_mapSystem.GetMap(mouseWorldPos.MapId), mouseWorldPos);
         }
 
         const float BufferDistance = 0.1f;
index 08e86ff400dfc6973505b98163177e3bc04f8e20..ed46412a084ff4130d4cec795a9833f186cdd862 100644 (file)
@@ -136,7 +136,7 @@ public sealed partial class AdminVerbSystem
                     Filter.PvsExcept(args.Target), true, PopupType.MediumCaution);
                 var board = Spawn("ChessBoard", xform.Coordinates);
                 var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(board));
-                xform.Coordinates = EntityCoordinates.FromMap(_mapManager, session.Position);
+                xform.Coordinates = _transformSystem.ToCoordinates(session.Position);
                 _transformSystem.SetWorldRotationNoLerp((args.Target, xform), Angle.Zero);
             },
             Impact = LogImpact.Extreme,
index beffbd6d68eabe8d13df64bf127525e774f09241..57759fedfe9f0f52751b664781e89e8a28bc1686 100644 (file)
@@ -16,6 +16,7 @@ using Content.Shared.GameTicking;
 using Content.Shared.Inventory;
 using Content.Shared.Projectiles;
 using Content.Shared.Throwing;
+using Robust.Server.GameObjects;
 using Robust.Server.GameStates;
 using Robust.Server.Player;
 using Robust.Shared.Audio.Systems;
@@ -38,6 +39,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
     [Dependency] private readonly IConfigurationManager _cfg = default!;
     [Dependency] private readonly IPlayerManager _playerManager = default!;
 
+    [Dependency] private readonly MapSystem _mapSystem = default!;
     [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
     [Dependency] private readonly DamageableSystem _damageableSystem = default!;
     [Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!;
@@ -345,7 +347,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
         CameraShake(iterationIntensity.Count * 4f, pos, queued.TotalIntensity);
 
         //For whatever bloody reason, sound system requires ENTITY coordinates.
-        var mapEntityCoords = EntityCoordinates.FromMap(_mapManager.GetMapEntityId(pos.MapId), pos, _transformSystem, EntityManager);
+        var mapEntityCoords = _transformSystem.ToCoordinates(_mapSystem.GetMap(pos.MapId), pos);
 
         // play sound.
         // for the normal audio, we want everyone in pvs range
index db9ee85a0cd934fff5e50b5a337443f9e95c49d9..264b647afba277268e5bac83cc36f78db4e7c75d 100644 (file)
@@ -15,11 +15,11 @@ namespace Content.Shared.Coordinates.Helpers
             if (gridId == null)
             {
                 var xformSys = entMan.System<SharedTransformSystem>();
-                var mapPos = coordinates.ToMap(entMan, xformSys);
+                var mapPos = xformSys.ToMapCoordinates(coordinates);
                 var mapX = (int)Math.Floor(mapPos.X) + 0.5f;
                 var mapY = (int)Math.Floor(mapPos.Y) + 0.5f;
                 mapPos = new MapCoordinates(new Vector2(mapX, mapY), mapPos.MapId);
-                return EntityCoordinates.FromMap(coordinates.EntityId, mapPos, xformSys);
+                return xformSys.ToCoordinates(coordinates.EntityId, mapPos);
             }
 
             var grid = entMan.GetComponent<MapGridComponent>(gridId.Value);
index 101d206acd8a6494fdbfaa811dddd2c55243aacd..0fbf87f5af41153cf7ce1447a3ff929a71159db7 100644 (file)
@@ -115,7 +115,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
                 && (itemPos.Position - TransformSystem.GetMapCoordinates(uid, xform: xform).Position).Length() <= MaxAnimationRange
                 && MetaData(entity).VisibilityMask == MetaData(uid).VisibilityMask) // Don't animate aghost pickups.
             {
-                var initialPosition = EntityCoordinates.FromMap(coordinateEntity, itemPos, TransformSystem, EntityManager);
+                var initialPosition = TransformSystem.ToCoordinates(coordinateEntity, itemPos);
                 _storage.PlayPickupAnimation(entity, initialPosition, xform.Coordinates, itemXform.LocalRotation, uid);
             }
         }
index 7a8961485d6eaaf7bde03303a2ddd2f2aa9da209..c1fc856ff390a48a89adb3449f17e7be8b4c6679 100644 (file)
@@ -81,7 +81,7 @@ public sealed class MagnetPickupSystem : EntitySystem
                 // game state handling we can't show a lerp animation for it.
                 var nearXform = Transform(near);
                 var nearMap = _transform.GetMapCoordinates(near, xform: nearXform);
-                var nearCoords = EntityCoordinates.FromMap(moverCoords.EntityId, nearMap, _transform, EntityManager);
+                var nearCoords = _transform.ToCoordinates(moverCoords.EntityId, nearMap);
 
                 if (!_storage.Insert(uid, near, out var stacked, storageComp: storage, playSound: !playedSound))
                     continue;
index b6228ae779b990fcefc85e2bb1ead7cccc668421..51ee89c10b41f8ab9ad1508a70997a2af6772bdb 100644 (file)
@@ -532,10 +532,9 @@ public abstract class SharedStorageSystem : EntitySystem
             {
                 var parent = transformOwner.ParentUid;
 
-                var position = EntityCoordinates.FromMap(
+                var position = TransformSystem.ToCoordinates(
                     parent.IsValid() ? parent : uid,
-                    TransformSystem.GetMapCoordinates(transformEnt),
-                    TransformSystem
+                    TransformSystem.GetMapCoordinates(transformEnt)
                 );
 
                 args.Handled = true;
@@ -585,10 +584,9 @@ public abstract class SharedStorageSystem : EntitySystem
                 continue;
             }
 
-            var position = EntityCoordinates.FromMap(
+            var position = TransformSystem.ToCoordinates(
                 xform.ParentUid.IsValid() ? xform.ParentUid : uid,
-                new MapCoordinates(TransformSystem.GetWorldPosition(targetXform), targetXform.MapID),
-                TransformSystem
+                new MapCoordinates(TransformSystem.GetWorldPosition(targetXform), targetXform.MapID)
             );
 
             var angle = targetXform.LocalRotation;