Implemented silicon production / Centrifuge / Retexturing

This commit is contained in:
Anuken
2018-03-30 23:25:39 -04:00
parent 532eeb7ab0
commit 662283908c
30 changed files with 468 additions and 374 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 B

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 99 KiB

View File

@@ -1,7 +1,7 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Thu Mar 29 23:33:54 EDT 2018 #Fri Mar 30 23:22:00 EDT 2018
version=release version=release
androidBuildCode=729 androidBuildCode=748
name=Mindustry name=Mindustry
code=3.4 code=3.4
build=custom build build=custom build

View File

@@ -26,7 +26,7 @@ public class Items {
{ {
explosiveness = 0.2f; explosiveness = 0.2f;
flammability = 0.5f; flammability = 0.5f;
fluxiness = 0.5f; fluxiness = 0.3f;
material = false; material = false;
hardness = 2; hardness = 2;
} }
@@ -50,6 +50,13 @@ public class Items {
{ {
material = false; material = false;
flammability = 0.4f; flammability = 0.4f;
fluxiness = 0.2f;
}
},
sand = new Item("sand", Color.valueOf("e3d39e")){
{
material = false;
fluxiness = 0.5f;
} }
}; };
} }

View File

@@ -57,13 +57,14 @@ public class Recipes {
new Recipe(crafting, CraftingBlocks.alloysmelter, stack(Items.titanium, 50), stack(Items.steel, 50)), 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.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.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.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.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.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.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.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.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.melter, stack(Items.steel, 30), stack(Items.titanium, 15)),
new Recipe(crafting, CraftingBlocks.weaponFactory, stack(Items.steel, 60), stack(Items.iron, 60)).setDesktop(), new Recipe(crafting, CraftingBlocks.weaponFactory, stack(Items.steel, 60), stack(Items.iron, 60)).setDesktop(),

View File

@@ -86,7 +86,7 @@ public class Blocks {
}, },
sand = new Floor("sand") {{ sand = new Floor("sand") {{
drops = new ItemStack(Items.silicon, 1); drops = new ItemStack(Items.sand, 1);
}}, }},
ice = new Floor("ice") { ice = new Floor("ice") {

View File

@@ -1,5 +1,6 @@
package io.anuke.mindustry.content.blocks; package io.anuke.mindustry.content.blocks;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.Items; import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids; import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.graphics.Fx; import io.anuke.mindustry.graphics.Fx;
@@ -26,6 +27,19 @@ public class CraftingBlocks {
result = Items.densealloy; result = Items.densealloy;
burnDuration = 45f; burnDuration = 45f;
craftTime = 25f; 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") {{ poweralloysmelter = new PowerSmelter("poweralloysmelter") {{
@@ -74,29 +88,44 @@ public class CraftingBlocks {
liquid = Liquids.water; liquid = Liquids.water;
item = Items.stone; item = Items.stone;
results = new Item[]{ 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.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.iron, Items.iron, Items.iron,
Items.lead, Items.lead, Items.lead, Items.lead,
Items.coal, Items.coal, Items.coal, Items.coal,
Items.titanium Items.titanium
}; };
liquidUse = 0.2f; liquidUse = 0.2f;
filterTime = 40f; filterTime = 40f;
itemCapacity = 40; itemCapacity = 40;
health = 50; health = 50;
}}, }},
centrifuge = new GenericCrafter("centrifuge") {{ centrifuge = new Separator("centrifuge") {{
inputItem = new ItemStack(Items.stone, 6); liquid = Liquids.water;
inputLiquid = Liquids.water; item = Items.stone;
liquidUse = 0.1f; results = new Item[]{
output = Items.coal; null, null, null, null, null, null, null, null, null, null, null, null, null,
health = 50; Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand,
craftTime = 50; Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone,
hasInventory = hasLiquids = true; 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; size = 2;
}}, }},

View File

@@ -241,7 +241,7 @@ public class Fx{
smeltsmoke = new Effect(15, e -> { smeltsmoke = new Effect(15, e -> {
Angles.randLenVectors(e.id, 6, 4f + e.ifract()*5f, (x, y)->{ 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); Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fract()*2f, 45);
Draw.reset(); Draw.reset();
}); });
@@ -391,11 +391,12 @@ public class Fx{
Draw.reset(); Draw.reset();
}), }),
smelt = new Effect(10, e -> { smelt = new Effect(20, e -> {
Lines.stroke(1f); Angles.randLenVectors(e.id, 6, 2f + e.ifract()*5f, (x, y)->{
Draw.color(Color.YELLOW, Color.RED, e.ifract()); Draw.color(Color.WHITE, e.color, e.ifract());
Lines.spikes(e.x, e.y, e.ifract() * 5f, 1f, 8); Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fract()*2f, 45);
Draw.reset(); Draw.reset();
});
}), }),
breakBlock = new Effect(12, e -> { breakBlock = new Effect(12, e -> {

View File

@@ -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){
}
}

View File

@@ -88,11 +88,14 @@ public class GenericCrafter extends Block{
entity.progress += 1f / craftTime * Timers.delta(); entity.progress += 1f / craftTime * Timers.delta();
entity.totalProgress += Timers.delta(); entity.totalProgress += Timers.delta();
entity.warmup = Mathf.lerp(entity.warmup, 1f, 0.02f);
if(hasPower) entity.power.amount -= powerUsed; if(hasPower) entity.power.amount -= powerUsed;
if(hasLiquids) entity.liquid.amount -= liquidUsed; if(hasLiquids) entity.liquid.amount -= liquidUsed;
if(Mathf.chance(Timers.delta() * updateEffectChance)) if(Mathf.chance(Timers.delta() * updateEffectChance))
Effects.effect(updateEffect, entity.x + Mathf.range(size*4f), entity.y + Mathf.range(size*4)); 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){ if(entity.progress >= 1f){
@@ -127,5 +130,7 @@ public class GenericCrafter extends Block{
public static class GenericCrafterEntity extends TileEntity{ public static class GenericCrafterEntity extends TileEntity{
public float progress; public float progress;
public float totalProgress; public float totalProgress;
public float warmup;
public float craftTime;
} }
} }

View File

@@ -16,7 +16,7 @@ public class PlasticFormer extends GenericCrafter {
GenericCrafterEntity entity = tile.entity(); 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.rect(name + "-top", tile.drawx(), tile.drawy());
Draw.reset(); Draw.reset();
} }

View File

@@ -112,7 +112,7 @@ public class PowerSmelter extends PowerBlock {
} }
offloadNear(tile, result); offloadNear(tile, result);
Effects.effect(craftEffect, entity); Effects.effect(craftEffect, flameColor, entity);
} }
@Override @Override

View File

@@ -1,5 +1,6 @@
package io.anuke.mindustry.world.blocks.types.production; package io.anuke.mindustry.world.blocks.types.production;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Liquid; 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.Tile;
import io.anuke.mindustry.world.blocks.types.production.GenericCrafter.GenericCrafterEntity; import io.anuke.mindustry.world.blocks.types.production.GenericCrafter.GenericCrafterEntity;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
/**Extracts a random list of items from an input item and an input liquid.*/ /**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 item;
protected Item[] results; protected Item[] results;
protected float liquidUse; protected float liquidUse;
protected float powerUse;
protected float filterTime; protected float filterTime;
protected float spinnerRadius = 2.5f;
protected float spinnerLength = 1f;
protected float spinnerThickness = 1f;
protected float spinnerSpeed = 2f;
protected boolean offloading = false; protected boolean offloading = false;
@@ -29,6 +37,22 @@ public class Separator extends Block {
hasLiquids = true; 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 //TODO draw with effects such as spinning
@Override @Override
@@ -36,10 +60,19 @@ public class Separator extends Block {
GenericCrafterEntity entity = tile.entity(); GenericCrafterEntity entity = tile.entity();
float liquidUsed = Math.min(liquidCapacity, liquidUse * Timers.delta()); 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.progress += 1f/filterTime;
entity.liquid.amount -= liquidUsed; 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){ if(entity.progress >= 1f){

View File

@@ -1,5 +1,6 @@
package io.anuke.mindustry.world.blocks.types.production; package io.anuke.mindustry.world.blocks.types.production;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Fx; import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item; 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.Effects.Effect;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Fill;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings; 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 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 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 Effect craftEffect = Fx.smelt, burnEffect = Fx.fuelburn;
protected Color flameColor = Color.valueOf("ffb879");
protected int capacity = 20; protected int capacity = 20;
@@ -57,7 +60,7 @@ public class Smelter extends Block{
@Override @Override
public void update(Tile tile){ public void update(Tile tile){
CrafterEntity entity = tile.entity(); SmelterEntity entity = tile.entity();
if(entity.timer.get(timerDump, 5) && entity.inventory.hasItem(result)){ if(entity.timer.get(timerDump, 5) && entity.inventory.hasItem(result)){
tryDump(tile, result); tryDump(tile, result);
@@ -73,6 +76,9 @@ public class Smelter extends Block{
//decrement burntime //decrement burntime
if(entity.burnTime > 0){ if(entity.burnTime > 0){
entity.burnTime -= Timers.delta(); 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 //make sure it has all the items
@@ -93,7 +99,7 @@ public class Smelter extends Block{
} }
offloadNear(tile, result); offloadNear(tile, result);
Effects.effect(craftEffect, entity); Effects.effect(craftEffect, flameColor, entity);
} }
@Override @Override
@@ -114,22 +120,30 @@ public class Smelter extends Block{
public void draw(Tile tile){ public void draw(Tile tile){
super.draw(tile); super.draw(tile);
CrafterEntity entity = tile.entity(); SmelterEntity entity = tile.entity();
//draw glowing center //draw glowing center
if(entity.burnTime > 0){ if(entity.heat > 0f){
Draw.color(1f, 1f, 1f, Mathf.absin(Timers.time(), 9f, 0.4f) + Mathf.random(0.05f)); float g = 0.1f;
Draw.rect("smelter-middle", tile.worldx(), tile.worldy());
Draw.color(); 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 @Override
public TileEntity getEntity() { public TileEntity getEntity() {
return new CrafterEntity(); return new SmelterEntity();
} }
public class CrafterEntity extends TileEntity{ public class SmelterEntity extends TileEntity{
public float burnTime; public float burnTime;
public float heat;
} }
} }