Remove canProduce as a method
This commit is contained in:
@@ -10,13 +10,11 @@ import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.scene.ui.layout.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.pooling.*;
|
||||
import io.anuke.mindustry.content.TypeIDs;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.io.*;
|
||||
import io.anuke.mindustry.ui.*;
|
||||
import io.anuke.mindustry.ui.dialogs.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
@@ -151,6 +149,10 @@ public class MinimapRenderer implements Disposable{
|
||||
private int colorFor(Tile tile){
|
||||
if(tile == null) return 0;
|
||||
tile = tile.link();
|
||||
int bc = tile.block().minimapColor(tile);
|
||||
if(bc != 0){
|
||||
return bc;
|
||||
}
|
||||
return Tmp.c1.set(MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.getTeam())).mul(tile.block().cacheLayer == CacheLayer.walls ? 1f - tile.rotation() / 4f : 1f).rgba();
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ public class Block extends BlockStorage{
|
||||
|
||||
/** @return whether this block should play its idle sound.*/
|
||||
public boolean shouldIdleSound(Tile tile){
|
||||
return canProduce(tile);
|
||||
return shouldConsume(tile);
|
||||
}
|
||||
|
||||
public void drawLayer(Tile tile){
|
||||
@@ -716,6 +716,11 @@ public class Block extends BlockStorage{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
/** @return a custom minimap color for this tile, or 0 to use default colors. */
|
||||
public int minimapColor(Tile tile){
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void drawRequestConfigTop(BuildRequest req, Eachable<BuildRequest> list){
|
||||
|
||||
}
|
||||
|
||||
@@ -266,9 +266,4 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns whether this block's inventory has space and is ready for production. */
|
||||
public boolean canProduce(Tile tile){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,11 @@ public class Sorter extends Block{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minimapColor(Tile tile){
|
||||
return tile.<SorterEntity>entity().sortItem == null ? 0 : tile.<SorterEntity>entity().sortItem.color.rgba();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
Tile to = getTileTarget(item, tile, source, false);
|
||||
|
||||
@@ -129,7 +129,7 @@ public class Drill extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProduce(Tile tile){
|
||||
public boolean shouldConsume(Tile tile){
|
||||
return tile.entity.items.total() < itemCapacity;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Fracker extends SolidPump{
|
||||
public void drawCracks(Tile tile){}
|
||||
|
||||
@Override
|
||||
public boolean canProduce(Tile tile){
|
||||
public boolean shouldConsume(Tile tile){
|
||||
return tile.entity.liquids.get(result) < liquidCapacity - 0.01f;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ public class GenericCrafter extends Block{
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canProduce(Tile tile){
|
||||
public boolean shouldConsume(Tile tile){
|
||||
if(outputItem != null && tile.entity.items.get(outputItem.item) >= itemCapacity){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Separator extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProduce(Tile tile){
|
||||
public boolean shouldConsume(Tile tile){
|
||||
return tile.entity.items.total() < itemCapacity;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,16 +186,11 @@ public class UnitFactory extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProduce(Tile tile){
|
||||
public boolean shouldConsume(Tile tile){
|
||||
UnitFactoryEntity entity = tile.entity();
|
||||
return entity.spawned < maxSpawn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldConsume(Tile tile){
|
||||
return canProduce(tile);
|
||||
}
|
||||
|
||||
public static class UnitFactoryEntity extends TileEntity{
|
||||
float buildTime;
|
||||
float time;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ConsumeModule extends BlockModule{
|
||||
}
|
||||
|
||||
public boolean valid(){
|
||||
return valid && entity.block.canProduce(entity.tile);
|
||||
return valid && entity.block.shouldConsume(entity.tile);
|
||||
}
|
||||
|
||||
public boolean optionalValid(){
|
||||
|
||||
Reference in New Issue
Block a user