]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Resolve `'TransformComponent.MapPosition' is obsolete` in content (#27939)
authorKara <lunarautomaton6@gmail.com>
Sun, 12 May 2024 14:31:54 +0000 (07:31 -0700)
committerGitHub <noreply@github.com>
Sun, 12 May 2024 14:31:54 +0000 (10:31 -0400)
* Resolve `'TransformComponent.MapPosition' is obsolete: 'Use TransformSystem.GetMapCoordinates'` in content

* build?

59 files changed:
Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionWindow.xaml.cs
Content.Client/GPS/UI/HandheldGpsStatusControl.cs
Content.Client/MouseRotator/MouseRotatorSystem.cs
Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs
Content.Client/Sprite/SpriteFadeSystem.cs
Content.Client/Tabletop/TabletopSystem.cs
Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Content.Client/Verbs/VerbSystem.cs
Content.Client/Weapons/Melee/MeleeArcOverlay.cs
Content.Client/Weapons/Melee/MeleeSpreadCommand.cs
Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Content.Client/Weapons/Ranged/GunSpreadOverlay.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Content.IntegrationTests/Tests/Doors/AirlockTest.cs
Content.IntegrationTests/Tests/Hands/HandTests.cs
Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs
Content.Server/Administration/Commands/ExplosionCommand.cs
Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs
Content.Server/Anomaly/Effects/ElectricityAnomalySystem.cs
Content.Server/Anomaly/Effects/InjectionAnomalySystem.cs
Content.Server/Beam/BeamSystem.cs
Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs
Content.Server/Chemistry/ReactionEffects/CreateEntityReactionEffect.cs
Content.Server/Chemistry/ReactionEffects/EmpReactionEffect.cs
Content.Server/Cloning/CloningSystem.cs
Content.Server/Construction/ConstructionSystem.Initial.cs
Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs
Content.Server/Disposal/Tube/DisposalTubeSystem.cs
Content.Server/Dragon/DragonSystem.cs
Content.Server/Emp/EmpSystem.cs
Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs
Content.Server/Fluids/EntitySystems/DrainSystem.cs
Content.Server/GameTicking/Rules/DeathMatchRuleSystem.cs
Content.Server/Gatherable/GatherableSystem.cs
Content.Server/Guardian/GuardianSystem.cs
Content.Server/Kitchen/EntitySystems/SharpSystem.cs
Content.Server/Lightning/LightningSystem.cs
Content.Server/Lightning/LightningTargetSystem.cs
Content.Server/NPC/Systems/NPCSteeringSystem.cs
Content.Server/NPC/Systems/NPCUtilitySystem.cs
Content.Server/Nuke/NukeSystem.cs
Content.Server/Nutrition/EntitySystems/FoodSystem.cs
Content.Server/PDA/Ringer/RingerSystem.cs
Content.Server/Payload/EntitySystems/PayloadSystem.cs
Content.Server/Pointing/EntitySystems/PointingSystem.cs
Content.Server/Respawn/SpecialRespawnSystem.cs
Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs
Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/EmpArtifactSystem.cs
Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/SpawnArtifactSystem.cs
Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ThrowArtifactSystem.cs
Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs
Content.Shared/Examine/ExamineSystemShared.cs
Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs
Content.Shared/Interaction/RotateToFaceSystem.cs
Content.Shared/Interaction/SharedInteractionSystem.cs
Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs
Content.Shared/Tabletop/SharedTabletopSystem.cs
Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs

index 5f187cad794efe8df987aef0db7c698cefd520a9..b0d8a946ec5f8fc9d9b764112910468570695a08 100644 (file)
@@ -3,6 +3,7 @@ using Content.Shared.Explosion;
 using JetBrains.Annotations;
 using Robust.Client.AutoGenerated;
 using Robust.Client.Console;
+using Robust.Client.GameObjects;
 using Robust.Client.Player;
 using Robust.Client.UserInterface.CustomControls;
 using Robust.Client.UserInterface.XAML;
@@ -22,7 +23,7 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
     [Dependency] private readonly IPlayerManager _playerManager = default!;
     [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
     [Dependency] private readonly IEntityManager _entMan = default!;
-
+    private readonly SharedTransformSystem _transform = default!;
 
     private readonly SpawnExplosionEui _eui;
     private List<MapId> _mapData = new();
@@ -37,6 +38,7 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
     {
         RobustXamlLoader.Load(this);
         IoCManager.InjectDependencies(this);
+        _transform = _entMan.System<TransformSystem>();
         _eui = eui;
 
         ExplosionOption.OnItemSelected += ExplosionSelected;
@@ -104,7 +106,7 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
 
         _pausePreview = true;
         MapOptions.Select(_mapData.IndexOf(transform.MapID));
-        (MapX.Value, MapY.Value) = transform.MapPosition.Position;
+        (MapX.Value, MapY.Value) = _transform.GetMapCoordinates(_playerManager.LocalEntity!.Value, xform: transform).Position;
         _pausePreview = false;
 
         UpdatePreview();
index de6a1031bad0070f475409d4bd7aa11f01e88893..7dcf3f29c5197e0527838cb3eef1a904a019c2d8 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Client.GPS.Components;
 using Content.Client.Message;
 using Content.Client.Stylesheets;
+using Robust.Client.GameObjects;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
 using Robust.Shared.Timing;
@@ -13,11 +14,13 @@ public sealed class HandheldGpsStatusControl : Control
     private readonly RichTextLabel _label;
     private float _updateDif;
     private readonly IEntityManager _entMan;
+    private readonly SharedTransformSystem _transform;
 
     public HandheldGpsStatusControl(Entity<HandheldGPSComponent> parent)
     {
         _parent = parent;
         _entMan = IoCManager.Resolve<IEntityManager>();
+        _transform = _entMan.System<TransformSystem>();
         _label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
         AddChild(_label);
         UpdateGpsDetails();
@@ -41,7 +44,7 @@ public sealed class HandheldGpsStatusControl : Control
         var posText = "Error";
         if (_entMan.TryGetComponent(_parent, out TransformComponent? transComp))
         {
-            var pos =  transComp.MapPosition;
+            var pos =  _transform.GetMapCoordinates(_parent.Owner, xform: transComp);
             var x = (int) pos.X;
             var y = (int) pos.Y;
             posText = $"({x}, {y})";
index 4894c17c4c01224f5b3513a35d63c8c63c575887..ce174c6144c59647b950724e9c43aa7ca9d430d4 100644 (file)
@@ -2,6 +2,7 @@
 using Robust.Client.Graphics;
 using Robust.Client.Input;
 using Robust.Client.Player;
+using Robust.Client.Replays.Loading;
 using Robust.Shared.Map;
 using Robust.Shared.Timing;
 
@@ -37,7 +38,7 @@ public sealed class MouseRotatorSystem : SharedMouseRotatorSystem
         if (mapPos.MapId == MapId.Nullspace)
             return;
 
-        var angle = (mapPos.Position - xform.MapPosition.Position).ToWorldAngle();
+        var angle = (mapPos.Position - _transform.GetMapCoordinates(player.Value, xform: xform).Position).ToWorldAngle();
 
         var curRot = _transform.GetWorldRotation(xform);
 
index 9012767ef3f3874f5c99043a79ac54bc1691fde5..8d5607af2d061774c797c369b20b541a4d73742c 100644 (file)
@@ -1,9 +1,11 @@
 using System.Numerics;
 using Content.Shared.Radiation.Components;
+using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Shared.Enums;
 using Robust.Shared.Graphics;
 using Robust.Shared.Map;
+using Robust.Shared.Physics;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Timing;
 
@@ -14,6 +16,7 @@ namespace Content.Client.Radiation.Overlays
         [Dependency] private readonly IEntityManager _entityManager = default!;
         [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
         [Dependency] private readonly IGameTiming _gameTiming = default!;
+        private TransformSystem? _transform;
 
         private const float MaxDist = 15.0f;
 
@@ -72,6 +75,8 @@ namespace Content.Client.Radiation.Overlays
         //Queries all pulses on the map and either adds or removes them from the list of rendered pulses based on whether they should be drawn (in range? on the same z-level/map? pulse entity still exists?)
         private void RadiationQuery(IEye? currentEye)
         {
+            _transform ??= _entityManager.System<TransformSystem>();
+
             if (currentEye == null)
             {
                 _pulses.Clear();
@@ -91,7 +96,7 @@ namespace Content.Client.Radiation.Overlays
                             (
                                 _baseShader.Duplicate(),
                                 new RadiationShaderInstance(
-                                    _entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition,
+                                    _transform.GetMapCoordinates(pulseEntity),
                                     pulse.VisualRange,
                                     pulse.StartTime,
                                     pulse.VisualDuration
@@ -109,7 +114,7 @@ namespace Content.Client.Radiation.Overlays
                     _entityManager.TryGetComponent(pulseEntity, out RadiationPulseComponent? pulse))
                 {
                     var shaderInstance = _pulses[pulseEntity];
-                    shaderInstance.instance.CurrentMapCoords = _entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition;
+                    shaderInstance.instance.CurrentMapCoords = _transform.GetMapCoordinates(pulseEntity);
                     shaderInstance.instance.Range = pulse.VisualRange;
                 } else {
                     _pulses[pulseEntity].shd.Dispose();
index dda3a6c948ee518e5f63cef4a230c716be14160e..d9584b60a6532936acc3a313be2912229e8005d1 100644 (file)
@@ -3,6 +3,7 @@ using Content.Shared.Sprite;
 using Robust.Client.GameObjects;
 using Robust.Client.Player;
 using Robust.Client.State;
+using Robust.Shared.Physics;
 
 namespace Content.Client.Sprite;
 
@@ -15,6 +16,7 @@ public sealed class SpriteFadeSystem : EntitySystem
 
     [Dependency] private readonly IPlayerManager _playerManager = default!;
     [Dependency] private readonly IStateManager _stateManager = default!;
+    [Dependency] private readonly SharedTransformSystem _transform = default!;
 
     private readonly HashSet<FadingSpriteComponent> _comps = new();
 
@@ -48,7 +50,7 @@ public sealed class SpriteFadeSystem : EntitySystem
             spriteQuery.TryGetComponent(player, out var playerSprite))
         {
             var fadeQuery = GetEntityQuery<SpriteFadeComponent>();
-            var mapPos = playerXform.MapPosition;
+            var mapPos = _transform.GetMapCoordinates(_playerManager.LocalEntity!.Value, xform: playerXform);
 
             // Also want to handle large entities even if they may not be clickable.
             foreach (var ent in state.GetClickableEntities(mapPos))
index 696c1455e0c1bf609eb3ece64520b626300a2050..0b55a1839c0a97d26a6ddf93a9a3094d5f39b938 100644 (file)
@@ -258,7 +258,7 @@ namespace Content.Client.Tabletop
             // Set the dragging player on the component to noone
             if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_draggedEntity.Value))
             {
-                RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transform(_draggedEntity.Value).MapPosition, GetNetEntity(_table!.Value)));
+                RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transforms.GetMapCoordinates(_draggedEntity.Value), GetNetEntity(_table!.Value)));
                 RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false));
             }
 
@@ -277,7 +277,8 @@ namespace Content.Client.Tabletop
             if (coordinates == MapCoordinates.Nullspace) return MapCoordinates.Nullspace;
 
             var eye = viewport.Eye;
-            if (eye == null) return MapCoordinates.Nullspace;
+            if (eye == null)
+                return MapCoordinates.Nullspace;
 
             var size = (Vector2) viewport.ViewportSize / EyeManager.PixelsPerMeter; // Convert to tiles instead of pixels
             var eyePosition = eye.Position.Position;
index 31e09e6603604dca7b314ebab73f9da1349b3b71..334ba6087380379b38dd3db27b56b25b65c5b540 100644 (file)
@@ -60,6 +60,7 @@ public sealed class ChatUIController : UIController
     [UISystemDependency] private readonly GhostSystem? _ghost = default;
     [UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default;
     [UISystemDependency] private readonly ChatSystem? _chatSys = default;
+    [UISystemDependency] private readonly TransformSystem? _transform = default;
 
     [ValidatePrototypeId<ColorPalettePrototype>]
     private const string ChatNamePalette = "ChatNames";
@@ -625,7 +626,7 @@ public sealed class ChatUIController : UIController
         var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data)
             => uid == data.compOwner || uid == data.attachedEntity;
         var playerPos = player != null
-            ? EntityManager.GetComponent<TransformComponent>(player.Value).MapPosition
+            ? _transform?.GetMapCoordinates(player.Value) ?? MapCoordinates.Nullspace
             : MapCoordinates.Nullspace;
 
         var occluded = player != null && _examine.IsOccluded(player.Value);
@@ -644,7 +645,7 @@ public sealed class ChatUIController : UIController
                 continue;
             }
 
-            var otherPos = EntityManager.GetComponent<TransformComponent>(ent).MapPosition;
+            var otherPos = _transform?.GetMapCoordinates(ent) ?? MapCoordinates.Nullspace;
 
             if (occluded && !_examine.InRangeUnOccluded(
                     playerPos,
index 49a3785eb285ab78bcbf4ada10f675762f78b36c..2e6c5f58099ed32f79dc8f93166b4486e188afe0 100644 (file)
@@ -22,6 +22,7 @@ namespace Content.Client.Verbs
         [Dependency] private readonly PopupSystem _popupSystem = default!;
         [Dependency] private readonly ExamineSystem _examine = default!;
         [Dependency] private readonly TagSystem _tagSystem = default!;
+        [Dependency] private readonly SharedTransformSystem _transform = default!;
         [Dependency] private readonly IStateManager _stateManager = default!;
         [Dependency] private readonly EntityLookupSystem _entityLookup = default!;
         [Dependency] private readonly IPlayerManager _playerManager = default!;
@@ -141,7 +142,7 @@ namespace Content.Client.Verbs
             if ((visibility & MenuVisibility.NoFov) == 0)
             {
                 var xformQuery = GetEntityQuery<TransformComponent>();
-                var playerPos = xformQuery.GetComponent(player.Value).MapPosition;
+                var playerPos = _transform.GetMapCoordinates(player.Value, xform: xformQuery.GetComponent(player.Value));
 
                 for (var i = entities.Count - 1; i >= 0; i--)
                 {
@@ -149,7 +150,7 @@ namespace Content.Client.Verbs
 
                     if (!_examine.InRangeUnOccluded(
                         playerPos,
-                        xformQuery.GetComponent(entity).MapPosition,
+                        _transform.GetMapCoordinates(entity, xform: xformQuery.GetComponent(entity)),
                         ExamineSystemShared.ExamineRange,
                         null))
                     {
index dbd68c15e247a87580c3eb0aa141e240c2e0b949..e7b6c8b0d60cbfc3083caa8746c4b20cc947acd6 100644 (file)
@@ -20,10 +20,11 @@ public sealed class MeleeArcOverlay : Overlay
     private readonly IPlayerManager _playerManager;
     private readonly MeleeWeaponSystem _melee;
     private readonly SharedCombatModeSystem _combatMode;
+    private readonly SharedTransformSystem _transform = default!;
 
     public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
 
-    public MeleeArcOverlay(IEntityManager entManager, IEyeManager eyeManager, IInputManager inputManager, IPlayerManager playerManager, MeleeWeaponSystem melee, SharedCombatModeSystem combatMode)
+    public MeleeArcOverlay(IEntityManager entManager, IEyeManager eyeManager, IInputManager inputManager, IPlayerManager playerManager, MeleeWeaponSystem melee, SharedCombatModeSystem combatMode, SharedTransformSystem transform)
     {
         _entManager = entManager;
         _eyeManager = eyeManager;
@@ -31,6 +32,7 @@ public sealed class MeleeArcOverlay : Overlay
         _playerManager = playerManager;
         _melee = melee;
         _combatMode = combatMode;
+        _transform = transform;
     }
 
     protected override void Draw(in OverlayDrawArgs args)
@@ -52,7 +54,7 @@ public sealed class MeleeArcOverlay : Overlay
         if (mapPos.MapId != args.MapId)
             return;
 
-        var playerPos = xform.MapPosition;
+        var playerPos = _transform.GetMapCoordinates(player.Value, xform: xform);
 
         if (mapPos.MapId != playerPos.MapId)
             return;
index 6b259a7fd54916c9c96714e726f8ed2c9a4afd82..eda469deaf0f0e0ef1813875e61b8cb5a300249a 100644 (file)
@@ -35,6 +35,7 @@ public sealed class MeleeSpreadCommand : IConsoleCommand
             collection.Resolve<IInputManager>(),
             collection.Resolve<IPlayerManager>(),
             sysManager.GetEntitySystem<MeleeWeaponSystem>(),
-            sysManager.GetEntitySystem<SharedCombatModeSystem>()));
+            sysManager.GetEntitySystem<SharedCombatModeSystem>(),
+            sysManager.GetEntitySystem<SharedTransformSystem>()));
     }
 }
