mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-10 12:49:37 +07:00
Fixed a minor cursor bug, changed drill/pump place verification
This commit is contained in:
parent
fab3704dbd
commit
ba67c01dd0
@ -29,7 +29,6 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
|
||||
private static Vector2 vector = new Vector2();
|
||||
|
||||
//private Interpolator interpolator = new Interpolator();
|
||||
private Team team;
|
||||
|
||||
public Timer timer = new Timer(3);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<Tile> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user