From 1f62892e10330d7d6d6857128c23556eeb096451 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 7 Oct 2024 12:36:40 -0400 Subject: [PATCH] Fixed armored duct blending / Fixed some pathfinding bugs --- core/src/mindustry/ai/ControlPathfinder.java | 14 ++++++++++---- core/src/mindustry/world/blocks/Autotiler.java | 6 +++--- .../world/blocks/distribution/ArmoredConveyor.java | 4 ++-- .../mindustry/world/blocks/distribution/Duct.java | 4 ++-- gradle.properties | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/core/src/mindustry/ai/ControlPathfinder.java b/core/src/mindustry/ai/ControlPathfinder.java index 895ec7ee69..d513f5e936 100644 --- a/core/src/mindustry/ai/ControlPathfinder.java +++ b/core/src/mindustry/ai/ControlPathfinder.java @@ -1100,6 +1100,10 @@ public class ControlPathfinder implements Runnable{ } public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 mainDestination, Vec2 out, @Nullable boolean[] noResultFound){ + if(noResultFound != null){ + noResultFound[0] = false; + } + int costId = unit.type.pathCostId; PathCost cost = idToCost(costId); @@ -1253,7 +1257,11 @@ public class ControlPathfinder implements Runnable{ return true; } } - }else if(request == null){ + }else{ + //destroy the old one immediately, it's invalid now + if(request != null){ + request.lastUpdateId = -1000; + } //queue new request. unitRequests.put(unit, request = new PathRequest(unit, team, costId, destPos)); @@ -1266,9 +1274,7 @@ public class ControlPathfinder implements Runnable{ recalculatePath(f); }); - out.set(destination); - - return true; + return false; } if(noResultFound != null){ diff --git a/core/src/mindustry/world/blocks/Autotiler.java b/core/src/mindustry/world/blocks/Autotiler.java index fa62143fd5..4cefac1434 100644 --- a/core/src/mindustry/world/blocks/Autotiler.java +++ b/core/src/mindustry/world/blocks/Autotiler.java @@ -189,14 +189,14 @@ public interface Autotiler{ default boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ return Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery) - || ((!otherblock.rotatedOutput(otherx, othery) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && + || ((!otherblock.rotatedOutput(otherx, othery, tile) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || - (otherblock.rotatedOutput(otherx, othery) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))); + (otherblock.rotatedOutput(otherx, othery, tile) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))); } /** @return whether this other block is *not* looking at this one. */ default boolean notLookingAt(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ - return !(otherblock.rotatedOutput(otherx, othery) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)); + return !(otherblock.rotatedOutput(otherx, othery, tile) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)); } /** @return whether this tile is looking at the other tile, or the other tile is looking at this one. diff --git a/core/src/mindustry/world/blocks/distribution/ArmoredConveyor.java b/core/src/mindustry/world/blocks/distribution/ArmoredConveyor.java index 4788b6662e..8c5d2f6e23 100644 --- a/core/src/mindustry/world/blocks/distribution/ArmoredConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/ArmoredConveyor.java @@ -21,9 +21,9 @@ public class ArmoredConveyor extends Conveyor{ @Override public boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ return Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery) - || ((!otherblock.rotatedOutput(otherx, othery) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && + || ((!otherblock.rotatedOutput(otherx, othery, tile) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || - (otherblock instanceof Conveyor && otherblock.rotatedOutput(otherx, othery) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))); + (otherblock instanceof Conveyor && otherblock.rotatedOutput(otherx, othery, tile) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))); } public class ArmoredConveyorBuild extends ConveyorBuild{ diff --git a/core/src/mindustry/world/blocks/distribution/Duct.java b/core/src/mindustry/world/blocks/distribution/Duct.java index 0505ec7aad..dacd3a8b8e 100644 --- a/core/src/mindustry/world/blocks/distribution/Duct.java +++ b/core/src/mindustry/world/blocks/distribution/Duct.java @@ -82,10 +82,10 @@ public class Duct extends Block implements Autotiler{ @Override public boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ return Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery) - || ((!otherblock.rotatedOutput(otherx, othery) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && + || ((!otherblock.rotatedOutput(otherx, othery, tile) && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || - ((otherblock.rotatedOutput(otherx, othery)) && (otherblock.isDuct) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))); + ((otherblock.rotatedOutput(otherx, othery, tile)) && (otherblock.isDuct) && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))); } @Override diff --git a/gradle.properties b/gradle.properties index edfdba6f2f..0be7e3088e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,4 +26,4 @@ org.gradle.caching=true org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 android.enableR8.fullMode=false -archash=89c7f1aee6 +archash=a39155a23e