mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-28 07:22:21 -08:00
Crash fixes
This commit is contained in:
parent
62585a32b3
commit
061caaa092
4 changed files with 13 additions and 8 deletions
|
|
@ -35,7 +35,9 @@ public class EditorTile extends Tile{
|
|||
if(floor == type && overlayID() == 0) return;
|
||||
if(overlayID() != 0) op(OpType.overlay, overlayID());
|
||||
if(floor != type) op(OpType.floor, floor.id);
|
||||
super.setFloor(type);
|
||||
|
||||
this.floor = type;
|
||||
this.overlay = (Floor)Blocks.air;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -141,7 +143,7 @@ public class EditorTile extends Tile{
|
|||
|
||||
if(block == null) block = Blocks.air;
|
||||
if(floor == null) floor = (Floor)Blocks.air;
|
||||
|
||||
|
||||
Block block = block();
|
||||
|
||||
if(block.hasBuilding()){
|
||||
|
|
|
|||
|
|
@ -1758,7 +1758,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
}
|
||||
|
||||
boolean canTapPlayer(float x, float y){
|
||||
return player.within(x, y, playerSelectRange) && player.unit().stack.amount > 0;
|
||||
return player.within(x, y, playerSelectRange) && !player.dead() && player.unit().stack.amount > 0;
|
||||
}
|
||||
|
||||
/** Tries to begin mining a tile, returns true if successful. */
|
||||
|
|
@ -1788,7 +1788,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
}
|
||||
|
||||
boolean tryRepairDerelict(Tile selected){
|
||||
if(selected != null && !state.rules.editor && player.team() != Team.derelict && selected.build != null && selected.build.block.unlockedNow() && selected.build.team == Team.derelict &&
|
||||
if(!player.dead() && selected != null && !state.rules.editor && player.team() != Team.derelict && selected.build != null && selected.build.block.unlockedNow() && selected.build.team == Team.derelict &&
|
||||
Build.validPlace(selected.block(), player.team(), selected.build.tileX(), selected.build.tileY(), selected.build.rotation)){
|
||||
|
||||
player.unit().addBuild(new BuildPlan(selected.build.tileX(), selected.build.tileY(), selected.build.rotation, selected.block(), selected.build.config()));
|
||||
|
|
@ -1798,12 +1798,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
}
|
||||
|
||||
boolean canRepairDerelict(Tile tile){
|
||||
return tile != null && tile.build != null && !state.rules.editor && player.team() != Team.derelict && tile.build.team == Team.derelict && tile.build.block.unlockedNowHost() &&
|
||||
return tile != null && tile.build != null && !player.dead() && !state.rules.editor && player.team() != Team.derelict && tile.build.team == Team.derelict && tile.build.block.unlockedNowHost() &&
|
||||
Build.validPlace(tile.block(), player.team(), tile.build.tileX(), tile.build.tileY(), tile.build.rotation);
|
||||
}
|
||||
|
||||
boolean canMine(Tile tile){
|
||||
return !Core.scene.hasMouse()
|
||||
&& !player.dead()
|
||||
&& player.unit().validMine(tile)
|
||||
&& player.unit().acceptsItem(player.unit().getMineResult(tile))
|
||||
&& !((!Core.settings.getBool("doubletapmine") && tile.floor().playerUnmineable) && tile.overlay().itemDrop == null);
|
||||
|
|
|
|||
|
|
@ -193,8 +193,8 @@ public class ConstructBlock extends Block{
|
|||
@Override
|
||||
public void tapped(){
|
||||
//if the target is constructable, begin constructing
|
||||
if(current.isPlaceable()){
|
||||
if(control.input.buildWasAutoPaused && !control.input.isBuilding && player.isBuilder()){
|
||||
if(current.isPlaceable() && player.isBuilder()){
|
||||
if(control.input.buildWasAutoPaused && !control.input.isBuilding){
|
||||
control.input.isBuilding = true;
|
||||
}
|
||||
player.unit().addBuild(new BuildPlan(tile.x, tile.y, rotation, current, lastConfig), false);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ public class LaserTurret extends PowerTurret{
|
|||
super.setStats();
|
||||
|
||||
stats.remove(Stat.booster);
|
||||
stats.add(Stat.input, StatValues.boosters(reload, coolant.amount, coolantMultiplier, false, this::consumesLiquid));
|
||||
if(coolant != null){
|
||||
stats.add(Stat.input, StatValues.boosters(reload, coolant.amount, coolantMultiplier, false, this::consumesLiquid));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue