This commit is contained in:
Anuken
2020-02-12 11:25:00 -05:00
parent 5c48ae2158
commit e798619679
3 changed files with 19 additions and 0 deletions

View File

@@ -167,6 +167,14 @@ public class Teams{
public CoreEntity core(){ public CoreEntity core(){
return cores.first(); 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. /** Represents a block made by this team that was destroyed somewhere on the map.

View File

@@ -264,6 +264,7 @@ public class Conveyor extends Block implements Autotiler{
@Override @Override
public void handleStack(Item item, int amount, Tile tile, Unit source){ public void handleStack(Item item, int amount, Tile tile, Unit source){
ConveyorEntity e = tile.ent(); ConveyorEntity e = tile.ent();
amount = Math.min(amount, itemCapacity - e.len);
for(int i = amount - 1; i >= 0; i--){ for(int i = amount - 1; i >= 0; i--){
e.add(0); e.add(0);

View File

@@ -214,6 +214,16 @@ public class ApplicationTests{
assertTrue(state.teams.playerCores().size > 0); 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 @Test
void conveyorBench(){ void conveyorBench(){
int[] items = {0}; int[] items = {0};