Nodes in entities are now named. (#3825)

This commit is contained in:
Vera Aguilera Puerto
2021-04-09 20:47:31 +02:00
committed by GitHub
parent 8a26920e4c
commit 009870116d
25 changed files with 198 additions and 168 deletions

View File

@@ -13,26 +13,22 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
{
protected override IEnumerable<Node> GetReachableNodes()
{
if (!Owner.TryGetComponent(out SnapGridComponent? grid))
if (!Owner.TryGetComponent(out SnapGridComponent? snap))
yield break;
var cells = grid.GetCardinalNeighborCells();
foreach (var cell in cells)
foreach (var cell in snap.GetCardinalNeighborCells())
foreach (var entity in cell.GetLocal())
{
foreach (var entity in cell.GetLocal())
if (!entity.TryGetComponent<NodeContainerComponent>(out var container)) continue;
foreach (var node in container.Nodes.Values)
{
if (entity.TryGetComponent<NodeContainerComponent>(out var container))
if (node != null && node != this)
{
foreach (var node in container.Nodes)
{
if (node != null && node != this)
{
yield return node;
}
}
yield return node;
}
}
}
}
}