1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-21 13:28:12 +03:00

Many crashes fixed, added server run script

This commit is contained in:
Anuken 2018-02-17 12:06:57 -05:00
parent fe3eb356fa
commit 26fc1c1fb0
7 changed files with 19 additions and 6 deletions

View File

@ -1,5 +1,5 @@
#Autogenerated file. Do not modify.
#Fri Feb 16 11:30:06 EST 2018
#Sat Feb 17 11:08:49 EST 2018
version=beta
androidBuildCode=234
name=Mindustry

View File

@ -50,6 +50,7 @@ public class Control extends Module{
private InputProxy proxy;
private float controlx, controly;
private boolean controlling;
private Throwable error;
public Control(){
saves = new Saves();
@ -195,6 +196,10 @@ public class Control extends Module{
});
}
public void setError(Throwable error){
this.error = error;
}
public UpgradeInventory upgrades() {
return upgrades;
}
@ -273,6 +278,10 @@ public class Control extends Module{
@Override
public void update(){
if(error != null){
throw new RuntimeException(error);
}
if(Gdx.input != proxy){
Gdx.input = proxy;
}

View File

@ -10,6 +10,7 @@ import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.entities.EntityGroup.ArrayContainer;
import io.anuke.ucore.util.Log;
import static io.anuke.mindustry.Vars.control;
import static io.anuke.mindustry.Vars.logic;
public class ThreadHandler {
@ -119,10 +120,8 @@ public class ThreadHandler {
}
} catch (InterruptedException ex) {
Log.info("Stopping logic thread.");
} catch (Exception ex) {
Timers.run(0f, () -> {
throw new RuntimeException(ex);
});
} catch (Throwable ex) {
control.setError(ex);
}
}

View File

@ -99,6 +99,7 @@ public abstract class InputHandler extends InputAdapter{
rect.setCenter(offset.x + x * tilesize, offset.y + y * tilesize);
for(SolidEntity e : Entities.getNearby(enemyGroup, x * tilesize, y * tilesize, tilesize * 2f)){
if(e == null) continue; //not sure why this happens?
Rectangle rect = e.hitbox.getRect(e.x, e.y);
if(this.rect.overlaps(rect)){

View File

@ -143,6 +143,7 @@ public class Conveyor extends Block{
@Override
public boolean acceptItem(Item item, Tile tile, Tile source){
if(tile.entity == null) return false;
int direction = source == null ? 0 : Math.abs(source.relativeTo(tile.x, tile.y) - tile.getRotation());
float minitem = tile.<ConveyorEntity>entity().minitem;
return (((direction == 0) && minitem > 0.05f) ||

View File

@ -142,7 +142,7 @@ public class Teleporter extends PowerBlock{
@Override
public boolean acceptItem(Item item, Tile tile, Tile source){
PowerEntity entity = tile.entity();
return entity.power >= powerPerItem && findLinks(tile, item).size > 0;
return !(source.block() instanceof Teleporter) && entity.power >= powerPerItem && findLinks(tile, item).size > 0;
}
@Override

3
run-server Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
./gradlew server:dist
java -jar server/build/libs/server-release.jar