Skip to content

Commit

Permalink
Fixed Anuken#8957
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Aug 20, 2023
1 parent c45f3d2 commit 480b68f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ public boolean positionsValid(int x1, int y1, int x2, int y2){
}

public class DirectionBridgeBuild extends Building{
public Building[] occupied = new Building[4];
public DirectionBridgeBuild[] occupied = new DirectionBridgeBuild[4];
public @Nullable DirectionBridgeBuild lastLink;

@Override
public void draw(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void draw(){

@Override
public void updateTile(){
var link = findLink();
var link = lastLink = findLink();
if(link != null){
moveLiquid(link, liquids.current());
link.occupied[rotation % 4] = this;
Expand All @@ -68,7 +68,7 @@ public void updateTile(){
}

for(int i = 0; i < 4; i++){
if(occupied[i] == null || occupied[i].rotation != i || !occupied[i].isValid()){
if(occupied[i] == null || occupied[i].rotation != i || !occupied[i].isValid() || occupied[i].lastLink != this){
occupied[i] = null;
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/mindustry/world/blocks/distribution/DuctBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class DuctBridgeBuild extends DirectionBridgeBuild{

@Override
public void updateTile(){
var link = findLink();
var link = lastLink = findLink();
if(link != null){
link.occupied[rotation % 4] = this;
if(items.any() && link.items.total() < link.block.itemCapacity){
Expand All @@ -43,7 +43,7 @@ public void updateTile(){
}

for(int i = 0; i < 4; i++){
if(occupied[i] == null || occupied[i].rotation != i || !occupied[i].isValid()){
if(occupied[i] == null || occupied[i].rotation != i || !occupied[i].isValid() || occupied[i].lastLink != this){
occupied[i] = null;
}
}
Expand Down

0 comments on commit 480b68f

Please sign in to comment.