mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-10 07:47:25 +07:00
Compilation cleanup
This commit is contained in:
@ -3,11 +3,17 @@ package io.anuke.mindustry.content;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Lines;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.graphics.CacheLayer;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.mindustry.type.Category;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.LiquidStack;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
@ -370,7 +376,7 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.crafting, ItemStack.with(Items.copper, 150, Items.lead, 60));
|
||||
|
||||
craftEffect = Fx.pulverizeMedium;
|
||||
outputItem = Items.graphite;
|
||||
outputItem = new ItemStack(Items.graphite, 1);
|
||||
craftTime = 90f;
|
||||
size = 2;
|
||||
hasItems = true;
|
||||
@ -382,7 +388,7 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.crafting, ItemStack.with(Items.titanium, 200, Items.silicon, 50, Items.lead, 200, Items.graphite, 100));
|
||||
|
||||
craftEffect = Fx.pulverizeMedium;
|
||||
outputItem = Items.graphite;
|
||||
outputItem = new ItemStack(Items.graphite, 2);
|
||||
craftTime = 30f;
|
||||
size = 3;
|
||||
hasItems = true;
|
||||
@ -390,14 +396,14 @@ public class Blocks implements ContentList{
|
||||
hasPower = true;
|
||||
|
||||
consumes.power(2f);
|
||||
consumes.item(Items.coal, 2);
|
||||
consumes.item(Items.coal, 4);
|
||||
consumes.liquid(Liquids.water, 0.1f);
|
||||
}};
|
||||
|
||||
siliconSmelter = new PowerSmelter("silicon-smelter"){{
|
||||
siliconSmelter = new GenericSmelter("silicon-smelter"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.lead, 50));
|
||||
craftEffect = Fx.smeltsmoke;
|
||||
output = Items.silicon;
|
||||
outputItem = new ItemStack(Items.silicon, 1);
|
||||
craftTime = 40f;
|
||||
size = 2;
|
||||
hasLiquids = false;
|
||||
@ -407,10 +413,10 @@ public class Blocks implements ContentList{
|
||||
consumes.power(0.50f);
|
||||
}};
|
||||
|
||||
kiln = new PowerSmelter("kiln"){{
|
||||
kiln = new GenericSmelter("kiln"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.copper, 120, Items.graphite, 60, Items.lead, 60));
|
||||
craftEffect = Fx.smeltsmoke;
|
||||
output = Items.metaglass;
|
||||
outputItem = new ItemStack(Items.metaglass, 1);
|
||||
craftTime = 30f;
|
||||
size = 2;
|
||||
hasPower = hasItems = true;
|
||||
@ -425,7 +431,7 @@ public class Blocks implements ContentList{
|
||||
hasItems = true;
|
||||
liquidCapacity = 60f;
|
||||
craftTime = 60f;
|
||||
outputItem = Items.plastanium;
|
||||
outputItem = new ItemStack(Items.plastanium, 1);
|
||||
size = 2;
|
||||
health = 320;
|
||||
hasPower = hasLiquids = true;
|
||||
@ -437,21 +443,55 @@ public class Blocks implements ContentList{
|
||||
consumes.item(Items.titanium, 2);
|
||||
}};
|
||||
|
||||
phaseWeaver = new PhaseWeaver("phase-weaver"){{
|
||||
phaseWeaver = new GenericCrafter("phase-weaver"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.silicon, 260, Items.lead, 240, Items.thorium, 150));
|
||||
craftEffect = Fx.smeltsmoke;
|
||||
output = Items.phasefabric;
|
||||
outputItem = new ItemStack(Items.phasefabric, 1);
|
||||
craftTime = 120f;
|
||||
size = 2;
|
||||
|
||||
consumes.items(new ItemStack(Items.thorium, 4), new ItemStack(Items.sand, 10));
|
||||
consumes.power(5f);
|
||||
|
||||
int bottomRegion = addr(name + "-bottom"), weaveRegion = addr(name + "-weave");
|
||||
|
||||
drawer = tile -> {
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
|
||||
Draw.rect(reg(bottomRegion), tile.drawx(), tile.drawy());
|
||||
|
||||
float progress = 0.5f;
|
||||
|
||||
Shaders.build.region = reg(weaveRegion);
|
||||
Shaders.build.progress = progress;
|
||||
Shaders.build.color.set(Pal.accent);
|
||||
Shaders.build.color.a = entity.warmup;
|
||||
Shaders.build.time = -entity.totalProgress / 10f;
|
||||
|
||||
Draw.shader(Shaders.build, false);
|
||||
Shaders.build.apply();
|
||||
Draw.rect(reg(weaveRegion), tile.drawx(), tile.drawy(), entity.totalProgress);
|
||||
Draw.shader();
|
||||
|
||||
Draw.color(Pal.accent);
|
||||
Draw.alpha(entity.warmup);
|
||||
|
||||
Lines.lineAngleCenter(
|
||||
tile.drawx() + Mathf.sin(entity.totalProgress, 6f, Vars.tilesize / 3f * size),
|
||||
tile.drawy(),
|
||||
90,
|
||||
size * Vars.tilesize / 2f);
|
||||
|
||||
Draw.reset();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
};
|
||||
}};
|
||||
|
||||
surgeSmelter = new PowerSmelter("alloy-smelter"){{
|
||||
surgeSmelter = new GenericSmelter("alloy-smelter"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.silicon, 160, Items.lead, 160, Items.thorium, 140));
|
||||
craftEffect = Fx.smeltsmoke;
|
||||
output = Items.surgealloy;
|
||||
outputItem = new ItemStack(Items.surgealloy, 1);
|
||||
craftTime = 75f;
|
||||
size = 3;
|
||||
|
||||
@ -461,10 +501,15 @@ public class Blocks implements ContentList{
|
||||
|
||||
cryofluidMixer = new LiquidMixer("cryofluidmixer"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.lead, 130, Items.silicon, 80, Items.thorium, 90));
|
||||
outputLiquid = Liquids.cryofluid;
|
||||
liquidPerItem = 50f;
|
||||
outputLiquid = new LiquidStack(Liquids.cryofluid, 0.3f);
|
||||
craftTime = 5f;
|
||||
size = 2;
|
||||
hasPower = true;
|
||||
hasItems = true;
|
||||
rotate = false;
|
||||
solid = true;
|
||||
singleLiquid = false;
|
||||
outputsLiquid = true;
|
||||
|
||||
consumes.power(1f);
|
||||
consumes.item(Items.titanium);
|
||||
@ -475,19 +520,19 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.crafting, ItemStack.with(Items.lead, 60, Items.titanium, 40));
|
||||
hasItems = true;
|
||||
hasPower = true;
|
||||
outputItem = Items.blastCompound;
|
||||
outputItem = new ItemStack(Items.blastCompound, 1);
|
||||
size = 2;
|
||||
|
||||
consumes.items(new ItemStack(Items.pyratite, 1), new ItemStack(Items.sporePod, 1));
|
||||
consumes.power(0.40f);
|
||||
}};
|
||||
|
||||
pyratiteMixer = new PowerSmelter("pyratite-mixer"){{
|
||||
pyratiteMixer = new GenericSmelter("pyratite-mixer"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.copper, 100, Items.lead, 50));
|
||||
flameColor = Color.CLEAR;
|
||||
hasItems = true;
|
||||
hasPower = true;
|
||||
output = Items.pyratite;
|
||||
outputItem = new ItemStack(Items.pyratite, 1);
|
||||
|
||||
size = 2;
|
||||
|
||||
@ -495,11 +540,10 @@ public class Blocks implements ContentList{
|
||||
consumes.items(new ItemStack(Items.coal, 1), new ItemStack(Items.lead, 2), new ItemStack(Items.sand, 2));
|
||||
}};
|
||||
|
||||
melter = new PowerCrafter("melter"){{
|
||||
melter = new GenericCrafter("melter"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.lead, 70, Items.graphite, 90));
|
||||
health = 200;
|
||||
outputLiquid = Liquids.slag;
|
||||
outputLiquidAmount = 2f;
|
||||
outputLiquid = new LiquidStack(Liquids.slag, 2f);
|
||||
craftTime = 10f;
|
||||
hasLiquids = hasPower = true;
|
||||
|
||||
@ -529,7 +573,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
cultivator = new Cultivator("cultivator"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.copper, 20, Items.lead, 50, Items.silicon, 20));
|
||||
outputItem = Items.sporePod;
|
||||
outputItem = new ItemStack(Items.sporePod, 1);
|
||||
craftTime = 160;
|
||||
size = 2;
|
||||
hasLiquids = true;
|
||||
@ -544,8 +588,7 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.crafting, ItemStack.with(Items.lead, 70, Items.silicon, 60));
|
||||
liquidCapacity = 60f;
|
||||
craftTime = 20f;
|
||||
outputLiquid = Liquids.oil;
|
||||
outputLiquidAmount = 4f;
|
||||
outputLiquid = new LiquidStack(Liquids.oil, 4f);
|
||||
size = 2;
|
||||
health = 320;
|
||||
hasLiquids = true;
|
||||
@ -556,7 +599,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
pulverizer = new Pulverizer("pulverizer"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.lead, 50));
|
||||
outputItem = Items.sand;
|
||||
outputItem = new ItemStack(Items.sand, 1);
|
||||
craftEffect = Fx.pulverize;
|
||||
craftTime = 40f;
|
||||
updateEffect = Fx.pulverizeSmall;
|
||||
|
@ -106,6 +106,9 @@ public class Block extends BlockStorage{
|
||||
public BooleanProvider buildVisibility = () -> false;
|
||||
public boolean alwaysUnlocked = false;
|
||||
|
||||
protected TextureRegion[] cacheRegions = {};
|
||||
protected Array<String> cacheRegionStrings = new Array<>();
|
||||
|
||||
protected Array<Tile> tempTiles = new Array<>();
|
||||
protected TextureRegion[] icons = new TextureRegion[Icon.values().length];
|
||||
protected TextureRegion[] generatedIcons;
|
||||
@ -324,6 +327,22 @@ public class Block extends BlockStorage{
|
||||
@Override
|
||||
public void load(){
|
||||
region = Core.atlas.find(name);
|
||||
|
||||
cacheRegions = new TextureRegion[cacheRegionStrings.size];
|
||||
for(int i = 0; i < cacheRegions.length; i++){
|
||||
cacheRegions[i] = Core.atlas.find(cacheRegionStrings.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
/**Adds a region by name to be loaded. Returns an ID to looks this region up by in {@link #reg(int)}.*/
|
||||
protected int addr(String name){
|
||||
cacheRegionStrings.add(name);
|
||||
return cacheRegionStrings.size - 1;
|
||||
}
|
||||
|
||||
/**Returns an internally cached region by ID.*/
|
||||
protected TextureRegion reg(int id){
|
||||
return cacheRegions[id];
|
||||
}
|
||||
|
||||
/** Called when the block is tapped. */
|
||||
|
@ -48,7 +48,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
}
|
||||
|
||||
if(hasLiquids){
|
||||
consumes.add(new ConsumeLiquidFilter(liquid -> getLiquidEfficiency(liquid) >= minLiquidEfficiency, 0.001f, true)).update(false).optional(true);
|
||||
consumes.add(new ConsumeLiquidFilter(liquid -> getLiquidEfficiency(liquid) >= minLiquidEfficiency, maxLiquidGenerate)).update(false).optional(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,12 @@ package io.anuke.mindustry.world.blocks.production;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.production.GenericCrafter.GenericCrafterEntity;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class Compressor extends PowerCrafter{
|
||||
public class Compressor extends GenericCrafter{
|
||||
protected TextureRegion liquidRegion, topRegion;
|
||||
protected TextureRegion[] frameRegions;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.production;
|
||||
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.function.Consumer;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
@ -30,6 +30,8 @@ public class GenericCrafter extends Block{
|
||||
protected Effect updateEffect = Fx.none;
|
||||
protected float updateEffectChance = 0.04f;
|
||||
|
||||
protected Consumer<Tile> drawer = null;
|
||||
|
||||
public GenericCrafter(String name){
|
||||
super(name);
|
||||
update = true;
|
||||
@ -53,14 +55,11 @@ public class GenericCrafter extends Block{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
Draw.rect(name, tile.drawx(), tile.drawy());
|
||||
|
||||
if(!hasLiquids) return;
|
||||
|
||||
Draw.color(tile.entity.liquids.current().color);
|
||||
Draw.alpha(tile.entity.liquids.total() / liquidCapacity);
|
||||
Draw.rect("blank", tile.drawx(), tile.drawy(), 2, 2);
|
||||
Draw.color();
|
||||
if(drawer == null){
|
||||
super.draw(tile);
|
||||
}else{
|
||||
drawer.accept(tile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,11 +10,11 @@ import io.anuke.arc.util.Time;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
/**A GenericCrafter with a new glowing region drawn on top.*/
|
||||
public class PowerSmelter extends GenericCrafter{
|
||||
public class GenericSmelter extends GenericCrafter{
|
||||
protected Color flameColor = Color.valueOf("ffc999");
|
||||
protected TextureRegion topRegion;
|
||||
|
||||
public PowerSmelter(String name){
|
||||
public GenericSmelter(String name){
|
||||
super(name);
|
||||
}
|
||||
|
@ -1,67 +1,30 @@
|
||||
package io.anuke.mindustry.world.blocks.production;
|
||||
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.LiquidBlock;
|
||||
import io.anuke.mindustry.world.consumers.ConsumeLiquid;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.StatUnit;
|
||||
import io.anuke.mindustry.world.modules.LiquidModule;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.modules.LiquidModule;
|
||||
|
||||
public class LiquidMixer extends LiquidBlock{
|
||||
protected Liquid outputLiquid;
|
||||
protected float liquidPerItem = 50f;
|
||||
public class LiquidMixer extends GenericCrafter{
|
||||
protected TextureRegion liquidRegion, bottomRegion, topRegion;
|
||||
|
||||
public LiquidMixer(String name){
|
||||
super(name);
|
||||
hasItems = true;
|
||||
rotate = false;
|
||||
solid = true;
|
||||
singleLiquid = false;
|
||||
outputsLiquid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
public void load(){
|
||||
super.load();
|
||||
|
||||
produces.set(outputLiquid);
|
||||
liquidRegion = Core.atlas.find(name + "-liquid");
|
||||
topRegion = Core.atlas.find(name + "-top");
|
||||
bottomRegion = Core.atlas.find(name + "-bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(BlockStat.liquidOutput, outputLiquid);
|
||||
stats.add(BlockStat.liquidOutputSpeed, 60f * consumes.get(ConsumeLiquid.class).used(), StatUnit.liquidSecond);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldConsume(Tile tile){
|
||||
return tile.entity.liquids.get(outputLiquid) < liquidCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
LiquidMixerEntity entity = tile.entity();
|
||||
|
||||
if(tile.entity.cons.valid()){
|
||||
float use = Math.min(consumes.get(ConsumeLiquid.class).used() * entity.delta(), liquidCapacity - entity.liquids.get(outputLiquid));
|
||||
if(hasPower){
|
||||
use *= entity.power.satisfaction; // Produce less liquid if power is not maxed
|
||||
}
|
||||
entity.accumulator += use;
|
||||
entity.liquids.add(outputLiquid, use);
|
||||
for(int i = 0; i < (int) (entity.accumulator / liquidPerItem); i++){
|
||||
if(!entity.items.has(consumes.item())) break;
|
||||
entity.items.remove(consumes.item(), 1);
|
||||
entity.accumulator -= liquidPerItem;
|
||||
}
|
||||
}
|
||||
|
||||
tryDumpLiquid(tile, outputLiquid);
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name + "-top")};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -73,21 +36,12 @@ public class LiquidMixer extends LiquidBlock{
|
||||
Draw.rect(bottomRegion, tile.drawx(), tile.drawy(), rotation);
|
||||
|
||||
if(mod.total() > 0.001f){
|
||||
Draw.color(outputLiquid.color);
|
||||
Draw.alpha(mod.get(outputLiquid) / liquidCapacity);
|
||||
Draw.color(outputLiquid.liquid.color);
|
||||
Draw.alpha(mod.get(outputLiquid.liquid) / liquidCapacity);
|
||||
Draw.rect(liquidRegion, tile.drawx(), tile.drawy(), rotation);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy(), rotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity newEntity(){
|
||||
return new LiquidMixerEntity();
|
||||
}
|
||||
|
||||
static class LiquidMixerEntity extends TileEntity{
|
||||
float accumulator;
|
||||
}
|
||||
}
|
||||
|
@ -1,66 +0,0 @@
|
||||
package io.anuke.mindustry.world.blocks.production;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Lines;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class PhaseWeaver extends PowerSmelter{
|
||||
protected TextureRegion bottomRegion;
|
||||
protected TextureRegion weaveRegion;
|
||||
|
||||
public PhaseWeaver(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
|
||||
bottomRegion = Core.atlas.find(name + "-bottom");
|
||||
weaveRegion = Core.atlas.find(name + "-weave");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
PowerSmelterEntity entity = tile.entity();
|
||||
|
||||
Draw.rect(bottomRegion, tile.drawx(), tile.drawy());
|
||||
|
||||
float progress = 0.5f;
|
||||
|
||||
Shaders.build.region = weaveRegion;
|
||||
Shaders.build.progress = progress;
|
||||
Shaders.build.color.set(Pal.accent);
|
||||
Shaders.build.color.a = entity.heat;
|
||||
Shaders.build.time = -entity.time / 10f;
|
||||
|
||||
Draw.shader(Shaders.build, false);
|
||||
Shaders.build.apply();
|
||||
Draw.rect(weaveRegion, tile.drawx(), tile.drawy(), entity.time);
|
||||
Draw.shader();
|
||||
|
||||
Draw.color(Pal.accent);
|
||||
Draw.alpha(entity.heat);
|
||||
|
||||
Lines.lineAngleCenter(
|
||||
tile.drawx() + Mathf.sin(entity.time, 6f, Vars.tilesize / 3f * size),
|
||||
tile.drawy(),
|
||||
90,
|
||||
size * Vars.tilesize / 2f);
|
||||
|
||||
Draw.reset();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ public class Pump extends LiquidBlock{
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
stats.add(BlockStat.liquidOutputSpeed, 60f * pumpAmount, StatUnit.liquidSecond);
|
||||
stats.add(BlockStat.output, 60f * pumpAmount, StatUnit.liquidSecond);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +51,7 @@ public class Separator extends Block{
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(BlockStat.outputItem, new ItemFilterValue(item -> {
|
||||
stats.add(BlockStat.output, new ItemFilterValue(item -> {
|
||||
for(ItemStack i : results){
|
||||
if(item == i.item) return true;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class SolidPump extends Pump{
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(BlockStat.liquidOutput, result);
|
||||
stats.add(BlockStat.output, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,7 +102,7 @@ public class UnitFactory extends Block{
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(BlockStat.craftSpeed, produceTime / 60f, StatUnit.seconds);
|
||||
stats.add(BlockStat.productionTime, produceTime / 60f, StatUnit.seconds);
|
||||
stats.add(BlockStat.maxUnits, maxSpawn, StatUnit.none);
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,6 @@ public class ConsumeItem extends Consume{
|
||||
|
||||
@Override
|
||||
public void display(BlockStats stats){
|
||||
stats.add(boost ? BlockStat.boostItem : BlockStat.inputItem, new ItemStack(item, amount));
|
||||
stats.add(boost ? BlockStat.booster : BlockStat.input, new ItemStack(item, amount));
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,6 @@ public class ConsumeItemFilter extends Consume{
|
||||
|
||||
@Override
|
||||
public void display(BlockStats stats){
|
||||
stats.add(boost ? BlockStat.boostItem : BlockStat.inputItem, new ItemFilterValue(filter));
|
||||
stats.add(boost ? BlockStat.booster : BlockStat.input, new ItemFilterValue(filter));
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,6 @@ public class ConsumeItems extends Consume{
|
||||
|
||||
@Override
|
||||
public void display(BlockStats stats){
|
||||
stats.add(boost ? BlockStat.boostItem : BlockStat.inputItems, new ItemListValue(items));
|
||||
stats.add(boost ? BlockStat.booster : BlockStat.input, new ItemListValue(items));
|
||||
}
|
||||
}
|
||||
|
@ -51,9 +51,9 @@ public class ConsumeLiquid extends Consume{
|
||||
public void display(BlockStats stats){
|
||||
if(!boost){
|
||||
stats.add(BlockStat.liquidUse, use * 60f, StatUnit.liquidSecond);
|
||||
stats.add(BlockStat.inputLiquid, liquid);
|
||||
stats.add(BlockStat.input, liquid);
|
||||
}else{
|
||||
stats.add(BlockStat.boostLiquid, liquid);
|
||||
stats.add(BlockStat.booster, liquid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,16 +19,10 @@ import static io.anuke.mindustry.Vars.content;
|
||||
public class ConsumeLiquidFilter extends Consume{
|
||||
private final Predicate<Liquid> filter;
|
||||
private final float use;
|
||||
private final boolean isFuel;
|
||||
|
||||
public ConsumeLiquidFilter(Predicate<Liquid> liquid, float amount, boolean isFuel){
|
||||
this.filter = liquid;
|
||||
this.use = amount;
|
||||
this.isFuel = isFuel;
|
||||
}
|
||||
|
||||
public ConsumeLiquidFilter(Predicate<Liquid> liquid, float amount){
|
||||
this(liquid, amount, false);
|
||||
this.filter = liquid;
|
||||
this.use = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -58,12 +52,9 @@ public class ConsumeLiquidFilter extends Consume{
|
||||
@Override
|
||||
public void display(BlockStats stats){
|
||||
if(boost){
|
||||
stats.add(BlockStat.boostLiquid, new LiquidFilterValue(filter));
|
||||
}else if(isFuel){
|
||||
stats.add(BlockStat.inputLiquidFuel, new LiquidFilterValue(filter));
|
||||
stats.add(BlockStat.liquidFuelUse, 60f * use, StatUnit.liquidSecond);
|
||||
stats.add(BlockStat.booster, new LiquidFilterValue(filter));
|
||||
}else {
|
||||
stats.add(BlockStat.inputLiquid, new LiquidFilterValue(filter));
|
||||
stats.add(BlockStat.input, new LiquidFilterValue(filter));
|
||||
stats.add(BlockStat.liquidUse, 60f * use, StatUnit.liquidSecond);
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,6 @@ public enum BlockStat{
|
||||
size(StatCategory.general),
|
||||
|
||||
itemCapacity(StatCategory.items),
|
||||
inputItemCapacity(StatCategory.items),
|
||||
outputItemCapacity(StatCategory.items),
|
||||
itemsMoved(StatCategory.items),
|
||||
launchTime(StatCategory.items),
|
||||
|
||||
@ -23,12 +21,8 @@ public enum BlockStat{
|
||||
powerUse(StatCategory.power),
|
||||
powerDamage(StatCategory.power),
|
||||
powerRange(StatCategory.power),
|
||||
powerTransferSpeed(StatCategory.power),
|
||||
basePowerGeneration(StatCategory.power),
|
||||
inputLiquidFuel(StatCategory.power),
|
||||
liquidFuelUse(StatCategory.power),
|
||||
|
||||
inputLiquid(StatCategory.crafting),
|
||||
liquidUse(StatCategory.crafting),
|
||||
input(StatCategory.crafting),
|
||||
output(StatCategory.crafting),
|
||||
|
Reference in New Issue
Block a user