Files
RobustToolbox/Robust.Server/GameObjects/EntitySystems/TileLookup/GridTileLookupChunk.cs
T
AcruidandGitHub 2183cd7ca1 Massive Namespace Cleanup (#1544)
* Removed the Interfaces folder.
* All objects inside the GameObjects subfolders are now in the GameObjects namespace.
* Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces.
* Simplified Robust.client.Graphics namespace.
* Automated remove redundant using statements.
2021-02-10 23:27:19 -08:00

35 lines
981 B
C#

using Robust.Shared.Map;
using Robust.Shared.Maths;
namespace Robust.Server.GameObjects
{
internal sealed class GridTileLookupChunk
{
internal const byte ChunkSize = 16;
internal GridId GridId { get; }
internal Vector2i Indices { get; }
private GridTileLookupNode[,] _nodes = new GridTileLookupNode[ChunkSize,ChunkSize];
internal GridTileLookupChunk(GridId gridId, Vector2i indices)
{
GridId = gridId;
Indices = indices;
for (var x = 0; x < ChunkSize; x++)
{
for (var y = 0; y < ChunkSize; y++)
{
_nodes[x, y] = new GridTileLookupNode(this, new Vector2i(Indices.X + x, Indices.Y + y));
}
}
}
internal GridTileLookupNode GetNode(Vector2i nodeIndices)
{
return _nodes[nodeIndices.X - Indices.X, nodeIndices.Y - Indices.Y];
}
}
}