This commit is contained in:
Anuken
2020-02-17 09:30:36 -05:00
4 changed files with 28 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ package mindustry.mod;
import arc.audio.*;
import arc.math.geom.*;
import arc.mock.MockSound;
import arc.mock.*;
import arc.util.ArcAnnotate.*;
public class ModLoadingSound implements Sound{

View File

@@ -51,6 +51,7 @@ public class ItemSelection{
scrollPos = pane.getScrollY();
});
table.add(pane).maxHeight(40 * 5);
pane.setOverscroll(false, false);
table.add(pane).maxHeight(Scl.scl(40 * 5));
}
}

View File

@@ -8,7 +8,7 @@ import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.meta.*;
import java.io.*;
import static mindustry.Vars.world;
public class OverflowGate extends Block{
public float speed = 1f;
@@ -124,11 +124,24 @@ public class OverflowGate extends Block{
Tile lastInput;
float time;
@Override
public byte version(){
return 3;
}
@Override
public void write(Writes write){
write.i(lastInput == null ? Pos.invalid : lastInput.pos());
}
@Override
public void read(Reads read, byte revision){
super.read(read, revision);
if(revision == 1){
new DirectionalItemBuffer(25, 50f).read(read);
}else if(revision == 3){
lastInput = world.tile(read.i());
lastItem = items.first();
}
}
}

View File

@@ -69,15 +69,24 @@ public class ItemModule extends BlockModule{
return total;
}
public Item first(){
for(int i = 0; i < items.length; i++){
if(items[i] > 0){
return content.item(i);
}
}
return null;
}
public Item take(){
for(int i = 0; i < items.length; i++){
int index = (i + takeRotation);
if(index >= items.length) index -= items.length; //conditional instead of mod
if(index >= items.length) index -= items.length;
if(items[index] > 0){
items[index] --;
total --;
takeRotation = index + 1;
return content.item(index % items.length);
return content.item(index);
}
}
return null;