Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repositories{

ext{
//the build number that this mod is made for
mindustryVersion = 'v146'
mindustryVersion = 'v147'
jabelVersion = "93fde537c7"
isWindows = System.getProperty("os.name").toLowerCase().contains("windows")
sdkRoot = System.getenv("ANDROID_HOME") ?: System.getenv("ANDROID_SDK_ROOT")
Expand Down
2 changes: 1 addition & 1 deletion mod.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ author: "Pointifix"
main: "autodrill.AutoDrill"
description: "Adds tools for automatically filling resource patches with drills"
version: 1.0
minGameVersion: 136
minGameVersion: 147
java: true
hidden: true
10 changes: 5 additions & 5 deletions src/autodrill/filler/BridgeDrill.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ public static void fill(Tile tile, Drill drill, Direction direction) {
private static void placeDrillsAndBridges(Tile source, Seq<Tile> tiles, Drill drill, Direction direction) {
Point2 directionConfig = new Point2(direction.p.x * 3, direction.p.y * 3);

Seq<Tile> drillTiles = tiles.copy().filter(BridgeDrill::isDrillTile);
Seq<Tile> bridgeTiles = tiles.copy().filter(BridgeDrill::isBridgeTile);
Seq<Tile> drillTiles = tiles.select(BridgeDrill::isDrillTile);
Seq<Tile> bridgeTiles = tiles.select(BridgeDrill::isBridgeTile);

int minOresPerDrill = Core.settings.getInt((drill == Blocks.blastDrill ? "airblast" : (drill == Blocks.laserDrill ? "laser" : (drill == Blocks.pneumaticDrill ? "pneumatic" : "mechanical"))) + "-drill-min-ores");

drillTiles.filter(t -> {
drillTiles.retainAll(t -> {
ObjectIntMap.Entry<Item> itemAndCount = Util.countOre(t, drill);

if (itemAndCount == null || itemAndCount.key != source.drop() || itemAndCount.value < minOresPerDrill) {
return false;
}

Seq<Tile> neighbors = Util.getNearbyTiles(t.x, t.y, drill);
neighbors.filter(BridgeDrill::isBridgeTile);
neighbors.retainAll(BridgeDrill::isBridgeTile);

for (Tile neighbor : neighbors) {
if (bridgeTiles.contains(neighbor)) return true;
}

neighbors.filter(n -> {
neighbors.retainAll(n -> {
BuildPlan buildPlan = new BuildPlan(n.x, n.y, 0, Blocks.itemBridge);
return buildPlan.placeable(Vars.player.team());
});
Expand Down
2 changes: 1 addition & 1 deletion src/autodrill/filler/OptimizationDrill.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void fill(Tile tile, Drill drill, boolean waterExtractorsAndPowerN
tilesItemAndCount.put(t, Util.countOre(t, drill));
}

tiles.filter(t -> {
tiles.retainAll(t -> {
ObjectIntMap.Entry<Item> itemAndCount = tilesItemAndCount.get(t);
return itemAndCount != null && itemAndCount.key == floor.itemDrop && itemAndCount.value >= minOresPerDrill;
}).sort(t -> {
Expand Down
4 changes: 2 additions & 2 deletions src/autodrill/filler/WallDrill.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void fill(Tile tile, BeamDrill drill, Direction direction) {
}
if (ductTiles.isEmpty()) return;

Tile outerMostDuctTile = ductTiles.copy().filter(t -> boreTiles.find(bt -> direction.secondaryAxis(new Point2(bt.x, bt.y)) == direction.secondaryAxis(new Point2(t.x, t.y))) == null).max(t -> -direction.primaryAxis(new Point2(t.x, t.y)));
Tile outerMostDuctTile = ductTiles.select(t -> boreTiles.find(bt -> direction.secondaryAxis(new Point2(bt.x, bt.y)) == direction.secondaryAxis(new Point2(t.x, t.y))) == null).max(t -> -direction.primaryAxis(new Point2(t.x, t.y)));
if (outerMostDuctTile == null) return;
ductTiles.sort(t -> t.dst2(outerMostDuctTile));
Seq<Tile> connectingTiles = new Seq<>();
Expand Down Expand Up @@ -203,7 +203,7 @@ private static Seq<Tile> getConnectedWallTiles(Tile tile, Direction direction) {
}

Seq<Tile> tilesCopy = tiles.copy();
tiles.filter(t1 -> {
tiles.retainAll(t1 -> {
Point2 pT1 = Util.tileToPoint2(t1);
int paT1 = direction.primaryAxis(pT1);
int saT1 = direction.secondaryAxis(pT1);
Expand Down