mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
* Combine TileChangedEvents in SetTiles * Raise event after regenerating collision * continue, not return * No need for GetComponent * Swap TileRef for Tile + Vector2i * Estimate size of tileChanges
27 lines
958 B
C#
27 lines
958 B
C#
using System;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Map.Components;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Shared.GameObjects;
|
|
|
|
public abstract partial class SharedMapSystem
|
|
{
|
|
/// <summary>
|
|
/// Replaces a single tile inside of the chunk.
|
|
/// </summary>
|
|
/// <param name="xIndex">The X tile index relative to the chunk.</param>
|
|
/// <param name="yIndex">The Y tile index relative to the chunk.</param>
|
|
/// <param name="tile">The new tile to insert.</param>
|
|
internal bool SetChunkTile(EntityUid uid, MapGridComponent grid, MapChunk chunk, ushort xIndex, ushort yIndex, Tile tile, out Tile oldTile)
|
|
{
|
|
if (!chunk.TrySetTile(xIndex, yIndex, tile, out oldTile, out var shapeChanged))
|
|
return false;
|
|
|
|
var tileIndices = new Vector2i(xIndex, yIndex);
|
|
OnTileModified(uid, grid, chunk, tileIndices, tile, oldTile, shapeChanged);
|
|
return true;
|
|
}
|
|
}
|