WIP small unit fabricator

This commit is contained in:
Anuken 2022-02-16 18:38:40 -05:00
parent e86b4b0192
commit 5e601cb978
11 changed files with 34 additions and 38 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -542,3 +542,4 @@
63161=prime-control-core|block-prime-control-core-ui
63160=ore-wall-thorium|block-ore-wall-thorium-ui
63159=core-zone|block-core-zone-ui
63158=fabricator|block-fabricator-ui

Binary file not shown.

View File

@ -136,6 +136,7 @@ public class Blocks{
repairPoint, repairTurret,
//unit - erekir
fabricator,
tankAssembler, shipAssembler, mechAssembler,
//TODO maybe making it 5x5 would be more appropriate, seems kinda cheap.
basicAssemblerModule,
@ -3598,6 +3599,14 @@ public class Blocks{
researchCostMultiplier = 0f;
}};
fabricator = new UnitFactory("fabricator"){{
requirements(Category.units, with(Items.silicon, 230, Items.oxide, 50, Items.beryllium, 230));
size = 3;
configurable = false;
plans.add(new UnitPlan(UnitTypes.dagger, 60f * 60f, with(Items.oxide, 15f, Items.silicon, 50f)));
consumePower(2f);
}};
tankAssembler = new UnitAssembler("tank-assembler"){{
requirements(Category.units, with(Items.graphite, 600, Items.beryllium, 600, Items.oxide, 250, Items.tungsten, 400, Items.silicon, 500));
size = 5;
@ -3635,7 +3644,8 @@ public class Blocks{
consumeLiquid(Liquids.nitrogen, 24f / 60f);
}};
//TODO requirements
//TODO 5x5
if(false)
basicAssemblerModule = new UnitAssemblerModule("basic-assembler-module"){{
requirements(Category.units, with(Items.graphite, 10));
consumePower(0.5f);

View File

@ -296,40 +296,17 @@ public class Maps{
public Seq<GenerateFilter> readFilters(String str){
if(str == null || str.isEmpty()){
//create default filters list
Seq<GenerateFilter> filters = Seq.with(
new ScatterFilter(){{
flooronto = Blocks.snow;
block = Blocks.snowBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.ice;
block = Blocks.snowBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.sand;
block = Blocks.sandBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.darksand;
block = Blocks.basaltBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.basalt;
block = Blocks.basaltBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.dacite;
block = Blocks.daciteBoulder;
}},
new ScatterFilter(){{
flooronto = Blocks.stone;
block = Blocks.boulder;
}},
new ScatterFilter(){{
flooronto = Blocks.shale;
block = Blocks.shaleBoulder;
}}
);
Seq<GenerateFilter> filters = new Seq<>();
for(Block block : content.blocks()){
if(block.isFloor() && block.inEditor && block.asFloor().decoration != Blocks.air){
var filter = new ScatterFilter();
filter.flooronto = block.asFloor();
filter.block = block.asFloor().decoration;
filters.add(filter);
}
}
addDefaultOres(filters);

View File

@ -7,8 +7,8 @@ import mindustry.world.*;
import static mindustry.maps.filters.FilterOption.*;
public class ScatterFilter extends GenerateFilter{
protected float chance = 0.013f;
protected Block flooronto = Blocks.air, floor = Blocks.air, block = Blocks.air;
public float chance = 0.013f;
public Block flooronto = Blocks.air, floor = Blocks.air, block = Blocks.air;
@Override
public FilterOption[] options(){

View File

@ -264,7 +264,7 @@ public class PowerGraph{
batteries.add(build);
}else if(build.block.outputsPower){
producers.add(build);
}else if(build.block.consumesPower){
}else if(build.block.consumesPower && build.block.consPower != null){
consumers.add(build);
}
}

View File

@ -41,12 +41,16 @@ public class UnitFactory extends UnitBlock{
regionRotated1 = 1;
config(Integer.class, (UnitFactoryBuild tile, Integer i) -> {
if(!configurable) return;
if(tile.currentPlan == i) return;
tile.currentPlan = i < 0 || i >= plans.size ? -1 : i;
tile.progress = 0;
});
config(UnitType.class, (UnitFactoryBuild tile, UnitType val) -> {
if(!configurable) return;
int next = plans.indexOf(p -> p.unit == val);
if(tile.currentPlan == next) return;
tile.currentPlan = next;
@ -218,6 +222,10 @@ public class UnitFactory extends UnitBlock{
@Override
public void updateTile(){
if(!configurable){
currentPlan = 0;
}
if(currentPlan < 0 || currentPlan >= plans.size){
currentPlan = -1;
}