diff --git a/core/assets-raw/sprites/blocks/units/basic-asssembler-module-out.png b/core/assets-raw/sprites/blocks/units/basic-asssembler-module-out.png new file mode 100644 index 0000000000..afb61bf138 Binary files /dev/null and b/core/assets-raw/sprites/blocks/units/basic-asssembler-module-out.png differ diff --git a/core/assets-raw/sprites/blocks/units/fabricator-out.png b/core/assets-raw/sprites/blocks/units/fabricator-out.png new file mode 100644 index 0000000000..afb61bf138 Binary files /dev/null and b/core/assets-raw/sprites/blocks/units/fabricator-out.png differ diff --git a/core/assets-raw/sprites/blocks/units/fabricator-top.png b/core/assets-raw/sprites/blocks/units/fabricator-top.png new file mode 100644 index 0000000000..1a2301dfc1 Binary files /dev/null and b/core/assets-raw/sprites/blocks/units/fabricator-top.png differ diff --git a/core/assets-raw/sprites/blocks/units/drone-center.png b/core/assets-raw/sprites/blocks/units/fabricator.png similarity index 100% rename from core/assets-raw/sprites/blocks/units/drone-center.png rename to core/assets-raw/sprites/blocks/units/fabricator.png diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index 4e6fa24051..d99a3ce968 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -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 diff --git a/core/assets/logicids.dat b/core/assets/logicids.dat index 87e2db7395..a503134147 100644 Binary files a/core/assets/logicids.dat and b/core/assets/logicids.dat differ diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 98d4c4f3d7..8c717ced4b 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -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); diff --git a/core/src/mindustry/maps/Maps.java b/core/src/mindustry/maps/Maps.java index 0e0fd5aa01..ba738767c6 100644 --- a/core/src/mindustry/maps/Maps.java +++ b/core/src/mindustry/maps/Maps.java @@ -296,40 +296,17 @@ public class Maps{ public Seq readFilters(String str){ if(str == null || str.isEmpty()){ //create default filters list - Seq 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 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); diff --git a/core/src/mindustry/maps/filters/ScatterFilter.java b/core/src/mindustry/maps/filters/ScatterFilter.java index ca094891b4..162ed2c89e 100644 --- a/core/src/mindustry/maps/filters/ScatterFilter.java +++ b/core/src/mindustry/maps/filters/ScatterFilter.java @@ -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(){ diff --git a/core/src/mindustry/world/blocks/power/PowerGraph.java b/core/src/mindustry/world/blocks/power/PowerGraph.java index 6d3feb16e5..cade17d6de 100644 --- a/core/src/mindustry/world/blocks/power/PowerGraph.java +++ b/core/src/mindustry/world/blocks/power/PowerGraph.java @@ -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); } } diff --git a/core/src/mindustry/world/blocks/units/UnitFactory.java b/core/src/mindustry/world/blocks/units/UnitFactory.java index 0244c23285..57d1d95b8b 100644 --- a/core/src/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/mindustry/world/blocks/units/UnitFactory.java @@ -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; }