mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-20 20:57:59 +07:00
Fixed junction/tunnel crashes with sorters
This commit is contained in:
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="io.anuke.mindustry"
|
package="io.anuke.mindustry"
|
||||||
android:versionCode="68"
|
android:versionCode="70"
|
||||||
android:versionName="3.3b17" >
|
android:versionName="3.3b19" >
|
||||||
|
|
||||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||||
<uses-permission android:name="com.android.vending.BILLING" />
|
<uses-permission android:name="com.android.vending.BILLING" />
|
||||||
|
@ -156,7 +156,7 @@ public class Player extends SyncEntity{
|
|||||||
stucktime = 0f;
|
stucktime = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stucktime > 20f){
|
if(stucktime > 15f){
|
||||||
damage(health+1); //die instantly
|
damage(health+1); //die instantly
|
||||||
stucktime = 0f;
|
stucktime = 0f;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import io.anuke.ucore.core.Timers;
|
|||||||
import io.anuke.ucore.util.Bits;
|
import io.anuke.ucore.util.Bits;
|
||||||
|
|
||||||
public class Junction extends Block{
|
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;
|
protected int capacity = 16;
|
||||||
|
|
||||||
public Junction(String name) {
|
public Junction(String name) {
|
||||||
@ -43,6 +43,7 @@ public class Junction extends Block{
|
|||||||
if(buffer.index > 0){
|
if(buffer.index > 0){
|
||||||
buffer.time += Timers.delta();
|
buffer.time += Timers.delta();
|
||||||
if(buffer.time >= speed){
|
if(buffer.time >= speed){
|
||||||
|
if(buffer.index > buffer.items.length) buffer.index = buffer.items.length;
|
||||||
int val = buffer.items[buffer.index - 1];
|
int val = buffer.items[buffer.index - 1];
|
||||||
|
|
||||||
Item item = Item.getByID(Bits.getLeftShort(val));
|
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.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.core.Timers;
|
|
||||||
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
||||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
@ -55,11 +54,8 @@ public class Sorter extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void handleItem(Item item, Tile tile, Tile source){
|
public void handleItem(Item item, Tile tile, Tile source){
|
||||||
Tile to = getTileTarget(item, tile, source, true);
|
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){
|
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{
|
public class TunnelConveyor extends Block{
|
||||||
protected int maxdist = 3;
|
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 int capacity = 16;
|
||||||
|
|
||||||
protected TunnelConveyor(String name) {
|
protected TunnelConveyor(String name) {
|
||||||
@ -43,6 +43,7 @@ public class TunnelConveyor extends Block{
|
|||||||
if(entity.index > 0){
|
if(entity.index > 0){
|
||||||
entity.time += Timers.delta();
|
entity.time += Timers.delta();
|
||||||
if(entity.time >= speed){
|
if(entity.time >= speed){
|
||||||
|
if(entity.index > entity.buffer.length) entity.index = entity.buffer.length;
|
||||||
int i = entity.buffer[entity.index - 1];
|
int i = entity.buffer[entity.index - 1];
|
||||||
|
|
||||||
Item item = Item.getByID(i);
|
Item item = Item.getByID(i);
|
||||||
|
Reference in New Issue
Block a user