Package mindustry.input
Class Placement
java.lang.Object
mindustry.input.Placement
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
calculateBridges
(Seq<BuildPlan> plans, DirectionBridge bridge, boolean hasJunction, Boolf<Block> same) static void
calculateBridges
(Seq<BuildPlan> plans, ItemBridge bridge) static void
Calculates optimal node placement for nodes with spacing.static boolean
isSidePlace
(Seq<BuildPlan> plans) static Placement.NormalizeResult
normalizeArea
(int tilex, int tiley, int endx, int endy, int rotation, boolean snap, int maxLength) Normalizes a placement area and returns the result.normalizeDrawArea
(Block block, int startx, int starty, int endx, int endy, boolean snap, int maxLength, float scaling) Normalizes a placement area and returns the result, ready to be used for drawing a rectangle.normalizeLine
(int startX, int startY, int endX, int endY) Normalize two points into one straight line, no diagonals.pathfindLine
(boolean conveyors, int startX, int startY, int endX, int endY) Normalize a diagonal line into points.upgradeLine
(int startX, int startY, int endX, int endY)
-
Constructor Details
-
Placement
public Placement()
-
-
Method Details
-
pathfindLine
public static Seq<Point2> pathfindLine(boolean conveyors, int startX, int startY, int endX, int endY) Normalize a diagonal line into points. -
normalizeLine
Normalize two points into one straight line, no diagonals. -
upgradeLine
-
calculateNodes
public static void calculateNodes(Seq<Point2> points, Block block, int rotation, Boolf2<Point2, Point2> overlapper) Calculates optimal node placement for nodes with spacing. Used for bridges and power nodes. -
isSidePlace
-
calculateBridges
-
calculateBridges
public static void calculateBridges(Seq<BuildPlan> plans, DirectionBridge bridge, boolean hasJunction, Boolf<Block> same) -
normalizeDrawArea
public static Placement.NormalizeDrawResult normalizeDrawArea(Block block, int startx, int starty, int endx, int endy, boolean snap, int maxLength, float scaling) Normalizes a placement area and returns the result, ready to be used for drawing a rectangle. Returned x2 and y2 will always be greater than x and y.- Parameters:
block
- block that will be drawnstartx
- starting X coordinatestarty
- starting Y coordinateendx
- ending X coordinateendy
- ending Y coordinatesnap
- whether to snap to a linemaxLength
- maximum length of area
-
normalizeArea
public static Placement.NormalizeResult normalizeArea(int tilex, int tiley, int endx, int endy, int rotation, boolean snap, int maxLength) Normalizes a placement area and returns the result. Returned x2 and y2 will always be greater than x and y.- Parameters:
tilex
- starting X coordinatetiley
- starting Y coordinateendx
- ending X coordinateendy
- ending Y coordinatesnap
- whether to snap to a linerotation
- placement rotationmaxLength
- maximum length of area
-