connectedPower similar to conductivePower (#8306)

This commit is contained in:
MEEPofFaith
2023-02-15 23:22:05 -05:00
committed by GitHub
parent a8a3453632
commit 348819d1ac
4 changed files with 7 additions and 5 deletions
@@ -179,7 +179,7 @@ public class BeamNode extends PowerBlock{
}
//power nodes do NOT play nice with beam nodes, do not touch them as that forcefully modifies their links
if(other != null && other.block.hasPower && other.team == team && !(other.block instanceof PowerNode)){
if(other != null && other.block.hasPower && other.block.connectedPower && other.team == team && !(other.block instanceof PowerNode)){
links[i] = other;
dests[i] = world.tile(tile.x + j * dir.x, tile.y + j * dir.y);
break;
@@ -210,7 +210,7 @@ public class PowerNode extends PowerBlock{
protected void getPotentialLinks(Tile tile, Team team, Cons<Building> others){
if(!autolink) return;
Boolf<Building> valid = other -> other != null && other.tile() != tile && other.power != null &&
Boolf<Building> valid = other -> other != null && other.tile() != tile && other.block.connectedPower && other.power != null &&
(other.block.outputsPower || other.block.consumesPower || other.block instanceof PowerNode) &&
overlaps(tile.x * tilesize + offset, tile.y * tilesize + offset, other.tile(), laserRange * tilesize) && other.team == team &&
!graphs.contains(other.power.graph) &&
@@ -342,7 +342,7 @@ public class PowerNode extends PowerBlock{
}
public boolean linkValid(Building tile, Building link, boolean checkMaxNodes){
if(tile == link || link == null || !link.block.hasPower || tile.team != link.team) return false;
if(tile == link || link == null || !link.block.hasPower || !link.block.connectedPower || tile.team != link.team) return false;
if(overlaps(tile, link, laserRange * tilesize) || (link.block instanceof PowerNode node && overlaps(link, tile, node.laserRange * tilesize))){
if(checkMaxNodes && link.block instanceof PowerNode node){