Skip to content

Commit

Permalink
surge slime & cloner
Browse files Browse the repository at this point in the history
  • Loading branch information
sk7725 committed Jan 19, 2021
1 parent 489228c commit 94cbce3
Show file tree
Hide file tree
Showing 17 changed files with 268 additions and 8 deletions.
7 changes: 7 additions & 0 deletions assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions assets/bundles/bundle_ko.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/blocks/distribution/surge-slime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/blocks/production/cloner-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/blocks/production/cloner-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/blocks/production/cloner-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/blocks/production/cloner-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/blocks/production/cloner-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/blocks/production/cloner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 18 additions & 2 deletions src/betamindy/content/MindyBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"){
Expand Down
14 changes: 14 additions & 0 deletions src/betamindy/graphics/Drawm.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/betamindy/util/MobileFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public void created(){
reMap();
}

//TODO: reMap when pushed
public void reMap(){
proxOres = new Seq<Tile>();
proxItems = new Seq<Item>();
Expand Down
2 changes: 1 addition & 1 deletion src/betamindy/world/blocks/distribution/Piston.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public Seq<Building> getPowerConnections(Seq<Building> out){
}
return out;
}
//TODO: override conductsTo (I hope)
//TODO: override conductsTo in the next Mindustry build(122.1++)
@Override
public void onProximityUpdate(){
super.onProximityUpdate();
Expand Down
24 changes: 21 additions & 3 deletions src/betamindy/world/blocks/distribution/SlimeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -27,16 +29,32 @@ 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")){
Draw.rect(coreRegion, x, y);
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();
Expand Down
193 changes: 193 additions & 0 deletions src/betamindy/world/blocks/production/BlockCloner.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
}

0 comments on commit 94cbce3

Please sign in to comment.