a bit less broken but still broken

This commit is contained in:
Anuken
2019-05-05 19:05:46 -04:00
parent 35b158dba7
commit bf073a84c8
57 changed files with 274 additions and 445 deletions

View File

@@ -96,9 +96,8 @@ public class DesktopInput extends InputHandler{
for(int x = dresult.x; x <= dresult.x2; x++){
for(int y = dresult.y; y <= dresult.y2; y++){
Tile tile = world.tile(x, y);
Tile tile = world.ltile(x, y);
if(tile == null || !validBreak(tile.x, tile.y)) continue;
tile = tile.target();
Draw.color(Pal.removeBack);
Lines.square(tile.drawx(), tile.drawy() - 1, tile.block().size * tilesize / 2f - 1);
@@ -175,7 +174,7 @@ public class DesktopInput extends InputHandler{
Tile cursor = tileAt(Core.input.mouseX(), Core.input.mouseY());
if(cursor != null){
cursor = cursor.target();
cursor = cursor.link();
cursorType = cursor.block().getCursor(cursor);
@@ -257,7 +256,7 @@ public class DesktopInput extends InputHandler{
}
if(selected != null){
tryDropItems(selected.target(), Core.input.mouseWorld().x, Core.input.mouseWorld().y);
tryDropItems(selected.link(), Core.input.mouseWorld().x, Core.input.mouseWorld().y);
}
mode = none;

View File

@@ -154,7 +154,7 @@ public abstract class InputHandler implements InputProcessor{
/** Handles tile tap events that are not platform specific. */
boolean tileTapped(Tile tile){
tile = tile.target();
tile = tile.link();
boolean consumed = false, showedInventory = false;
@@ -331,7 +331,7 @@ public abstract class InputHandler implements InputProcessor{
}
public void breakBlock(int x, int y){
Tile tile = world.tile(x, y).target();
Tile tile = world.ltile(x, y);
player.addBuildRequest(new BuildRequest(tile.x, tile.y));
}

View File

@@ -87,8 +87,7 @@ public class MobileInput extends InputHandler implements GestureListener{
player.setMineTile(null);
player.target = unit;
}else{
Tile tile = world.tileWorld(x, y);
if(tile != null) tile = tile.target();
Tile tile = world.ltileWorld(x, y);
if(tile != null && tile.synthetic() && state.teams.areEnemies(player.getTeam(), tile.getTeam())){
TileEntity entity = tile.entity;
@@ -408,9 +407,8 @@ public class MobileInput extends InputHandler implements GestureListener{
for(int x = dresult.x; x <= dresult.x2; x++){
for(int y = dresult.y; y <= dresult.y2; y++){
Tile other = world.tile(x, y);
Tile other = world.ltile(x, y);
if(other == null || !validBreak(other.x, other.y)) continue;
other = other.target();
Draw.color(Pal.removeBack);
Lines.square(other.drawx(), other.drawy() - 1, other.block().size * tilesize / 2f - 1);
@@ -506,12 +504,10 @@ public class MobileInput extends InputHandler implements GestureListener{
int wx = lineStartX + x * Mathf.sign(tileX - lineStartX);
int wy = lineStartY + y * Mathf.sign(tileY - lineStartY);
Tile tar = world.tile(wx, wy);
Tile tar = world.ltile(wx, wy);
if(tar == null) continue;
tar = tar.target();
if(!hasRequest(world.tile(tar.x, tar.y)) && validBreak(tar.x, tar.y)){
PlaceRequest request = new PlaceRequest(tar.x, tar.y);
request.scale = 1f;
@@ -527,7 +523,7 @@ public class MobileInput extends InputHandler implements GestureListener{
if(tile == null) return false;
tryDropItems(tile.target(), Core.input.mouseWorld(screenX, screenY).x, Core.input.mouseWorld(screenX, screenY).y);
tryDropItems(tile.link(), Core.input.mouseWorld(screenX, screenY).x, Core.input.mouseWorld(screenX, screenY).y);
}
return false;
}
@@ -577,11 +573,11 @@ public class MobileInput extends InputHandler implements GestureListener{
}else if(mode == placing && isPlacing() && validPlace(cursor.x, cursor.y, block, rotation) && !checkOverlapPlacement(cursor.x, cursor.y, block)){
//add to selection queue if it's a valid place position
selection.add(lastPlaced = new PlaceRequest(cursor.x, cursor.y, block, rotation));
}else if(mode == breaking && validBreak(cursor.target().x, cursor.target().y) && !hasRequest(cursor.target())){
}else if(mode == breaking && validBreak(cursor.link().x, cursor.link().y) && !hasRequest(cursor.link())){
//add to selection queue if it's a valid BREAK position
cursor = cursor.target();
cursor = cursor.link();
selection.add(new PlaceRequest(cursor.x, cursor.y));
}else if(!canTapPlayer(worldx, worldy) && !tileTapped(cursor.target())){
}else if(!canTapPlayer(worldx, worldy) && !tileTapped(cursor.link())){
tryBeginMine(cursor);
}