Fixed MapIO not reading map stream fully
This commit is contained in:
@@ -21,7 +21,7 @@ import java.util.Arrays;
|
||||
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
/**Interface for units that build thing.*/
|
||||
/**Interface for units that build, break or mine things.*/
|
||||
public interface BlockBuilder {
|
||||
//temporary static final values
|
||||
Translator[] tmptr = {new Translator(), new Translator(), new Translator(), new Translator()};
|
||||
@@ -30,6 +30,12 @@ public interface BlockBuilder {
|
||||
/**Returns the queue for storing build requests.*/
|
||||
Queue<BuildRequest> getPlaceQueue();
|
||||
|
||||
/**Returns the tile this builder is currently mining.*/
|
||||
Tile getMineTile();
|
||||
|
||||
/**Sets the tile this builder is currently mining.*/
|
||||
void setMineTile(Tile tile);
|
||||
|
||||
/**Return whether this builder's place queue contains items.*/
|
||||
default boolean isBuilding(){
|
||||
return getPlaceQueue().size != 0;
|
||||
@@ -70,11 +76,18 @@ public interface BlockBuilder {
|
||||
return getPlaceQueue().size == 0 ? null : getPlaceQueue().first();
|
||||
}
|
||||
|
||||
/**Update building mechanism for this unit.*/
|
||||
/**Update building mechanism for this unit.
|
||||
* This includes mining.*/
|
||||
default void updateBuilding(Unit unit){
|
||||
BuildRequest current = getCurrentRequest();
|
||||
|
||||
if(current == null) return; //nothing to do here
|
||||
//update mining here
|
||||
if(current == null){
|
||||
if(getMineTile() != null){
|
||||
updateMining(unit);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Tile tile = world.tile(current.x, current.y);
|
||||
|
||||
@@ -138,6 +151,11 @@ public interface BlockBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/**Do not call directly.*/
|
||||
default void updateMining(Unit unit){
|
||||
|
||||
}
|
||||
|
||||
/**Draw placement effects for an entity.*/
|
||||
default void drawBuilding(Unit unit){
|
||||
Tile tile = world.tile(getCurrentRequest().x, getCurrentRequest().y);
|
||||
|
||||
@@ -63,6 +63,7 @@ public class Player extends Unit implements BlockBuilder {
|
||||
private boolean respawning;
|
||||
private float walktime;
|
||||
private Queue<BuildRequest> placeQueue = new Queue<>();
|
||||
private Tile mining;
|
||||
private Trail trail = new Trail(16);
|
||||
|
||||
public Player(){
|
||||
@@ -77,6 +78,17 @@ public class Player extends Unit implements BlockBuilder {
|
||||
|
||||
//region unit and event overrides, utility methods
|
||||
|
||||
|
||||
@Override
|
||||
public Tile getMineTile() {
|
||||
return mining;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMineTile(Tile tile) {
|
||||
this.mining = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getArmor() {
|
||||
return 0f;
|
||||
|
||||
Reference in New Issue
Block a user