Fix mime wall & turf/tile helper issues. (#17844)

This commit is contained in:
Leon Friedrich
2023-07-06 16:43:49 +12:00
committed by GitHub
parent 88f9d2b6b8
commit 126f5d6dae
10 changed files with 55 additions and 38 deletions

View File

@@ -12,6 +12,7 @@ public sealed class TurfSystem : EntitySystem
{
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly IMapManager _mapMan = default!;
/// <summary>
/// Returns true if a given tile is blocked by physics-enabled entities.
@@ -84,4 +85,14 @@ public sealed class TurfSystem : EntitySystem
return false;
}
/// <summary>
/// Returns the location of the centre of the tile in grid coordinates.
/// </summary>
public EntityCoordinates GetTileCenter(TileRef turf)
{
var grid = _mapMan.GetGrid(turf.GridUid);
var center = (turf.GridIndices + new Vector2(0.5f, 0.5f)) * grid.TileSize;
return new EntityCoordinates(turf.GridUid, center);
}
}