From e066034e9f42a706a12dfec61e1f203284c09ebc Mon Sep 17 00:00:00 2001 From: Patrick 'Quezler' Mounier Date: Tue, 5 Nov 2019 14:52:57 +0100 Subject: [PATCH] Remove duplicate blend check for armored --- .../world/blocks/distribution/ArmoredConduit.java | 4 +--- .../world/blocks/distribution/ArmoredConveyor.java | 10 +++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/ArmoredConduit.java b/core/src/io/anuke/mindustry/world/blocks/distribution/ArmoredConduit.java index 8655562c08..a977d10e25 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/ArmoredConduit.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/ArmoredConduit.java @@ -42,8 +42,6 @@ public class ArmoredConduit extends Conduit{ @Override public boolean blends(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ - return otherblock.outputsLiquid && (Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery) - || ((!otherblock.rotate && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && - Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || (otherblock.rotate && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)))); + return otherblock.outputsLiquid && ArmoredConveyor.blender(tile, rotation, otherx, othery, otherrot, otherblock); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/ArmoredConveyor.java b/core/src/io/anuke/mindustry/world/blocks/distribution/ArmoredConveyor.java index fad38034e5..c71ff7e208 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/ArmoredConveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/ArmoredConveyor.java @@ -17,8 +17,12 @@ public class ArmoredConveyor extends Conveyor{ @Override public boolean blends(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ - return otherblock.outputsItems() && (Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery) - || ((!otherblock.rotate && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && - Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || (otherblock.rotate && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)))); + return otherblock.outputsItems() && blender(tile, rotation, otherx, othery, otherrot, otherblock); + } + + public static boolean blender(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){ + return (Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery) + || ((!otherblock.rotate && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null && + Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || (otherblock.rotate && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)))); } }