Copper added, carbide removed

This commit is contained in:
Anuken 2018-08-19 13:34:36 -04:00
parent 81931eb536
commit 9d654c1f18
3 changed files with 39 additions and 30 deletions

View File

@ -163,14 +163,14 @@ public class CraftingBlocks extends BlockList implements ContentList{
}};
separator = new Separator("separator"){{
results = new Item[]{
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.tungsten, Items.tungsten, Items.tungsten, Items.tungsten,
Items.lead, Items.lead,
Items.coal, Items.coal,
Items.titanium
results = new ItemStack[]{
new ItemStack(null, 10),
new ItemStack(Items.sand, 10),
new ItemStack(Items.stone, 9),
new ItemStack(Items.copper, 4),
new ItemStack(Items.lead, 2),
new ItemStack(Items.coal, 2),
new ItemStack(Items.titanium, 1),
};
filterTime = 40f;
itemCapacity = 40;
@ -181,15 +181,15 @@ public class CraftingBlocks extends BlockList implements ContentList{
}};
centrifuge = new Separator("centrifuge"){{
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.tungsten, Items.tungsten, Items.tungsten, Items.tungsten, Items.tungsten,
Items.lead, Items.lead, Items.lead,
Items.coal, Items.coal, Items.coal,
Items.titanium, Items.titanium,
Items.thorium,
results = new ItemStack[]{
new ItemStack(null, 13),
new ItemStack(Items.sand, 12),
new ItemStack(Items.stone, 11),
new ItemStack(Items.copper, 5),
new ItemStack(Items.lead, 3),
new ItemStack(Items.coal, 3),
new ItemStack(Items.titanium, 2),
new ItemStack(Items.thorium, 1)
};
hasPower = true;

View File

@ -6,19 +6,12 @@ import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.ContentList;
public class StandardBullets extends BulletList implements ContentList{
public static BulletType tungsten, lead, carbide, thorium, homing, tracer;
public static BulletType copper, carbide, thorium, homing, tracer;
@Override
public void load(){
tungsten = new BasicBulletType(3.2f, 10, "bullet"){
{
bulletWidth = 9f;
bulletHeight = 11f;
}
};
lead = new BasicBulletType(2.5f, 5, "bullet"){
copper = new BasicBulletType(2.5f, 7, "bullet"){
{
bulletWidth = 7f;
bulletHeight = 9f;

View File

@ -6,6 +6,7 @@ import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.production.GenericCrafter.GenericCrafterEntity;
@ -22,7 +23,7 @@ import io.anuke.ucore.util.Mathf;
public class Separator extends Block{
protected final int timerDump = timers++;
protected Item[] results;
protected ItemStack[] results;
protected float filterTime;
protected float spinnerRadius = 2.5f;
protected float spinnerLength = 1f;
@ -57,8 +58,8 @@ public class Separator extends Block{
super.setStats();
stats.add(BlockStat.outputItem, new ItemFilterValue(item -> {
for(Item i : results){
if(item == i) return true;
for(ItemStack i : results){
if(item == i.item) return true;
}
return false;
}));
@ -95,7 +96,22 @@ public class Separator extends Block{
if(entity.progress >= 1f){
entity.progress = 0f;
Item item = Mathf.select(results);
int sum = 0;
for(ItemStack stack : results) sum += stack.amount;
int i = Mathf.random(sum);
int count = 0;
Item item = null;
//TODO possible desync since items are random
for(ItemStack stack : results){
if(i >= count && i < count + stack.amount){
item = stack.item;
break;
}
count += stack.amount;
}
entity.items.remove(consumes.item(), consumes.itemAmount());
if(item != null){
offloading = true;