diff --git a/assets/bundles/bundle.properties b/assets/bundles/bundle.properties index d7fc079b..1f5ed6a5 100644 --- a/assets/bundles/bundle.properties +++ b/assets/bundles/bundle.properties @@ -11,6 +11,9 @@ block.betamindy-piston-sticky.description = Can push or pull up to 16 blocks. Ca block.betamindy-spore-slime.name = Spore Slime block.betamindy-spore-slime.description = Sticks to adjacent blocks. Does not stick to phase coating. block.betamindy-spore-slime.details = Has a grape flavor, and is very chewy. +block.betamindy-surge-slime.name = Surge Slime +block.betamindy-surge-slime.description = Sticks to adjacent blocks, just like spore slimes. Conducts power to adjacent blocks. Does not stick to phase coating. +block.betamindy-surge-slime.details = Has a lime flavor, and is very chewy. block.betamindy-spore-slime-sided.name = Sided Spore Slime block.betamindy-spore-slime-sided.description = Only one side of it is sticky. Sticks to adjacent blocks. Does not stick to phase coating. block.betamindy-accel.name = Accelerator @@ -58,8 +61,12 @@ block.betamindy-team-wall.description = When broken, alerts everyone about the a # Production block.betamindy-drill-mini.name = Mini Driller block.betamindy-drill-mini.description = Drills nearby ores or blocks automatically. +block.betamindy-drill-mini.details = A mono was sent to brazil by Sharlotte. When it returned... block.betamindy-drill-mega.name = Mega Driller block.betamindy-drill-mega.description = An upgraded version of the mini driller. Drills nearby ores or blocks automatically. Cannot drill items that are too soft. +block.betamindy-cloner.name = Block Cloner +block.betamindy-cloner.description = Clones the [accent]block it is facing[] to [#a9d8ff]the tile behind it[]. Can only clone blocks that you should be able to place by yourself. Consumes items and power. +block.betamindy-cloner.details = A perfect way to make piston flying machine factories. # Stats stat.dphealth = {0}*payload health*distance(blocks) diff --git a/assets/bundles/bundle_ko.properties b/assets/bundles/bundle_ko.properties index 9bf3748f..1833b252 100644 --- a/assets/bundles/bundle_ko.properties +++ b/assets/bundles/bundle_ko.properties @@ -11,6 +11,9 @@ block.betamindy-piston-sticky.description = \uCD5C\uB300 16\uAC1C\uC758 \uBE14\u block.betamindy-spore-slime.name = \uD3EC\uC790 \uC2AC\uB77C\uC784 block.betamindy-spore-slime.description = \uC778\uC811\uD55C \uBE14\uB85D\uC5D0 \uB2EC\uB77C\uBD99\uC2B5\uB2C8\uB2E4. \uBA54\uD0C0 \uCF54\uD305\uC5D0\uB294 \uB2EC\uB77C\uBD99\uC9C0 \uBABB\uD569\uB2C8\uB2E4. block.betamindy-spore-slime.details = \uD3EC\uB3C4\uB9DB \uB9C8\uC774\uCBB8. +block.betamindy-surge-slime.name = \uC11C\uC9C0 \uC2AC\uB77C\uC784 +block.betamindy-surge-slime.description = \uC778\uC811\uD55C \uBE14\uB85D\uC5D0 \uB2EC\uB77C\uBD99\uC2B5\uB2C8\uB2E4. \uC804\uB3C4\uCCB4\uC785\uB2C8\uB2E4. \uBA54\uD0C0 \uCF54\uD305\uC5D0\uB294 \uB2EC\uB77C\uBD99\uC9C0 \uBABB\uD569\uB2C8\uB2E4. +block.betamindy-surge-slime.details = \uB808\uBAAC\uB9DB \uB9C8\uC774\uCBB8. block.betamindy-spore-slime-sided.name = \uBC29\uD5A5\uC131 \uD3EC\uC790 \uC2AC\uB77C\uC784 block.betamindy-spore-slime-sided.description = \uD55C\uCABD \uBA74\uB9CC \uB048\uC801\uC785\uB2C8\uB2E4. \uC778\uC811\uD55C \uBE14\uB85D\uC5D0 \uB2EC\uB77C\uBD99\uC2B5\uB2C8\uB2E4. \uBA54\uD0C0 \uCF54\uD305\uC5D0\uB294 \uB2EC\uB77C\uBD99\uC9C0 \uBABB\uD569\uB2C8\uB2E4. block.betamindy-accel.name = \uAC00\uC18D\uB3C4\uACC4 @@ -57,6 +60,16 @@ block.betamindy-warehouse.details = \uB9C8\uCE58 \uBE44\uD589\uAE30 \uC5EC\uB7EC block.betamindy-team-wall.name = \uD300 \uBE14\uB85D block.betamindy-team-wall.description = \uD30C\uAD34\uB418\uBA74, \uADF8 \uC0AC\uC2E4 \uBC0F \uACF5\uACA9\uC790\uC758 \uC815\uCCB4\uB97C \uBAA8\uB450\uC5D0\uAC8C \uC54C\uB9BD\uB2C8\uB2E4. PvP\uC5D0\uC11C \uB3D9\uB9F9 \uBC0F \uBC30\uC2E0\uC758 \uC99D\uAC70\uB85C \uD65C\uC6A9\uD558\uAC70\uB098, \uC11C\uBC14\uC774\uBC8C\uC5D0\uC11C \uBC29\uC5B4\uC120\uC774 \uB6AB\uB838\uC74C\uC744 \uACBD\uACE0\uD558\uB294 \uC6A9\uB3C4\uB85C \uC4F8 \uC218 \uC788\uC2B5\uB2C8\uB2E4. +# Production +block.betamindy-drill-mini.name = \uBBF8\uB2C8 \uB4DC\uB9B4\uB7EC +block.betamindy-drill-mini.description = \uC8FC\uBCC0\uC758 \uC790\uC6D0\uC744 \uC790\uB3D9\uC73C\uB85C \uCC44\uAD74\uD569\uB2C8\uB2E4. +block.betamindy-drill-mini.details = \uC0E4\uB97C\uB85C\uD14C\uC5D0 \uC758\uD574 \uBE0C\uB77C\uC9C8\uB85C \uBCF4\uB0B4\uC9C4 \uBAA8\uB178. \uBB34\uC0AC\uD788 \uB3CC\uC544\uC654\uC9C0\uB9CC... +block.betamindy-drill-mega.name = \uBA54\uAC00 \uB4DC\uB9B4\uB7EC +block.betamindy-drill-mega.description = \uB354 \uBC1C\uC804\uB41C \uB4DC\uB9B4\uB7EC\uC785\uB2C8\uB2E4. \uC8FC\uBCC0\uC758 \uC790\uC6D0\uC744 \uC790\uB3D9\uC73C\uB85C \uCC44\uAD74\uD569\uB2C8\uB2E4. \uB108\uBB34 \uBB34\uB978 \uC790\uC6D0\uC740 \uCC44\uAD74\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +block.betamindy-cloner.name = \uBE14\uB85D \uBCF5\uC0AC\uAE30 +block.betamindy-cloner.description = [accent]\uBC14\uB77C\uBCF4\uB294 \uBE14\uB85D[]\uC744 [#a9d8ff]\uC774 \uBE14\uB85D \uB4A4[]\uB85C \uBCF5\uC0AC\uD569\uB2C8\uB2E4. \uD50C\uB808\uC774\uC5B4\uAC00 \uC9C1\uC811 \uADF8 \uC704\uCE58\uC5D0 \uB193\uC744 \uC218 \uC788\uB294 \uBE14\uB85D\uB9CC \uBCF5\uC0AC\uAC00 \uAC00\uB2A5\uD569\uB2C8\uB2E4. \uC790\uC6D0\uACFC \uC804\uB825\uC744 \uC18C\uBAA8\uD569\uB2C8\uB2E4. +block.betamindy-cloner.details = \uD53C\uC2A4\uD1A4 \uD0C8\uAC83 \uACF5\uC7A5\uC744 \uB9CC\uB4E4\uAE30\uC5D0 \uC548\uC131\uB9DE\uCDA4\uC774\uB2E4. + # Stats stat.dphealth = {0}x\uD654\uBB3C \uCCB4\uB825x\uBE44\uAC70\uB9AC(\uBE14\uB85D) diff --git a/assets/sprites/blocks/distribution/surge-slime-core.png b/assets/sprites/blocks/distribution/surge-slime-core.png new file mode 100644 index 00000000..a87d79f4 Binary files /dev/null and b/assets/sprites/blocks/distribution/surge-slime-core.png differ diff --git a/assets/sprites/blocks/distribution/surge-slime.png b/assets/sprites/blocks/distribution/surge-slime.png new file mode 100644 index 00000000..66721c46 Binary files /dev/null and b/assets/sprites/blocks/distribution/surge-slime.png differ diff --git a/assets/sprites/blocks/production/cloner-0.png b/assets/sprites/blocks/production/cloner-0.png new file mode 100644 index 00000000..a5818826 Binary files /dev/null and b/assets/sprites/blocks/production/cloner-0.png differ diff --git a/assets/sprites/blocks/production/cloner-1.png b/assets/sprites/blocks/production/cloner-1.png new file mode 100644 index 00000000..9c934a0b Binary files /dev/null and b/assets/sprites/blocks/production/cloner-1.png differ diff --git a/assets/sprites/blocks/production/cloner-2.png b/assets/sprites/blocks/production/cloner-2.png new file mode 100644 index 00000000..3d8c732d Binary files /dev/null and b/assets/sprites/blocks/production/cloner-2.png differ diff --git a/assets/sprites/blocks/production/cloner-3.png b/assets/sprites/blocks/production/cloner-3.png new file mode 100644 index 00000000..4dab7c38 Binary files /dev/null and b/assets/sprites/blocks/production/cloner-3.png differ diff --git a/assets/sprites/blocks/production/cloner-base.png b/assets/sprites/blocks/production/cloner-base.png new file mode 100644 index 00000000..09824d0e Binary files /dev/null and b/assets/sprites/blocks/production/cloner-base.png differ diff --git a/assets/sprites/blocks/production/cloner.png b/assets/sprites/blocks/production/cloner.png new file mode 100644 index 00000000..2a69b251 Binary files /dev/null and b/assets/sprites/blocks/production/cloner.png differ diff --git a/src/betamindy/content/MindyBlocks.java b/src/betamindy/content/MindyBlocks.java index 411bde62..5a99fdbe 100644 --- a/src/betamindy/content/MindyBlocks.java +++ b/src/betamindy/content/MindyBlocks.java @@ -30,7 +30,7 @@ public class MindyBlocks implements ContentList { //payloads payCannon, payCatapult, blockWorkshop, blockFactory, blockPacker, blockUnpacker, payDeconstructor, payDestroyer, payEradicator, //pistons - piston, stickyPiston, sporeSlime, sporeSlimeSided, accel, + piston, stickyPiston, sporeSlime, sporeSlimeSided, surgeSlime, accel, cloner, //effect silo, warehouse, //walls @@ -197,9 +197,25 @@ public void load() { color = Color.valueOf("9E78DC"); }}; + surgeSlime = new SlimeBlock("surge-slime", 0){{ + health = 120; + requirements(Category.distribution, with(Items.sporePod, 3, Items.surgeAlloy, 3)); + hasPower = true; + outputsPower = true; + consumesPower = false; + + color = Color.valueOf("F3E979"); + }}; + accel = new AccelBlock("accel"){{ health = 150; - requirements(Category.power, with(Items.titanium, 25, Items.silicon, 20, Items.plastanium, 3)); + requirements(Category.power, with(Items.lead, 25, Items.silicon, 20, Items.plastanium, 3)); + }}; + + cloner = new BlockCloner("cloner"){{ + hasPower = true; + consumes.power(0.6f); + requirements(Category.crafting, with(Items.titanium, 30, Items.silicon, 35, Items.phaseFabric, 8)); }}; silo = new StorageBlock("silo"){ diff --git a/src/betamindy/graphics/Drawm.java b/src/betamindy/graphics/Drawm.java index 04194a26..7ba9d7c7 100644 --- a/src/betamindy/graphics/Drawm.java +++ b/src/betamindy/graphics/Drawm.java @@ -46,6 +46,20 @@ public static void construct(Building t, TextureRegion region, float rotation, f Draw.reset(); } + public static void constructLineless(float x, float y, TextureRegion region, float rotation, float progress, float speed, float time, Color color){ + Shaders.build.region = region; + Shaders.build.progress = progress; + Shaders.build.color.set(color); + Shaders.build.color.a = speed; + Shaders.build.time = -time / 20f; + + Draw.shader(Shaders.build); + Draw.rect(region, x, y, rotation); + Draw.shader(); + + Draw.reset(); + } + /** Generates all team regions and returns the sharded team region for icon. */ public static @Nullable TextureRegion generateTeamRegion(Block b){ TextureRegion shardTeamTop = null; diff --git a/src/betamindy/util/MobileFunctions.java b/src/betamindy/util/MobileFunctions.java index ada1deed..d10d659e 100644 --- a/src/betamindy/util/MobileFunctions.java +++ b/src/betamindy/util/MobileFunctions.java @@ -9,7 +9,7 @@ import mindustry.world.blocks.payloads.*; //exists to provide functions that are not public in the Mobile version, for some reason. -//TODO: remove if the cat has answered + public class MobileFunctions { public int payloadUnit, payloadBlock; public void init() { diff --git a/src/betamindy/world/blocks/defense/turrets/DrillTurret.java b/src/betamindy/world/blocks/defense/turrets/DrillTurret.java index b430d0f1..a27a5e3d 100644 --- a/src/betamindy/world/blocks/defense/turrets/DrillTurret.java +++ b/src/betamindy/world/blocks/defense/turrets/DrillTurret.java @@ -84,7 +84,6 @@ public void created(){ reMap(); } - //TODO: reMap when pushed public void reMap(){ proxOres = new Seq(); proxItems = new Seq(); diff --git a/src/betamindy/world/blocks/distribution/Piston.java b/src/betamindy/world/blocks/distribution/Piston.java index c1d18cb0..9d3c4542 100644 --- a/src/betamindy/world/blocks/distribution/Piston.java +++ b/src/betamindy/world/blocks/distribution/Piston.java @@ -193,7 +193,7 @@ public Seq getPowerConnections(Seq out){ } return out; } - //TODO: override conductsTo (I hope) + //TODO: override conductsTo in the next Mindustry build(122.1++) @Override public void onProximityUpdate(){ super.onProximityUpdate(); diff --git a/src/betamindy/world/blocks/distribution/SlimeBlock.java b/src/betamindy/world/blocks/distribution/SlimeBlock.java index d0c9a2e9..a896b2d6 100644 --- a/src/betamindy/world/blocks/distribution/SlimeBlock.java +++ b/src/betamindy/world/blocks/distribution/SlimeBlock.java @@ -3,8 +3,9 @@ import arc.*; import arc.graphics.*; import arc.graphics.g2d.*; -import mindustry.graphics.Layer; +import mindustry.graphics.*; import mindustry.type.Category; +import mindustry.ui.*; import mindustry.world.*; import mindustry.gen.*; import mindustry.world.meta.BlockGroup; @@ -14,7 +15,8 @@ public class SlimeBlock extends Block { public int slimeType; public Color color; - public TextureRegion coreRegion; + public TextureRegion coreRegion, topRegion; + public boolean useTopRegion = false; public SlimeBlock(String name, int stype){ super(name); slimeType = stype; @@ -27,9 +29,21 @@ public SlimeBlock(String name, int stype){ public void load(){ super.load(); coreRegion = atlas.find(name + "-core"); + if(useTopRegion) topRegion = atlas.find(name + "-top"); } - public class SlimeBuild extends Building{ + @Override + public void setBars() { + super.setBars(); + if(hasPower){ + bars.add("power", (SlimeBuild entity) -> new Bar(() -> + Core.bundle.get("bar.power"), + () -> Pal.powerBar, + () -> entity.power.graph.getSatisfaction())); + } + } + + public class SlimeBuild extends Building { @Override public void draw(){ if(Core.settings.getBool("animatedshields") && Core.settings.getBool("slimeeffect")){ @@ -37,6 +51,10 @@ public void draw(){ Draw.z(Layer.shields + 0.0001f); Draw.color(color); Fill.square(x, y, 4f); + if(useTopRegion){ + Draw.color(); + Draw.rect(topRegion, x, y); + } Draw.reset(); } else super.draw(); diff --git a/src/betamindy/world/blocks/production/BlockCloner.java b/src/betamindy/world/blocks/production/BlockCloner.java new file mode 100644 index 00000000..cb7f8a3a --- /dev/null +++ b/src/betamindy/world/blocks/production/BlockCloner.java @@ -0,0 +1,193 @@ +package betamindy.world.blocks.production; + +import arc.Core; +import arc.graphics.*; +import arc.graphics.g2d.*; +import arc.math.*; +import arc.math.geom.*; +import arc.util.*; +import arc.util.io.*; +import betamindy.graphics.Drawm; +import mindustry.Vars; +import mindustry.gen.*; +import mindustry.graphics.*; +import mindustry.type.Item; +import mindustry.type.ItemStack; +import mindustry.ui.*; +import mindustry.world.*; +import mindustry.world.consumers.*; + +import static arc.Core.atlas; +import static mindustry.Vars.tilesize; + +public class BlockCloner extends Block { + public Color color = Pal.lancerLaser; + /** Build speed multiplier */ + public float buildSpeed = 0.8f; + public int maxSize = 1;//TODO: add support for bigger sizes? + public TextureRegion baseRegion; + public TextureRegion[] topRegion = new TextureRegion[4]; + + public BlockCloner(String name){ + super(name); + update = true; + solid = true; + rotate = true; + quickRotate = false; + hasItems = true; + + consumes.add(new ConsumeItemDynamic((ClonerBuild e) -> e.recipe != null ? e.recipe.requirements : ItemStack.empty)); + } + + @Override + public void load() { + super.load(); + baseRegion = atlas.find(name + "-base"); + for(int i = 0; i < 4; i++){ + topRegion[i] = atlas.find(name + "-" + i); + } + } + + @Override + public void setBars() { + super.setBars(); + + bars.add("progress", (ClonerBuild entity) -> new Bar("bar.progress", Pal.ammo, () -> entity.recipe == null ? 0f : (entity.progress / entity.constructTime()))); + } + + @Override + public void drawPlace(int x, int y, int rotation, boolean valid) { + super.drawPlace(x, y, rotation, valid); + int br = (rotation + 2) % 4; + Lines.stroke(1f); + Draw.color(Pal.accent, Mathf.absin(Time.globalTime, 2f, 1f)); + Lines.square((x + Geometry.d4x(rotation)) * tilesize + offset, (y + Geometry.d4y(rotation)) * tilesize + offset, tilesize / 2f); + Draw.color(color, Mathf.absin(Time.globalTime, 2f, 1f)); + Lines.square((x + Geometry.d4x(br)) * tilesize + offset, (y + Geometry.d4y(br)) * tilesize + offset, tilesize / 2f); + Draw.color(); + } + + public class ClonerBuild extends Building { + public float progress, heat, time; + public @Nullable Block recipe, prev; + public int recipeRot = 0; + + @Override + public void onProximityUpdate() { + super.onProximityUpdate(); + Tile t = tile.nearby(rotation); + if(t == null) recipe = null; + else{ + if(t.block() == null) recipe = null; + if(!obstructed(t.block()) && t.block().size <= maxSize){ + recipe = t.block(); + if(recipe.rotate && t.build != null) recipeRot = t.build.rotation; + else recipeRot = 0; + } + else recipe = null; + } + if(recipe == null){ + recipeRot = 0; + } + //Log.info(recipe == null ? "null" : recipe.name); + } + + @Override + public void update() { + super.update(); + boolean produce = recipe != null && consValid(); + if(produce){ + progress += edelta(); + if(progress >= constructTime()){ + if(placeBlock(tile.nearby((rotation + 2) % 4))) consume(); + progress = 0f; + } + } + + if(recipe == null) progress = 0f; + else if(recipe != prev){ + prev = recipe; + progress = 0f; + } + + heat = Mathf.lerpDelta(heat, Mathf.num(progress > 0.001f), 0.3f); + time += edelta(); + } + + public float constructTime(){ + return (recipe == null) ? 8f * buildSpeed : block.buildCost * buildSpeed; + } + + public boolean obstructed(Block b){ + Tile t = tile.nearby((rotation + 2) % 4); + if(t == null) return true; + return !Build.validPlace(b, team, t.x, t.y, recipeRot, true); + } + + public boolean placeBlock(@Nullable Tile t){ + if(obstructed(recipe) || t == null) return false; + Vars.world.tile(t.x, t.y).setBlock(recipe, team, recipeRot); + return true; + } + + @Override + public boolean acceptItem(Building source, Item item){ + return items.get(item) < getMaximumAccepted(item); + } + + @Override + public int getMaximumAccepted(Item item){ + if(recipe == null) return 0; + for(ItemStack stack : recipe.requirements){ + if(stack.item == item) return stack.amount * 2; + } + return 0; + } + + @Override + public void draw() { + Draw.rect(baseRegion, x, y); + Draw.rect(topRegion[rotation], x, y); + if(recipe != null){ + Draw.z(Layer.blockOver); + Draw.blend(Blending.additive); + Draw.color(color, Mathf.absin(2f, 1f)); + float dx = x + Geometry.d4x((rotation + 2) % 4) * tilesize; + float dy = y + Geometry.d4y((rotation + 2) % 4) * tilesize; + Draw.rect(recipe.icon(Cicon.full), dx, dy, recipeRot * 90f); + Draw.blend(); + Draw.reset(); + + if(heat > 0.001f){ + Draw.draw(Layer.blockOver, () -> { + Drawm.constructLineless(dx, dy, recipe.icon(Cicon.full), recipeRot * 90f, progress / constructTime(), heat, time, color); + }); + } + } + } + + @Override + public void drawSelect() { + super.drawSelect(); + int br = (rotation + 2) % 4; + Lines.stroke(1f); + Draw.color(Pal.accent, Mathf.absin(Time.time, 2f, 1f)); + Lines.square(x + Geometry.d4x(rotation) * tilesize, y + Geometry.d4y(rotation) * tilesize, tilesize / 2f); + Draw.color(color, Mathf.absin(Time.time, 2f, 1f)); + Lines.square(x + Geometry.d4x(br) * tilesize, y + Geometry.d4y(br) * tilesize, tilesize / 2f); + Draw.color(); + } + + @Override + public void write(Writes write){ + super.write(write); + write.f(progress); + } + + @Override + public void read(Reads read, byte revision){ + super.read(read, revision); + progress = read.f(); + } + } +}