Fixed a minor cursor bug, changed drill/pump place verification
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user