]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup warning in `EventHorizonSystem` (#37736)
authorTayrtahn <tayrtahn@gmail.com>
Fri, 23 May 2025 03:19:21 +0000 (23:19 -0400)
committerGitHub <noreply@github.com>
Fri, 23 May 2025 03:19:21 +0000 (05:19 +0200)
* Cleanup 1 warning in EventHorizonSystem

* Now even more future-proof!

Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs

index c9e217b17078447f3b3a226f27007cc02668685c..7a15ba3413e7875fec8abe0c6fc8a7dff4b8af3b 100644 (file)
@@ -270,7 +270,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
         var toConsume = new List<(Vector2i, Tile)>();
         foreach (var tile in tiles)
         {
-            if (CanConsumeTile(hungry, tile, grid, eventHorizon))
+            if (CanConsumeTile((hungry, eventHorizon), tile, (gridId, grid)))
                 toConsume.Add((tile.GridIndices, Tile.Empty));
         }
 
@@ -284,16 +284,23 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
     /// Checks whether an event horizon can consume a given tile.
     /// This is only possible if it can also consume all entities anchored to the tile.
     /// </summary>
-    public bool CanConsumeTile(EntityUid hungry, TileRef tile, MapGridComponent grid, EventHorizonComponent eventHorizon)
+    public bool CanConsumeTile(Entity<EventHorizonComponent> hungry, TileRef tile, Entity<MapGridComponent> grid)
     {
-        foreach (var blockingEntity in grid.GetAnchoredEntities(tile.GridIndices))
+        foreach (var blockingEntity in _mapSystem.GetAnchoredEntities(grid, tile.GridIndices))
         {
-            if (!CanConsumeEntity(hungry, blockingEntity, eventHorizon))
+            if (!CanConsumeEntity(hungry, blockingEntity, hungry.Comp))
                 return false;
         }
         return true;
     }
 
+    /// <inheritdoc cref="CanConsumeTile(EntityUid, TileRef, Entity{MapGridComponent}, EventHorizonComponent)"/>
+    [Obsolete("Use the Entity<T> overload")]
+    public bool CanConsumeTile(EntityUid hungry, TileRef tile, MapGridComponent grid, EventHorizonComponent eventHorizon)
+    {
+        return CanConsumeTile((hungry, eventHorizon), tile, (grid.Owner, grid));
+    }
+
     /// <summary>
     /// Consumes all tiles within a given distance of an entity.
     /// Some entities are immune to consumption.