From 244eb91dfb9c525ae7fdaec31886ac3e3fad39cc Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 4 Oct 2018 17:59:16 -0400 Subject: [PATCH] Added new test --- core/src/io/anuke/mindustry/maps/Sectors.java | 1 - .../mindustry/world/blocks/production/Pump.java | 5 +++++ tests/src/test/java/ApplicationTests.java | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/core/src/io/anuke/mindustry/maps/Sectors.java b/core/src/io/anuke/mindustry/maps/Sectors.java index 160bee8196..7f6c9c835f 100644 --- a/core/src/io/anuke/mindustry/maps/Sectors.java +++ b/core/src/io/anuke/mindustry/maps/Sectors.java @@ -31,7 +31,6 @@ import static io.anuke.mindustry.Vars.*; public class Sectors{ private static final int sectorImageSize = 32; private static final boolean checkExpansion = false; - private static final float sectorLargeChance = 0.24f; private GridMap grid = new GridMap<>(); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Pump.java b/core/src/io/anuke/mindustry/world/blocks/production/Pump.java index 364464376e..f4437ab163 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Pump.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Pump.java @@ -101,6 +101,11 @@ public class Pump extends LiquidBlock{ tryDumpLiquid(tile, tile.entity.liquids.current()); } + @Override + public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){ + return false; + } + protected boolean isValid(Tile tile){ return tile != null && tile.floor().liquidDrop != null && tier >= tile.floor().liquidDrop.tier; } diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 5cee8a0c0a..12390167d1 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -1,6 +1,7 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.backends.headless.HeadlessApplication; import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration; +import com.badlogic.gdx.math.GridPoint2; import io.anuke.mindustry.Vars; import io.anuke.mindustry.content.Items; import io.anuke.mindustry.content.blocks.Blocks; @@ -14,6 +15,7 @@ import io.anuke.mindustry.game.Team; import io.anuke.mindustry.io.BundleLoader; import io.anuke.mindustry.io.SaveIO; import io.anuke.mindustry.maps.Map; +import io.anuke.mindustry.world.Edges; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Timers; import io.anuke.ucore.modules.ModuleCore; @@ -201,4 +203,16 @@ public class ApplicationTests{ assertTrue(world.width() == map.meta.width); assertTrue(world.height() == map.meta.height); } + + @Test + void edgeTest(){ + GridPoint2[] edges = Edges.getEdges(1); + assertTrue(edges[0].equals(new GridPoint2(1, 0))); + assertTrue(edges[1].equals(new GridPoint2(0, 1))); + assertTrue(edges[2].equals(new GridPoint2(-1, 0))); + assertTrue(edges[3].equals(new GridPoint2(0, -1))); + + GridPoint2[] edges2 = Edges.getEdges(2); + assertTrue(edges2.length == 8); + } } \ No newline at end of file