using System.Collections.Generic; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.NodeContainer.Nodes { /// /// A that can reach other s that are directly adjacent to it. /// [DataDefinition] public sealed class AdjacentNode : Node { public override IEnumerable GetReachableNodes(TransformComponent xform, EntityQuery nodeQuery, EntityQuery xformQuery, IMapGrid? grid, IEntityManager entMan) { if (!xform.Anchored || grid == null) yield break; var gridIndex = grid.TileIndicesFor(xform.Coordinates); foreach (var (_, node) in NodeHelpers.GetCardinalNeighborNodes(nodeQuery, grid, gridIndex)) { if (node != this) yield return node; } } } }