This commit is contained in:
Anuken
2019-04-25 21:53:17 -04:00
parent 9f5dc7f091
commit 6e1fb71194
5 changed files with 15 additions and 23 deletions

View File

@@ -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++;

View File

@@ -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();
}
}

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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){