Bugfixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package mindustry.world;
|
||||
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.modules.*;
|
||||
|
||||
@@ -19,7 +20,7 @@ public class CachedTile extends Tile{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void changed(){
|
||||
protected void changed(Team team){
|
||||
entity = null;
|
||||
|
||||
Block block = block();
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Tile implements Position{
|
||||
this.block = wall;
|
||||
|
||||
//update entity and create it if needed
|
||||
changed();
|
||||
changed(Team.derelict);
|
||||
}
|
||||
|
||||
public Tile(int x, int y, int floor, int overlay, int wall){
|
||||
@@ -163,7 +163,7 @@ public class Tile implements Position{
|
||||
preChanged();
|
||||
this.block = type;
|
||||
this.rotation = rotation == 0 ? 0 : (byte)Mathf.mod(rotation, 4);
|
||||
changed();
|
||||
changed(team);
|
||||
|
||||
if(entity != null){
|
||||
entity.team(team);
|
||||
@@ -510,7 +510,7 @@ public class Tile implements Position{
|
||||
}
|
||||
}
|
||||
|
||||
protected void changed(){
|
||||
protected void changed(Team team){
|
||||
if(entity != null){
|
||||
entity.remove();
|
||||
entity = null;
|
||||
@@ -519,7 +519,7 @@ public class Tile implements Position{
|
||||
Block block = block();
|
||||
|
||||
if(block.hasEntity()){
|
||||
entity = block.newEntity().init(this, block.update);
|
||||
entity = block.newEntity().init(this, team, block.update);
|
||||
entity.cons(new ConsumeModule(entity));
|
||||
if(block.hasItems) entity.items(new ItemModule());
|
||||
if(block.hasLiquids) entity.liquids(new LiquidModule());
|
||||
|
||||
@@ -11,7 +11,6 @@ public class Tiles implements Iterable<Tile>{
|
||||
public final int width, height;
|
||||
|
||||
private final Tile[] array;
|
||||
private final TileIterator iterator = new TileIterator();
|
||||
|
||||
public Tiles(int width, int height){
|
||||
this.array = new Tile[width * height];
|
||||
@@ -73,12 +72,8 @@ public class Tiles implements Iterable<Tile>{
|
||||
|
||||
@Override
|
||||
public Iterator<Tile> iterator(){
|
||||
if(iterator.index != 0 && iterator.index != array.length){
|
||||
iterator.index = 0;
|
||||
throw new IllegalArgumentException("Double iteration. " + iterator.index + " != " + array.length);
|
||||
}
|
||||
iterator.index = 0;
|
||||
return iterator;
|
||||
//iterating through the entire map is expensive anyway, so a new allocation doesn't make much of a difference
|
||||
return new TileIterator();
|
||||
}
|
||||
|
||||
private class TileIterator implements Iterator<Tile>{
|
||||
|
||||
@@ -42,7 +42,7 @@ public class LiquidSource extends Block{
|
||||
drawRequestConfigCenter(req, (Content)req.config, "center");
|
||||
}
|
||||
|
||||
class LiquidSourceEntity extends TileEntity{
|
||||
public class LiquidSourceEntity extends TileEntity{
|
||||
public @Nullable Liquid source = null;
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user