This commit is contained in:
Chawanya-c
2022-06-26 22:44:04 +07:00
2 changed files with 5 additions and 0 deletions

View File

@@ -859,6 +859,10 @@ public class Block extends UnlockableContent implements Senseable{
return isVisible() && (!state.rules.bannedBlocks.contains(this) || state.rules.editor) && supportsEnv(state.rules.env); return isVisible() && (!state.rules.bannedBlocks.contains(this) || state.rules.editor) && supportsEnv(state.rules.env);
} }
public boolean shouldConnect(Building build){
return true;
}
/** @return whether this block supports a specific environment. */ /** @return whether this block supports a specific environment. */
public boolean supportsEnv(int env){ public boolean supportsEnv(int env){
return (envEnabled & env) != 0 && (envDisabled & env) == 0 && (envRequired == 0 || (envRequired & env) == envRequired); return (envEnabled & env) != 0 && (envDisabled & env) == 0 && (envRequired == 0 || (envRequired & env) == envRequired);

View File

@@ -215,6 +215,7 @@ public class PowerNode extends PowerBlock{
overlaps(tile.x * tilesize + offset, tile.y * tilesize + offset, other.tile(), laserRange * tilesize) && other.team == team && overlaps(tile.x * tilesize + offset, tile.y * tilesize + offset, other.tile(), laserRange * tilesize) && other.team == team &&
!graphs.contains(other.power.graph) && !graphs.contains(other.power.graph) &&
!PowerNode.insulated(tile, other.tile) && !PowerNode.insulated(tile, other.tile) &&
other.block.shouldConnect(other) &&
!(other instanceof PowerNodeBuild obuild && obuild.power.links.size >= ((PowerNode)obuild.block).maxNodes) && !(other instanceof PowerNodeBuild obuild && obuild.power.links.size >= ((PowerNode)obuild.block).maxNodes) &&
!Structs.contains(Edges.getEdges(size), p -> { //do not link to adjacent buildings !Structs.contains(Edges.getEdges(size), p -> { //do not link to adjacent buildings
var t = world.tile(tile.x + p.x, tile.y + p.y); var t = world.tile(tile.x + p.x, tile.y + p.y);