index 039af55bd0100f23f4ccd7057e93a304524fe822..d59d471f1a3275ffcc08da5b36be9cdf0e95ea02 100644 (file)
@@ -142,7 +142,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
         // Light attack
         if (useDown == BoundKeyState.Down)
         {
-            var attackerPos = Transform(entity).MapPosition;
+            var attackerPos = TransformSystem.GetMapCoordinates(entity);
 
             if (mousePos.MapId != attackerPos.MapId ||
                 (attackerPos.Position - mousePos.Position).Length() > weapon.Range)
index 62df764ae50c590c7c5a615602f0bef87268045b..63d21c84635f7c30f26308227aa08a7b489f4ee0 100644 (file)
@@ -18,8 +18,9 @@ public sealed class GunSpreadOverlay : Overlay
     private readonly IInputManager _input;
     private readonly IPlayerManager _player;
     private readonly GunSystem _guns;
+    private readonly SharedTransformSystem _transform;
 
-    public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system)
+    public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system, SharedTransformSystem transform)
     {
         _entManager = entManager;
         _eye = eyeManager;
@@ -27,6 +28,7 @@ public sealed class GunSpreadOverlay : Overlay
         _timing = timing;
         _player = player;
         _guns = system;
+        _transform = transform;
     }
 
     protected override void Draw(in OverlayDrawArgs args)
