diff --git a/core/src/io/anuke/mindustry/editor/EditorTool.java b/core/src/io/anuke/mindustry/editor/EditorTool.java index db74684eea..b4cb882ce2 100644 --- a/core/src/io/anuke/mindustry/editor/EditorTool.java +++ b/core/src/io/anuke/mindustry/editor/EditorTool.java @@ -4,8 +4,7 @@ import io.anuke.arc.Core; import io.anuke.arc.collection.IntArray; import io.anuke.arc.function.IntPositionConsumer; import io.anuke.arc.input.KeyCode; -import io.anuke.arc.util.Pack; -import io.anuke.arc.util.Structs; +import io.anuke.arc.util.*; import io.anuke.mindustry.content.Blocks; import io.anuke.mindustry.world.*; import io.anuke.mindustry.world.blocks.*; @@ -143,7 +142,6 @@ public enum EditorTool{ }else{ //normal fill int x1; - boolean spanAbove, spanBelow; stack.clear(); @@ -157,21 +155,21 @@ public enum EditorTool{ x1 = x; while(x1 >= 0 && eq(x1, y)) x1--; x1++; - spanAbove = spanBelow = false; + boolean spanAbove = false, spanBelow = false; while(x1 < width && eq(x1, y)){ writer.accept(x1, y); if(!spanAbove && y > 0 && eq(x1, y - 1)){ stack.add(Pos.get(x1, y - 1)); spanAbove = true; - }else if(spanAbove && eq(x1, y - 1)){ + }else if(spanAbove && !eq(x1, y - 1)){ spanAbove = false; } if(!spanBelow && y < height - 1 && eq(x1, y + 1)){ stack.add(Pos.get(x1, y + 1)); spanBelow = true; - }else if(spanBelow && y < height - 1 && eq(x1, y + 1)){ + }else if(spanBelow && y < height - 1 && !eq(x1, y + 1)){ spanBelow = false; } x1++; diff --git a/core/src/io/anuke/mindustry/entities/type/TileEntity.java b/core/src/io/anuke/mindustry/entities/type/TileEntity.java index 438902af92..a02be3653b 100644 --- a/core/src/io/anuke/mindustry/entities/type/TileEntity.java +++ b/core/src/io/anuke/mindustry/entities/type/TileEntity.java @@ -243,7 +243,6 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{ Events.fire(new BlockDestroyEvent(tile)); block.onDestroyed(tile); world.removeBlock(tile); - block.afterDestroyed(tile, this); remove(); } } diff --git a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java index 7f0843c058..053deef1ed 100644 --- a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java @@ -194,11 +194,11 @@ public class BlockRenderer implements Disposable{ if(block.expanded || !expanded){ - if(block.layer != null && block.isLayer(tile)){ + if(block.layer != null){ addRequest(tile, block.layer); } - if(block.layer2 != null && block.isLayer2(tile)){ + if(block.layer2 != null){ addRequest(tile, block.layer2); } diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index d1caf70b5c..513b4caf5f 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -192,14 +192,6 @@ public class Block extends BlockStorage{ return progressIncrease; } - public boolean isLayer(Tile tile){ - return true; - } - - public boolean isLayer2(Tile tile){ - return true; - } - public void drawLayer(Tile tile){ } @@ -274,7 +266,6 @@ public class Block extends BlockStorage{ /** Called when a unit that spawned at this tile is removed. */ public void unitRemoved(Tile tile, Unit unit){ - } /** Returns whether ot not this block can be place on the specified tile. */ @@ -476,11 +467,6 @@ public class Block extends BlockStorage{ return (hasItems && itemCapacity > 0); } - /** Called after the block is destroyed and removed. */ - public void afterDestroyed(Tile tile, TileEntity entity){ - - } - /** Called when the block is destroyed. */ public void onDestroyed(Tile tile){ float x = tile.worldx(), y = tile.worldy(); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java index 6caa16390e..c89ef0c4cf 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java @@ -38,6 +38,15 @@ public class ItemTurret extends CooledTurret{ stats.add(BlockStat.ammo, new AmmoListValue<>(ammo)); } + @Override + public void onProximityAdded(Tile tile){ + super.onProximityAdded(tile); + + //add first ammo item to cheaty blocks so they can shoot properly + if(tile.isEnemyCheat() && ammo.size > 0){ + handleItem(ammo.entries().next().key, tile, tile); + } + } @Override public void displayBars(Tile tile, Table bars){