From 5e601cb978c45c92f23cd55cb3cec17d987f1954 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 16 Feb 2022 18:38:40 -0500 Subject: [PATCH] WIP small unit fabricator --- .../units/basic-asssembler-module-out.png | Bin 0 -> 565 bytes .../sprites/blocks/units/fabricator-out.png | Bin 0 -> 565 bytes .../sprites/blocks/units/fabricator-top.png | Bin 0 -> 1015 bytes .../{drone-center.png => fabricator.png} | Bin core/assets/icons/icons.properties | 1 + core/assets/logicids.dat | Bin 4195 -> 4207 bytes core/src/mindustry/content/Blocks.java | 12 ++++- core/src/mindustry/maps/Maps.java | 45 +++++------------- .../mindustry/maps/filters/ScatterFilter.java | 4 +- .../world/blocks/power/PowerGraph.java | 2 +- .../world/blocks/units/UnitFactory.java | 8 ++++ 11 files changed, 34 insertions(+), 38 deletions(-) create mode 100644 core/assets-raw/sprites/blocks/units/basic-asssembler-module-out.png create mode 100644 core/assets-raw/sprites/blocks/units/fabricator-out.png create mode 100644 core/assets-raw/sprites/blocks/units/fabricator-top.png rename core/assets-raw/sprites/blocks/units/{drone-center.png => fabricator.png} (100%) 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 0000000000000000000000000000000000000000..afb61bf138431a4132364abfe10ab922cac804a9 GIT binary patch literal 565 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGojKx9jP7LeL$-D%z-+Q_^hE&XX zd)LwLumg|VL-})ooze%|g14N$SKoN0dP=Bj$i+_EZ%3wm+Gi?wqMv1@af%89L&IXr z_;ug6zmk8n;@tGtv6DCg9vIeiGVK0s4I-=L_PI3N{bLSdSC|6H)4gr_f(a|vKJ;dZ zIA#PC@Q!HL7gU&={zHf{s1n3Hd**{G(~=poK#dzt0GTZ=K+%M#V<2V$yUOoBzsmT( zl>FkTJ^%f})eCRG3GbT6z^Nq2F(Ji_iBagRi-LnuJ`0o1gHDGA*END18z!hSF^b*p za%f0m(QtzkWiP%qTzvlj{QS@7>uzk@8h1c8!DRD?q@8UHeDgT2tygWBoVsCN082&U zmoxIbH-4{BI?!N#=*)dirkojjh1YN-2;BW?-~=?y;6%lhJx&e0iyx-j%;GS3AZvF! zNa*apXPb3X4No`RoVKYWeM647r`hM4?J>nbJJXH-%O@EAsy-we(8F+)13_$%xE;i` zQFo~T3U%SlE<;8k7qPdT0wQ+}4^}xa=;vr1(LOEpfG?xrdYIXP?r7-;SC8_3`1Fpg zqPCV<=D`I9_ZcP!6zzBmdP13Ho?K&amoz(&IFGkrPA;>|i#rb2s+gEM7#JKD#-FR2 W*%+gAOca<77(8A5T-G@yGywpo@9rJ| literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..afb61bf138431a4132364abfe10ab922cac804a9 GIT binary patch literal 565 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGojKx9jP7LeL$-D%z-+Q_^hE&XX zd)LwLumg|VL-})ooze%|g14N$SKoN0dP=Bj$i+_EZ%3wm+Gi?wqMv1@af%89L&IXr z_;ug6zmk8n;@tGtv6DCg9vIeiGVK0s4I-=L_PI3N{bLSdSC|6H)4gr_f(a|vKJ;dZ zIA#PC@Q!HL7gU&={zHf{s1n3Hd**{G(~=poK#dzt0GTZ=K+%M#V<2V$yUOoBzsmT( zl>FkTJ^%f})eCRG3GbT6z^Nq2F(Ji_iBagRi-LnuJ`0o1gHDGA*END18z!hSF^b*p za%f0m(QtzkWiP%qTzvlj{QS@7>uzk@8h1c8!DRD?q@8UHeDgT2tygWBoVsCN082&U zmoxIbH-4{BI?!N#=*)dirkojjh1YN-2;BW?-~=?y;6%lhJx&e0iyx-j%;GS3AZvF! zNa*apXPb3X4No`RoVKYWeM647r`hM4?J>nbJJXH-%O@EAsy-we(8F+)13_$%xE;i` zQFo~T3U%SlE<;8k7qPdT0wQ+}4^}xa=;vr1(LOEpfG?xrdYIXP?r7-;SC8_3`1Fpg zqPCV<=D`I9_ZcP!6zzBmdP13Ho?K&amoz(&IFGkrPA;>|i#rb2s+gEM7#JKD#-FR2 W*%+gAOca<77(8A5T-G@yGywpo@9rJ| literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..1a2301dfc14a444b94c359883f6e305463e5014f GIT binary patch literal 1015 zcmV&ubYfUqBG z1EUcbi(#Cjww9stg;s>$KR;CiXd%be0U--|DrtS(#UT` zK)phgED_*fNBKf{ z`NEF!h4Au|BuSDaNs=TS-jj_X^BZinaPPI`9+&&^PXS=0Gba9r~m)} delta 16 YcmaE_@K}L~;o(N6S-hK9@E&IZ06K35fdBvi 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; }