Duct blend fix / Duct autobridge

This commit is contained in:
Anuken
2021-12-01 16:01:49 -05:00
parent a31ddb7fa1
commit 99488e7c8d
5 changed files with 38 additions and 9 deletions

View File

@@ -175,7 +175,7 @@ public class Placement{
plans.set(result);
}
public static void calculateBridges(Seq<BuildPlan> plans, DirectionBridge bridge){
public static void calculateBridges(Seq<BuildPlan> plans, DirectionBridge bridge, boolean hasJunction){
if(isSidePlace(plans)) return;
//check for orthogonal placement + unlocked state
@@ -183,8 +183,11 @@ public class Placement{
return;
}
Boolf<BuildPlan> placeable = plan -> (plan.placeable(player.team())) ||
(plan.tile() != null && plan.tile().block() == plan.block); //don't count the same block as inaccessible
//TODO for chains of ducts, do not count consecutives in a different rotation as 'placeable'
Boolf<BuildPlan> placeable = plan ->
!(!hasJunction && plan.build() != null && plan.build().block == plan.block && plan.rotation != plan.build().rotation) &&
(plan.placeable(player.team()) ||
(plan.tile() != null && plan.tile().block() == plan.block)); //don't count the same block as inaccessible
var result = plans1.clear();
var team = player.team();
@@ -198,7 +201,7 @@ public class Placement{
if(i < plans.size - 1 && placeable.get(cur) && !placeable.get(plans.get(i + 1))){
//find the closest valid position within range
for(int j = i + 1; j < plans.size; j++){
for(int j = i + 2; j < plans.size; j++){
var other = plans.get(j);
//out of range now, set to current position and keep scanning forward for next occurrence