Direction bugfixes

This commit is contained in:
Anuken
2020-05-15 20:10:03 -04:00
parent 1cefaf28db
commit 4c85864260
2 changed files with 5 additions and 1 deletions
@@ -189,6 +189,10 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
return relativeTo(tile.tile()); return relativeTo(tile.tile());
} }
public byte relativeToEdge(Tile other){
return relativeTo(Edges.getFacingEdge(other, tile));
}
public byte relativeTo(int cx, int cy){ public byte relativeTo(int cx, int cy){
return tile.absoluteRelativeTo(cx, cy); return tile.absoluteRelativeTo(cx, cy);
} }
@@ -89,7 +89,7 @@ public class OverflowGate extends Block{
} }
public @Nullable Tilec getTileTarget(Item item, Tile src, boolean flip){ public @Nullable Tilec getTileTarget(Item item, Tile src, boolean flip){
int from = relativeTo(src.x, src.y); int from = relativeToEdge(src);
if(from == -1) return null; if(from == -1) return null;
Tilec to = nearby((from + 2) % 4); Tilec to = nearby((from + 2) % 4);
boolean canForward = to != null && to.acceptItem(this, item) && to.team() == team && !(to.block() instanceof OverflowGate); boolean canForward = to != null && to.acceptItem(this, item) && to.team() == team && !(to.block() instanceof OverflowGate);