Fixed junction/tunnel crashes with sorters
This commit is contained in:
@@ -156,7 +156,7 @@ public class Player extends SyncEntity{
|
||||
stucktime = 0f;
|
||||
}
|
||||
|
||||
if(stucktime > 20f){
|
||||
if(stucktime > 15f){
|
||||
damage(health+1); //die instantly
|
||||
stucktime = 0f;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.util.Bits;
|
||||
|
||||
public class Junction extends Block{
|
||||
protected float speed = 20; //frames taken to go through this junction
|
||||
protected float speed = 15; //frames taken to go through this junction
|
||||
protected int capacity = 16;
|
||||
|
||||
public Junction(String name) {
|
||||
@@ -43,6 +43,7 @@ public class Junction extends Block{
|
||||
if(buffer.index > 0){
|
||||
buffer.time += Timers.delta();
|
||||
if(buffer.time >= speed){
|
||||
if(buffer.index > buffer.items.length) buffer.index = buffer.items.length;
|
||||
int val = buffer.items[buffer.index - 1];
|
||||
|
||||
Item item = Item.getByID(Bits.getLeftShort(val));
|
||||
|
||||
@@ -7,7 +7,6 @@ import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||
import io.anuke.ucore.scene.ui.ImageButton;
|
||||
@@ -55,11 +54,8 @@ public class Sorter extends Block{
|
||||
@Override
|
||||
public void handleItem(Item item, Tile tile, Tile source){
|
||||
Tile to = getTileTarget(item, tile, source, true);
|
||||
|
||||
Timers.run(15, () -> {
|
||||
to.block().handleItem(item, to, tile);
|
||||
});
|
||||
|
||||
|
||||
to.block().handleItem(item, to, tile);
|
||||
}
|
||||
|
||||
Tile getTileTarget(Item item, Tile dest, Tile source, boolean flip){
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.anuke.ucore.core.Timers;
|
||||
|
||||
public class TunnelConveyor extends Block{
|
||||
protected int maxdist = 3;
|
||||
protected float speed = 20; //frames taken to go through this tunnel
|
||||
protected float speed = 18; //frames taken to go through this tunnel
|
||||
protected int capacity = 16;
|
||||
|
||||
protected TunnelConveyor(String name) {
|
||||
@@ -43,6 +43,7 @@ public class TunnelConveyor extends Block{
|
||||
if(entity.index > 0){
|
||||
entity.time += Timers.delta();
|
||||
if(entity.time >= speed){
|
||||
if(entity.index > entity.buffer.length) entity.index = entity.buffer.length;
|
||||
int i = entity.buffer[entity.index - 1];
|
||||
|
||||
Item item = Item.getByID(i);
|
||||
|
||||
Reference in New Issue
Block a user