From e798619679bb205448dc59594071605a332de9d2 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 12 Feb 2020 11:25:00 -0500 Subject: [PATCH] Bugfixes --- core/src/mindustry/game/Teams.java | 8 ++++++++ .../mindustry/world/blocks/distribution/Conveyor.java | 1 + tests/src/test/java/ApplicationTests.java | 10 ++++++++++ 3 files changed, 19 insertions(+) diff --git a/core/src/mindustry/game/Teams.java b/core/src/mindustry/game/Teams.java index 62479c66ec..813df73e21 100644 --- a/core/src/mindustry/game/Teams.java +++ b/core/src/mindustry/game/Teams.java @@ -167,6 +167,14 @@ public class Teams{ public CoreEntity core(){ return cores.first(); } + + @Override + public String toString(){ + return "TeamData{" + + "cores=" + cores + + ", team=" + team + + '}'; + } } /** Represents a block made by this team that was destroyed somewhere on the map. diff --git a/core/src/mindustry/world/blocks/distribution/Conveyor.java b/core/src/mindustry/world/blocks/distribution/Conveyor.java index 55b643473b..56a4d7f2ad 100644 --- a/core/src/mindustry/world/blocks/distribution/Conveyor.java +++ b/core/src/mindustry/world/blocks/distribution/Conveyor.java @@ -264,6 +264,7 @@ public class Conveyor extends Block implements Autotiler{ @Override public void handleStack(Item item, int amount, Tile tile, Unit source){ ConveyorEntity e = tile.ent(); + amount = Math.min(amount, itemCapacity - e.len); for(int i = amount - 1; i >= 0; i--){ e.add(0); diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 8bb1ba3206..b37ca45b06 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -214,6 +214,16 @@ public class ApplicationTests{ assertTrue(state.teams.playerCores().size > 0); } + @Test + void conveyorCrash(){ + world.loadMap(testMap); + state.set(State.playing); + + world.tile(0, 0).setBlock(Blocks.conveyor); + world.tile(0, 0).rotation(0); + Blocks.conveyor.acceptStack(Items.copper, 1000, world.tile(0, 0), null); + } + @Test void conveyorBench(){ int[] items = {0};