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
{
///
/// Replaces a single tile inside of the chunk.
///
/// The X tile index relative to the chunk.
/// The Y tile index relative to the chunk.
/// The new tile to insert.
internal bool SetChunkTile(EntityUid uid, MapGridComponent grid, MapChunk chunk, ushort xIndex, ushort yIndex, Tile tile, out Tile oldTile)
{
return SetChunkTile(uid, grid, chunk, xIndex, yIndex, tile, out oldTile, out _);
}
///
/// Replaces a single tile inside of the chunk.
///
/// The X tile index relative to the chunk.
/// The Y tile index relative to the chunk.
/// The new tile to insert.
internal bool SetChunkTile(EntityUid uid, MapGridComponent grid, MapChunk chunk, ushort xIndex, ushort yIndex, Tile tile, out Tile oldTile, out bool shapeChanged)
{
if (!chunk.TrySetTile(xIndex, yIndex, tile, out oldTile, out shapeChanged))
return false;
var tileIndices = new Vector2i(xIndex, yIndex);
OnTileModified(uid, grid, chunk, tileIndices, tile, oldTile, shapeChanged);
return true;
}
}