Cleanup warning in EventHorizonSystem (#37736)

* Cleanup 1 warning in EventHorizonSystem

* Now even more future-proof!
This commit is contained in:
Tayrtahn
2025-05-22 23:19:21 -04:00
committed by GitHub
parent 3f9670f792
commit 947e20eeb7

View File

@@ -270,7 +270,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
var toConsume = new List<(Vector2i, Tile)>(); var toConsume = new List<(Vector2i, Tile)>();
foreach (var tile in tiles) foreach (var tile in tiles)
{ {
if (CanConsumeTile(hungry, tile, grid, eventHorizon)) if (CanConsumeTile((hungry, eventHorizon), tile, (gridId, grid)))
toConsume.Add((tile.GridIndices, Tile.Empty)); 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. /// 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. /// This is only possible if it can also consume all entities anchored to the tile.
/// </summary> /// </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 false;
} }
return true; 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> /// <summary>
/// Consumes all tiles within a given distance of an entity. /// Consumes all tiles within a given distance of an entity.
/// Some entities are immune to consumption. /// Some entities are immune to consumption.