Fix grid chunk bugs (#4525)

* Fix grid rendering

* Use TileChangedEvent

* Other empty chunk fixes

* Remove assert

Good ol integration tests at it again, adding invalid components
This commit is contained in:
Leon Friedrich
2023-10-28 13:57:54 +11:00
committed by GitHub
parent 9750b113c8
commit 3aa04a3c86
10 changed files with 249 additions and 183 deletions
@@ -126,11 +126,12 @@ namespace Robust.Shared.GameObjects
/// <summary>
/// Creates a new instance of this class.
/// </summary>
public TileChangedEvent(EntityUid uid, TileRef newTile, Tile oldTile)
public TileChangedEvent(EntityUid uid, TileRef newTile, Tile oldTile, Vector2i chunkIndex)
{
Entity = uid;
NewTile = newTile;
OldTile = oldTile;
ChunkIndex = chunkIndex;
}
/// <summary>
@@ -147,36 +148,10 @@ namespace Robust.Shared.GameObjects
/// Old tile that was replaced.
/// </summary>
public readonly Tile OldTile;
}
/// <summary>
/// Arguments for when a one or more tiles on a grid are modified at once.
/// </summary>
public sealed class GridModifiedEvent : EntityEventArgs
{
/// <summary>
/// The id of the grid being changed.
/// </summary>
public EntityUid GridEnt { get; }
/// <summary>
/// Grid being changed.
/// The index of the grid-chunk that this tile belongs to.
/// </summary>
public MapGridComponent Grid { get; }
/// <summary>
/// Set of tiles that were modified.
/// </summary>
public IReadOnlyCollection<(Vector2i position, Tile tile)> Modified { get; }
/// <summary>
/// Creates a new instance of this class.
/// </summary>
public GridModifiedEvent(EntityUid gridEnt, MapGridComponent grid, IReadOnlyCollection<(Vector2i position, Tile tile)> modified)
{
GridEnt = gridEnt;
Grid = grid;
Modified = modified;
}
public readonly Vector2i ChunkIndex;
}
}