Refactored weapon recipes (broken)
This commit is contained in:
31
core/src/io/anuke/mindustry/resource/UpgradeRecipes.java
Normal file
31
core/src/io/anuke/mindustry/resource/UpgradeRecipes.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.ObjectMap.Entries;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class UpgradeRecipes {
|
||||
private static final ObjectMap<Upgrade, ItemStack[]> recipes = Mathf.map(
|
||||
Weapon.triblaster, list(stack(Item.iron, 40)),
|
||||
Weapon.multigun, list(stack(Item.iron, 60), stack(Item.steel, 20)),
|
||||
Weapon.flamer, list(stack(Item.steel, 60), stack(Item.iron, 120)),
|
||||
Weapon.railgun, list(stack(Item.iron, 60), stack(Item.steel, 60)),
|
||||
Weapon.mortar, list(stack(Item.titanium, 40), stack(Item.steel, 60))
|
||||
);
|
||||
|
||||
public ItemStack[] get(Upgrade upgrade){
|
||||
return recipes.get(upgrade);
|
||||
}
|
||||
|
||||
public static Entries<Upgrade, ItemStack[]> getAllRecipes(){
|
||||
return recipes.entries();
|
||||
}
|
||||
|
||||
private static ItemStack[] list(ItemStack... stacks){
|
||||
return stacks;
|
||||
}
|
||||
|
||||
private static ItemStack stack(Item item, int amount){
|
||||
return new ItemStack(item, amount);
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@ public class Weapon extends Upgrade{
|
||||
shake = 2f;
|
||||
}
|
||||
};
|
||||
|
||||
float reload;
|
||||
BulletType type;
|
||||
String shootsound = "shoot";
|
||||
@@ -92,8 +93,4 @@ public class Weapon extends Upgrade{
|
||||
Angles.translation(angle, 3f);
|
||||
new Bullet(type, owner, x + Angles.x(), y + Angles.y(), angle).add();
|
||||
}
|
||||
|
||||
private static ItemStack stack(Item item, int amount){
|
||||
return new ItemStack(item, amount);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user