mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Crash fixes
This commit is contained in:
parent
d4ccfa31b5
commit
3f07102f2a
@ -80,7 +80,7 @@ public class DefenseBlocks extends BlockList implements ContentList{
|
||||
shockMine = new ShockMine("shock-mine"){{
|
||||
health = 40;
|
||||
damage = 11;
|
||||
tileDamage = 6f;
|
||||
tileDamage = 7f;
|
||||
length = 10;
|
||||
tendrils = 5;
|
||||
}};
|
||||
|
@ -158,5 +158,9 @@ public class Logic extends Module{
|
||||
world.pathfinder().update();
|
||||
}
|
||||
}
|
||||
|
||||
if(threads.isEnabled()){
|
||||
netServer.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ public class NetClient extends Module{
|
||||
}
|
||||
|
||||
//when all chunks have been recieved, begin
|
||||
if(netClient.recievedChunkCounter >= totalChunks){
|
||||
if(netClient.recievedChunkCounter >= totalChunks && netClient.currentSnapshot != null){
|
||||
snapshot = netClient.currentSnapshot;
|
||||
}else{
|
||||
return;
|
||||
|
@ -403,10 +403,12 @@ public class NetServer extends Module{
|
||||
}
|
||||
|
||||
public void update(){
|
||||
if(threads.isEnabled() && !threads.isOnThread()) return;
|
||||
|
||||
if(!headless && !closing && Net.server() && state.is(State.menu)){
|
||||
closing = true;
|
||||
reset();
|
||||
ui.loadfrag.show("$text.server.closing");
|
||||
threads.runGraphics(() -> ui.loadfrag.show("$text.server.closing"));
|
||||
Timers.runTask(5f, () -> {
|
||||
Net.closeServer();
|
||||
ui.loadfrag.hide();
|
||||
|
@ -15,6 +15,7 @@ import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||
@ -89,13 +90,14 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
Unit unit = Units.getClosestEnemy(player.getTeam(), x, y, 20f, u -> true);
|
||||
|
||||
if(unit != null){
|
||||
player.target = unit;
|
||||
threads.run(() -> player.target = unit);
|
||||
}else{
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
if(tile != null) tile = tile.target();
|
||||
|
||||
if(tile != null && state.teams.areEnemies(player.getTeam(), tile.getTeam())){
|
||||
player.target = tile.entity;
|
||||
TileEntity entity = tile.entity;
|
||||
threads.run(() -> player.target = entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class ShockMine extends Block{
|
||||
protected int timerDamage = timers ++;
|
||||
|
||||
protected float cooldown = 80f;
|
||||
protected float tileDamage = 4f;
|
||||
protected float tileDamage = 5f;
|
||||
protected float damage = 10;
|
||||
protected int length = 10;
|
||||
protected int tendrils = 6;
|
||||
|
@ -41,7 +41,7 @@ public class LiquidJunction extends LiquidBlock{
|
||||
public void handleLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
int dir = source.relativeTo(tile.x, tile.y);
|
||||
dir = (dir + 4) % 4;
|
||||
Tile to = tile.getNearby(dir);
|
||||
Tile to = tile.getNearby(dir).target();
|
||||
|
||||
if(to.block().hasLiquids && to.block().acceptLiquid(to, tile, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount))){
|
||||
to.block().handleLiquid(to, tile, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount));
|
||||
@ -53,6 +53,8 @@ public class LiquidJunction extends LiquidBlock{
|
||||
int dir = source.relativeTo(dest.x, dest.y);
|
||||
dir = (dir + 4) % 4;
|
||||
Tile to = dest.getNearby(dir);
|
||||
return to != null && to.block().hasLiquids && to.block().acceptLiquid(to, dest, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount));
|
||||
if(to == null) return false;
|
||||
to = to.target();
|
||||
return to != null && to.entity != null && to.block().hasLiquids && to.block().acceptLiquid(to, dest, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user