Implemented silicon production / Centrifuge / Retexturing
This commit is contained in:
@@ -26,7 +26,7 @@ public class Items {
|
||||
{
|
||||
explosiveness = 0.2f;
|
||||
flammability = 0.5f;
|
||||
fluxiness = 0.5f;
|
||||
fluxiness = 0.3f;
|
||||
material = false;
|
||||
hardness = 2;
|
||||
}
|
||||
@@ -50,6 +50,13 @@ public class Items {
|
||||
{
|
||||
material = false;
|
||||
flammability = 0.4f;
|
||||
fluxiness = 0.2f;
|
||||
}
|
||||
},
|
||||
sand = new Item("sand", Color.valueOf("e3d39e")){
|
||||
{
|
||||
material = false;
|
||||
fluxiness = 0.5f;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -57,13 +57,14 @@ public class Recipes {
|
||||
new Recipe(crafting, CraftingBlocks.alloysmelter, stack(Items.titanium, 50), stack(Items.steel, 50)),
|
||||
new Recipe(crafting, CraftingBlocks.powersmelter, stack(Items.steel, 30), stack(Items.iron, 30)),
|
||||
new Recipe(crafting, CraftingBlocks.poweralloysmelter, stack(Items.steel, 30), stack(Items.iron, 30)),
|
||||
new Recipe(crafting, CraftingBlocks.siliconsmelter, stack(Items.steel, 30), stack(Items.iron, 30)),
|
||||
new Recipe(crafting, CraftingBlocks.separator, stack(Items.steel, 30), stack(Items.iron, 30)),
|
||||
new Recipe(crafting, CraftingBlocks.centrifuge, stack(Items.steel, 30), stack(Items.iron, 30)),
|
||||
new Recipe(crafting, CraftingBlocks.oilRefinery, stack(Items.steel, 15), stack(Items.iron, 15)),
|
||||
new Recipe(crafting, CraftingBlocks.biomatterCompressor, stack(Items.steel, 15), stack(Items.iron, 15)),
|
||||
new Recipe(crafting, CraftingBlocks.stoneFormer, stack(Items.steel, 10), stack(Items.iron, 10)),
|
||||
new Recipe(crafting, CraftingBlocks.plasticFormer, stack(Items.steel, 30), stack(Items.titanium, 15)),
|
||||
new Recipe(crafting, CraftingBlocks.cryofluidmixer, stack(Items.steel, 30), stack(Items.titanium, 15)),
|
||||
new Recipe(crafting, CraftingBlocks.stoneFormer, stack(Items.steel, 10), stack(Items.iron, 10)),
|
||||
new Recipe(crafting, CraftingBlocks.melter, stack(Items.steel, 30), stack(Items.titanium, 15)),
|
||||
new Recipe(crafting, CraftingBlocks.weaponFactory, stack(Items.steel, 60), stack(Items.iron, 60)).setDesktop(),
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class Blocks {
|
||||
},
|
||||
|
||||
sand = new Floor("sand") {{
|
||||
drops = new ItemStack(Items.silicon, 1);
|
||||
drops = new ItemStack(Items.sand, 1);
|
||||
}},
|
||||
|
||||
ice = new Floor("ice") {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
@@ -26,6 +27,19 @@ public class CraftingBlocks {
|
||||
result = Items.densealloy;
|
||||
burnDuration = 45f;
|
||||
craftTime = 25f;
|
||||
flameColor = Color.valueOf("fd896e");
|
||||
}},
|
||||
|
||||
siliconsmelter = new PowerSmelter("siliconsmelter") {{
|
||||
health = 90;
|
||||
craftEffect = Fx.smeltsmoke;
|
||||
inputs = new ItemStack[]{new ItemStack(Items.coal, 1), new ItemStack(Items.sand, 2)};
|
||||
result = Items.silicon;
|
||||
powerUse = 0.05f;
|
||||
craftTime = 35f;
|
||||
size = 2;
|
||||
hasLiquids = false;
|
||||
flameColor = Color.valueOf("ffef99");
|
||||
}},
|
||||
|
||||
poweralloysmelter = new PowerSmelter("poweralloysmelter") {{
|
||||
@@ -74,29 +88,44 @@ public class CraftingBlocks {
|
||||
liquid = Liquids.water;
|
||||
item = Items.stone;
|
||||
results = new Item[]{
|
||||
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null,
|
||||
Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand,
|
||||
Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone,
|
||||
Items.iron, Items.iron, Items.iron, Items.iron,
|
||||
Items.lead, Items.lead,
|
||||
Items.coal, Items.coal,
|
||||
Items.titanium
|
||||
};
|
||||
|
||||
liquidUse = 0.2f;
|
||||
filterTime = 40f;
|
||||
itemCapacity = 40;
|
||||
|
||||
health = 50;
|
||||
}},
|
||||
|
||||
centrifuge = new GenericCrafter("centrifuge") {{
|
||||
inputItem = new ItemStack(Items.stone, 6);
|
||||
inputLiquid = Liquids.water;
|
||||
liquidUse = 0.1f;
|
||||
output = Items.coal;
|
||||
health = 50;
|
||||
craftTime = 50;
|
||||
hasInventory = hasLiquids = true;
|
||||
centrifuge = new Separator("centrifuge") {{
|
||||
liquid = Liquids.water;
|
||||
item = Items.stone;
|
||||
results = new Item[]{
|
||||
null, null, null, null, null, null, null, null, null, null, null, null, null,
|
||||
Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand,
|
||||
Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone,
|
||||
Items.iron, Items.iron, Items.iron, Items.iron, Items.iron,
|
||||
Items.lead, Items.lead, Items.lead,
|
||||
Items.coal, Items.coal, Items.coal,
|
||||
Items.titanium, Items.titanium,
|
||||
Items.thorium,
|
||||
};
|
||||
|
||||
liquidUse = 0.3f;
|
||||
hasPower = true;
|
||||
powerUse = 0.2f;
|
||||
filterTime = 15f;
|
||||
itemCapacity = 60;
|
||||
health = 50*4;
|
||||
spinnerLength = 1.5f;
|
||||
spinnerRadius = 3.5f;
|
||||
spinnerThickness = 1.5f;
|
||||
spinnerSpeed = 3f;
|
||||
size = 2;
|
||||
}},
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ public class Fx{
|
||||
|
||||
smeltsmoke = new Effect(15, e -> {
|
||||
Angles.randLenVectors(e.id, 6, 4f + e.ifract()*5f, (x, y)->{
|
||||
Draw.color(Color.WHITE, Color.valueOf("ffc999"), e.ifract());
|
||||
Draw.color(Color.WHITE, e.color, e.ifract());
|
||||
Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fract()*2f, 45);
|
||||
Draw.reset();
|
||||
});
|
||||
@@ -391,11 +391,12 @@ public class Fx{
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
smelt = new Effect(10, e -> {
|
||||
Lines.stroke(1f);
|
||||
Draw.color(Color.YELLOW, Color.RED, e.ifract());
|
||||
Lines.spikes(e.x, e.y, e.ifract() * 5f, 1f, 8);
|
||||
Draw.reset();
|
||||
smelt = new Effect(20, e -> {
|
||||
Angles.randLenVectors(e.id, 6, 2f + e.ifract()*5f, (x, y)->{
|
||||
Draw.color(Color.WHITE, e.color, e.ifract());
|
||||
Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fract()*2f, 45);
|
||||
Draw.reset();
|
||||
});
|
||||
}),
|
||||
|
||||
breakBlock = new Effect(12, e -> {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class Centrifuge extends GenericCrafter {
|
||||
protected float powerUsed = 0.1f;
|
||||
protected float timeUsed = 360f;
|
||||
|
||||
public Centrifuge(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -88,11 +88,14 @@ public class GenericCrafter extends Block{
|
||||
|
||||
entity.progress += 1f / craftTime * Timers.delta();
|
||||
entity.totalProgress += Timers.delta();
|
||||
entity.warmup = Mathf.lerp(entity.warmup, 1f, 0.02f);
|
||||
if(hasPower) entity.power.amount -= powerUsed;
|
||||
if(hasLiquids) entity.liquid.amount -= liquidUsed;
|
||||
|
||||
if(Mathf.chance(Timers.delta() * updateEffectChance))
|
||||
Effects.effect(updateEffect, entity.x + Mathf.range(size*4f), entity.y + Mathf.range(size*4));
|
||||
}else{
|
||||
entity.warmup = Mathf.lerp(entity.warmup, 0f, 0.02f);
|
||||
}
|
||||
|
||||
if(entity.progress >= 1f){
|
||||
@@ -127,5 +130,7 @@ public class GenericCrafter extends Block{
|
||||
public static class GenericCrafterEntity extends TileEntity{
|
||||
public float progress;
|
||||
public float totalProgress;
|
||||
public float warmup;
|
||||
public float craftTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class PlasticFormer extends GenericCrafter {
|
||||
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
|
||||
Draw.alpha(Mathf.absin(entity.totalProgress, 3f, 0.9f));
|
||||
Draw.alpha(Mathf.absin(entity.totalProgress, 3f, 0.9f) * entity.warmup);
|
||||
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class PowerSmelter extends PowerBlock {
|
||||
}
|
||||
|
||||
offloadNear(tile, result);
|
||||
Effects.effect(craftEffect, entity);
|
||||
Effects.effect(craftEffect, flameColor, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
@@ -7,6 +8,8 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.production.GenericCrafter.GenericCrafterEntity;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
/**Extracts a random list of items from an input item and an input liquid.*/
|
||||
@@ -17,7 +20,12 @@ public class Separator extends Block {
|
||||
protected Item item;
|
||||
protected Item[] results;
|
||||
protected float liquidUse;
|
||||
protected float powerUse;
|
||||
protected float filterTime;
|
||||
protected float spinnerRadius = 2.5f;
|
||||
protected float spinnerLength = 1f;
|
||||
protected float spinnerThickness = 1f;
|
||||
protected float spinnerSpeed = 2f;
|
||||
|
||||
protected boolean offloading = false;
|
||||
|
||||
@@ -29,6 +37,22 @@ public class Separator extends Block {
|
||||
hasLiquids = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile) {
|
||||
super.draw(tile);
|
||||
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
|
||||
Draw.color(tile.entity.liquid.liquid.color);
|
||||
Draw.alpha(tile.entity.liquid.amount / liquidCapacity);
|
||||
Draw.rect(name + "-liquid", tile.drawx(), tile.drawy());
|
||||
|
||||
Draw.color(Color.valueOf("858585"));
|
||||
Lines.stroke(spinnerThickness);
|
||||
Lines.spikes(tile.drawx(), tile.drawy(), spinnerRadius, spinnerLength, 3, entity.craftTime*spinnerSpeed);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
//TODO draw with effects such as spinning
|
||||
|
||||
@Override
|
||||
@@ -36,10 +60,19 @@ public class Separator extends Block {
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
|
||||
float liquidUsed = Math.min(liquidCapacity, liquidUse * Timers.delta());
|
||||
float powerUsed = Math.min(powerCapacity, powerUse * Timers.delta());
|
||||
|
||||
if(entity.liquid.amount >= liquidUsed && entity.inventory.hasItem(item)){
|
||||
entity.craftTime += entity.warmup*Timers.delta();
|
||||
|
||||
if(entity.liquid.amount >= liquidUsed && entity.inventory.hasItem(item) &&
|
||||
(!hasPower || entity.power.amount >= powerUsed)){
|
||||
entity.progress += 1f/filterTime;
|
||||
entity.liquid.amount -= liquidUsed;
|
||||
if(hasPower) entity.power.amount -= powerUsed;
|
||||
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.02f);
|
||||
}else{
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, 0.02f);
|
||||
}
|
||||
|
||||
if(entity.progress >= 1f){
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
@@ -11,6 +12,7 @@ import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
@@ -27,6 +29,7 @@ public class Smelter extends Block{
|
||||
protected float craftTime = 20f; //time to craft one item, so max 3 items per second by default
|
||||
protected float burnDuration = 50f; //by default, the fuel will burn 45 frames, so that's 2.5 items/fuel at most
|
||||
protected Effect craftEffect = Fx.smelt, burnEffect = Fx.fuelburn;
|
||||
protected Color flameColor = Color.valueOf("ffb879");
|
||||
|
||||
protected int capacity = 20;
|
||||
|
||||
@@ -57,7 +60,7 @@ public class Smelter extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
CrafterEntity entity = tile.entity();
|
||||
SmelterEntity entity = tile.entity();
|
||||
|
||||
if(entity.timer.get(timerDump, 5) && entity.inventory.hasItem(result)){
|
||||
tryDump(tile, result);
|
||||
@@ -73,6 +76,9 @@ public class Smelter extends Block{
|
||||
//decrement burntime
|
||||
if(entity.burnTime > 0){
|
||||
entity.burnTime -= Timers.delta();
|
||||
entity.heat = Mathf.lerp(entity.heat, 1f, 0.02f);
|
||||
}else{
|
||||
entity.heat = Mathf.lerp(entity.heat, 0f, 0.02f);
|
||||
}
|
||||
|
||||
//make sure it has all the items
|
||||
@@ -93,7 +99,7 @@ public class Smelter extends Block{
|
||||
}
|
||||
|
||||
offloadNear(tile, result);
|
||||
Effects.effect(craftEffect, entity);
|
||||
Effects.effect(craftEffect, flameColor, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,22 +120,30 @@ public class Smelter extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
CrafterEntity entity = tile.entity();
|
||||
SmelterEntity entity = tile.entity();
|
||||
|
||||
//draw glowing center
|
||||
if(entity.burnTime > 0){
|
||||
Draw.color(1f, 1f, 1f, Mathf.absin(Timers.time(), 9f, 0.4f) + Mathf.random(0.05f));
|
||||
Draw.rect("smelter-middle", tile.worldx(), tile.worldy());
|
||||
Draw.color();
|
||||
}
|
||||
if(entity.heat > 0f){
|
||||
float g = 0.1f;
|
||||
|
||||
Draw.alpha(((1f-g) + Mathf.absin(Timers.time(), 8f, g)) * entity.heat);
|
||||
|
||||
Draw.tint(flameColor);
|
||||
Fill.circle(tile.drawx(), tile.drawy(), 2f + Mathf.absin(Timers.time(), 5f, 0.8f));
|
||||
Draw.color(1f, 1f, 1f, entity.heat);
|
||||
Fill.circle(tile.drawx(), tile.drawy(), 1f + Mathf.absin(Timers.time(), 5f, 0.7f));
|
||||
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity() {
|
||||
return new CrafterEntity();
|
||||
return new SmelterEntity();
|
||||
}
|
||||
|
||||
public class CrafterEntity extends TileEntity{
|
||||
public class SmelterEntity extends TileEntity{
|
||||
public float burnTime;
|
||||
public float heat;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user