1
0
mirror of https://github.com/demodude4u/Factorio-FBSR.git synced 2025-02-13 19:52:12 +02:00

Hiding input logistics behind the DEBUG:inputs option

This commit is contained in:
Weston Rye (Demod) 2017-06-08 00:17:16 -04:00
parent 05a5853384
commit e7a8dfac9f
2 changed files with 27 additions and 24 deletions

View File

@ -528,32 +528,34 @@ public class FBSR {
}
});
logisticGrid.cellSet().stream().filter(c -> c.getValue().isTransitEnd()).forEach(c -> {
Set<String> inputs = c.getValue().getInputs().get();
for (String item : inputs) {
work.add(new Pair<>(map.getLogisticCellPosition(c), c.getValue()));
while (!work.isEmpty()) {
Pair<Point2D.Double, LogisticGridCell> pair = work.pop();
Point2D.Double cellPos = pair.getKey();
LogisticGridCell cell = pair.getValue();
if (cell.addTransit(item)) {
cell.getMovedFrom().ifPresent(l -> {
for (Direction d : l) {
Point2D.Double nextCellPos = d.offset(cellPos, 0.5);
map.getLogisticGridCell(nextCellPos).filter(nc -> !nc.isBlockTransit())
.ifPresent(next -> work.add(new Pair<>(nextCellPos, next)));
}
});
cell.getWarpedFrom().ifPresent(l -> {
for (Point2D.Double p : l) {
map.getLogisticGridCell(p).filter(nc -> !nc.isBlockTransit())
.ifPresent(next -> work.add(new Pair<>(p, next)));
}
});
if (map.getDebug().inputs) {
logisticGrid.cellSet().stream().filter(c -> c.getValue().isTransitEnd()).forEach(c -> {
Set<String> inputs = c.getValue().getInputs().get();
for (String item : inputs) {
work.add(new Pair<>(map.getLogisticCellPosition(c), c.getValue()));
while (!work.isEmpty()) {
Pair<Point2D.Double, LogisticGridCell> pair = work.pop();
Point2D.Double cellPos = pair.getKey();
LogisticGridCell cell = pair.getValue();
if (cell.addTransit(item)) {
cell.getMovedFrom().ifPresent(l -> {
for (Direction d : l) {
Point2D.Double nextCellPos = d.offset(cellPos, 0.5);
map.getLogisticGridCell(nextCellPos).filter(nc -> !nc.isBlockTransit())
.ifPresent(next -> work.add(new Pair<>(nextCellPos, next)));
}
});
cell.getWarpedFrom().ifPresent(l -> {
for (Point2D.Double p : l) {
map.getLogisticGridCell(p).filter(nc -> !nc.isBlockTransit())
.ifPresent(next -> work.add(new Pair<>(p, next)));
}
});
}
}
}
}
});
});
}
}

View File

@ -42,6 +42,7 @@ public class WorldMap {
}
public static class Debug {
public boolean inputs = false;
public boolean logistic = false;
public boolean rail = false;
}