Bugfixes / Better power link priority

This commit is contained in:
Anuken 2019-11-03 21:27:58 -05:00
parent b542b6651e
commit 08d0a7ada7
2 changed files with 11 additions and 2 deletions

View File

@ -434,6 +434,7 @@ public class MobileInput extends InputHandler implements GestureListener{
public void useSchematic(Schematic schem){
selectRequests.clear();
selectRequests.addAll(schematics.toRequests(schem, world.toTile(player.x), world.toTile(player.y)));
lastSchematic = schem;
}
@Override

View File

@ -114,7 +114,11 @@ public class PowerNode extends PowerBlock{
}
});
tempTiles.sort(Structs.comparingFloat(t -> t.dst2(tile)));
tempTiles.sort((a, b) -> {
int type = -Boolean.compare(a.block() instanceof PowerNode, b.block() instanceof PowerNode);
if(type != 0) return type;
return Float.compare(a.dst2(tile), b.dst2(tile));
});
tempTiles.each(valid, other -> {
if(!tile.entity.power.links.contains(other.pos())){
tile.configureAny(other.pos());
@ -139,7 +143,11 @@ public class PowerNode extends PowerBlock{
}
});
tempTiles.sort(Structs.comparingFloat(t -> t.dst2(tile)));
tempTiles.sort((a, b) -> {
int type = -Boolean.compare(a.block() instanceof PowerNode, b.block() instanceof PowerNode);
if(type != 0) return type;
return Float.compare(a.dst2(tile), b.dst2(tile));
});
tempTiles.each(valid, t -> {
graphs.add(t.entity.power.graph);
others.get(t);