diff --git a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java index 6d4df2f08e..0e14bb685b 100644 --- a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java +++ b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java @@ -29,7 +29,6 @@ public class Bullet extends BulletEntity implements TeamTrait, SyncT private static Vector2 vector = new Vector2(); - //private Interpolator interpolator = new Interpolator(); private Team team; public Timer timer = new Timer(3); diff --git a/core/src/io/anuke/mindustry/input/DesktopInput.java b/core/src/io/anuke/mindustry/input/DesktopInput.java index 17502c86fe..8b5779b836 100644 --- a/core/src/io/anuke/mindustry/input/DesktopInput.java +++ b/core/src/io/anuke/mindustry/input/DesktopInput.java @@ -159,7 +159,11 @@ public class DesktopInput extends InputHandler{ cursorType = cursor.block().getCursor(cursor); - if(canMine(cursor)){ + if(isPlacing()){ + cursorType = hand; + } + + if(!isPlacing() && canMine(cursor)){ cursorType = drill; } diff --git a/core/src/io/anuke/mindustry/world/Build.java b/core/src/io/anuke/mindustry/world/Build.java index cd7d2ee3cf..2d841b11c1 100644 --- a/core/src/io/anuke/mindustry/world/Build.java +++ b/core/src/io/anuke/mindustry/world/Build.java @@ -191,7 +191,7 @@ 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) || 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) { return false; } } diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java index 2111868595..30f34bf3c6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java @@ -174,25 +174,18 @@ public class Drill extends Block{ } @Override - public boolean isLayer(Tile tile){ + public boolean canPlaceOn(Tile tile) { if(isMultiblock()){ for(Tile other : tile.getLinkedTiles(drawTiles)){ if(isValid(other)){ - return false; + return true; } } - return true; + return false; }else{ - return !isValid(tile); + return isValid(tile); } } - - @Override - public void drawLayer(Tile tile){ - Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f)); - Draw.rect("cross-" + size, tile.drawx(), tile.drawy()); - Draw.color(); - } @Override public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount) { @@ -204,6 +197,10 @@ public class Drill extends Block{ return new DrillEntity(); } + protected boolean isValid(Tile tile){ + return tile.floor().drops != null && tile.floor().drops.item.hardness <= tier; + } + public static class DrillEntity extends TileEntity{ public float progress; public int index; @@ -211,8 +208,4 @@ public class Drill extends Block{ public float drillTime; } - protected boolean isValid(Tile tile){ - return tile.floor().drops != null && tile.floor().drops.item.hardness <= tier; - } - } diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Pump.java b/core/src/io/anuke/mindustry/world/blocks/production/Pump.java index d8e0eb8fd1..b94622ee64 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Pump.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Pump.java @@ -1,17 +1,19 @@ package io.anuke.mindustry.world.blocks.production; import com.badlogic.gdx.graphics.g2d.TextureRegion; -import io.anuke.mindustry.type.Liquid; -import io.anuke.mindustry.world.meta.BlockGroup; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.graphics.Layer; +import io.anuke.mindustry.type.Liquid; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.LiquidBlock; +import io.anuke.mindustry.world.meta.BlockGroup; import io.anuke.ucore.core.Timers; import io.anuke.ucore.graphics.Draw; -import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Strings; public class Pump extends LiquidBlock{ + protected final Array drawTiles = new Array<>(); + protected float pumpAmount = 1f; public Pump(String name) { @@ -49,15 +51,17 @@ public class Pump extends LiquidBlock{ } @Override - public boolean isLayer(Tile tile) { - return tile.floor().liquidDrop == null; - } - - @Override - public void drawLayer(Tile tile){ - Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f)); - Draw.rect("cross-"+size, tile.drawx(), tile.drawy()); - Draw.color(); + public boolean canPlaceOn(Tile tile) { + if(isMultiblock()){ + for(Tile other : tile.getLinkedTiles(drawTiles)){ + if(isValid(other)){ + return true; + } + } + return false; + }else{ + return isValid(tile); + } } @Override @@ -72,4 +76,8 @@ public class Pump extends LiquidBlock{ tryDumpLiquid(tile); } + protected boolean isValid(Tile tile){ + return tile.floor().liquidDrop != null; + } + } diff --git a/kryonet/src/io/anuke/kryonet/KryoServer.java b/kryonet/src/io/anuke/kryonet/KryoServer.java index efcb788baa..c9edd752d0 100644 --- a/kryonet/src/io/anuke/kryonet/KryoServer.java +++ b/kryonet/src/io/anuke/kryonet/KryoServer.java @@ -39,6 +39,7 @@ import java.util.concurrent.CopyOnWriteArraySet; import static io.anuke.mindustry.Vars.headless; public class KryoServer implements ServerProvider { + final boolean tcpOnly = System.getProperty("java.version") == null; final Server server; final ByteSerializer serializer = new ByteSerializer(); final ByteBuffer buffer = ByteBuffer.allocate(4096); @@ -142,7 +143,11 @@ public class KryoServer implements ServerProvider { lastconnection = 0; connections.clear(); missing.clear(); - server.bind(port, port); + if(tcpOnly){ + server.bind(port); + }else{ + server.bind(port, port); + } webServer = new SocketServer(Vars.webPort); webServer.start();