Shader crash fix / More blocks / Kiln / Removed (unused) flux
BIN
core/assets-raw/sprites/blocks/environment/stained-stone1.png
Normal file
|
After Width: | Height: | Size: 1023 B |
BIN
core/assets-raw/sprites/blocks/environment/stained-stone2.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
core/assets-raw/sprites/blocks/environment/stained-stone3.png
Normal file
|
After Width: | Height: | Size: 1022 B |
BIN
core/assets-raw/sprites/blocks/production/kiln.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -498,7 +498,6 @@ mech.glaive-ship.weapon = Flame Repeater
|
|||||||
item.explosiveness = [LIGHT_GRAY]Explosiveness: {0}%
|
item.explosiveness = [LIGHT_GRAY]Explosiveness: {0}%
|
||||||
item.flammability = [LIGHT_GRAY]Flammability: {0}%
|
item.flammability = [LIGHT_GRAY]Flammability: {0}%
|
||||||
item.radioactivity = [LIGHT_GRAY]Radioactivity: {0}%
|
item.radioactivity = [LIGHT_GRAY]Radioactivity: {0}%
|
||||||
item.fluxiness = [LIGHT_GRAY]Flux Power: {0}%
|
|
||||||
unit.health = [LIGHT_GRAY]Health: {0}
|
unit.health = [LIGHT_GRAY]Health: {0}
|
||||||
unit.speed = [LIGHT_GRAY]Speed: {0}
|
unit.speed = [LIGHT_GRAY]Speed: {0}
|
||||||
mech.weapon = [LIGHT_GRAY]Weapon: {0}
|
mech.weapon = [LIGHT_GRAY]Weapon: {0}
|
||||||
@@ -510,6 +509,8 @@ mech.ability = [LIGHT_GRAY]Ability: {0}
|
|||||||
liquid.heatcapacity = [LIGHT_GRAY]Heat Capacity: {0}
|
liquid.heatcapacity = [LIGHT_GRAY]Heat Capacity: {0}
|
||||||
liquid.viscosity = [LIGHT_GRAY]Viscosity: {0}
|
liquid.viscosity = [LIGHT_GRAY]Viscosity: {0}
|
||||||
liquid.temperature = [LIGHT_GRAY]Temperature: {0}
|
liquid.temperature = [LIGHT_GRAY]Temperature: {0}
|
||||||
|
block.kiln.name = Kiln
|
||||||
|
block.kiln.description = Smelts sand and lead into metaglass. Requires small amounts of power.
|
||||||
block.graphite-press.name = Graphite Press
|
block.graphite-press.name = Graphite Press
|
||||||
block.multi-press.name = Multi-Press
|
block.multi-press.name = Multi-Press
|
||||||
block.constructing = {0} [LIGHT_GRAY](Constructing)
|
block.constructing = {0} [LIGHT_GRAY](Constructing)
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1015 KiB After Width: | Height: | Size: 1022 KiB |
@@ -36,10 +36,10 @@ public class Blocks implements ContentList{
|
|||||||
//environment
|
//environment
|
||||||
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
|
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
|
||||||
grass, holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster,
|
grass, holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster,
|
||||||
iceSnow, sandWater, duneRocks, stainedRocks,
|
iceSnow, sandWater, duneRocks, stainedRocks, stainedStone,
|
||||||
|
|
||||||
//crafting
|
//crafting
|
||||||
siliconSmelter, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
|
siliconSmelter, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
|
||||||
melter, separator, centrifuge, biomatterCompressor, pulverizer, incinerator,
|
melter, separator, centrifuge, biomatterCompressor, pulverizer, incinerator,
|
||||||
|
|
||||||
//sandbox
|
//sandbox
|
||||||
@@ -200,7 +200,6 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
grass = new Floor("grass"){{
|
grass = new Floor("grass"){{
|
||||||
hasOres = true;
|
|
||||||
minimapColor = Color.valueOf("549d5b");
|
minimapColor = Color.valueOf("549d5b");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -240,6 +239,11 @@ public class Blocks implements ContentList{
|
|||||||
variants = 2;
|
variants = 2;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
stainedStone = new Floor("stained-stone"){{
|
||||||
|
edgeStyle = "blocky";
|
||||||
|
hasOres = true;
|
||||||
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
//region crafting
|
//region crafting
|
||||||
|
|
||||||
@@ -283,6 +287,19 @@ public class Blocks implements ContentList{
|
|||||||
consumes.power(0.50f);
|
consumes.power(0.50f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
kiln = new PowerSmelter("kiln"){{
|
||||||
|
requirements(Category.crafting, ItemStack.with(Items.copper, 120, Items.graphite, 60, Items.lead, 60));
|
||||||
|
craftEffect = Fx.smeltsmoke;
|
||||||
|
output = Items.metaglass;
|
||||||
|
craftTime = 30f;
|
||||||
|
size = 2;
|
||||||
|
hasLiquids = false;
|
||||||
|
flameColor = Color.valueOf("ffc099");
|
||||||
|
|
||||||
|
consumes.items(new ItemStack(Items.lead, 1), new ItemStack(Items.sand, 1));
|
||||||
|
consumes.power(0.60f);
|
||||||
|
}};
|
||||||
|
|
||||||
plastaniumCompressor = new PlastaniumCompressor("plastanium-compressor"){{
|
plastaniumCompressor = new PlastaniumCompressor("plastanium-compressor"){{
|
||||||
requirements(Category.crafting, ItemStack.with(Items.silicon, 160, Items.lead, 230, Items.graphite, 120, Items.titanium, 160));
|
requirements(Category.crafting, ItemStack.with(Items.silicon, 160, Items.lead, 230, Items.graphite, 120, Items.titanium, 160));
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
@@ -318,9 +335,6 @@ public class Blocks implements ContentList{
|
|||||||
craftTime = 75f;
|
craftTime = 75f;
|
||||||
size = 2;
|
size = 2;
|
||||||
|
|
||||||
useFlux = true;
|
|
||||||
fluxNeeded = 3;
|
|
||||||
|
|
||||||
consumes.power(4f);
|
consumes.power(4f);
|
||||||
consumes.items(new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.copper, 3));
|
consumes.items(new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.copper, 3));
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ public class Items implements ContentList{
|
|||||||
phasefabric = new Item("phase-fabric", Color.valueOf("f4ba6e")){{
|
phasefabric = new Item("phase-fabric", Color.valueOf("f4ba6e")){{
|
||||||
type = ItemType.material;
|
type = ItemType.material;
|
||||||
cost = 1.5f;
|
cost = 1.5f;
|
||||||
fluxiness = 1.8f;
|
|
||||||
radioactivity = 0.6f;
|
radioactivity = 0.6f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -88,11 +87,10 @@ public class Items implements ContentList{
|
|||||||
|
|
||||||
biomatter = new Item("biomatter", Color.valueOf("648b55")){{
|
biomatter = new Item("biomatter", Color.valueOf("648b55")){{
|
||||||
flammability = 1.05f;
|
flammability = 1.05f;
|
||||||
fluxiness = 0.6f;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
sand = new Item("sand", Color.valueOf("e3d39e")){{
|
sand = new Item("sand", Color.valueOf("e3d39e")){{
|
||||||
fluxiness = 1f;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
blastCompound = new Item("blast-compound", Color.valueOf("ff795e")){{
|
blastCompound = new Item("blast-compound", Color.valueOf("ff795e")){{
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ public class World implements ApplicationListener{
|
|||||||
for(int x = 0; x < tiles.length; x++){
|
for(int x = 0; x < tiles.length; x++){
|
||||||
for(int y = 0; y < tiles[0].length; y++){
|
for(int y = 0; y < tiles[0].length; y++){
|
||||||
Tile tile = tiles[x][y];
|
Tile tile = tiles[x][y];
|
||||||
if(tile.block().solid && !tile.block().update && tile.block().fillsTile){
|
if(tile.block().solid && !tile.block().synthetic() && tile.block().fillsTile){
|
||||||
dark[x][y] = darkIterations;
|
dark[x][y] = darkIterations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -459,7 +459,7 @@ public class World implements ApplicationListener{
|
|||||||
for(int x = 0; x < tiles.length; x++){
|
for(int x = 0; x < tiles.length; x++){
|
||||||
for(int y = 0; y < tiles[0].length; y++){
|
for(int y = 0; y < tiles[0].length; y++){
|
||||||
Tile tile = tiles[x][y];
|
Tile tile = tiles[x][y];
|
||||||
if(tile.block().solid && !tile.block().update){
|
if(tile.block().solid && !tile.block().synthetic()){
|
||||||
tiles[x][y].setRotation(dark[x][y]);
|
tiles[x][y].setRotation(dark[x][y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOutOfBounds(){
|
public boolean isOutOfBounds(){
|
||||||
return x < worldBounds || y < worldBounds || x > world.width() * tilesize + worldBounds || y > world.height() * tilesize + worldBounds;
|
return x < -worldBounds || y < -worldBounds || x > world.width() * tilesize + worldBounds || y > world.height() * tilesize + worldBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float calculateDamage(float amount){
|
public float calculateDamage(float amount){
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class BlockRenderer{
|
|||||||
for(int x = 0; x < world.width(); x++){
|
for(int x = 0; x < world.width(); x++){
|
||||||
for(int y = 0; y < world.height(); y++){
|
for(int y = 0; y < world.height(); y++){
|
||||||
Tile tile = world.rawTile(x, y);
|
Tile tile = world.rawTile(x, y);
|
||||||
if(tile.getRotation() > 0){
|
if(tile.getRotation() > 0 && tile.block().solid && tile.block().fillsTile && !tile.block().synthetic()){
|
||||||
Draw.color(0f, 0f, 0f, Math.min((tile.getRotation() + 0.5f)/4f, 1f));
|
Draw.color(0f, 0f, 0f, Math.min((tile.getRotation() + 0.5f)/4f, 1f));
|
||||||
Fill.rect(tile.x + 0.5f, tile.y + 0.5f, 1, 1);
|
Fill.rect(tile.x + 0.5f, tile.y + 0.5f, 1, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,19 +7,12 @@ import io.anuke.arc.graphics.glutils.Shader;
|
|||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.Unit;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
|
||||||
|
|
||||||
public class Shaders{
|
public class Shaders{
|
||||||
public static Outline outline;
|
public static Outline outline;
|
||||||
public static Shadow shadow;
|
public static Shadow shadow;
|
||||||
public static BlockBuild blockbuild;
|
public static BlockBuild blockbuild;
|
||||||
public static BlockPreview blockpreview;
|
public static BlockPreview blockpreview;
|
||||||
public static Shield shield;
|
public static Shield shield;
|
||||||
public static SurfaceShader water;
|
|
||||||
public static SurfaceShader lava;
|
|
||||||
public static SurfaceShader oil;
|
|
||||||
public static Space space;
|
|
||||||
public static UnitBuild build;
|
public static UnitBuild build;
|
||||||
public static MixShader mix;
|
public static MixShader mix;
|
||||||
public static Shader fullMix;
|
public static Shader fullMix;
|
||||||
@@ -32,10 +25,6 @@ public class Shaders{
|
|||||||
blockbuild = new BlockBuild();
|
blockbuild = new BlockBuild();
|
||||||
blockpreview = new BlockPreview();
|
blockpreview = new BlockPreview();
|
||||||
shield = new Shield();
|
shield = new Shield();
|
||||||
water = new SurfaceShader("water");
|
|
||||||
lava = new SurfaceShader("lava");
|
|
||||||
oil = new SurfaceShader("oil");
|
|
||||||
space = new Space();
|
|
||||||
build = new UnitBuild();
|
build = new UnitBuild();
|
||||||
mix = new MixShader();
|
mix = new MixShader();
|
||||||
fog = new FogShader();
|
fog = new FogShader();
|
||||||
@@ -82,19 +71,6 @@ public class Shaders{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Space extends SurfaceShader{
|
|
||||||
|
|
||||||
public Space(){
|
|
||||||
super("space2");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(){
|
|
||||||
super.apply();
|
|
||||||
setUniformf("u_center", world.width() * tilesize / 2f, world.height() * tilesize / 2f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class UnitBuild extends LoadShader{
|
public static class UnitBuild extends LoadShader{
|
||||||
public float progress, time;
|
public float progress, time;
|
||||||
public Color color = new Color();
|
public Color color = new Color();
|
||||||
@@ -204,23 +180,6 @@ public class Shaders{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SurfaceShader extends LoadShader{
|
|
||||||
|
|
||||||
public SurfaceShader(String frag){
|
|
||||||
super(frag, "cache");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(){
|
|
||||||
setUniformf("camerapos",
|
|
||||||
Core.camera.position.x - Core.camera.width / 2 ,
|
|
||||||
Core.camera.position.y - Core.camera.height / 2 );
|
|
||||||
setUniformf("screensize", Core.camera.width,
|
|
||||||
Core.camera.height );
|
|
||||||
setUniformf("u_time", Time.time());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class LoadShader extends Shader{
|
public static class LoadShader extends Shader{
|
||||||
public LoadShader(String frag, String vert){
|
public LoadShader(String frag, String vert){
|
||||||
super(Core.files.internal("shaders/" + vert + ".vertex"), Core.files.internal("shaders/" + frag + ".fragment"));
|
super(Core.files.internal("shaders/" + vert + ".vertex"), Core.files.internal("shaders/" + frag + ".fragment"));
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class MapGenerator extends Generator{
|
|||||||
|
|
||||||
if((tile.block() instanceof StaticWall
|
if((tile.block() instanceof StaticWall
|
||||||
&& tiles[newX][newY].block() instanceof StaticWall)
|
&& tiles[newX][newY].block() instanceof StaticWall)
|
||||||
|| tile.block() == Blocks.air
|
|| (tile.block() == Blocks.air && !tiles[newX][newY].block().synthetic())
|
||||||
|| (tiles[newX][newY].block() == Blocks.air && tile.block() instanceof StaticWall)){
|
|| (tiles[newX][newY].block() == Blocks.air && tile.block() instanceof StaticWall)){
|
||||||
tile.setBlock(tiles[newX][newY].block());
|
tile.setBlock(tiles[newX][newY].block());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ public class Item extends UnlockableContent implements Comparable<Item>{
|
|||||||
public float flammability = 0f;
|
public float flammability = 0f;
|
||||||
/**how radioactive this item is. 0=none, 1=chernobyl ground zero*/
|
/**how radioactive this item is. 0=none, 1=chernobyl ground zero*/
|
||||||
public float radioactivity;
|
public float radioactivity;
|
||||||
/**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/
|
|
||||||
public float fluxiness = 0f;
|
|
||||||
/**drill hardness of the item*/
|
/**drill hardness of the item*/
|
||||||
public int hardness = 0;
|
public int hardness = 0;
|
||||||
/**the burning color of this item. TODO unused; implement*/
|
/**the burning color of this item. TODO unused; implement*/
|
||||||
|
|||||||
@@ -92,8 +92,6 @@ public class ContentDisplay{
|
|||||||
table.row();
|
table.row();
|
||||||
table.add(Core.bundle.format("item.radioactivity", (int) (item.radioactivity * 100)));
|
table.add(Core.bundle.format("item.radioactivity", (int) (item.radioactivity * 100)));
|
||||||
table.row();
|
table.row();
|
||||||
table.add(Core.bundle.format("item.fluxiness", (int) (item.fluxiness * 100)));
|
|
||||||
table.row();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void displayLiquid(Table table, Liquid liquid){
|
public static void displayLiquid(Table table, Liquid liquid){
|
||||||
|
|||||||
@@ -173,8 +173,7 @@ public class HudFragment extends Fragment{
|
|||||||
.update(l ->{
|
.update(l ->{
|
||||||
l.setColor(Tmp.c1.set(Color.WHITE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 10f, 1f)));
|
l.setColor(Tmp.c1.set(Color.WHITE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 10f, 1f)));
|
||||||
l.setText(Core.bundle.format("outofbounds", (int)((boundsCountdown - players[0].destructTime) / 60f)));
|
l.setText(Core.bundle.format("outofbounds", (int)((boundsCountdown - players[0].destructTime) / 60f)));
|
||||||
}).get().setAlignment(Align.center, Align.center))
|
}).get().setAlignment(Align.center, Align.center)).margin(6).update(u -> {
|
||||||
.margin(6).update(u -> {
|
|
||||||
u.color.a = Mathf.lerpDelta(u.color.a, Mathf.num(players[0].isOutOfBounds()), 0.1f);
|
u.color.a = Mathf.lerpDelta(u.color.a, Mathf.num(players[0].isOutOfBounds()), 0.1f);
|
||||||
}).get().color.a = 0f;
|
}).get().color.a = 0f;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import io.anuke.arc.graphics.g2d.Fill;
|
|||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.mindustry.content.Items;
|
|
||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.Fx;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
@@ -23,19 +22,11 @@ import java.io.DataInput;
|
|||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.content;
|
|
||||||
|
|
||||||
public class PowerSmelter extends PowerBlock{
|
public class PowerSmelter extends PowerBlock{
|
||||||
protected final int timerDump = timers++;
|
protected final int timerDump = timers++;
|
||||||
|
|
||||||
protected Item output;
|
protected Item output;
|
||||||
|
|
||||||
protected float minFlux = 0.2f;
|
|
||||||
protected int fluxNeeded = 1;
|
|
||||||
protected float fluxSpeedMult = 0.75f;
|
|
||||||
protected float baseFluxChance = 0.25f;
|
|
||||||
protected boolean useFlux = false;
|
|
||||||
|
|
||||||
protected float heatUpTime = 80f;
|
protected float heatUpTime = 80f;
|
||||||
protected float minHeat = 0.5f;
|
protected float minHeat = 0.5f;
|
||||||
|
|
||||||
@@ -56,10 +47,6 @@ public class PowerSmelter extends PowerBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
if(useFlux){
|
|
||||||
consumes.item(Items.sand).optional(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
produces.set(output);
|
produces.set(output);
|
||||||
@@ -106,43 +93,18 @@ public class PowerSmelter extends PowerBlock{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float baseSmeltSpeed = 1f;
|
|
||||||
for(Item item : content.items()){
|
|
||||||
if(item.fluxiness >= minFlux && tile.entity.items.get(item) > 0){
|
|
||||||
baseSmeltSpeed = fluxSpeedMult;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
entity.craftTime += entity.delta() * entity.power.satisfaction;
|
entity.craftTime += entity.delta() * entity.power.satisfaction;
|
||||||
|
|
||||||
if(entity.items.get(output) >= itemCapacity //output full
|
if(entity.items.get(output) >= itemCapacity //output full
|
||||||
|| entity.heat <= minHeat //not burning
|
|| entity.heat <= minHeat //not burning
|
||||||
|| entity.craftTime < craftTime*baseSmeltSpeed){ //not yet time
|
|| entity.craftTime < craftTime){ //not yet time
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.craftTime = 0f;
|
entity.craftTime = 0f;
|
||||||
|
|
||||||
boolean consumeInputs = true;
|
for(ItemStack item : consumes.items()){
|
||||||
|
entity.items.remove(item.item, item.amount);
|
||||||
if(useFlux){
|
|
||||||
//remove flux materials if present
|
|
||||||
for(Item item : content.items()){
|
|
||||||
if(item.fluxiness >= minFlux && tile.entity.items.get(item) >= fluxNeeded){
|
|
||||||
tile.entity.items.remove(item, fluxNeeded);
|
|
||||||
|
|
||||||
//chance of not consuming inputs if flux material present
|
|
||||||
consumeInputs = !Mathf.chance(item.fluxiness * baseFluxChance);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(consumeInputs){
|
|
||||||
for(ItemStack item : consumes.items()){
|
|
||||||
entity.items.remove(item.item, item.amount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
offloadNear(tile, output);
|
offloadNear(tile, output);
|
||||||
@@ -158,8 +120,7 @@ public class PowerSmelter extends PowerBlock{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return useFlux && item.fluxiness >= minFlux && tile.entity.items.get(item) < itemCapacity;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
package io.anuke.mindustry.world.blocks.production;
|
package io.anuke.mindustry.world.blocks.production;
|
||||||
|
|
||||||
|
import io.anuke.arc.entities.Effects;
|
||||||
|
import io.anuke.arc.entities.Effects.Effect;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
|
import io.anuke.arc.graphics.g2d.Fill;
|
||||||
|
import io.anuke.arc.math.Mathf;
|
||||||
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.Fx;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
@@ -11,25 +17,12 @@ import io.anuke.mindustry.world.consumers.ConsumeItem;
|
|||||||
import io.anuke.mindustry.world.consumers.ConsumeItems;
|
import io.anuke.mindustry.world.consumers.ConsumeItems;
|
||||||
import io.anuke.mindustry.world.meta.BlockStat;
|
import io.anuke.mindustry.world.meta.BlockStat;
|
||||||
import io.anuke.mindustry.world.meta.StatUnit;
|
import io.anuke.mindustry.world.meta.StatUnit;
|
||||||
import io.anuke.arc.entities.Effects;
|
|
||||||
import io.anuke.arc.entities.Effects.Effect;
|
|
||||||
import io.anuke.arc.util.Time;
|
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
|
||||||
import io.anuke.arc.graphics.g2d.Fill;
|
|
||||||
import io.anuke.arc.math.Mathf;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
|
||||||
|
|
||||||
public class Smelter extends Block{
|
public class Smelter extends Block{
|
||||||
protected final int timerDump = timers++;
|
protected final int timerDump = timers++;
|
||||||
|
|
||||||
protected Item result;
|
protected Item result;
|
||||||
|
|
||||||
protected float minFlux = 0.2f;
|
|
||||||
protected float fluxSpeedMult = 0.75f;
|
|
||||||
protected float baseFluxChance = 0.25f;
|
|
||||||
protected boolean useFlux = false;
|
|
||||||
|
|
||||||
protected float craftTime = 20f;
|
protected float craftTime = 20f;
|
||||||
protected float burnDuration = 50f;
|
protected float burnDuration = 50f;
|
||||||
protected Effect craftEffect = Fx.smelt, burnEffect = Fx.fuelburn;
|
protected Effect craftEffect = Fx.smelt, burnEffect = Fx.fuelburn;
|
||||||
@@ -61,13 +54,6 @@ public class Smelter extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
for(ItemStack item : consumes.items()){
|
|
||||||
if(item.item.fluxiness >= minFlux && useFlux){
|
|
||||||
throw new IllegalArgumentException("'" + name + "' has input item '" + item.item.name + "', which is a flux, when useFlux is enabled. To prevent ambiguous item use, either remove this flux item from the inputs, or set useFlux to false.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
produces.set(result);
|
produces.set(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,43 +85,17 @@ public class Smelter extends Block{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float baseSmeltSpeed = 1f;
|
|
||||||
for(Item item : content.items()){
|
|
||||||
if(item.fluxiness >= minFlux && tile.entity.items.get(item) > 0){
|
|
||||||
baseSmeltSpeed = fluxSpeedMult;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
entity.craftTime += entity.delta();
|
entity.craftTime += entity.delta();
|
||||||
|
|
||||||
if(entity.items.get(result) >= itemCapacity //output full
|
if(entity.items.get(result) >= itemCapacity //output full
|
||||||
|| entity.burnTime <= 0 //not burning
|
|| entity.burnTime <= 0 //not burning
|
||||||
|| entity.craftTime < craftTime*baseSmeltSpeed){ //not yet time
|
|| entity.craftTime < craftTime){ //not yet time
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.craftTime = 0f;
|
entity.craftTime = 0f;
|
||||||
|
for(ItemStack item : consumes.items()){
|
||||||
boolean consumeInputs = true;
|
entity.items.remove(item.item, item.amount);
|
||||||
|
|
||||||
if(useFlux){
|
|
||||||
//remove flux materials if present
|
|
||||||
for(Item item : content.items()){
|
|
||||||
if(item.fluxiness >= minFlux && tile.entity.items.get(item) > 0){
|
|
||||||
tile.entity.items.remove(item, 1);
|
|
||||||
|
|
||||||
//chance of not consuming inputs if flux material present
|
|
||||||
consumeInputs = !Mathf.chance(item.fluxiness * baseFluxChance);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(consumeInputs){
|
|
||||||
for(ItemStack item : consumes.items()){
|
|
||||||
entity.items.remove(item.item, item.amount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
offloadNear(tile, result);
|
offloadNear(tile, result);
|
||||||
@@ -153,8 +113,7 @@ public class Smelter extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (isInput && tile.entity.items.get(item) < itemCapacity) || (item == consumes.item() && tile.entity.items.get(consumes.item()) < itemCapacity) ||
|
return (isInput && tile.entity.items.get(item) < itemCapacity) || (item == consumes.item() && tile.entity.items.get(consumes.item()) < itemCapacity);
|
||||||
(useFlux && item.fluxiness >= minFlux && tile.entity.items.get(item) < itemCapacity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||