#nullable enable using System.Collections.Generic; using Robust.Shared.GameObjects; namespace Content.Server.GameObjects.Components.NodeContainer.Nodes { /// /// A that can reach other s that are directly adjacent to it. /// public class AdjacentNode : Node { protected override IEnumerable GetReachableNodes() { if (!Owner.TryGetComponent(out SnapGridComponent? grid)) yield break; var cells = grid.GetCardinalNeighborCells(); foreach (var cell in cells) { foreach (var entity in cell.GetLocal()) { if (entity.TryGetComponent(out var container)) { foreach (var node in container.Nodes) { if (node != null && node != this) { yield return node; } } } } } } } }