Various fixes / Placement visual improvements

This commit is contained in:
Anuken
2018-10-17 00:36:43 -04:00
parent 0e5db49b93
commit a29f95194d
8 changed files with 87 additions and 40 deletions

View File

@@ -94,15 +94,16 @@ public class DesktopInput extends InputHandler{
NormalizeDrawResult result = PlaceUtils.normalizeDrawArea(Blocks.air, selectX, selectY, cursorX, cursorY, false, maxLength, 1f);
NormalizeResult dresult = PlaceUtils.normalizeArea(selectX, selectY, cursorX, cursorY, rotation, false, maxLength);
Draw.color(Palette.remove);
for(int x = dresult.x; x <= dresult.x2; x++){
for(int y = dresult.y; y <= dresult.y2; y++){
Tile tile = world.tile(x, y);
if(tile == null || !validBreak(tile.x, tile.y)) continue;
tile = tile.target();
Lines.poly(tile.drawx(), tile.drawy(), 4, tile.block().size * tilesize / 2f, 45 + 15);
Draw.color(Palette.removeBack);
Lines.square(tile.drawx(), tile.drawy()-1, tile.block().size * tilesize / 2f);
Draw.color(Palette.remove);
Lines.square(tile.drawx(), tile.drawy(), tile.block().size * tilesize / 2f);
}
}

View File

@@ -8,7 +8,6 @@ import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.fx.EnvironmentFx;
import io.anuke.mindustry.core.World;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.effect.ItemTransfer;
@@ -227,6 +226,12 @@ public abstract class InputHandler extends InputAdapter{
frag.consume.hide();
}
if(!consumed && player.isBuilding()){
player.clearBuilding();
recipe = null;
return true;
}
return consumed;
}

View File

@@ -178,9 +178,11 @@ public class MobileInput extends InputHandler implements GestureListener{
request.recipe.result.rotate ? request.rotation * 90 : 0);
}
}else{
Draw.color(Palette.remove);
//draw removing request
Lines.poly(tile.drawx(), tile.drawy(), 4, tile.block().size * tilesize / 2f * request.scale, 45 + 15);
Draw.color(Palette.removeBack);
Lines.square(tile.drawx(), tile.drawy()-1, tile.block().size * tilesize / 2f);
Draw.color(Palette.remove);
Lines.square(tile.drawx(), tile.drawy(), tile.block().size * tilesize / 2f);
}
}
@@ -374,18 +376,16 @@ public class MobileInput extends InputHandler implements GestureListener{
NormalizeDrawResult result = PlaceUtils.normalizeDrawArea(Blocks.air, lineStartX, lineStartY, tileX, tileY, false, maxLength, 1f);
NormalizeResult dresult = PlaceUtils.normalizeArea(lineStartX, lineStartY, tileX, tileY, rotation, false, maxLength);
Draw.color(Palette.remove);
Draw.alpha(0.6f);
Draw.alpha(1f);
for(int x = dresult.x; x <= dresult.x2; x++){
for(int y = dresult.y; y <= dresult.y2; y++){
Tile other = world.tile(x, y);
if(other == null || !validBreak(other.x, other.y)) continue;
other = other.target();
Lines.poly(other.drawx(), other.drawy(), 4, other.block().size * tilesize / 2f, 45 + 15);
Draw.color(Palette.removeBack);
Lines.square(other.drawx(), other.drawy()-1, other.block().size * tilesize / 2f);
Draw.color(Palette.remove);
Lines.square(other.drawx(), other.drawy(), other.block().size * tilesize / 2f);
}
}