This commit is contained in:
Anuken
2018-12-03 10:33:50 -05:00
parent 9c01256029
commit 6d59fe3080
3 changed files with 10 additions and 3 deletions
@@ -73,7 +73,7 @@ public class TurretBullets extends BulletList implements ContentList{
super.hit(b); super.hit(b);
tile = tile.target(); 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); Effects.effect(BlockFx.healBlockFull, Palette.heal, tile.drawx(), tile.drawy(), tile.block().size);
tile.entity.healBy(healPercent / 100f * tile.entity.maxHealth()); tile.entity.healBy(healPercent / 100f * tile.entity.maxHealth());
} }
@@ -598,6 +598,10 @@ public class MobileInput extends InputHandler implements GestureListener{
showGuide("construction"); showGuide("construction");
} }
if(recipe == null && mode == placing){
mode = none;
}
//automatically switch to placing after a new recipe is selected //automatically switch to placing after a new recipe is selected
if(lastRecipe != recipe && mode == breaking && recipe != null){ if(lastRecipe != recipe && mode == breaking && recipe != null){
mode = placing; mode = placing;
@@ -36,9 +36,11 @@ public class PlacementFragment extends Fragment{
Tile hoverTile; Tile hoverTile;
Table blockTable, toggler, topTable; Table blockTable, toggler, topTable;
boolean shown = true; boolean shown = true;
boolean lastGround;
public PlacementFragment(){ public PlacementFragment(){
Events.on(WorldLoadGraphicsEvent.class, event -> { Events.on(WorldLoadGraphicsEvent.class, event -> {
currentCategory = Category.turret;
Group group = toggler.getParent(); Group group = toggler.getParent();
toggler.remove(); toggler.remove();
build(group); build(group);
@@ -109,13 +111,14 @@ public class PlacementFragment extends Fragment{
frame.table("button-edge-2", top -> { frame.table("button-edge-2", top -> {
topTable = top; topTable = top;
top.add(new Table()).growX().update(topTable -> { top.add(new Table()).growX().update(topTable -> {
if((tileDisplayBlock() == null && lastDisplay == getSelected()) || if((tileDisplayBlock() == null && lastDisplay == getSelected() && !lastGround) ||
(tileDisplayBlock() != null && lastDisplay == tileDisplayBlock())) return; (tileDisplayBlock() != null && lastDisplay == tileDisplayBlock() && lastGround)) return;
topTable.clear(); topTable.clear();
topTable.top().left().margin(5); topTable.top().left().margin(5);
lastDisplay = getSelected(); lastDisplay = getSelected();
lastGround = tileDisplayBlock() != null;
if(lastDisplay != null){ //show selected recipe if(lastDisplay != null){ //show selected recipe
topTable.table(header -> { topTable.table(header -> {