Fix mime wall & turf/tile helper issues. (#17844)
This commit is contained in:
@@ -140,13 +140,6 @@ namespace Content.Shared.Maps
|
||||
return IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TurfSystem>().IsTileBlocked(turf, mask);
|
||||
}
|
||||
|
||||
public static EntityCoordinates GridPosition(this TileRef turf, IMapManager? mapManager = null)
|
||||
{
|
||||
mapManager ??= IoCManager.Resolve<IMapManager>();
|
||||
|
||||
return turf.GridIndices.ToEntityCoordinates(turf.GridUid, mapManager);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a box the size of a tile, at the same position in the world as the tile.
|
||||
/// </summary>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user