From 6e162d91e5b90b9dfbe3c7c73a4e830dcc1eb2e6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 16 Jun 2020 10:08:33 -0400 Subject: [PATCH] Fixed #2169 --- .../world/blocks/distribution/ItemBridge.java | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/core/src/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/mindustry/world/blocks/distribution/ItemBridge.java index 2ff00e47b2..b9b96e4ce6 100644 --- a/core/src/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/mindustry/world/blocks/distribution/ItemBridge.java @@ -112,7 +112,7 @@ public class ItemBridge extends Block{ return false; } - return other.block() == this && (other.team() == tile.team() || tile.block() != this) && (!checkDouble || other.ent().link != tile.pos()); + return other.block() == tile.block() && (other.team() == tile.team() || tile.block() != this) && (!checkDouble || other.ent().link != tile.pos()); } public Tile findLink(int x, int y){ @@ -280,35 +280,15 @@ public class ItemBridge extends Block{ if(rel == rel2) return false; }else{ - return source.block() instanceof ItemBridge && ((ItemBridgeEntity)source).link == tile.pos() && items.total() < itemCapacity; + return source.block() instanceof ItemBridge && linkValid(source.tile(), tile) && items.total() < itemCapacity; } return items.total() < itemCapacity; } - @Override public boolean canDumpLiquid(Tilec to, Liquid liquid){ - Tile other = world.tile(link); - if(!linkValid(tile, other)){ - Tile edge = Edges.getFacingEdge(to.tile(), tile); - int i = relativeTo(edge.x, edge.y); - - IntSetIterator it = incoming.iterator(); - - while(it.hasNext){ - int v = it.next(); - if(relativeTo(Point2.x(v), Point2.y(v)) == i){ - return false; - } - } - return true; - } - - int rel = relativeTo(other.x, other.y); - int rel2 = relativeTo(to.tileX(), to.tileY()); - - return rel != rel2; + return checkDump(to); } @Override @@ -322,7 +302,7 @@ public class ItemBridge extends Block{ int rel2 = relativeTo(Edges.getFacingEdge(source, this)); if(rel == rel2) return false; - }else if(!(source.block() instanceof ItemBridge && ((ItemBridgeEntity)source).link == tile.pos())){ + }else if(!(source.block() instanceof ItemBridge && linkValid(source.tile(), tile))){ return false; } @@ -331,6 +311,10 @@ public class ItemBridge extends Block{ @Override public boolean canDump(Tilec to, Item item){ + return checkDump(to); + } + + protected boolean checkDump(Tilec to){ Tile other = world.tile(link); if(!linkValid(tile, other)){ Tile edge = Edges.getFacingEdge(to.tile(), tile);