Added deselection, fixed pump placement and junction skipping
This commit is contained in:
@@ -46,7 +46,6 @@ public class Blocks extends BlockList implements ContentList{
|
||||
}};
|
||||
|
||||
deepwater = new Floor("deepwater") {{
|
||||
placeableOn = false;
|
||||
liquidColor = Color.valueOf("546bb3");
|
||||
speedMultiplier = 0.2f;
|
||||
variants = 0;
|
||||
@@ -59,7 +58,6 @@ public class Blocks extends BlockList implements ContentList{
|
||||
}};
|
||||
|
||||
water = new Floor("water") {{
|
||||
placeableOn = false;
|
||||
liquidColor = Color.valueOf("546bb3");
|
||||
speedMultiplier = 0.5f;
|
||||
variants = 0;
|
||||
@@ -71,7 +69,6 @@ public class Blocks extends BlockList implements ContentList{
|
||||
}};
|
||||
|
||||
lava = new Floor("lava") {{
|
||||
placeableOn = false;
|
||||
liquidColor = Color.valueOf("ed5334");
|
||||
speedMultiplier = 0.2f;
|
||||
damageTaken = 0.1f;
|
||||
@@ -84,7 +81,6 @@ public class Blocks extends BlockList implements ContentList{
|
||||
}};
|
||||
|
||||
oil = new Floor("oil") {{
|
||||
placeableOn = false;
|
||||
liquidColor = Color.valueOf("292929");
|
||||
status = StatusEffects.tarred;
|
||||
statusIntensity = 1f;
|
||||
|
||||
@@ -9,10 +9,9 @@ import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.world.meta.BlockBar;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.meta.BlockBar;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.function.Callable;
|
||||
@@ -91,12 +90,6 @@ public class OverlayRenderer {
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
if (Inputs.keyDown("block_info") && target.block().isAccessible()) {
|
||||
Draw.color(Palette.accent);
|
||||
Lines.crect(target.drawx(), target.drawy(), target.block().size * tilesize, target.block().size * tilesize);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
if (target.entity != null) {
|
||||
int[] values = {0, 0};
|
||||
Tile t = target;
|
||||
|
||||
@@ -33,7 +33,6 @@ public class DefaultKeybinds {
|
||||
"menu", Gdx.app.getType() == ApplicationType.Android ? Input.BACK : Input.ESCAPE,
|
||||
"pause", Input.SPACE,
|
||||
"toggle_menus", Input.C,
|
||||
"block_info", Input.CONTROL_LEFT,
|
||||
"item_withdraw", Input.SHIFT_LEFT,
|
||||
new Category("Multiplayer"),
|
||||
"player_list", Input.TAB,
|
||||
|
||||
@@ -205,6 +205,10 @@ public class DesktopInput extends InputHandler{
|
||||
selectY = cursor.y;
|
||||
mode = breaking;
|
||||
}else if(button == Buttons.MIDDLE){ //middle button = cancel placing
|
||||
if(recipe == null){
|
||||
player.clearBuilding();
|
||||
}
|
||||
|
||||
recipe = null;
|
||||
mode = none;
|
||||
}
|
||||
|
||||
@@ -161,6 +161,8 @@ public class BlocksFragment implements Fragment{
|
||||
Element e = Core.scene.hit(Graphics.mouse().x, Graphics.mouse().y, true);
|
||||
if(e != null && e.isDescendantOf(pane)){
|
||||
Core.scene.setScrollFocus(pane);
|
||||
}else if(Core.scene.getScrollFocus() == pane){
|
||||
Core.scene.setScrollFocus(null);
|
||||
}
|
||||
|
||||
if(lastCategory == cat){
|
||||
|
||||
@@ -11,6 +11,7 @@ import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.type.Recipe;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
@@ -20,6 +21,8 @@ import io.anuke.ucore.scene.actions.Actions;
|
||||
import io.anuke.ucore.scene.builders.imagebutton;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
import io.anuke.ucore.scene.event.InputEvent;
|
||||
import io.anuke.ucore.scene.event.InputListener;
|
||||
import io.anuke.ucore.scene.event.Touchable;
|
||||
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
||||
import io.anuke.ucore.scene.ui.Image;
|
||||
@@ -130,6 +133,7 @@ public class HudFragment implements Fragment{
|
||||
aright();
|
||||
|
||||
new table("button"){{
|
||||
Table table = get();
|
||||
margin(5);
|
||||
marginBottom(10);
|
||||
TextureRegionDrawable draw = new TextureRegionDrawable(new TextureRegion());
|
||||
@@ -143,7 +147,21 @@ public class HudFragment implements Fragment{
|
||||
}
|
||||
};
|
||||
image.setDrawable(draw);
|
||||
table.addListener(new InputListener(){
|
||||
public boolean scrolled (InputEvent event, float x, float y, int amount) {
|
||||
renderer.minimap().zoomBy(amount);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
image.update(() -> {
|
||||
|
||||
Element e = Core.scene.hit(Graphics.mouse().x, Graphics.mouse().y, true);
|
||||
if(e != null && e.isDescendantOf(table)){
|
||||
Core.scene.setScrollFocus(table);
|
||||
}else if(Core.scene.getScrollFocus() == table){
|
||||
Core.scene.setScrollFocus(null);
|
||||
}
|
||||
|
||||
if (renderer.minimap().getTexture() == null) {
|
||||
draw.getRegion().setRegion(Draw.region("white"));
|
||||
} else {
|
||||
|
||||
@@ -74,6 +74,8 @@ public class Block extends BaseBlock implements UnlockableContent{
|
||||
public float baseExplosiveness = 0f;
|
||||
/**whether to display a different shadow per variant*/
|
||||
public boolean varyShadow = false;
|
||||
/**whether this block can be placed on liquids.*/
|
||||
public boolean floating = true;
|
||||
/**number of block variants, 0 to disable*/
|
||||
public int variants = 0;
|
||||
/**stuff that drops when broken*/
|
||||
|
||||
@@ -191,15 +191,20 @@ public class Build {
|
||||
for (int dx = 0; dx < type.size; dx++) {
|
||||
for (int dy = 0; dy < type.size; dy++) {
|
||||
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
|
||||
if (other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) || !type.canPlaceOn(other) || other.cliffs != 0 || !other.floor().placeableOn) {
|
||||
if (other == null || (other.block() != Blocks.air && !other.block().alwaysReplace)
|
||||
|| !type.canPlaceOn(other) || other.cliffs != 0 || !other.floor().placeableOn ||
|
||||
(tile.floor().liquidDrop != null && !type.floating)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return (tile.getTeam() == Team.none || tile.getTeam() == team) && tile.floor().placeableOn && tile.cliffs == 0
|
||||
&& ((type.canReplace(tile.block()) && !(type == tile.block() && rotation == tile.getRotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air)
|
||||
return (tile.getTeam() == Team.none || tile.getTeam() == team)
|
||||
&& (tile.floor().liquidDrop == null || type.floating)
|
||||
&& tile.floor().placeableOn && tile.cliffs == 0
|
||||
&& ((type.canReplace(tile.block())
|
||||
&& !(type == tile.block() && rotation == tile.getRotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air)
|
||||
&& tile.block().isMultiblock() == type.isMultiblock() && type.canPlaceOn(tile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import io.anuke.mindustry.gen.CallBlocks;
|
||||
import io.anuke.mindustry.graphics.Layer;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.mindustry.input.CursorType;
|
||||
import io.anuke.mindustry.net.In;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Recipe;
|
||||
@@ -38,14 +39,16 @@ public class BreakBlock extends Block {
|
||||
size = Integer.parseInt(name.charAt(name.length()-1) + "");
|
||||
health = 1;
|
||||
layer = Layer.placement;
|
||||
configurable = true;
|
||||
consumesTap = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tapped(Tile tile, Player player) {
|
||||
BreakEntity entity = tile.entity();
|
||||
public CursorType getCursor(Tile tile) {
|
||||
return CursorType.hand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tapped(Tile tile, Player player) {
|
||||
player.clearBuilding();
|
||||
player.addBuildRequest(new BuildRequest(tile.x, tile.y));
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import io.anuke.mindustry.gen.CallBlocks;
|
||||
import io.anuke.mindustry.graphics.Layer;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.mindustry.input.CursorType;
|
||||
import io.anuke.mindustry.net.In;
|
||||
import io.anuke.mindustry.type.Recipe;
|
||||
import io.anuke.mindustry.world.BarType;
|
||||
@@ -37,10 +38,14 @@ public class BuildBlock extends Block {
|
||||
size = Integer.parseInt(name.charAt(name.length()-1) + "");
|
||||
health = 1;
|
||||
layer = Layer.placement;
|
||||
configurable = true;
|
||||
consumesTap = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CursorType getCursor(Tile tile) {
|
||||
return CursorType.hand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tapped(Tile tile, Player player) {
|
||||
BuildEntity entity = tile.entity();
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Junction extends Block{
|
||||
Tile dest = tile.getNearby(direction);
|
||||
|
||||
if(dest == null || !dest.block().acceptItem(item, dest, tile)){
|
||||
if(buffer.index > 1){
|
||||
if(buffer.index > 1 && Bits.getRightShort(Bits.getRightInt(buffer.items[1])) != direction){
|
||||
System.arraycopy(buffer.items, 1, buffer.items, 0, buffer.index - 1);
|
||||
buffer.index --;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class Pump extends LiquidBlock{
|
||||
liquidFlowFactor = 3f;
|
||||
group = BlockGroup.liquids;
|
||||
liquidRegion = "pump-liquid";
|
||||
floating = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user