]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
replace obsolete IsGrid calls with HasComp<MapGridComponent> (#36729)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Sun, 20 Apr 2025 04:14:58 +0000 (00:14 -0400)
committerGitHub <noreply@github.com>
Sun, 20 Apr 2025 04:14:58 +0000 (14:14 +1000)
* replace obsolete IsGrid calls with HasComp<MapGridComponent>

* remove IMapManager dependency

* well would you look at that

* just look at it

Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs
Content.Shared/Movement/Systems/SharedMoverController.Input.cs
Content.Shared/Movement/Systems/SharedMoverController.cs

index c714acb2f38c211ce58ef51f37254e7a0af2cd80..ae067d5523a514e020f192f3f737cf90ce2d617a 100644 (file)
@@ -16,6 +16,7 @@ using Robust.Shared;
 using Robust.Shared.Configuration;
 using Robust.Shared.Enums;
 using Robust.Shared.Map;
+using Robust.Shared.Map.Components;
 using Robust.Shared.Player;
 using Robust.Shared.Threading;
 using Robust.Shared.Timing;
@@ -60,6 +61,7 @@ namespace Content.Server.Atmos.EntitySystems
         private float _updateInterval;
 
         private int _thresholds;
+        private EntityQuery<MapGridComponent> _gridQuery;
         private EntityQuery<GasTileOverlayComponent> _query;
 
         public override void Initialize()
@@ -76,6 +78,7 @@ namespace Content.Server.Atmos.EntitySystems
                 MapManager = _mapManager,
                 ChunkViewerPool = _chunkViewerPool,
                 LastSentChunks = _lastSentChunks,
+                GridQuery = _gridQuery,
             };
 
             _playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
@@ -86,6 +89,7 @@ namespace Content.Server.Atmos.EntitySystems
             SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
             SubscribeLocalEvent<GasTileOverlayComponent, ComponentStartup>(OnStartup);
             _query = GetEntityQuery<GasTileOverlayComponent>();
+            _gridQuery = GetEntityQuery<MapGridComponent>();
         }
 
         private void OnStartup(EntityUid uid, GasTileOverlayComponent component, ComponentStartup args)
@@ -375,6 +379,8 @@ namespace Content.Server.Atmos.EntitySystems
             public Dictionary<ICommonSession, Dictionary<NetEntity, HashSet<Vector2i>>> LastSentChunks;
             public List<ICommonSession> Sessions;
 
+            public EntityQuery<MapGridComponent> GridQuery;
+
             public void Execute(int index)
             {
                 var playerSession = Sessions[index];
@@ -391,7 +397,7 @@ namespace Content.Server.Atmos.EntitySystems
                         previouslySent.Remove(netGrid);
 
                         // If grid was deleted then don't worry about sending it to the client.
-                        if (!EntManager.TryGetEntity(netGrid, out var gridId) || !MapManager.IsGrid(gridId.Value))
+                        if (!EntManager.TryGetEntity(netGrid, out var gridId) || GridQuery.HasComp(gridId.Value))
                             ev.RemovedChunks[netGrid] = oldIndices;
                         else
                         {
index 14c803628712917a084cfcea07ab49717f8b3366..87849e8f125136fb3e752fe3b86101d4fce3cfe3 100644 (file)
@@ -214,7 +214,7 @@ namespace Content.Shared.Movement.Systems
             }
             // If we went from grid -> grid OR grid -> map then snap the target to cardinal and lerp there.
             // OR just rotate to zero (depending on cvar)
-            else if (relative != null && _mapManager.IsGrid(relative.Value))
+            else if (relative != null && MapGridQuery.HasComp(relative.Value))
             {
                 if (CameraRotationLocked)
                     targetRotation = Angle.Zero;
index a5c32b2992defaa0ef2c9fc4cf460e1fb01080d5..a98fc633d0efbed3302173c8b97a2536336c3b95 100644 (file)
@@ -35,7 +35,6 @@ public abstract partial class SharedMoverController : VirtualController
 {
     [Dependency] private   readonly IConfigurationManager _configManager = default!;
     [Dependency] protected readonly IGameTiming Timing = default!;
-    [Dependency] private   readonly IMapManager _mapManager = default!;
     [Dependency] private   readonly ITileDefinitionManager _tileDefinitionManager = default!;
     [Dependency] private   readonly EntityLookupSystem _lookup = default!;
     [Dependency] private   readonly InventorySystem _inventory = default!;