Preserve conveyors end rotation on placement (#6496)
* Preserve conveyors end rotation on placement * Formatting
This commit is contained in:
committed by
GitHub
parent
fa06d2c20b
commit
0b9483cffc
@@ -1269,19 +1269,24 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
int endRotation = -1;
|
int endRotation = -1;
|
||||||
|
var start = world.build(startX, startY);
|
||||||
|
var end = world.build(endX, endY);
|
||||||
if(diagonal){
|
if(diagonal){
|
||||||
var start = world.build(startX, startY);
|
|
||||||
var end = world.build(endX, endY);
|
|
||||||
if(block != null && start instanceof ChainedBuilding && end instanceof ChainedBuilding
|
if(block != null && start instanceof ChainedBuilding && end instanceof ChainedBuilding
|
||||||
&& block.canReplace(end.block) && block.canReplace(start.block)){
|
&& block.canReplace(end.block) && block.canReplace(start.block)){
|
||||||
points = Placement.upgradeLine(startX, startY, endX, endY);
|
points = Placement.upgradeLine(startX, startY, endX, endY);
|
||||||
endRotation = end.rotation;
|
|
||||||
}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{
|
}else{
|
||||||
points = Placement.normalizeLine(startX, startY, endX, endY);
|
points = Placement.normalizeLine(startX, startY, endX, endY);
|
||||||
}
|
}
|
||||||
|
if(points.size > 1 && end instanceof ChainedBuilding){
|
||||||
|
Point2 secondToLast = points.get(points.size - 2);
|
||||||
|
if (!(world.build(secondToLast.x, secondToLast.y) instanceof ChainedBuilding)){
|
||||||
|
endRotation = end.rotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(block != null){
|
if(block != null){
|
||||||
block.changePlacementPath(points, rotation);
|
block.changePlacementPath(points, rotation);
|
||||||
|
|||||||
Reference in New Issue
Block a user