public override IEnumerable <Node> GetReachableNodes() { if (IoCManager.Resolve <IEntityManager>().GetComponent <TransformComponent>(Owner).GridID == GridId.Invalid) { yield break; // No funny nodes in spess. } var entMan = IoCManager.Resolve <IEntityManager>(); var grid = IoCManager.Resolve <IMapManager>().GetGrid(IoCManager.Resolve <IEntityManager>().GetComponent <TransformComponent>(Owner).GridID); var gridIndex = grid.TileIndicesFor(IoCManager.Resolve <IEntityManager>().GetComponent <TransformComponent>(Owner).Coordinates); var dir = IoCManager.Resolve <IEntityManager>().GetComponent <TransformComponent>(Owner).LocalRotation.GetDir(); var targetIdx = gridIndex + NodeHelpers.TileOffsetForDir(dir); foreach (var node in NodeHelpers.GetNodesInTile(entMan, grid, targetIdx)) { if (node is CableTerminalPortNode) { yield return(node); } } foreach (var node in base.GetReachableNodes()) { yield return(node); } }
public override IEnumerable <Node> GetReachableNodes(TransformComponent xform, EntityQuery <NodeContainerComponent> nodeQuery, EntityQuery <TransformComponent> xformQuery, IMapGrid?grid, IEntityManager entMan) { if (!xform.Anchored || grid == null) { yield break; } var gridIndex = grid.TileIndicesFor(xform.Coordinates); var dir = xform.LocalRotation.GetDir(); var targetIdx = gridIndex.Offset(dir); foreach (var node in NodeHelpers.GetNodesInTile(nodeQuery, grid, targetIdx)) { if (node is CableTerminalPortNode) { yield return(node); } } foreach (var node in base.GetReachableNodes(xform, nodeQuery, xformQuery, grid, entMan)) { yield return(node); } }
public override IEnumerable <Node> GetReachableNodes() { if (!Anchored) { yield break; } var entMan = IoCManager.Resolve <IEntityManager>(); // If we're in an invalid grid, such as grid 0, we cannot connect to anything. if (!IoCManager.Resolve <IMapManager>().TryGetGrid(IoCManager.Resolve <IEntityManager>().GetComponent <TransformComponent>(Owner).GridID, out var grid)) { yield break; } var gridIndex = grid.TileIndicesFor(IoCManager.Resolve <IEntityManager>().GetComponent <TransformComponent>(Owner).Coordinates); foreach (var node in NodeHelpers.GetNodesInTile(entMan, grid, gridIndex)) { if (node is CableNode) { yield return(node); } } }
public override IEnumerable <Node> GetReachableNodes() { var compMgr = IoCManager.Resolve <IComponentManager>(); var grid = IoCManager.Resolve <IMapManager>().GetGrid(Owner.Transform.GridID); var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); foreach (var node in NodeHelpers.GetNodesInTile(compMgr, grid, gridIndex)) { if (node is CableNode) { yield return(node); } } }
public override IEnumerable <Node> GetReachableNodes(TransformComponent xform, EntityQuery <NodeContainerComponent> nodeQuery, EntityQuery <TransformComponent> xformQuery, IMapGrid?grid, IEntityManager entMan) { if (!xform.Anchored || grid == null) { yield break; } var gridIndex = grid.TileIndicesFor(xform.Coordinates); foreach (var node in NodeHelpers.GetNodesInTile(nodeQuery, grid, gridIndex)) { if (node is CableNode) { yield return(node); } } }
public override IEnumerable <Node> GetReachableNodes() { var entMan = IoCManager.Resolve <IEntityManager>(); var grid = IoCManager.Resolve <IMapManager>().GetGrid(Owner.Transform.GridID); var gridIndex = grid.TileIndicesFor(Owner.Transform.Coordinates); var dir = Owner.Transform.LocalRotation.GetDir(); var targetIdx = gridIndex + NodeHelpers.TileOffsetForDir(dir); foreach (var node in NodeHelpers.GetNodesInTile(entMan, grid, targetIdx)) { if (node is CableTerminalPortNode) { yield return(node); } } foreach (var node in base.GetReachableNodes()) { yield return(node); } }