mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-15 15:20:57 -08:00
Better allowRectanglePlacement
This commit is contained in:
parent
bd4ae0639d
commit
76e83c1516
3 changed files with 5 additions and 5 deletions
|
|
@ -1978,7 +1978,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||||
}else{
|
}else{
|
||||||
points = Placement.pathfindLine(block != null && block.conveyorPlacement, startX, startY, endX, endY);
|
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);
|
points = Placement.normalizeRectangle(startX, startY, endX, endY, block.size);
|
||||||
}else{
|
}else{
|
||||||
points = Placement.normalizeLine(startX, startY, endX, endY);
|
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);
|
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 y = 0; y <= maxY - minY; y += blockSize){
|
||||||
for(int x = minX; x <= maxX; x += blockSize){
|
for(int x = 0; x <= maxX - minX; x += blockSize){
|
||||||
points.add(Pools.obtain(Point2.class, Point2::new).set(x, y));
|
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;
|
public boolean allowDiagonal = true;
|
||||||
/** Whether to swap the diagonal placement modes. */
|
/** Whether to swap the diagonal placement modes. */
|
||||||
public boolean swapDiagonalPlacement;
|
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;
|
public boolean allowRectanglePlacement = false;
|
||||||
/** Build queue priority in schematics. */
|
/** Build queue priority in schematics. */
|
||||||
public int schematicPriority = 0;
|
public int schematicPriority = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue