diff --git a/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java b/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java index 8cd8d02a08..3b356f3251 100644 --- a/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java +++ b/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java @@ -73,7 +73,7 @@ public class TurretBullets extends BulletList implements ContentList{ super.hit(b); tile = tile.target(); - if(tile.getTeam() == b.getTeam() && !(tile.block() instanceof BuildBlock)){ + if(tile != null && tile.getTeam() == b.getTeam() && !(tile.block() instanceof BuildBlock)){ Effects.effect(BlockFx.healBlockFull, Palette.heal, tile.drawx(), tile.drawy(), tile.block().size); tile.entity.healBy(healPercent / 100f * tile.entity.maxHealth()); } diff --git a/core/src/io/anuke/mindustry/input/MobileInput.java b/core/src/io/anuke/mindustry/input/MobileInput.java index 6187b738d9..314d20819e 100644 --- a/core/src/io/anuke/mindustry/input/MobileInput.java +++ b/core/src/io/anuke/mindustry/input/MobileInput.java @@ -598,6 +598,10 @@ public class MobileInput extends InputHandler implements GestureListener{ showGuide("construction"); } + if(recipe == null && mode == placing){ + mode = none; + } + //automatically switch to placing after a new recipe is selected if(lastRecipe != recipe && mode == breaking && recipe != null){ mode = placing; diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java index 0ed4a6d9b6..d3ad336dc2 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java @@ -36,9 +36,11 @@ public class PlacementFragment extends Fragment{ Tile hoverTile; Table blockTable, toggler, topTable; boolean shown = true; + boolean lastGround; public PlacementFragment(){ Events.on(WorldLoadGraphicsEvent.class, event -> { + currentCategory = Category.turret; Group group = toggler.getParent(); toggler.remove(); build(group); @@ -109,13 +111,14 @@ public class PlacementFragment extends Fragment{ frame.table("button-edge-2", top -> { topTable = top; top.add(new Table()).growX().update(topTable -> { - if((tileDisplayBlock() == null && lastDisplay == getSelected()) || - (tileDisplayBlock() != null && lastDisplay == tileDisplayBlock())) return; + if((tileDisplayBlock() == null && lastDisplay == getSelected() && !lastGround) || + (tileDisplayBlock() != null && lastDisplay == tileDisplayBlock() && lastGround)) return; topTable.clear(); topTable.top().left().margin(5); lastDisplay = getSelected(); + lastGround = tileDisplayBlock() != null; if(lastDisplay != null){ //show selected recipe topTable.table(header -> {