@@ -41,7 +43,7 @@ public sealed class GunSpreadOverlay : Overlay
             return;
         }
 
-        var mapPos = xform.MapPosition;
+        var mapPos = _transform.GetMapCoordinates(player.Value, xform: xform);
 
         if (mapPos.MapId == MapId.Nullspace)
             return;
index 4a7711032e4ecc60a12fee8b7d7b40166847cb88..ac5914d47c0358b0d74132c87b6af3372992bbc4 100644 (file)
@@ -60,7 +60,8 @@ public sealed partial class GunSystem : SharedGunSystem
                     Timing,
                     _inputManager,
                     _player,
-                    this));
+                    this,
+                    TransformSystem));
             }
             else
             {
index 9f31231091ff1bf34da850e52a09540dd558c047..2fbaa91456f595a1b237d287f378f76936e157d8 100644 (file)
@@ -171,7 +171,7 @@ namespace Content.IntegrationTests.Tests.Doors
             // Sloth: Okay I'm sorry but I hate having to rewrite tests for every refactor
             // If you see this yell at me in discord so I can continue to pretend this didn't happen.
             // REMINDER THAT I STILL HAVE TO FIX THIS TEST EVERY OTHER PHYSICS PR
-            // Assert.That(AirlockPhysicsDummy.Transform.MapPosition.X, Is.GreaterThan(AirlockPhysicsDummyStartingX));
+            // _transform.GetMapCoordinates(UID HERE, xform: Assert.That(AirlockPhysicsDummy.Transform).X, Is.GreaterThan(AirlockPhysicsDummyStartingX));
 
             // Blocked by the airlock
             await server.WaitAssertion(() =>
index fdcd7f9096ff354f002b0cf9ee04eaec96fafbef..9ecabbeebf69414ca5b17f47500b432b3a7e30b1 100644 (file)
@@ -1,6 +1,7 @@
 using System.Linq;
 using Content.Shared.Hands.Components;
 using Content.Shared.Hands.EntitySystems;
+using Robust.Server.GameObjects;
 using Robust.Server.Player;
 using Robust.Shared.GameObjects;
 using Robust.Shared.Map;
@@ -24,6 +25,7 @@ public sealed class HandTests
         var playerMan = server.ResolveDependency<IPlayerManager>();
         var mapMan = server.ResolveDependency<IMapManager>();
         var sys = entMan.System<SharedHandsSystem>();
+        var tSys = entMan.System<TransformSystem>();
 
         var data = await pair.CreateTestMap();
         await pair.RunTicksSync(5);
@@ -35,7 +37,7 @@ public sealed class HandTests
         {
             player = playerMan.Sessions.First().AttachedEntity!.Value;
             var xform = entMan.GetComponent<TransformComponent>(player);
-            item = entMan.SpawnEntity("Crowbar", xform.MapPosition);
+            item = entMan.SpawnEntity("Crowbar", tSys.GetMapCoordinates(player, xform: xform));
             hands = entMan.GetComponent<HandsComponent>(player);
             sys.TryPickup(player, item, hands.ActiveHand!);
         });
index b8828763a23094d30befef3eb93eb5d0b557e80c..719367e54e616baeda15b7b5762135fbab23a35d 100644 (file)
@@ -1,5 +1,6 @@
 using System.Numerics;
 using Content.Shared.Interaction;
+using Robust.Server.GameObjects;
 using Robust.Shared.Containers;
 using Robust.Shared.GameObjects;
 using Robust.Shared.Map;
@@ -32,6 +33,7 @@ namespace Content.IntegrationTests.Tests.Interaction
             var sEntities = server.ResolveDependency<IEntityManager>();
             var mapManager = server.ResolveDependency<IMapManager>();
             var conSystem = sEntities.EntitySysManager.GetEntitySystem<SharedContainerSystem>();
+            var tSystem = sEntities.EntitySysManager.GetEntitySystem<TransformSystem>();
 
             EntityUid origin = default;
             EntityUid other = default;
@@ -45,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Interaction
                 origin = sEntities.SpawnEntity(HumanId, coordinates);
                 other = sEntities.SpawnEntity(HumanId, coordinates);
                 conSystem.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
-                mapCoordinates = sEntities.GetComponent<TransformComponent>(other).MapPosition;
+                mapCoordinates = tSystem.GetMapCoordinates(other);
             });
 
             await server.WaitIdleAsync();
index 56ed78b2e2e3909ecd87b902a10a65ecd915450e..81daca59c4853f4a4a0713a25021f77653ea0d32 100644 (file)
@@ -8,6 +8,7 @@ using Robust.Shared.Map;
 using Robust.Shared.Prototypes;
 using System.Linq;
 using System.Numerics;
+using Robust.Server.GameObjects;
 
 namespace Content.Server.Administration.Commands;
 
@@ -105,7 +106,7 @@ public sealed class ExplosionCommand : IConsoleCommand
             if (args.Length > 4)
                 coords = new MapCoordinates(new Vector2(x, y), xform.MapID);
             else
-                coords = xform.MapPosition;
+                coords = entMan.System<TransformSystem>().GetMapCoordinates(shell.Player.AttachedEntity.Value, xform: xform);
         }
 
         ExplosionPrototype? type;
index ed60fe5448e169d7b29520790bcec208d8314570..eb21662719e2e4cfa5f8b61d02fba8b89c5e1251 100644 (file)
@@ -102,7 +102,7 @@ public sealed partial class AdminVerbSystem
             Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/smite.svg.192dpi.png")),
             Act = () =>
             {
-                var coords = Transform(args.Target).MapPosition;
+                var coords = _transformSystem.GetMapCoordinates(args.Target);
                 Timer.Spawn(_gameTiming.TickPeriod,
                     () => _explosionSystem.QueueExplosion(coords, ExplosionSystem.DefaultExplosionPrototypeId,
                         4, 1, 2, maxTileBreak: 0), // it gibs, damage doesn't need to be high.
index f2a060d6295d39ea359642f6cfa75f7a2c6ca9c3..bd4718e8e35cf89fea8e0a59c720769b60268e4f 100644 (file)
@@ -61,7 +61,7 @@ public sealed class ElectricityAnomalySystem : EntitySystem
             var damage = (int) (elec.MaxElectrocuteDamage * anom.Severity);
             var duration = elec.MaxElectrocuteDuration * anom.Severity;
 
-            foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(xform.MapPosition, range))
+            foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(_transform.GetMapCoordinates(uid, xform), range))
             {
                 _electrocution.TryDoElectrocution(ent, uid, damage, duration, true, statusEffects: comp, ignoreInsulation: true);
             }
index 731d853280c938d41a436d5b77c170f4ee3b397d..1fa0c00bd349185683421130564d5fdfcd7090d8 100644 (file)
@@ -3,6 +3,7 @@ using Content.Server.Chemistry.Containers.EntitySystems;
 using Content.Shared.Anomaly.Components;
 using Content.Shared.Chemistry.Components.SolutionManager;
 using System.Linq;
+using Robust.Server.GameObjects;
 
 namespace Content.Server.Anomaly.Effects;
 /// <summary>
