Misc cleanup

This commit is contained in:
Anuken
2018-12-09 23:28:36 -05:00
110 changed files with 1217 additions and 1229 deletions

View File

@@ -95,7 +95,7 @@ public abstract class InputHandler extends InputAdapter{
ItemTransfer.create(item,
player.x + Angles.trnsx(player.rotation + 180f, backTrns), player.y + Angles.trnsy(player.rotation + 180f, backTrns),
new Translator(tile.drawx() + stackTrns.x, tile.drawy() + stackTrns.y), () -> {
if(tile.block() != block || tile.entity == null) return;
if(tile.block() != block || tile.entity == null || tile.entity.items == null) return;
tile.block().handleStack(item, removed, tile, player);
remaining[1] -= removed;

View File

@@ -96,6 +96,9 @@ public class MobileInput extends InputHandler implements GestureListener{
TileEntity entity = tile.entity;
player.setMineTile(null);
player.target = entity;
}else if(tile != null && player.mech.canHeal && tile.entity != null && tile.getTeam() == player.getTeam() && tile.entity.damaged()){
player.setMineTile(null);
player.target = tile.entity;
}
}
}
@@ -221,11 +224,6 @@ public class MobileInput extends InputHandler implements GestureListener{
}
}).update(l -> l.setChecked(mode == breaking));
//rotate button
table.addImageButton("icon-arrow", "clear-partial", 16 * 2f, () -> rotation = Mathf.mod(rotation + 1, 4))
.update(i -> i.getImage().setRotationOrigin(rotation * 90, Align.center))
.visible(() -> recipe != null && recipe.result.rotate);
//cancel button
table.addImageButton("icon-cancel", "clear-partial", 16 * 2f, () -> {
player.clearBuilding();
@@ -233,6 +231,11 @@ public class MobileInput extends InputHandler implements GestureListener{
recipe = null;
}).visible(() -> player.isBuilding() || recipe != null || mode == breaking);
//rotate button
table.addImageButton("icon-arrow", "clear-partial", 16 * 2f, () -> rotation = Mathf.mod(rotation + 1, 4))
.update(i -> i.getImage().setRotationOrigin(rotation * 90, Align.center))
.visible(() -> recipe != null && recipe.result.rotate);
//confirm button
table.addImageButton("icon-check", "clear-partial", 16 * 2f, () -> {
for(PlaceRequest request : selection){
@@ -242,8 +245,10 @@ public class MobileInput extends InputHandler implements GestureListener{
if(tile != null){
if(!request.remove){
rotation = request.rotation;
Recipe before = recipe;
recipe = request.recipe;
tryPlaceBlock(tile.x, tile.y);
recipe = before;
}else{
tryBreakBlock(tile.x, tile.y);
}
@@ -596,6 +601,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;