Implemented Anuken/Mindustry-Suggestions/issues/2809

This commit is contained in:
Anuken
2021-08-07 12:08:30 -04:00
parent ce9bfdbcae
commit b1b89290b9
3 changed files with 9 additions and 2 deletions

View File

@@ -108,7 +108,13 @@ public class Placement{
points.addAll(result);
}
public static boolean isSidePlace(Seq<BuildPlan> plans){
return plans.size > 1 && Mathf.mod(Tile.relativeTo(plans.first().x, plans.first().y, plans.get(1).x, plans.get(1).y) - plans.first().rotation, 2) == 1;
}
public static void calculateBridges(Seq<BuildPlan> plans, ItemBridge bridge){
if(isSidePlace(plans)) return;
//check for orthogonal placement + unlocked state
if(!(plans.first().x == plans.peek().x || plans.first().y == plans.peek().y) || !bridge.unlockedNow()){
return;
@@ -170,6 +176,8 @@ public class Placement{
}
public static void calculateDuctBridges(Seq<BuildPlan> plans, DuctBridge bridge){
if(isSidePlace(plans)) return;
//check for orthogonal placement + unlocked state
if(!(plans.first().x == plans.peek().x || plans.first().y == plans.peek().y) || !bridge.unlockedNow()){
return;
@@ -180,7 +188,6 @@ public class Placement{
var result = plans1.clear();
var team = player.team();
var rot = plans.first().rotation;
outer:
for(int i = 0; i < plans.size;){