@@ -16,6 +17,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
 {
     [Dependency] private readonly EntityLookupSystem _lookup = default!;
     [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
 
     private EntityQuery<InjectableSolutionComponent> _injectableQuery;
 
@@ -45,7 +47,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
         //We get all the entity in the radius into which the reagent will be injected.
         var xformQuery = GetEntityQuery<TransformComponent>();
         var xform = xformQuery.GetComponent(entity);
-        var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(xform.MapPosition, injectRadius)
+        var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(_transform.GetMapCoordinates(entity, xform: xform), injectRadius)
             .Select(x => x.Owner).ToList();
 
         //for each matching entity found
index 33f2f252d90dd31180c77772d763de1d722d8b93..ad67f983c27257e72a9b6f9d70a8850b5113a432 100644 (file)
@@ -3,6 +3,7 @@ using Content.Server.Beam.Components;
 using Content.Shared.Beam;
 using Content.Shared.Beam.Components;
 using Content.Shared.Physics;
+using Robust.Server.GameObjects;
 using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Map;
@@ -16,6 +17,7 @@ namespace Content.Server.Beam;
 public sealed class BeamSystem : SharedBeamSystem
 {
     [Dependency] private readonly FixtureSystem _fixture = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
     [Dependency] private readonly SharedPhysicsSystem _physics = default!;
@@ -144,8 +146,8 @@ public sealed class BeamSystem : SharedBeamSystem
         if (Deleted(user) || Deleted(target))
             return;
 
-        var userMapPos = Transform(user).MapPosition;
-        var targetMapPos = Transform(target).MapPosition;
+        var userMapPos = _transform.GetMapCoordinates(user);
+        var targetMapPos = _transform.GetMapCoordinates(target);
 
         //The distance between the target and the user.
         var calculatedDistance = targetMapPos.Position - userMapPos.Position;
index 024558f8de34959f4dd0f4b67594cff8c047aa13..ebbf4e0341b29032519d05bbe9f6dba0802b3ffd 100644 (file)
@@ -6,6 +6,7 @@ using Content.Shared.Database;
 using Content.Shared.FixedPoint;
 using Content.Shared.Maps;
 using JetBrains.Annotations;
+using Robust.Server.GameObjects;
 using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Map;
@@ -58,15 +59,18 @@ namespace Content.Server.Chemistry.ReactionEffects
             var splitSolution = args.Source.SplitSolution(args.Source.Volume);
             var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
             var mapManager = IoCManager.Resolve<IMapManager>();
+            var mapSys = args.EntityManager.System<MapSystem>();
+            var sys = args.EntityManager.System<TransformSystem>();
+            var mapCoords = sys.GetMapCoordinates(args.SolutionEntity, xform: transform);
 
-            if (!mapManager.TryFindGridAt(transform.MapPosition, out _, out var grid) ||
-                !grid.TryGetTileRef(transform.Coordinates, out var tileRef) ||
+            if (!mapManager.TryFindGridAt(mapCoords, out var gridUid, out var grid) ||
+                !mapSys.TryGetTileRef(gridUid, grid, transform.Coordinates, out var tileRef) ||
                 tileRef.Tile.IsSpace())
             {
                 return;
             }
 
-            var coords = grid.MapToGrid(transform.MapPosition);
+            var coords = mapSys.MapToGrid(gridUid, mapCoords);
             var ent = args.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());
 
             var smoke = args.EntityManager.System<SmokeSystem>();
index f8c0378452bf1b450be7dc6264e321dab7638014..0d5acc172203fe6cc30a1f6fe31b42d41afe1bb0 100644 (file)
@@ -34,7 +34,7 @@ public sealed partial class CreateEntityReactionEffect : ReagentEffect
 
         for (var i = 0; i < quantity; i++)
         {
-            var uid = args.EntityManager.SpawnEntity(Entity, transform.MapPosition);
+            var uid = args.EntityManager.SpawnEntity(Entity, transformSystem.GetMapCoordinates(args.SolutionEntity, xform: transform));
             transformSystem.AttachToGridOrMap(uid);
 
             // TODO figure out how to properly spawn inside of containers
index b6714ca28d0f4c6265c3bf8e058c744a9348a8a3..9a320ffc39820a77aa5c2df3d0176b0c5eb1e816 100644 (file)
@@ -1,5 +1,6 @@
 using Content.Server.Emp;
 using Content.Shared.Chemistry.Reagent;
+using Robust.Server.GameObjects;
 using Robust.Shared.Prototypes;
 
 namespace Content.Server.Chemistry.ReactionEffects;
@@ -37,11 +38,12 @@ public sealed partial class EmpReactionEffect : ReagentEffect
 
     public override void Effect(ReagentEffectArgs args)
     {
+        var tSys = args.EntityManager.System<TransformSystem>();
         var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
         var range = MathF.Min((float) (args.Quantity*EmpRangePerUnit), EmpMaxRange);
 
-        args.EntityManager.System<EmpSystem>().EmpPulse(
-            transform.MapPosition,
+        args.EntityManager.System<EmpSystem>()
+            .EmpPulse(tSys.GetMapCoordinates(args.SolutionEntity, xform: transform),
             range,
             EnergyConsumption,
             DisableDuration);
index def9950d9049f609ada4f2093fea23b197e452de..3893f31d25d755067bbde4aa3892107ab663fadc 100644 (file)
@@ -210,7 +210,7 @@ namespace Content.Server.Cloning
             }
             // end of genetic damage checks
 
-            var mob = Spawn(speciesPrototype.Prototype, Transform(uid).MapPosition);
+            var mob = Spawn(speciesPrototype.Prototype, _transformSystem.GetMapCoordinates(uid));
             _humanoidSystem.CloneAppearance(bodyToClone, mob);
 
             var ev = new CloningEvent(bodyToClone, mob);
index ede8d3064faa3865b7bf2d40814851aa6ed98639..17ed5c90f4d42d113b0a8b2b0e7661ddab9c97ba 100644 (file)
@@ -79,7 +79,7 @@ namespace Content.Server.Construction
                 }
             }
 
-            var pos = Transform(user).MapPosition;
+            var pos = _transformSystem.GetMapCoordinates(user);
 
             foreach (var near in _lookupSystem.GetEntitiesInRange(pos, 2f, LookupFlags.Contained | LookupFlags.Dynamic | LookupFlags.Sundries | LookupFlags.Approximate))
             {
index 0fa3c06c04b89a6ed976cd52dd98b8482c0a365d..057b6df9df21b53a658d04cd07922db5d3110618 100644 (file)
@@ -3,6 +3,7 @@ using Content.Server.Forensics;
 using Content.Server.Stack;
 using Content.Shared.Prototypes;
 using Content.Shared.Stacks;
+using Robust.Server.GameObjects;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
 using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
@@ -30,7 +31,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
 
         public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
-            var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
+            var tSys = system.EntityManager.System<TransformSystem>();
+            var position = tSys.GetMapCoordinates(owner);
 
             var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));
 
@@ -48,7 +50,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
                         ? minMax.Min
                         : system.Random.Next(minMax.Min, minMax.Max + 1);
 
-                    if (count == 0) continue;
+                    if (count == 0)
+                        continue;
 
                     if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
                     {
index f0f6e9142c693dad44c403ea08beac11d716e8cd..b38e6e78f47f5e900a79b4cd39ed6f90117aaf24 100644 (file)
@@ -31,6 +31,7 @@ namespace Content.Server.Disposal.Tube
         [Dependency] private readonly DisposableSystem _disposableSystem = default!;
         [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
         [Dependency] private readonly AtmosphereSystem _atmosSystem = default!;
+        [Dependency] private readonly TransformSystem _transform = default!;
         public override void Initialize()
         {
             base.Initialize();
@@ -422,7 +423,7 @@ namespace Content.Server.Disposal.Tube
                 return false;
 
             var xform = Transform(uid);
-            var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, xform.MapPosition);
+            var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, _transform.GetMapCoordinates(uid, xform: xform));
             var holderComponent = Comp<DisposalHolderComponent>(holder);
 
             foreach (var entity in from.Container.ContainedEntities.ToArray())
index d33e6f3bef71d000821444c0b8a9b3d903943460..1e29b80ebafb3fdb08b3022596e0c20af4147b95 100644 (file)
@@ -165,7 +165,7 @@ public sealed partial class DragonSystem : EntitySystem
             return;
         }
 
-        var carpUid = Spawn(component.RiftPrototype, xform.MapPosition);
+        var carpUid = Spawn(component.RiftPrototype, _transform.GetMapCoordinates(uid, xform: xform));
         component.Rifts.Add(carpUid);
         Comp<DragonRiftComponent>(carpUid).Dragon = uid;
     }
index 7c1a6f9b5db0cfeed29f219165e8e576facf1adb..d8eab0c5d1f1a720ad4a7b24a5c368dcc1d38b2f 100644 (file)
@@ -4,6 +4,7 @@ using Content.Server.Radio;
 using Content.Server.SurveillanceCamera;
 using Content.Shared.Emp;
 using Content.Shared.Examine;
+using Robust.Server.GameObjects;
 using Robust.Shared.Map;
 
 namespace Content.Server.Emp;
@@ -11,6 +12,7 @@ namespace Content.Server.Emp;
 public sealed class EmpSystem : SharedEmpSystem
 {
     [Dependency] private readonly EntityLookupSystem _lookup = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
 
     public const string EmpPulseEffectPrototype = "EffectEmpPulse";
 
@@ -102,7 +104,7 @@ public sealed class EmpSystem : SharedEmpSystem
 
     private void HandleEmpTrigger(EntityUid uid, EmpOnTriggerComponent comp, TriggerEvent args)
     {
-        EmpPulse(Transform(uid).MapPosition, comp.Range, comp.EnergyConsumption, comp.DisableDuration);
+        EmpPulse(_transform.GetMapCoordinates(uid), comp.Range, comp.EnergyConsumption, comp.DisableDuration);
         args.Handled = true;
     }
 
index 17ca9723569798f08f111dc927aeeb7d556677f4..f958373ac74f007d647e45aeaef70ab5329fd8bd 100644 (file)
@@ -4,6 +4,7 @@ using Content.Server.Fluids.EntitySystems;
 using Content.Shared.Chemistry.Components;
 using Content.Shared.Coordinates.Helpers;
 using Content.Shared.Maps;
+using Robust.Server.GameObjects;
 using Robust.Shared.Map;
 
 namespace Content.Server.Explosion.EntitySystems;
@@ -15,6 +16,7 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
 {
     [Dependency] private readonly IMapManager _mapMan = default!;
     [Dependency] private readonly SmokeSystem _smoke = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
 
     public override void Initialize()
     {
@@ -26,14 +28,15 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
     private void OnTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent args)
     {
         var xform = Transform(uid);
-        if (!_mapMan.TryFindGridAt(xform.MapPosition, out _, out var grid) ||
+        var mapCoords = _transform.GetMapCoordinates(uid, xform);
+        if (!_mapMan.TryFindGridAt(mapCoords, out _, out var grid) ||
             !grid.TryGetTileRef(xform.Coordinates, out var tileRef) ||
             tileRef.Tile.IsSpace())
         {
             return;
         }
 
-        var coords = grid.MapToGrid(xform.MapPosition);
+        var coords = grid.MapToGrid(mapCoords);
         var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid());
         if (!TryComp<SmokeComponent>(ent, out var smoke))
         {
index 5fc406dca539e3fca7cbcc6f996ce8de15810e33..b79685d83b6de046d0f4baeff62589fb712ee8b4 100644 (file)
@@ -13,6 +13,7 @@ using Content.Shared.Fluids.Components;
 using Content.Shared.Interaction;
 using Content.Shared.Tag;
 using Content.Shared.Verbs;
+using Robust.Server.GameObjects;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Collections;
 using Robust.Shared.Prototypes;
@@ -31,6 +32,7 @@ public sealed class DrainSystem : SharedDrainSystem
     [Dependency] private readonly TagSystem _tagSystem = default!;
     [Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
     [Dependency] private readonly PuddleSystem _puddleSystem = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
 
@@ -161,7 +163,7 @@ public sealed class DrainSystem : SharedDrainSystem
 
             puddles.Clear();
 
-            foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, drain.Range))
+            foreach (var entity in _lookup.GetEntitiesInRange(_transform.GetMapCoordinates(uid, xform), drain.Range))
             {
                 // No InRangeUnobstructed because there's no collision group that fits right now
                 // and these are placed by mappers and not buildable/movable so shouldnt really be a problem...
index 78b8a8a85c865e6027d6a92d6d3893ddfbd5fcdb..ad7c63ff58df755775fcbd49e666e6e6df93a1ea 100644 (file)
@@ -9,6 +9,7 @@ using Content.Server.RoundEnd;
 using Content.Server.Station.Systems;
 using Content.Shared.Points;
 using Content.Shared.Storage;
+using Robust.Server.GameObjects;
 using Robust.Server.Player;
 using Robust.Shared.Utility;
 
@@ -25,6 +26,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
     [Dependency] private readonly RespawnRuleSystem _respawn = default!;
     [Dependency] private readonly RoundEndSystem _roundEnd = default!;
     [Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
 
     public override void Initialize()
     {
@@ -97,7 +99,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
                 _point.AdjustPointValue(assist.PlayerId, 1, uid, point);
 
             var spawns = EntitySpawnCollection.GetSpawns(dm.RewardSpawns).Cast<string?>().ToList();
-            EntityManager.SpawnEntities(Transform(ev.Entity).MapPosition, spawns);
+            EntityManager.SpawnEntities(_transform.GetMapCoordinates(ev.Entity), spawns);
         }
     }
 
index 7fbbf7f4f649a6d1d727d32b42c722707f12f3c3..11295bb3a35c0e02d115af6e2c672066943d0c1b 100644 (file)
@@ -4,6 +4,7 @@ using Content.Shared.EntityList;
 using Content.Shared.Interaction;
 using Content.Shared.Tag;
 using Content.Shared.Weapons.Melee.Events;
+using Robust.Server.GameObjects;
 using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Prototypes;
@@ -18,6 +19,7 @@ public sealed partial class GatherableSystem : EntitySystem
     [Dependency] private readonly DestructibleSystem _destructible = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly TagSystem _tagSystem = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
 
     public override void Initialize()
     {
@@ -61,7 +63,7 @@ public sealed partial class GatherableSystem : EntitySystem
         if (component.MappedLoot == null)
             return;
 
-        var pos = Transform(gatheredUid).MapPosition;
+        var pos = _transform.GetMapCoordinates(gatheredUid);
 
         foreach (var (tag, table) in component.MappedLoot)
         {
index 97d4eb06803d372f85b8be1076af7b87b647228f..203882ed9ef0554adf076015a892e2d3c3c34490 100644 (file)
@@ -208,7 +208,7 @@ namespace Content.Server.Guardian
             var hostXform = Transform(args.Args.Target.Value);
             var host = EnsureComp<GuardianHostComponent>(args.Args.Target.Value);
             // Use map position so it's not inadvertantly parented to the host + if it's in a container it spawns outside I guess.
-            var guardian = Spawn(component.GuardianProto, hostXform.MapPosition);
+            var guardian = Spawn(component.GuardianProto, _transform.GetMapCoordinates(args.Args.Target.Value, xform: hostXform));
 
             _container.Insert(guardian, host.GuardianContainer);
             host.HostedGuardian = guardian;
index 431e438fd8d768e660976f7dd8a292a03b127b10..b79668772144f406c6f123dd9d2ddb64d760c58e 100644 (file)
@@ -15,6 +15,7 @@ using Content.Shared.Kitchen;
 using Content.Shared.Mobs.Components;
 using Content.Shared.Mobs.Systems;
 using Robust.Server.Containers;
+using Robust.Server.GameObjects;
 using Robust.Shared.Random;
 using Robust.Shared.Utility;
 
@@ -28,6 +29,7 @@ public sealed class SharpSystem : EntitySystem
     [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
     [Dependency] private readonly ContainerSystem _containerSystem = default!;
     [Dependency] private readonly MobStateSystem _mobStateSystem = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
     [Dependency] private readonly IRobustRandom _robustRandom = default!;
     [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
 
@@ -101,7 +103,7 @@ public sealed class SharpSystem : EntitySystem
         }
 
         var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom);
-        var coords = Transform(args.Args.Target.Value).MapPosition;
+        var coords = _transform.GetMapCoordinates(args.Args.Target.Value);
         EntityUid popupEnt = default!;
         foreach (var proto in spawnEntities)
         {
index 4f975a60fdab392b24ee1f5232a070cfc95f7428..2147ac80f2e93f2a61f9c16dab9e31155498925f 100644 (file)
@@ -3,6 +3,7 @@ using Content.Server.Beam;
 using Content.Server.Beam.Components;
 using Content.Server.Lightning.Components;
 using Content.Shared.Lightning;
+using Robust.Server.GameObjects;
 using Robust.Shared.Random;
 
 namespace Content.Server.Lightning;
@@ -20,6 +21,7 @@ public sealed class LightningSystem : SharedLightningSystem
     [Dependency] private readonly BeamSystem _beam = default!;
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly EntityLookupSystem _lookup = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
 
     public override void Initialize()
     {
@@ -74,7 +76,7 @@ public sealed class LightningSystem : SharedLightningSystem
         //To Do: This is still pretty bad for perf but better than before and at least it doesn't re-allocate
         // several hashsets every time
 
-        var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(Transform(user).MapPosition, range).ToList();
+        var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(_transform.GetMapCoordinates(user), range).ToList();
         _random.Shuffle(targets);
         targets.Sort((x, y) => y.Priority.CompareTo(x.Priority));
 
index ccaa74e9e262c8d91d554837e717c609e4639559..bc99def9742980de3f424977c00b71d894ad10b0 100644 (file)
@@ -2,6 +2,7 @@ using Content.Server.Explosion.EntitySystems;
 using Content.Server.Lightning;
 using Content.Server.Lightning.Components;
 using Content.Shared.Damage;
+using Robust.Server.GameObjects;
 
 namespace Content.Server.Tesla.EntitySystems;
 
@@ -12,6 +13,7 @@ public sealed class LightningTargetSystem : EntitySystem
 {
     [Dependency] private readonly DamageableSystem _damageable = default!;
     [Dependency] private readonly ExplosionSystem _explosionSystem = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
 
     public override void Initialize()
     {
@@ -29,7 +31,7 @@ public sealed class LightningTargetSystem : EntitySystem
         if (uid.Comp.LightningExplode)
         {
             _explosionSystem.QueueExplosion(
-                Transform(uid).MapPosition,
+                _transform.GetMapCoordinates(uid),
                 uid.Comp.ExplosionPrototype,
                 uid.Comp.TotalIntensity, uid.Comp.Dropoff,
                 uid.Comp.MaxTileIntensity,
index 153a1738555b78efd08c46a88a77803132c29fc4..a77af941743078a69bd954843d1a8cadc27b2f62 100644 (file)
@@ -454,7 +454,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
         }
 
         var targetPos = steering.Coordinates.ToMap(EntityManager, _transform);
-        var ourPos = xform.MapPosition;
+        var ourPos = _transform.GetMapCoordinates(uid, xform: xform);
 
         PrunePath(uid, ourPos, targetPos.Position - ourPos.Position, result.Path);
         steering.CurrentPath = new Queue<PathPoly>(result.Path);
index e8fb54022ee1f6a993ae6530aa1e7c40c8b29d7d..4b0ccafa1d40aed0341c9aeb5d2139bb53381570 100644 (file)
@@ -372,7 +372,7 @@ public sealed class NPCUtilitySystem : EntitySystem
                 if (compQuery.Components.Count == 0)
                     return;
 
-                var mapPos = _xformQuery.GetComponent(owner).MapPosition;
+                var mapPos = _transform.GetMapCoordinates(owner, xform: _xformQuery.GetComponent(owner));
                 _compTypes.Clear();
                 var i = -1;
                 EntityPrototype.ComponentRegistryEntry compZero = default!;
index b72be0b46c97a2b7b7dcb33e75f194ac114f0ed6..db425b491eb550d75b739abffacad5907fffe45e 100644 (file)
@@ -450,7 +450,7 @@ public sealed class NukeSystem : EntitySystem
         if (stationUid != null)
             _alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnActivate, true, true, true, true);
 
-        var pos = nukeXform.MapPosition;
+        var pos = _transform.GetMapCoordinates(uid, xform: nukeXform);
         var x = (int) pos.X;
         var y = (int) pos.Y;
         var posText = $"({x}, {y})";
index 49d737404127c10551921746a6f89b265a11c00c..2c7632aadca5bd7068db4fd89caa46d022518b7c 100644 (file)
@@ -31,6 +31,7 @@ using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Utility;
 using System.Linq;
+using Robust.Server.GameObjects;
 
 namespace Content.Server.Nutrition.EntitySystems;
 
@@ -52,6 +53,7 @@ public sealed class FoodSystem : EntitySystem
     [Dependency] private readonly SharedHandsSystem _hands = default!;
     [Dependency] private readonly SharedInteractionSystem _interaction = default!;
     [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
     [Dependency] private readonly StackSystem _stack = default!;
     [Dependency] private readonly StomachSystem _stomach = default!;
     [Dependency] private readonly UtensilSystem _utensil = default!;
@@ -150,7 +152,7 @@ public sealed class FoodSystem : EntitySystem
             return (false, true);
 
         // TODO make do-afters account for fixtures in the range check.
-        if (!Transform(user).MapPosition.InRange(Transform(target).MapPosition, MaxFeedDistance))
+        if (!_transform.GetMapCoordinates(user).InRange(_transform.GetMapCoordinates(target), MaxFeedDistance))
         {
             var message = Loc.GetString("interaction-system-user-interaction-cannot-reach");
             _popup.PopupEntity(message, user, user);
@@ -325,7 +327,7 @@ public sealed class FoodSystem : EntitySystem
         }
 
         //We're empty. Become trash.
-        var position = Transform(food).MapPosition;
+        var position = _transform.GetMapCoordinates(food);
         var finisher = Spawn(component.Trash, position);
 
         // If the user is holding the item
index a10544d696638188d67939d1a03c06afd5834105..47ae41896e22773b286e45e71cadff8438d81f03 100644 (file)
@@ -25,6 +25,7 @@ namespace Content.Server.PDA.Ringer
         [Dependency] private readonly UserInterfaceSystem _ui = default!;
         [Dependency] private readonly AudioSystem _audio = default!;
         [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
+        [Dependency] private readonly TransformSystem _transform = default!;
 
         private readonly Dictionary<NetUserId, TimeSpan> _lastSetRingtoneAt = new();
 
@@ -210,7 +211,7 @@ namespace Content.Server.PDA.Ringer
 
                 _audio.PlayEntity(
                     GetSound(ringer.Ringtone[ringer.NoteCount]),
-                    Filter.Empty().AddInRange(ringerXform.MapPosition, ringer.Range),
+                    Filter.Empty().AddInRange(_transform.GetMapCoordinates(uid, ringerXform), ringer.Range),
                     uid,
                     true,
                     AudioParams.Default.WithMaxDistance(ringer.Range).WithVolume(ringer.Volume)
index 85cf303d5d73cf59718a88f309b79cc4fb2dcdc1..15966956d4f5cdec9411f8dd44a8299d57540670 100644 (file)
@@ -10,6 +10,7 @@ using Robust.Shared.Containers;
 using Robust.Shared.Serialization.Manager;
 using Robust.Shared.Utility;
 using System.Linq;
+using Robust.Server.GameObjects;
 
 namespace Content.Server.Payload.EntitySystems;
 
@@ -17,6 +18,7 @@ public sealed class PayloadSystem : EntitySystem
 {
     [Dependency] private readonly TagSystem _tagSystem = default!;
     [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
     [Dependency] private readonly IAdminLogManager _adminLogger = default!;
     [Dependency] private readonly IComponentFactory _componentFactory = default!;
     [Dependency] private readonly ISerializationManager _serializationManager = default!;
@@ -158,7 +160,7 @@ public sealed class PayloadSystem : EntitySystem
         var solStringB = SolutionContainerSystem.ToPrettyString(solutionB);
 
         _adminLogger.Add(LogType.ChemicalReaction,
-            $"Chemical bomb payload {ToPrettyString(entity.Owner):payload} at {Transform(entity.Owner).MapPosition:location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}");
+            $"Chemical bomb payload {ToPrettyString(entity.Owner):payload} at {_transform.GetMapCoordinates(entity.Owner):location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}");
 
         solutionA.MaxVolume += solutionB.MaxVolume;
         _solutionContainerSystem.TryAddSolution(solnA.Value, solutionB);
index 9b2e14eff8b7177270fb0d4e10c1c7220561b054..7bbf6409cdd38102843c7034d224243a7edc7d68 100644 (file)
@@ -183,7 +183,7 @@ namespace Content.Server.Pointing.EntitySystems
                     (eyeComp.VisibilityMask & layer) == 0)
                     return false;
 
-                return Transform(ent).MapPosition.InRange(Transform(player).MapPosition, PointingRange);
+                return _transform.GetMapCoordinates(ent).InRange(_transform.GetMapCoordinates(player), PointingRange);
             }
 
             var viewers = Filter.Empty()
index 2463bcd740243520bd87e995235ac3b2fb256381..6c7bb5c92349ed7f5508db9a16a8557c181c8d51 100644 (file)
@@ -95,7 +95,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
         {
             var xform = Transform(entityGridUid.Value);
             var pos = xform.Coordinates;
-            var mapPos = xform.MapPosition;
+            var mapPos = _transform.GetMapCoordinates(entityGridUid.Value, xform: xform);
             var circle = new Circle(mapPos.Position, 2);
 
             var found = false;
index 5874de2a7c28534a90c4ab584f0292651a060187..d7b83d4439915beff42e9157ff2762df35432de9 100644 (file)
@@ -165,7 +165,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
         var range2 = range * range;
         var xformQuery = EntityManager.GetEntityQuery<TransformComponent>();
         var epicenter = _xformSystem.GetWorldPosition(xform, xformQuery);
-        foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, range, flags: LookupFlags.Uncontained))
+        foreach (var entity in _lookup.GetEntitiesInRange(_xformSystem.GetMapCoordinates(uid, xform), range, flags: LookupFlags.Uncontained))
         {
             if (entity == uid)
                 continue;
@@ -295,7 +295,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
         if (!Resolve(uid, ref xform) || !Resolve(uid, ref eventHorizon))
             return;
 
-        var mapPos = xform.MapPosition;
+        var mapPos = _xformSystem.GetMapCoordinates(uid, xform: xform);
         var box = Box2.CenteredAround(mapPos.Position, new Vector2(range, range));
         var circle = new Circle(mapPos.Position, range);
         var grids = new List<Entity<MapGridComponent>>();
index d4ed8272aa3c27d3486fb6aa733192e002b15ec2..970743f48488853a375047245fb3fde723919ca1 100644 (file)
@@ -1,12 +1,14 @@
 using Content.Server.Emp;
 using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
 using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
+using Robust.Server.GameObjects;
 
 namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
 
 public sealed class EmpArtifactSystem : EntitySystem
 {
     [Dependency] private readonly EmpSystem _emp = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
 
     /// <inheritdoc/>
     public override void Initialize()
@@ -16,6 +18,6 @@ public sealed class EmpArtifactSystem : EntitySystem
 
     private void OnActivate(EntityUid uid, EmpArtifactComponent component, ArtifactActivatedEvent args)
     {
-        _emp.EmpPulse(Transform(uid).MapPosition, component.Range, component.EnergyConsumption, component.DisableDuration);
+        _emp.EmpPulse(_transform.GetMapCoordinates(uid), component.Range, component.EnergyConsumption, component.DisableDuration);
     }
-}
\ No newline at end of file
+}
index fcb33ae41fdb00022cf791bb08a83633ca84bf12..c2622837872e9e5737ebeea30e013394d429d912 100644 (file)
@@ -32,7 +32,7 @@ public sealed class SpawnArtifactSystem : EntitySystem
         if (component.Spawns is not {} spawns)
             return;
 
-        var artifactCord = Transform(uid).MapPosition;
+        var artifactCord = _transform.GetMapCoordinates(uid);
         foreach (var spawn in EntitySpawnCollection.GetSpawns(spawns, _random))
         {
             var dx = _random.NextFloat(-component.Range, component.Range);
index 57a30a2fd9ec43045c3b435a5a141c202ab46269..8708e0ff4e88b0cab4e4754908e5dd13e3f6b771 100644 (file)
@@ -4,6 +4,7 @@ using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
 using Content.Shared.Maps;
 using Content.Shared.Physics;
 using Content.Shared.Throwing;
+using Robust.Server.GameObjects;
 using Robust.Shared.Map.Components;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Random;
@@ -16,6 +17,7 @@ public sealed class ThrowArtifactSystem : EntitySystem
     [Dependency] private readonly EntityLookupSystem _lookup = default!;
     [Dependency] private readonly ThrowingSystem _throwing = default!;
     [Dependency] private readonly TileSystem _tile = default!;
+    [Dependency] private readonly TransformSystem _transform = default!;
 
     /// <inheritdoc/>
     public override void Initialize()
@@ -50,7 +52,7 @@ public sealed class ThrowArtifactSystem : EntitySystem
 
             var tempXform = Transform(ent);
 
-            var foo = tempXform.MapPosition.Position - xform.MapPosition.Position;
+            var foo = _transform.GetMapCoordinates(ent, xform: tempXform).Position - _transform.GetMapCoordinates(uid, xform: xform).Position;
             _throwing.TryThrow(ent, foo*2, component.ThrowStrength, uid, 0);
         }
     }
index 83aa70858970ca66fcc259ce3c16be52e59109c9..79a32268e803bd936356ec47e445eec6e4f83fb4 100644 (file)
@@ -13,6 +13,7 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
     [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
     [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
     [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
+    [Dependency] private readonly SharedTransformSystem _transform = default!;
 
     public const string InvokedPort = "link_port";
 
@@ -529,7 +530,7 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
     private bool InRange(EntityUid sourceUid, EntityUid sinkUid, float range)
     {
         // TODO: This should be using an existing method and also coordinates inrange instead.
-        return Transform(sourceUid).MapPosition.InRange(Transform(sinkUid).MapPosition, range);
+        return _transform.GetMapCoordinates(sourceUid).InRange(_transform.GetMapCoordinates(sinkUid), range);
     }
 
     private void SendNewLinkEvent(EntityUid? user, EntityUid sourceUid, string source, EntityUid sinkUid, string sink)
index 2a5201f76872c37c7841de747a0075e7544df5e2..8831213c352474c27d3012325c7965d268a5ee0b 100644 (file)
@@ -210,8 +210,8 @@ namespace Content.Shared.Examine
         public bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
         {
             var entMan = IoCManager.Resolve<IEntityManager>();
-            var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
-            var otherPos = entMan.GetComponent<TransformComponent>(other).MapPosition;
+            var originPos = _transform.GetMapCoordinates(origin);
+            var otherPos = _transform.GetMapCoordinates(other);
 
             return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
         }
@@ -219,7 +219,7 @@ namespace Content.Shared.Examine
         public bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
         {
             var entMan = IoCManager.Resolve<IEntityManager>();
-            var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
+            var originPos = _transform.GetMapCoordinates(origin);
             var otherPos = other.ToMap(entMan, _transform);
 
             return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
@@ -228,7 +228,7 @@ namespace Content.Shared.Examine
         public bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
         {
             var entMan = IoCManager.Resolve<IEntityManager>();
-            var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
+            var originPos = _transform.GetMapCoordinates(origin);
 
             return InRangeUnOccluded(originPos, other, range, predicate, ignoreInsideBlocker);
         }
index 20e08b2767d23c1090d1bf4c31565c0580931f5c..d1f41738e9d8b2c9405e88863babbfb7669c4706 100644 (file)
@@ -108,10 +108,10 @@ public abstract partial class SharedHandsSystem : EntitySystem
             var xform = Transform(uid);
             var coordinateEntity = xform.ParentUid.IsValid() ? xform.ParentUid : uid;
             var itemXform = Transform(entity);
-            var itemPos = itemXform.MapPosition;
+            var itemPos = TransformSystem.GetMapCoordinates(entity, xform: itemXform);
 
             if (itemPos.MapId == xform.MapID
-                && (itemPos.Position - xform.MapPosition.Position).Length() <= MaxAnimationRange
+                && (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);
index ed950240af69eeecabff4889658db36c4ff99ff1..7f73d3190f97869d6094a5f117dd2449f21e3e5a 100644 (file)
@@ -70,7 +70,7 @@ namespace Content.Shared.Interaction
             if (!Resolve(user, ref xform))
                 return false;
 
-            var diff = coordinates - xform.MapPosition.Position;
+            var diff = coordinates - _transform.GetMapCoordinates(user, xform: xform).Position;
             if (diff.LengthSquared() <= 0.01f)
                 return true;
 
index 1f421d0e6f70fe1c80ba621b688ac6b679a7590d..8b3431cb0246861dc2fa134ab844531927f5fe5b 100644 (file)
@@ -665,14 +665,14 @@ namespace Content.Shared.Interaction
                 else
                 {
                     // We'll still do the raycast from the centres but we'll bump the range as we know they're in range.
-                    originPos = xformA.MapPosition;
+                    originPos = _transform.GetMapCoordinates(origin, xform: xformA);
                     range = (originPos.Position - targetPos.Position).Length();
                 }
             }
             // No fixtures, e.g. wallmounts.
             else
             {
-                originPos = Transform(origin).MapPosition;
+                originPos = _transform.GetMapCoordinates(origin);
                 var otherParent = Transform(other).ParentUid;
                 targetRot = otherParent.IsValid() ? Transform(otherParent).LocalRotation + otherAngle : otherAngle;
             }
@@ -826,7 +826,7 @@ namespace Content.Shared.Interaction
             bool popup = false)
         {
             Ignored combinedPredicate = e => e == origin || (predicate?.Invoke(e) ?? false);
-            var originPosition = Transform(origin).MapPosition;
+            var originPosition = _transform.GetMapCoordinates(origin);
             var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, combinedPredicate, ShouldCheckAccess(origin));
 
             if (!inRange && popup && _gameTiming.IsFirstTimePredicted)
index 21861f57dab20ad713b3fb4dce92c4df06b5ae02..03da2d09b0e1f24ff5e9f502b1164a4850b5bf49 100644 (file)
@@ -77,7 +77,7 @@ public sealed class MagnetPickupSystem : EntitySystem
                 // the problem is that stack pickups delete the original entity, which is fine, but due to
                 // game state handling we can't show a lerp animation for it.
                 var nearXform = Transform(near);
-                var nearMap = nearXform.MapPosition;
+                var nearMap = _transform.GetMapCoordinates(near, xform: nearXform);
                 var nearCoords = EntityCoordinates.FromMap(moverCoords.EntityId, nearMap, _transform, EntityManager);
 
                 if (!_storage.Insert(uid, near, out var stacked, storageComp: storage, playSound: !playedSound))
index 7bfd9d345729a07496c884962b3772e1765ce046..afa77a643a0116ba9caf2d9fdac27cdd490cdd88 100644 (file)
@@ -16,7 +16,7 @@ namespace Content.Shared.Tabletop
         [Dependency] protected readonly ActionBlockerSystem ActionBlockerSystem = default!;
         [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
         [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
-        [Dependency] private readonly SharedTransformSystem _transforms = default!;
+        [Dependency] protected readonly SharedTransformSystem Transforms = default!;
         [Dependency] private readonly IMapManager _mapMan = default!;
 
         public override void Initialize()
@@ -41,8 +41,8 @@ namespace Content.Shared.Tabletop
 
             // Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map)
             var transform = EntityManager.GetComponent<TransformComponent>(moved);
-            _transforms.SetParent(moved, transform, _mapMan.GetMapEntityId(transform.MapID));
-            _transforms.SetLocalPositionNoLerp(transform, msg.Coordinates.Position);
+            Transforms.SetParent(moved, transform, _mapMan.GetMapEntityId(transform.MapID));
+            Transforms.SetLocalPositionNoLerp(transform, msg.Coordinates.Position);
         }
 
         private void OnDraggingPlayerChanged(TabletopDraggingPlayerChangedEvent msg, EntitySessionEventArgs args)
index dd297422c37997489fc9eabcd9d1945c5d3978d0..ad2249bfddf6fd67af4ef5a95eb08db4bd68e5a0 100644 (file)
@@ -220,7 +220,7 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
         _blocker.UpdateCanMove(target);
 
         // Invisible tether entity
-        var tether = Spawn("TetherEntity", Transform(target).MapPosition);
+        var tether = Spawn("TetherEntity", TransformSystem.GetMapCoordinates(target));
         var tetherPhysics = Comp<PhysicsComponent>(tether);
         component.TetherEntity = tether;
         _physics.WakeBody(tether);
index 11cfc88470a9199df13adf55d6b4f3435c824cf8..6242312b07090e5613b5de4ddeebd1014b772e7b 100644 (file)
@@ -35,7 +35,7 @@ public abstract partial class SharedGunSystem
         if (args.Handled)
             return;
 
-        ManualCycle(uid, component, Transform(uid).MapPosition, args.User);
+        ManualCycle(uid, component, TransformSystem.GetMapCoordinates(uid), args.User);
         args.Handled = true;
     }
 
@@ -161,7 +161,7 @@ public abstract partial class SharedGunSystem
             {
                 Text = Loc.GetString("gun-ballistic-cycle"),
                 Disabled = GetBallisticShots(component) == 0,
-                Act = () => ManualCycle(uid, component, Transform(uid).MapPosition, args.User),
+                Act = () => ManualCycle(uid, component, TransformSystem.GetMapCoordinates(uid), args.User),
             });
 
         }