Add tile overlay edge priority (#4341)

This commit is contained in:
Kara
2023-09-10 22:30:49 -07:00
committed by GitHub
parent cdf44ef3d9
commit 5486bc7686
2 changed files with 12 additions and 1 deletions

View File

@@ -61,11 +61,16 @@ public sealed class TileEdgeOverlay : Overlay
var neighborIndices = new Vector2i(tileRef.GridIndices.X + x, tileRef.GridIndices.Y + y);
var neighborTile = grid.GetTileRef(neighborIndices);
var neighborDef = _tileDefManager[neighborTile.Tile.TypeId];
// If it's the same tile then no edge to be drawn.
if (tileRef.Tile.TypeId == neighborTile.Tile.TypeId)
continue;
// Don't draw if the the neighbor tile edges should draw over us (or if we have the same priority)
if (neighborDef.EdgeSprites.Count != 0 && neighborDef.EdgeSpritePriority >= tileDef.EdgeSpritePriority)
continue;
var direction = new Vector2i(x, y).AsDirection();
// No edge tile

View File

@@ -30,10 +30,16 @@ namespace Robust.Shared.Map
ResPath? Sprite { get; }
/// <summary>
/// Possible sprites to use if we're neighboring another tile.
/// Possible sprites to use if we're neighboring another tile.
/// </summary>
Dictionary<Direction, ResPath> EdgeSprites { get; }
/// <summary>
/// When drawing adjacent tiles that both specify edge sprites, the one with the higher priority
/// is always solely drawn.
/// </summary>
int EdgeSpritePriority { get; }
/// <summary>
/// Physics objects that are interacting on this tile are slowed down by this float.
/// </summary>