Fixed armored duct blending / Fixed some pathfinding bugs
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user