Added phaseweaver to recipe list

This commit is contained in:
Anuken
2018-06-26 14:50:12 -04:00
parent a71f3f55b0
commit a6ca84308e
13 changed files with 633 additions and 562 deletions

View File

@@ -59,7 +59,6 @@ public class Recipes implements ContentList{
new Recipe(crafting, CraftingBlocks.siliconsmelter, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 50));
//other crafting
//TODO phaseweaver sprites
new Recipe(crafting, CraftingBlocks.phaseweaver, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 160), new ItemStack(Items.thorium, 150));
//TODO implement alloy smelter
// new Recipe(crafting, CraftingBlocks.alloySmelter, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 160), new ItemStack(Items.thorium, 140));

View File

@@ -68,14 +68,14 @@ public class CraftingBlocks extends BlockList implements ContentList {
updateEffect = BlockFx.plasticburn;
}};
phaseweaver = new PowerSmelter("phase-weaver") {{
phaseweaver = new PhaseWeaver("phase-weaver") {{
health = 90;
craftEffect = BlockFx.smeltsmoke;
inputs = new ItemStack[]{new ItemStack(Items.thorium, 2), new ItemStack(Items.sand, 6)};
inputs = new ItemStack[]{new ItemStack(Items.thorium, 4), new ItemStack(Items.sand, 10)};
result = Items.phasematter;
powerUse = 0.4f;
craftTime = 100f;
size = 3;
craftTime = 120f;
size = 2;
}};
alloysmelter = new PowerSmelter("alloy-smelter") {{

View File

@@ -111,7 +111,7 @@ public class ContentLoader {
}
if(Block.all().size >= 256){
throw new IllegalArgumentException("THE TIME HAS COME. More than 256 blocks have been created..");
throw new IllegalArgumentException("THE TIME HAS COME. More than 256 blocks have been created.");
}
Log.info("--- CONTENT INFO ---");

View File

@@ -0,0 +1,69 @@
package io.anuke.mindustry.world.blocks.production;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf;
public class PhaseWeaver extends PowerSmelter{
protected TextureRegion bottomRegion;
protected TextureRegion weaveRegion;
public PhaseWeaver(String name) {
super(name);
}
@Override
public void load() {
super.load();
bottomRegion = Draw.region(name + "-bottom");
weaveRegion = Draw.region(name + "-weave");
}
@Override
public TextureRegion[] getIcon() {
if(icon == null){
icon = new TextureRegion[]{Draw.region(name + "-bottom"), Draw.region(name)};
}
return icon;
}
@Override
public void draw(Tile tile) {
PowerSmelterEntity entity = tile.entity();
Draw.rect(bottomRegion, tile.drawx(), tile.drawy());
if(entity.heat > 0.001f){
float progress = 0.5f;
Shaders.build.region = weaveRegion;
Shaders.build.progress = progress;
Shaders.build.color.set(Palette.accent);
Shaders.build.time = -entity.time / 10f;
Graphics.shader(Shaders.build, false);
Shaders.build.apply();
Draw.rect(weaveRegion, tile.drawx(), tile.drawy(), entity.time);
Graphics.shader();
Draw.color(Palette.accent);
Lines.lineAngleCenter(
tile.drawx() + Mathf.sin(entity.time, 6f, Vars.tilesize / 3f * size),
tile.drawy(),
90,
size * Vars.tilesize /2f);
Draw.reset();
}
Draw.rect(name, tile.drawx(), tile.drawy());
}
}

View File

@@ -100,6 +100,7 @@ public class PowerSmelter extends PowerBlock {
}
entity.heat = Mathf.clamp(entity.heat);
entity.time += entity.heat * Timers.delta();
//make sure it has all the items
for(ItemStack item : inputs){
@@ -191,6 +192,7 @@ public class PowerSmelter extends PowerBlock {
class PowerSmelterEntity extends TileEntity{
public float heat;
public float time;
@Override
public void write(DataOutputStream stream) throws IOException {