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
@@ -163,14 +163,14 @@ public class CraftingBlocks extends BlockList implements ContentList{
}}; }};
separator = new Separator("separator"){{ separator = new Separator("separator"){{
results = new Item[]{ results = new ItemStack[]{
null, null, null, null, null, null, null, null, null, null, new ItemStack(null, 10),
Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, new ItemStack(Items.sand, 10),
Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, new ItemStack(Items.stone, 9),
Items.tungsten, Items.tungsten, Items.tungsten, Items.tungsten, new ItemStack(Items.copper, 4),
Items.lead, Items.lead, new ItemStack(Items.lead, 2),
Items.coal, Items.coal, new ItemStack(Items.coal, 2),
Items.titanium new ItemStack(Items.titanium, 1),
}; };
filterTime = 40f; filterTime = 40f;
itemCapacity = 40; itemCapacity = 40;
@@ -181,15 +181,15 @@ public class CraftingBlocks extends BlockList implements ContentList{
}}; }};
centrifuge = new Separator("centrifuge"){{ centrifuge = new Separator("centrifuge"){{
results = new Item[]{ results = new ItemStack[]{
null, null, null, null, null, null, null, null, null, null, null, null, null, new ItemStack(null, 13),
Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, Items.sand, new ItemStack(Items.sand, 12),
Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, Items.stone, new ItemStack(Items.stone, 11),
Items.tungsten, Items.tungsten, Items.tungsten, Items.tungsten, Items.tungsten, new ItemStack(Items.copper, 5),
Items.lead, Items.lead, Items.lead, new ItemStack(Items.lead, 3),
Items.coal, Items.coal, Items.coal, new ItemStack(Items.coal, 3),
Items.titanium, Items.titanium, new ItemStack(Items.titanium, 2),
Items.thorium, new ItemStack(Items.thorium, 1)
}; };
hasPower = true; hasPower = true;
@@ -6,19 +6,12 @@ import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.ContentList; import io.anuke.mindustry.type.ContentList;
public class StandardBullets extends BulletList implements 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 @Override
public void load(){ public void load(){
tungsten = new BasicBulletType(3.2f, 10, "bullet"){ copper = new BasicBulletType(2.5f, 7, "bullet"){
{
bulletWidth = 9f;
bulletHeight = 11f;
}
};
lead = new BasicBulletType(2.5f, 5, "bullet"){
{ {
bulletWidth = 7f; bulletWidth = 7f;
bulletHeight = 9f; bulletHeight = 9f;
@@ -6,6 +6,7 @@ import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids; import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.production.GenericCrafter.GenericCrafterEntity; import io.anuke.mindustry.world.blocks.production.GenericCrafter.GenericCrafterEntity;
@@ -22,7 +23,7 @@ import io.anuke.ucore.util.Mathf;
public class Separator extends Block{ public class Separator extends Block{
protected final int timerDump = timers++; protected final int timerDump = timers++;
protected Item[] results; protected ItemStack[] results;
protected float filterTime; protected float filterTime;
protected float spinnerRadius = 2.5f; protected float spinnerRadius = 2.5f;
protected float spinnerLength = 1f; protected float spinnerLength = 1f;
@@ -57,8 +58,8 @@ public class Separator extends Block{
super.setStats(); super.setStats();
stats.add(BlockStat.outputItem, new ItemFilterValue(item -> { stats.add(BlockStat.outputItem, new ItemFilterValue(item -> {
for(Item i : results){ for(ItemStack i : results){
if(item == i) return true; if(item == i.item) return true;
} }
return false; return false;
})); }));
@@ -95,7 +96,22 @@ public class Separator extends Block{
if(entity.progress >= 1f){ if(entity.progress >= 1f){
entity.progress = 0f; 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()); entity.items.remove(consumes.item(), consumes.itemAmount());
if(item != null){ if(item != null){
offloading = true; offloading = true;