Skip to content

Commit 1f62892

Browse files
committed
Fixed armored duct blending / Fixed some pathfinding bugs
1 parent ef33a05 commit 1f62892

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

core/src/mindustry/ai/ControlPathfinder.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,10 @@ public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 out, @Nullable
11001100
}
11011101

11021102
public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 mainDestination, Vec2 out, @Nullable boolean[] noResultFound){
1103+
if(noResultFound != null){
1104+
noResultFound[0] = false;
1105+
}
1106+
11031107
int costId = unit.type.pathCostId;
11041108
PathCost cost = idToCost(costId);
11051109

@@ -1253,7 +1257,11 @@ public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 mainDestination
12531257
return true;
12541258
}
12551259
}
1256-
}else if(request == null){
1260+
}else{
1261+
//destroy the old one immediately, it's invalid now
1262+
if(request != null){
1263+
request.lastUpdateId = -1000;
1264+
}
12571265

12581266
//queue new request.
12591267
unitRequests.put(unit, request = new PathRequest(unit, team, costId, destPos));
@@ -1266,9 +1274,7 @@ public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 mainDestination
12661274
recalculatePath(f);
12671275
});
12681276

1269-
out.set(destination);
1270-
1271-
return true;
1277+
return false;
12721278
}
12731279

12741280
if(noResultFound != null){

core/src/mindustry/world/blocks/Autotiler.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ default boolean blends(Tile tile, int rotation, int direction){
189189

190190
default boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
191191
return Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery)
192-
|| ((!otherblock.rotatedOutput(otherx, othery) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null &&
192+
|| ((!otherblock.rotatedOutput(otherx, othery, tile) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null &&
193193
Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) ||
194-
(otherblock.rotatedOutput(otherx, othery) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)));
194+
(otherblock.rotatedOutput(otherx, othery, tile) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)));
195195
}
196196

197197
/** @return whether this other block is *not* looking at this one. */
198198
default boolean notLookingAt(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
199-
return !(otherblock.rotatedOutput(otherx, othery) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y));
199+
return !(otherblock.rotatedOutput(otherx, othery, tile) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y));
200200
}
201201

202202
/** @return whether this tile is looking at the other tile, or the other tile is looking at this one.

core/src/mindustry/world/blocks/distribution/ArmoredConveyor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public boolean blends(Tile tile, int rotation, int otherx, int othery, int other
2121
@Override
2222
public boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
2323
return Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery)
24-
|| ((!otherblock.rotatedOutput(otherx, othery) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null &&
24+
|| ((!otherblock.rotatedOutput(otherx, othery, tile) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null &&
2525
Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) ||
26-
(otherblock instanceof Conveyor && otherblock.rotatedOutput(otherx, othery) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)));
26+
(otherblock instanceof Conveyor && otherblock.rotatedOutput(otherx, othery, tile) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)));
2727
}
2828

2929
public class ArmoredConveyorBuild extends ConveyorBuild{

core/src/mindustry/world/blocks/distribution/Duct.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
8282
@Override
8383
public boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
8484
return Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery)
85-
|| ((!otherblock.rotatedOutput(otherx, othery) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null &&
85+
|| ((!otherblock.rotatedOutput(otherx, othery, tile) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null &&
8686
Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) ||
8787

88-
((otherblock.rotatedOutput(otherx, othery)) && (otherblock.isDuct) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)));
88+
((otherblock.rotatedOutput(otherx, othery, tile)) && (otherblock.isDuct) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)));
8989
}
9090

9191
@Override

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ org.gradle.caching=true
2626
org.gradle.internal.http.socketTimeout=100000
2727
org.gradle.internal.http.connectionTimeout=100000
2828
android.enableR8.fullMode=false
29-
archash=89c7f1aee6
29+
archash=a39155a23e

0 commit comments

Comments
 (0)