WIP constructor filter
This commit is contained in:
@@ -3650,7 +3650,7 @@ public class Blocks{
|
|||||||
deconstructSpeed = 1f;
|
deconstructSpeed = 1f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//TODO consider usefulness and applicability to serpulo
|
//TODO consider usefulness and applicability to serpulo... or anything really
|
||||||
deconstructor = new PayloadDeconstructor("deconstructor"){{
|
deconstructor = new PayloadDeconstructor("deconstructor"){{
|
||||||
requirements(Category.units, with(Items.beryllium, 250, Items.oxide, 100, Items.silicon, 250, Items.carbide, 250));
|
requirements(Category.units, with(Items.beryllium, 250, Items.oxide, 100, Items.silicon, 250, Items.carbide, 250));
|
||||||
itemCapacity = 250;
|
itemCapacity = 250;
|
||||||
@@ -3659,13 +3659,14 @@ public class Blocks{
|
|||||||
deconstructSpeed = 2f;
|
deconstructSpeed = 2f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//TODO move completely to erekir tech tree?
|
|
||||||
constructor = new Constructor("constructor"){{
|
constructor = new Constructor("constructor"){{
|
||||||
requirements(Category.units, with(Items.silicon, 100, Items.beryllium, 150, Items.tungsten, 80));
|
requirements(Category.units, with(Items.silicon, 100, Items.beryllium, 150, Items.tungsten, 80));
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
buildSpeed = 0.3f;
|
buildSpeed = 0.3f;
|
||||||
consumes.power(2f);
|
consumes.power(2f);
|
||||||
size = 3;
|
size = 3;
|
||||||
|
//TODO expand this list
|
||||||
|
filter = Seq.with(Blocks.tungstenWallLarge, Blocks.berylliumWallLarge, Blocks.cliffCrusher, Blocks.plasmaBore, Blocks.reinforcedLiquidTank, Blocks.duct);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//yes this block is pretty much useless
|
//yes this block is pretty much useless
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package mindustry.world.blocks.payloads;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
@@ -15,6 +16,8 @@ import static mindustry.Vars.*;
|
|||||||
|
|
||||||
/** Configurable BlockProducer variant. */
|
/** Configurable BlockProducer variant. */
|
||||||
public class Constructor extends BlockProducer{
|
public class Constructor extends BlockProducer{
|
||||||
|
/** Empty seq for no filter. */
|
||||||
|
public Seq<Block> filter = new Seq<>();
|
||||||
public float buildSpeed = 0.4f;
|
public float buildSpeed = 0.4f;
|
||||||
public int minBlockSize = 1, maxBlockSize = 2;
|
public int minBlockSize = 1, maxBlockSize = 2;
|
||||||
|
|
||||||
@@ -43,7 +46,7 @@ public class Constructor extends BlockProducer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canProduce(Block b){
|
public boolean canProduce(Block b){
|
||||||
return b.isVisible() && b.size >= minBlockSize && b.size <= maxBlockSize && !(b instanceof CoreBlock) && !state.rules.bannedBlocks.contains(b) && b.environmentBuildable();
|
return b.isVisible() && b.size >= minBlockSize && b.size <= maxBlockSize && !(b instanceof CoreBlock) && !state.rules.bannedBlocks.contains(b) && b.environmentBuildable() && (filter.isEmpty() || filter.contains(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ConstructorBuild extends BlockProducerBuild{
|
public class ConstructorBuild extends BlockProducerBuild{
|
||||||
@@ -56,7 +59,7 @@ public class Constructor extends BlockProducer{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildConfiguration(Table table){
|
public void buildConfiguration(Table table){
|
||||||
ItemSelection.buildTable(Constructor.this, table, content.blocks().select(Constructor.this::canProduce), () -> recipe, this::configure);
|
ItemSelection.buildTable(Constructor.this, table, filter.isEmpty() ? content.blocks().select(Constructor.this::canProduce) : filter, () -> recipe, this::configure);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user