filterable power node connections
This commit is contained in:
@@ -670,6 +670,10 @@ public class Block extends UnlockableContent{
|
||||
return isVisible() && (!state.rules.bannedBlocks.contains(this) || state.rules.editor) && supportsEnv(state.rules.environment);
|
||||
}
|
||||
|
||||
public boolean shouldConnect(Building build){
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return whether this block supports a specific environment. */
|
||||
public boolean supportsEnv(int env){
|
||||
return (envEnabled & env) != 0 && (envDisabled & env) == 0 && (envRequired == 0 || (envRequired & env) == envRequired);
|
||||
|
||||
@@ -205,6 +205,7 @@ public class PowerNode extends PowerBlock{
|
||||
overlaps(tile.x * tilesize + offset, tile.y * tilesize + offset, other.tile(), laserRange * tilesize) && other.team == team &&
|
||||
!graphs.contains(other.power.graph) &&
|
||||
!PowerNode.insulated(tile, other.tile) &&
|
||||
other.block.shouldConnect(other) &&
|
||||
!(other instanceof PowerNodeBuild obuild && obuild.power.links.size >= ((PowerNode)obuild.block).maxNodes) &&
|
||||
!Structs.contains(Edges.getEdges(size), p -> { //do not link to adjacent buildings
|
||||
var t = world.tile(tile.x + p.x, tile.y + p.y);
|
||||
|
||||
Reference in New Issue
Block a user