using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
using Robust.Shared.GameObjects.Components.Transform;
using System.Collections.Generic;
using System.Linq;
namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
{
///
/// A that can reach other s that are directly adjacent to it.
///
[Node("AdjacentNode")]
public class AdjacentNode : Node
{
protected override IEnumerable GetReachableNodes()
{
return Owner.GetComponent()
.GetCardinalNeighborCells()
.SelectMany(sgc => sgc.GetLocal())
.Select(entity => entity.TryGetComponent(out var container) ? container : null)
.Where(container => container != null)
.SelectMany(container => container.Nodes)
.Where(node => node != null && node != this);
}
}
}