Implemented alloy smelter, fixed place crashes for many of the blocks
|
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 265 B |
BIN
core/assets-raw/sprites/blocks/production/itemvoid.png
Normal file
|
After Width: | Height: | Size: 274 B |
BIN
core/assets-raw/sprites/blocks/production/melter.png
Normal file
|
After Width: | Height: | Size: 284 B |
|
After Width: | Height: | Size: 194 B |
BIN
core/assets-raw/sprites/blocks/production/poweralloysmelter.png
Normal file
|
After Width: | Height: | Size: 474 B |
|
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 463 B |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 95 KiB |
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Mon Mar 26 22:36:42 EDT 2018
|
#Tue Mar 27 20:10:08 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=669
|
androidBuildCode=678
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.4
|
code=3.4
|
||||||
build=custom build
|
build=custom build
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class Recipes {
|
|||||||
new Recipe(crafting, CraftingBlocks.smelter, stack(Items.iron, 40)),
|
new Recipe(crafting, CraftingBlocks.smelter, stack(Items.iron, 40)),
|
||||||
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.extractor, stack(Items.steel, 10), stack(Items.iron, 10)),
|
new Recipe(crafting, CraftingBlocks.poweralloysmelter, 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)),
|
||||||
@@ -64,6 +64,7 @@ public class Recipes {
|
|||||||
new Recipe(crafting, CraftingBlocks.stoneFormer, stack(Items.steel, 10), stack(Items.iron, 10)),
|
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.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(),
|
||||||
|
|
||||||
//new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
//new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
||||||
@@ -110,6 +111,7 @@ public class Recipes {
|
|||||||
new Recipe(units, UnitBlocks.walkerFactory, stack(Items.steel, 10)),
|
new Recipe(units, UnitBlocks.walkerFactory, stack(Items.steel, 10)),
|
||||||
|
|
||||||
new Recipe(units, DebugBlocks.itemSource, stack(Items.steel, 10)).setDebug(),
|
new Recipe(units, DebugBlocks.itemSource, stack(Items.steel, 10)).setDebug(),
|
||||||
|
new Recipe(units, DebugBlocks.itemVoid, stack(Items.steel, 10)).setDebug(),
|
||||||
new Recipe(units, DebugBlocks.powerVoid, stack(Items.steel, 10)).setDebug(),
|
new Recipe(units, DebugBlocks.powerVoid, stack(Items.steel, 10)).setDebug(),
|
||||||
new Recipe(units, DebugBlocks.powerInfinite, stack(Items.steel, 10), stack(Items.densealloy, 5)).setDebug()
|
new Recipe(units, DebugBlocks.powerInfinite, stack(Items.steel, 10), stack(Items.densealloy, 5)).setDebug()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,15 +28,27 @@ public class CraftingBlocks {
|
|||||||
craftTime = 25f;
|
craftTime = 25f;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
powersmelter = new PowerSmelter("powersmelter") {{
|
poweralloysmelter = new PowerSmelter("poweralloysmelter") {{
|
||||||
health = 90;
|
health = 90;
|
||||||
|
craftEffect = Fx.smeltsmoke;
|
||||||
inputs = new ItemStack[]{new ItemStack(Items.titanium, 4), new ItemStack(Items.thorium, 4)};
|
inputs = new ItemStack[]{new ItemStack(Items.titanium, 4), new ItemStack(Items.thorium, 4)};
|
||||||
result = Items.densealloy;
|
result = Items.densealloy;
|
||||||
|
powerUse = 0.3f;
|
||||||
burnDuration = 45f;
|
burnDuration = 45f;
|
||||||
craftTime = 25f;
|
craftTime = 25f;
|
||||||
size = 2;
|
size = 2;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
powersmelter = new PowerSmelter("powersmelter") {{
|
||||||
|
health = 90;
|
||||||
|
inputs = new ItemStack[]{new ItemStack(Items.coal, 1), new ItemStack(Items.iron, 1)};
|
||||||
|
result = Items.densealloy;
|
||||||
|
burnDuration = 45f;
|
||||||
|
powerUse = 0.1f;
|
||||||
|
craftTime = 25f;
|
||||||
|
size = 2;
|
||||||
|
}},
|
||||||
|
|
||||||
cryofluidmixer = new LiquidMixer("cryofluidmixer") {{
|
cryofluidmixer = new LiquidMixer("cryofluidmixer") {{
|
||||||
health = 200;
|
health = 200;
|
||||||
inputLiquid = Liquids.water;
|
inputLiquid = Liquids.water;
|
||||||
@@ -48,23 +60,22 @@ public class CraftingBlocks {
|
|||||||
size = 2;
|
size = 2;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
//TODO implement melter
|
melter = new PowerCrafter("melter") {{
|
||||||
melter = new LiquidMixer("melter") {{
|
|
||||||
health = 200;
|
health = 200;
|
||||||
inputLiquid = Liquids.water;
|
outputLiquid = Liquids.lava;
|
||||||
outputLiquid = Liquids.cryofluid;
|
outputLiquidAmount = 0.05f;
|
||||||
inputItem = Items.titanium;
|
input = new ItemStack(Items.stone, 1);
|
||||||
liquidPerItem = 50f;
|
|
||||||
itemCapacity = 50;
|
itemCapacity = 50;
|
||||||
|
craftTime = 10f;
|
||||||
powerUse = 0.1f;
|
powerUse = 0.1f;
|
||||||
size = 2;
|
hasLiquids = hasPower = true;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
separator = new Separator("separator") {{
|
separator = new Separator("separator") {{
|
||||||
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, null, null,
|
||||||
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,
|
||||||
@@ -79,16 +90,6 @@ public class CraftingBlocks {
|
|||||||
health = 50;
|
health = 50;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
extractor = new GenericCrafter("extractor") {{
|
|
||||||
inputItem = new ItemStack(Items.stone, 6);
|
|
||||||
inputLiquid = Liquids.water;
|
|
||||||
liquidUse = 0.1f;
|
|
||||||
output = Items.coal;
|
|
||||||
health = 50;
|
|
||||||
craftTime = 50;
|
|
||||||
hasInventory = hasLiquids = true;
|
|
||||||
}},
|
|
||||||
|
|
||||||
centrifuge = new GenericCrafter("centrifuge") {{
|
centrifuge = new GenericCrafter("centrifuge") {{
|
||||||
inputItem = new ItemStack(Items.stone, 6);
|
inputItem = new ItemStack(Items.stone, 6);
|
||||||
inputLiquid = Liquids.water;
|
inputLiquid = Liquids.water;
|
||||||
|
|||||||
@@ -40,5 +40,19 @@ public class DebugBlocks {
|
|||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
itemVoid = new Block("itemvoid"){
|
||||||
|
{
|
||||||
|
update = solid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleItem(Item item, Tile tile, Tile source) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import io.anuke.mindustry.input.InputHandler;
|
|||||||
import io.anuke.mindustry.input.PlaceMode;
|
import io.anuke.mindustry.input.PlaceMode;
|
||||||
import io.anuke.mindustry.ui.fragments.ToolFragment;
|
import io.anuke.mindustry.ui.fragments.ToolFragment;
|
||||||
import io.anuke.mindustry.world.BlockBar;
|
import io.anuke.mindustry.world.BlockBar;
|
||||||
import io.anuke.mindustry.world.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.*;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.badlogic.gdx.graphics.OrthographicCamera;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Layer;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
import io.anuke.mindustry.world.blocks.types.StaticBlock;
|
import io.anuke.mindustry.world.blocks.types.StaticBlock;
|
||||||
@@ -125,7 +124,7 @@ public class BlockRenderer{
|
|||||||
|
|
||||||
for(; iterateidx < requestidx; iterateidx ++){
|
for(; iterateidx < requestidx; iterateidx ++){
|
||||||
|
|
||||||
if(iterateidx < requests.size - 1 && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
if(iterateidx < requests.size && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,15 +142,15 @@ public class BlockRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawTeamBlocks(Layer layer, Team team){
|
public void drawTeamBlocks(Layer layer, Team team){
|
||||||
int iterateidx = this.iterateidx;
|
int index = this.iterateidx;
|
||||||
|
|
||||||
for(; iterateidx < requestidx; iterateidx ++){
|
for(; index < requestidx; index ++){
|
||||||
|
|
||||||
if(iterateidx < requests.size - 1 && requests.get(iterateidx).layer.ordinal() > layer.ordinal()){
|
if(index < requests.size && requests.get(index).layer.ordinal() > layer.ordinal()){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockRequest req = requests.get(iterateidx);
|
BlockRequest req = requests.get(index);
|
||||||
if(req.tile.getTeam() != team) continue;
|
if(req.tile.getTeam() != team) continue;
|
||||||
Block block = req.tile.block();
|
Block block = req.tile.block();
|
||||||
|
|
||||||
@@ -166,7 +165,7 @@ public class BlockRenderer{
|
|||||||
public void skipLayer(Layer stopAt){
|
public void skipLayer(Layer stopAt){
|
||||||
|
|
||||||
for(; iterateidx < requestidx; iterateidx ++){
|
for(; iterateidx < requestidx; iterateidx ++){
|
||||||
if(iterateidx < requests.size - 1 && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
if(iterateidx < requests.size && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,6 +212,14 @@ 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());
|
||||||
|
Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fract()*2f, 45);
|
||||||
|
Draw.reset();
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
|
||||||
blastsmoke = new Effect(26, e -> {
|
blastsmoke = new Effect(26, e -> {
|
||||||
Angles.randLenVectors(e.id, 12, 1f + e.ifract()*23f, (x, y)->{
|
Angles.randLenVectors(e.id, 12, 1f + e.ifract()*23f, (x, y)->{
|
||||||
float size = 2f+e.fract()*6f;
|
float size = 2f+e.fract()*6f;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package io.anuke.mindustry.world;
|
package io.anuke.mindustry.graphics;
|
||||||
|
|
||||||
public enum Layer{
|
public enum Layer{
|
||||||
/**Base block layer.*/
|
/**Base block layer.*/
|
||||||
@@ -9,6 +9,7 @@ import io.anuke.mindustry.core.GameState.State;
|
|||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.graphics.DrawLayer;
|
import io.anuke.mindustry.graphics.DrawLayer;
|
||||||
import io.anuke.mindustry.graphics.Fx;
|
import io.anuke.mindustry.graphics.Fx;
|
||||||
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.net.NetEvents;
|
import io.anuke.mindustry.net.NetEvents;
|
||||||
import io.anuke.mindustry.resource.ItemStack;
|
import io.anuke.mindustry.resource.ItemStack;
|
||||||
@@ -85,7 +86,7 @@ public class Block extends BaseBlock {
|
|||||||
/**Draw layer. Only used for 'cached' rendering.*/
|
/**Draw layer. Only used for 'cached' rendering.*/
|
||||||
public DrawLayer drawLayer = DrawLayer.normal;
|
public DrawLayer drawLayer = DrawLayer.normal;
|
||||||
/**Layer to draw extra stuff on.*/
|
/**Layer to draw extra stuff on.*/
|
||||||
public Layer layer = null;
|
public io.anuke.mindustry.graphics.Layer layer = null;
|
||||||
/**Extra layer to draw extra extra stuff on.*/
|
/**Extra layer to draw extra extra stuff on.*/
|
||||||
public Layer layer2 = null;
|
public Layer layer2 = null;
|
||||||
/**whether this block can be replaced in all cases*/
|
/**whether this block can be replaced in all cases*/
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.graphics.Fx;
|
import io.anuke.mindustry.graphics.Fx;
|
||||||
import io.anuke.mindustry.world.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.world.blocks.types.defense;
|
|||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
import io.anuke.mindustry.world.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.types.defense;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.graphics.Fx;
|
import io.anuke.mindustry.graphics.Fx;
|
||||||
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.anuke.mindustry.resource.Item;
|
|||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.BlockGroup;
|
import io.anuke.mindustry.world.BlockGroup;
|
||||||
import io.anuke.mindustry.world.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
import com.badlogic.gdx.utils.IntArray;
|
import com.badlogic.gdx.utils.IntArray;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.world.Edges;
|
import io.anuke.mindustry.world.Edges;
|
||||||
import io.anuke.mindustry.world.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
||||||
import io.anuke.ucore.core.Settings;
|
import io.anuke.ucore.core.Settings;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.anuke.mindustry.graphics.Fx;
|
|||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.BlockGroup;
|
import io.anuke.mindustry.world.BlockGroup;
|
||||||
import io.anuke.mindustry.world.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class GenericCrafter extends Block{
|
|||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
Draw.rect(name(), tile.drawx(), tile.drawy());
|
Draw.rect(name(), tile.drawx(), tile.drawy());
|
||||||
|
|
||||||
if(tile.entity.liquid.liquid == null) return;
|
if(!hasLiquids) return;
|
||||||
|
|
||||||
Draw.color(tile.entity.liquid.liquid.color);
|
Draw.color(tile.entity.liquid.liquid.color);
|
||||||
Draw.alpha(tile.entity.liquid.amount / liquidCapacity);
|
Draw.alpha(tile.entity.liquid.amount / liquidCapacity);
|
||||||
@@ -81,11 +81,11 @@ public class GenericCrafter extends Block{
|
|||||||
|
|
||||||
if((!hasLiquids || liquidUsed > entity.liquid.amount) &&
|
if((!hasLiquids || liquidUsed > entity.liquid.amount) &&
|
||||||
(!hasPower || powerUsed > entity.power.amount) &&
|
(!hasPower || powerUsed > entity.power.amount) &&
|
||||||
(!hasInventory || entity.inventory.hasItem(inputItem.item, itemsUsed))){
|
(inputItem == null || entity.inventory.hasItem(inputItem.item, itemsUsed))){
|
||||||
|
|
||||||
entity.progress += 1f / craftTime * Timers.delta();
|
entity.progress += 1f / craftTime * Timers.delta();
|
||||||
entity.power.amount -= powerUsed;
|
if(hasPower) entity.power.amount -= powerUsed;
|
||||||
entity.liquid.amount -= liquidUsed;
|
if(hasLiquids) entity.liquid.amount -= liquidUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entity.progress >= 1f){
|
if(entity.progress >= 1f){
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
public class PowerCrafter extends Block{
|
public class PowerCrafter extends Block{
|
||||||
protected final int timerDump = timers++;
|
protected final int timerDump = timers++;
|
||||||
|
|
||||||
|
/**Required.*/
|
||||||
protected ItemStack input;
|
protected ItemStack input;
|
||||||
/**Optional.*/
|
/**Optional.*/
|
||||||
protected Item outputItem;
|
protected Item outputItem;
|
||||||
@@ -26,6 +27,7 @@ public class PowerCrafter extends Block{
|
|||||||
super(name);
|
super(name);
|
||||||
solid = true;
|
solid = true;
|
||||||
update = true;
|
update = true;
|
||||||
|
hasPower = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -12,6 +13,8 @@ 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.Log;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
@@ -24,7 +27,7 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
* Everything else in each array: requirements. Can have duplicates.*/
|
* Everything else in each array: requirements. Can have duplicates.*/
|
||||||
protected ItemStack[] inputs;
|
protected ItemStack[] inputs;
|
||||||
protected Item result;
|
protected Item result;
|
||||||
protected float powerDrain = 0.01f;
|
protected float powerUse;
|
||||||
|
|
||||||
protected float heatUpTime = 80f;
|
protected float heatUpTime = 80f;
|
||||||
protected float minHeat = 0.5f;
|
protected float minHeat = 0.5f;
|
||||||
@@ -32,7 +35,8 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
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 float burnEffectChance = 0.01f;
|
protected float burnEffectChance = 0.01f;
|
||||||
protected Effect craftEffect = Fx.smelt, burnEffect = Fx.fuelburn;
|
protected Effect craftEffect = Fx.smelt,
|
||||||
|
burnEffect = Fx.fuelburn;
|
||||||
|
|
||||||
protected int capacity = 20;
|
protected int capacity = 20;
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
super.setStats();
|
super.setStats();
|
||||||
//TODO input/outputs
|
//TODO input/outputs
|
||||||
// stats.add("input", Arrays.toString(inputs));
|
// stats.add("input", Arrays.toString(inputs));
|
||||||
stats.add("powersecond", Strings.toFixed(powerDrain*60f, 2));
|
stats.add("powersecond", Strings.toFixed(powerUse *60f, 2));
|
||||||
//stats.add("output", result);
|
//stats.add("output", result);
|
||||||
stats.add("fuelduration", Strings.toFixed(burnDuration/60f, 1));
|
stats.add("fuelduration", Strings.toFixed(burnDuration/60f, 1));
|
||||||
stats.add("maxoutputsecond", Strings.toFixed(60f/craftTime, 1));
|
stats.add("maxoutputsecond", Strings.toFixed(60f/craftTime, 1));
|
||||||
@@ -74,15 +78,16 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
tryDump(tile, result);
|
tryDump(tile, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
float used = powerDrain * Timers.delta();
|
float used = powerUse * Timers.delta();
|
||||||
|
|
||||||
//heat it up if there's enough power
|
//heat it up if there's enough power
|
||||||
if(entity.power.amount > used){
|
if(entity.power.amount > used){
|
||||||
entity.power.amount -= used;
|
entity.power.amount -= used;
|
||||||
entity.heat += 1f /heatUpTime;
|
entity.heat += 1f / heatUpTime;
|
||||||
if(Mathf.chance(Timers.delta() * burnEffectChance)) Effects.effect(burnEffect, entity.x + Mathf.range(2f), entity.y + Mathf.range(2f));
|
if(Mathf.chance(Timers.delta() * burnEffectChance))
|
||||||
|
Effects.effect(burnEffect, entity.x + Mathf.range(size*4f), entity.y + Mathf.range(size*4));
|
||||||
}else{
|
}else{
|
||||||
entity.heat -= 1f /heatUpTime;
|
entity.heat -= 1f / heatUpTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.heat = Mathf.clamp(entity.heat);
|
entity.heat = Mathf.clamp(entity.heat);
|
||||||
@@ -126,10 +131,22 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
|
|
||||||
PowerSmelterEntity entity = tile.entity();
|
PowerSmelterEntity entity = tile.entity();
|
||||||
|
|
||||||
|
Log.info(entity.heat + "");
|
||||||
|
|
||||||
//draw glowing center
|
//draw glowing center
|
||||||
if(entity.heat > 0f){
|
if(entity.heat > 0f){
|
||||||
Draw.color(1f, 1f, 1f, Mathf.absin(Timers.time(), 9f, 0.4f) + Mathf.random(0.05f));
|
float g = 0.3f;
|
||||||
Draw.rect("smelter-middle", tile.drawx(), tile.drawy());
|
float r = 0.06f;
|
||||||
|
float cr = Mathf.random(0.1f);
|
||||||
|
|
||||||
|
Draw.alpha(((1f-g) + Mathf.absin(Timers.time(), 9f, g) + Mathf.random(r) - r) * entity.heat);
|
||||||
|
|
||||||
|
Draw.tint(Color.valueOf("ffc999"));
|
||||||
|
Fill.circle(tile.drawx(), tile.drawy(), 3f + Mathf.absin(Timers.time(), 6f, 2f) + cr);
|
||||||
|
Draw.color(1f, 1f, 1f, entity.heat);
|
||||||
|
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
||||||
|
Fill.circle(tile.drawx(), tile.drawy(), 2f + Mathf.absin(Timers.time(), 6f, 1f) + cr);
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.world.blocks.types.production;
|
|||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.mindustry.resource.Liquid;
|
import io.anuke.mindustry.resource.Liquid;
|
||||||
import io.anuke.mindustry.world.BlockGroup;
|
import io.anuke.mindustry.world.BlockGroup;
|
||||||
import io.anuke.mindustry.world.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.types.LiquidBlock;
|
import io.anuke.mindustry.world.blocks.types.LiquidBlock;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
|
|||||||