Synchronized tile modification with updating

This commit is contained in:
Anuken
2018-02-17 16:04:09 -05:00
parent 30d0d7715a
commit a79dfe29ef
4 changed files with 25 additions and 22 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Sat Feb 17 13:59:09 EST 2018
#Sat Feb 17 14:39:13 EST 2018
version=beta
androidBuildCode=235
name=Mindustry
code=3.3
build=23
build=custom build
@@ -106,6 +106,7 @@ public class TileEntity extends Entity{
@Override
public void update(){
synchronized (tile) {
if (health != 0 && health < tile.block().health && !(tile.block() instanceof Wall) &&
Mathf.chance(0.009f * Timers.delta() * (1f - health / tile.block().health))) {
@@ -118,6 +119,7 @@ public class TileEntity extends Entity{
tile.block().update(tile);
}
}
public int totalItems(){
int sum = 0;
@@ -260,6 +260,7 @@ public class Tile{
}
public void changed(){
synchronized (this) {
if (entity != null) {
entity.remove();
entity = null;
@@ -273,6 +274,7 @@ public class Tile{
updateOcclusion();
}
}
@Override
public String toString(){
@@ -143,7 +143,6 @@ public class Conveyor extends Block{
@Override
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());
float minitem = tile.<ConveyorEntity>entity().minitem;
return (((direction == 0) && minitem > 0.05f) ||