Synchronized tile modification with updating
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Sat Feb 17 13:59:09 EST 2018
|
#Sat Feb 17 14:39:13 EST 2018
|
||||||
version=beta
|
version=beta
|
||||||
androidBuildCode=235
|
androidBuildCode=235
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.3
|
code=3.3
|
||||||
build=23
|
build=custom build
|
||||||
|
|||||||
@@ -106,17 +106,19 @@ public class TileEntity extends Entity{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
if(health != 0 && health < tile.block().health && !(tile.block() instanceof Wall) &&
|
synchronized (tile) {
|
||||||
Mathf.chance(0.009f*Timers.delta()*(1f-health/tile.block().health))){
|
if (health != 0 && health < tile.block().health && !(tile.block() instanceof Wall) &&
|
||||||
|
Mathf.chance(0.009f * Timers.delta() * (1f - health / tile.block().health))) {
|
||||||
|
|
||||||
Effects.effect(Fx.smoke, x+Mathf.range(4), y+Mathf.range(4));
|
Effects.effect(Fx.smoke, x + Mathf.range(4), y + Mathf.range(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(health <= 0){
|
if (health <= 0) {
|
||||||
onDeath();
|
onDeath();
|
||||||
|
}
|
||||||
|
|
||||||
|
tile.block().update(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
tile.block().update(tile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int totalItems(){
|
public int totalItems(){
|
||||||
|
|||||||
@@ -260,18 +260,20 @@ public class Tile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void changed(){
|
public void changed(){
|
||||||
if(entity != null){
|
synchronized (this) {
|
||||||
entity.remove();
|
if (entity != null) {
|
||||||
entity = null;
|
entity.remove();
|
||||||
}
|
entity = null;
|
||||||
|
}
|
||||||
Block block = block();
|
|
||||||
|
|
||||||
if(block.destructible || block.update){
|
|
||||||
entity = block.getEntity().init(this, block.update);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateOcclusion();
|
Block block = block();
|
||||||
|
|
||||||
|
if (block.destructible || block.update) {
|
||||||
|
entity = block.getEntity().init(this, block.update);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateOcclusion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ public class Conveyor extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
if(tile.entity == null) return false;
|
|
||||||
int direction = source == null ? 0 : Math.abs(source.relativeTo(tile.x, tile.y) - tile.getRotation());
|
int direction = source == null ? 0 : Math.abs(source.relativeTo(tile.x, tile.y) - tile.getRotation());
|
||||||
float minitem = tile.<ConveyorEntity>entity().minitem;
|
float minitem = tile.<ConveyorEntity>entity().minitem;
|
||||||
return (((direction == 0) && minitem > 0.05f) ||
|
return (((direction == 0) && minitem > 0.05f) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user