mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 15:27:19 +07:00
Better allowRectanglePlacement
This commit is contained in:
@ -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);
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user