Added sprites for all new crafting blocks, fixed seprator

This commit is contained in:
Anuken
2018-03-26 22:49:33 -04:00
parent 707e57e72d
commit 17bc8fd9ed
19 changed files with 366 additions and 303 deletions

View File

@@ -60,7 +60,7 @@ public class Recipes {
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.biomassCompressor, 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)),

View File

@@ -60,20 +60,21 @@ public class CraftingBlocks {
size = 2;
}},
separator = new Filtrator("separator") {{
separator = new Separator("separator") {{
liquid = Liquids.water;
item = Items.stone;
results = new Item[]{
null, null, null, null, null,
Items.stone, Items.stone, Items.stone, Items.stone,
Items.iron, Items.iron, Items.iron,
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.iron, Items.iron, Items.iron, Items.iron,
Items.lead, Items.lead,
Items.coal, Items.coal,
Items.titanium
};
liquidUse = 0.1f;
liquidUse = 0.2f;
filterTime = 40f;
itemCapacity = 40;
health = 50;
}},
@@ -111,7 +112,7 @@ public class CraftingBlocks {
hasPower = hasLiquids = true;
}},
biomassCompressor = new PowerCrafter("biomasscompressor") {{
biomatterCompressor = new PowerCrafter("biomattercompressor") {{
input = new ItemStack(Items.biomatter, 1);
liquidCapacity = 60f;
powerUse = 0.05f;

View File

@@ -11,11 +11,11 @@ public class LiquidBlocks {
public static final Block
pump = new Pump("pump") {{
pumpAmount = 0.8f;
pumpAmount = 0.1f;
}},
fluxpump = new Pump("fluxpump") {{
pumpAmount = 1.2f;
pumpAmount = 0.2f;
}},
conduit = new Conduit("conduit") {{

View File

@@ -12,6 +12,7 @@ import io.anuke.mindustry.io.MapTileData.TileDataMarker;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.ColorMapper;
import io.anuke.mindustry.world.ColorMapper.BlockPair;
import io.anuke.ucore.util.Log;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -137,9 +138,14 @@ public class MapIO {
short blocks = stream.readShort();
for(int i = 0; i < blocks; i ++){
Block block = Block.getByName(stream.readUTF());
if(block == null) block = Blocks.air;
map.put(stream.readShort(), block.id);
short id = stream.readShort();
String name = stream.readUTF();
Block block = Block.getByName(name);
if(block == null){
Log.info("Map load info: No block with name {0} found.", name);
block = Blocks.air;
}
map.put(id, block.id);
}
int width = stream.readShort();

View File

@@ -92,7 +92,7 @@ public abstract class BaseBlock {
if(ofract > fract) return;
float flow = Math.min((fract - ofract) * (liquidCapacity/(1.3f + tile.entity.liquid.liquid.viscosity)),
float flow = Math.min((fract - ofract) * (liquidCapacity/(1.1f + tile.entity.liquid.liquid.viscosity)),
Math.min(tile.entity.liquid.amount/liquidFlowFactor * Math.max(Timers.delta(), 1f), tile.entity.liquid.amount));
if(flow <= 0f || tile.entity.liquid.amount < flow) return;

View File

@@ -25,7 +25,7 @@ public class Conveyor extends Block{
private static ItemPos drawpos = new ItemPos();
private static ItemPos pos1 = new ItemPos();
private static ItemPos pos2 = new ItemPos();
private static final float itemSpace = 0.135f * 1.3f;
private static final float itemSpace = 0.135f * 2f;
private static final float offsetScl = 128f*3f;
private static final float itemSize = 5f;
private static final float minmove = 1f / (Short.MAX_VALUE - 2);
@@ -142,7 +142,7 @@ public class Conveyor extends Block{
public boolean acceptItem(Item item, Tile tile, Tile source){
int direction = source == null ? 0 : Math.abs(source.relativeTo(tile.x, tile.y) - tile.getRotation());
float minitem = tile.<ConveyorEntity>entity().minitem;
return (((direction == 0) && minitem > 0.05f) ||
return (((direction == 0) && minitem > itemSpace) ||
((direction %2 == 1) && minitem > 0.52f)) && (source == null || !(source.block().rotate && (source.getRotation() + 2) % 4 == tile.getRotation()));
}

View File

@@ -33,7 +33,6 @@ public class GenericCrafter extends Block{
public GenericCrafter(String name) {
super(name);
update = true;
rotate = false;
solid = true;
health = 60;
}

View File

@@ -10,7 +10,7 @@ import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Mathf;
/**Extracts a random list of items from an input item and an input liquid.*/
public class Filtrator extends Block {
public class Separator extends Block {
protected final int timerDump = timers ++;
protected Liquid liquid;
@@ -19,7 +19,9 @@ public class Filtrator extends Block {
protected float liquidUse;
protected float filterTime;
public Filtrator(String name) {
protected boolean offloading = false;
public Separator(String name) {
super(name);
update = true;
solid = true;
@@ -37,12 +39,18 @@ public class Filtrator extends Block {
if(entity.liquid.amount >= liquidUsed && entity.inventory.hasItem(item)){
entity.progress += 1f/filterTime;
entity.liquid.amount -= liquidUsed;
}
if(entity.progress >= 1f){
entity.progress = 0f;
Item item = Mathf.select(results);
if(item != null) offloadNear(tile, item);
entity.inventory.removeItem(this.item, 1);
if(item != null){
offloading = true;
offloadNear(tile, item);
offloading = false;
}
}
if(entity.timer.get(timerDump, 5)){
@@ -52,7 +60,7 @@ public class Filtrator extends Block {
@Override
public boolean canDump(Tile tile, Tile to, Item item) {
return item != this.item;
return offloading || item != this.item;
}
@Override