Better allowRectanglePlacement

This commit is contained in:
Anuken
2024-01-22 22:12:24 -05:00
parent bd4ae0639d
commit 76e83c1516
3 changed files with 5 additions and 5 deletions

View File

@ -1978,7 +1978,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
}else{
points = Placement.pathfindLine(block != null && block.conveyorPlacement, startX, startY, endX, endY);
}
}else if(block != null && block.size == 1 && block.allowRectanglePlacement){
}else if(block != null && block.allowRectanglePlacement){
points = Placement.normalizeRectangle(startX, startY, endX, endY, block.size);
}else{
points = Placement.normalizeLine(startX, startY, endX, endY);

View File

@ -65,9 +65,9 @@ public class Placement{
int minX = Math.min(startX, endX), minY = Math.min(startY, endY), maxX = Math.max(startX, endX), maxY = Math.max(startY, endY);
for(int y = minY; y <= maxY; y += blockSize){
for(int x = minX; x <= maxX; x += blockSize){
points.add(Pools.obtain(Point2.class, Point2::new).set(x, y));
for(int y = 0; y <= maxY - minY; y += blockSize){
for(int x = 0; x <= maxX - minX; x += blockSize){
points.add(Pools.obtain(Point2.class, Point2::new).set(startX + x * Mathf.sign(endX - startX), startY + y * Mathf.sign(endY - startY)));
}
}

View File

@ -245,7 +245,7 @@ public class Block extends UnlockableContent implements Senseable{
public boolean allowDiagonal = true;
/** Whether to swap the diagonal placement modes. */
public boolean swapDiagonalPlacement;
/** Whether to allow rectangular placement, as opposed to a line. Only supported for 1x1 blocks currently! */
/** Whether to allow rectangular placement, as opposed to a line. */
public boolean allowRectanglePlacement = false;
/** Build queue priority in schematics. */
public int schematicPriority = 0;