Content class reorganization, beginning work on unit factory
This commit is contained in:
@@ -8,39 +8,6 @@ import io.anuke.ucore.util.Bundles;
|
||||
public class Item implements Comparable<Item>{
|
||||
private static final Array<Item> items = new Array<>();
|
||||
|
||||
public static final Item
|
||||
stone = new Item("stone"){
|
||||
{
|
||||
material = false;
|
||||
}
|
||||
},
|
||||
iron = new Item("iron"),
|
||||
lead = new Item("lead"),
|
||||
coal = new Item("coal"){
|
||||
{
|
||||
explosiveness = 0.2f;
|
||||
flammability = 0.5f;
|
||||
fluxiness = 0.5f;
|
||||
material = false;
|
||||
}
|
||||
},
|
||||
steel = new Item("steel"),
|
||||
titanium = new Item("titanium"),
|
||||
thorium = new Item("thorium"){
|
||||
{
|
||||
explosiveness = 0.1f;
|
||||
}
|
||||
},
|
||||
silicon = new Item("silicon"),
|
||||
plastic = new Item("plastic"),
|
||||
densealloy = new Item("densealloy"),
|
||||
biomatter = new Item("biomatter"){
|
||||
{
|
||||
material = false;
|
||||
flammability = 0.4f;
|
||||
}
|
||||
};
|
||||
|
||||
public final int id;
|
||||
public final String name;
|
||||
public TextureRegion region;
|
||||
|
||||
@@ -8,48 +8,6 @@ public class Liquid {
|
||||
|
||||
private static final Array<Liquid> liquids = new Array<>();
|
||||
|
||||
public static final Liquid
|
||||
|
||||
none = new Liquid("none", Color.CLEAR),
|
||||
water = new Liquid("water", Color.ROYAL){
|
||||
{
|
||||
heatCapacity = 0.4f;
|
||||
}
|
||||
},
|
||||
plasma = new Liquid("plasma", Color.CORAL){
|
||||
{
|
||||
flammability = 0.4f;
|
||||
viscosity = 0.1f;
|
||||
heatCapacity = 0.2f;
|
||||
}
|
||||
},
|
||||
lava = new Liquid("lava", Color.valueOf("e37341")){
|
||||
{
|
||||
temperature = 0.7f;
|
||||
viscosity = 0.8f;
|
||||
}
|
||||
},
|
||||
oil = new Liquid("oil", Color.valueOf("292929")){
|
||||
{
|
||||
viscosity = 0.7f;
|
||||
flammability = 0.6f;
|
||||
explosiveness = 0.6f;
|
||||
}
|
||||
},
|
||||
cryofluid = new Liquid("cryofluid", Color.SKY){
|
||||
{
|
||||
heatCapacity = 0.75f;
|
||||
temperature = 0.5f;
|
||||
}
|
||||
},
|
||||
sulfuricAcid = new Liquid("sulfuricAcid", Color.YELLOW){
|
||||
{
|
||||
flammability = 0.4f;
|
||||
explosiveness = 0.4f;
|
||||
heatCapacity = 0.4f;
|
||||
}
|
||||
};
|
||||
|
||||
public final Color color;
|
||||
public final String name;
|
||||
public final int id;
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
public class Mech extends Upgrade{
|
||||
public static final Mech
|
||||
|
||||
standard = new Mech("standard-mech", false),
|
||||
standardShip = new Mech("standard-ship", true);
|
||||
|
||||
public boolean flying;
|
||||
public float mass = 1f;
|
||||
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.debug;
|
||||
import static io.anuke.mindustry.resource.Section.*;
|
||||
|
||||
public class Recipes {
|
||||
private static final Array<Recipe> list = Array.with(
|
||||
//new Recipe(defense, DefenseBlocks.stonewall, stack(Item.stone, 12)),
|
||||
new Recipe(defense, DefenseBlocks.ironwall, stack(Item.iron, 12)),
|
||||
new Recipe(defense, DefenseBlocks.steelwall, stack(Item.steel, 12)),
|
||||
new Recipe(defense, DefenseBlocks.titaniumwall, stack(Item.titanium, 12)),
|
||||
new Recipe(defense, DefenseBlocks.diriumwall, stack(Item.densealloy, 12)),
|
||||
new Recipe(defense, DefenseBlocks.steelwalllarge, stack(Item.steel, 12*4)),
|
||||
new Recipe(defense, DefenseBlocks.titaniumwalllarge, stack(Item.titanium, 12*4)),
|
||||
new Recipe(defense, DefenseBlocks.diriumwall, stack(Item.densealloy, 12*4)),
|
||||
new Recipe(defense, DefenseBlocks.door, stack(Item.steel, 3), stack(Item.iron, 3*4)).setDesktop(),
|
||||
new Recipe(defense, DefenseBlocks.largedoor, stack(Item.steel, 3*4), stack(Item.iron, 3*4*4)).setDesktop(),
|
||||
new Recipe(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 16)),
|
||||
|
||||
new Recipe(distribution, DistributionBlocks.conveyor, stack(Item.iron, 1)),
|
||||
new Recipe(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)),
|
||||
new Recipe(distribution, DistributionBlocks.pulseconveyor, stack(Item.densealloy, 1)),
|
||||
new Recipe(distribution, DistributionBlocks.router, stack(Item.iron, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.multiplexer, stack(Item.iron, 8)),
|
||||
new Recipe(distribution, DistributionBlocks.junction, stack(Item.iron, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.tunnel, stack(Item.iron, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.sorter, stack(Item.steel, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.splitter, stack(Item.steel, 1)),
|
||||
new Recipe(distribution, DistributionBlocks.vault, stack(Item.steel, 50)),
|
||||
new Recipe(distribution, ProductionBlocks.core, stack(Item.steel, 50)),
|
||||
new Recipe(distribution, DistributionBlocks.unloader, stack(Item.steel, 5)),
|
||||
new Recipe(distribution, DistributionBlocks.sortedunloader, stack(Item.steel, 5)),
|
||||
|
||||
new Recipe(weapon, WeaponBlocks.doubleturret, stack(Item.iron, 7)),
|
||||
new Recipe(weapon, WeaponBlocks.gatlingturret, stack(Item.iron, 8)),
|
||||
new Recipe(weapon, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)),
|
||||
new Recipe(weapon, WeaponBlocks.railgunturret, stack(Item.iron, 15), stack(Item.steel, 10)),
|
||||
new Recipe(weapon, WeaponBlocks.laserturret, stack(Item.steel, 12), stack(Item.titanium, 12)),
|
||||
new Recipe(weapon, WeaponBlocks.flakturret, stack(Item.steel, 25), stack(Item.titanium, 15)),
|
||||
new Recipe(weapon, WeaponBlocks.teslaturret, stack(Item.steel, 20), stack(Item.titanium, 25), stack(Item.densealloy, 15)),
|
||||
new Recipe(weapon, WeaponBlocks.magmaturret, stack(Item.steel, 80), stack(Item.titanium, 70), stack(Item.densealloy, 60)),
|
||||
new Recipe(weapon, WeaponBlocks.chainturret, stack(Item.steel, 50), stack(Item.titanium, 25), stack(Item.densealloy, 40)),
|
||||
new Recipe(weapon, WeaponBlocks.titanturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.densealloy, 55)),
|
||||
new Recipe(weapon, WeaponBlocks.missileturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.densealloy, 55)),
|
||||
new Recipe(weapon, WeaponBlocks.fornaxcannon, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.densealloy, 55)),
|
||||
|
||||
new Recipe(crafting, ProductionBlocks.smelter, stack(Item.iron, 40)),
|
||||
new Recipe(crafting, ProductionBlocks.alloysmelter, stack(Item.titanium, 50), stack(Item.steel, 50)),
|
||||
new Recipe(crafting, ProductionBlocks.coalextractor, stack(Item.steel, 10), stack(Item.iron, 10)),
|
||||
new Recipe(crafting, ProductionBlocks.titaniumextractor, stack(Item.steel, 30), stack(Item.iron, 30)),
|
||||
new Recipe(crafting, ProductionBlocks.oilrefinery, stack(Item.steel, 15), stack(Item.iron, 15)),
|
||||
new Recipe(crafting, ProductionBlocks.stoneformer, stack(Item.steel, 10), stack(Item.iron, 10)),
|
||||
new Recipe(crafting, ProductionBlocks.lavasmelter, stack(Item.steel, 30), stack(Item.titanium, 15)),
|
||||
new Recipe(crafting, ProductionBlocks.siliconextractor, stack(Item.steel, 30), stack(Item.titanium, 15)),
|
||||
new Recipe(crafting, ProductionBlocks.cryofluidmixer, stack(Item.steel, 30), stack(Item.titanium, 15)),
|
||||
new Recipe(crafting, ProductionBlocks.weaponFactory, stack(Item.steel, 60), stack(Item.iron, 60)).setDesktop(),
|
||||
//new Recipe(crafting, ProductionBlocks.centrifuge, stack(Item.steel, 30), stack(Item.iron, 30)),
|
||||
|
||||
//new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
||||
new Recipe(production, ProductionBlocks.irondrill, stack(Item.iron, 25)),
|
||||
new Recipe(production, ProductionBlocks.leaddrill, stack(Item.iron, 25)),
|
||||
new Recipe(production, ProductionBlocks.coaldrill, stack(Item.iron, 25), stack(Item.iron, 40)),
|
||||
new Recipe(production, ProductionBlocks.titaniumdrill, stack(Item.iron, 50), stack(Item.steel, 50)),
|
||||
new Recipe(production, ProductionBlocks.thoriumdrill, stack(Item.iron, 40), stack(Item.steel, 40)),
|
||||
new Recipe(production, ProductionBlocks.quartzextractor, stack(Item.titanium, 40), stack(Item.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.cultivator, stack(Item.titanium, 40), stack(Item.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.laserdrill, stack(Item.titanium, 40), stack(Item.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.waterextractor, stack(Item.titanium, 40), stack(Item.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.oilextractor, stack(Item.titanium, 40), stack(Item.densealloy, 40)),
|
||||
|
||||
new Recipe(power, ProductionBlocks.coalgenerator, stack(Item.iron, 30)),
|
||||
new Recipe(power, ProductionBlocks.thermalgenerator, stack(Item.steel, 30)),
|
||||
new Recipe(power, ProductionBlocks.combustiongenerator, stack(Item.iron, 30)),
|
||||
new Recipe(power, ProductionBlocks.solarpanel, stack(Item.iron, 30), stack(Item.silicon, 20)),
|
||||
new Recipe(power, ProductionBlocks.largesolarpanel, stack(Item.iron, 30), stack(Item.silicon, 20)),
|
||||
new Recipe(power, ProductionBlocks.rtgenerator, stack(Item.titanium, 20), stack(Item.steel, 20)),
|
||||
new Recipe(power, ProductionBlocks.nuclearReactor, stack(Item.titanium, 40), stack(Item.densealloy, 40), stack(Item.steel, 50)),
|
||||
new Recipe(power, DistributionBlocks.powernode, stack(Item.steel, 3), stack(Item.iron, 3)),
|
||||
new Recipe(power, DistributionBlocks.battery, stack(Item.steel, 5), stack(Item.iron, 5)),
|
||||
new Recipe(power, DistributionBlocks.batteryLarge, stack(Item.steel, 5), stack(Item.iron, 5)),
|
||||
|
||||
new Recipe(power, DefenseBlocks.shieldgenerator, stack(Item.titanium, 30), stack(Item.densealloy, 30)),
|
||||
|
||||
new Recipe(distribution, DistributionBlocks.teleporter, stack(Item.steel, 30), stack(Item.densealloy, 40)),
|
||||
|
||||
new Recipe(power, DefenseBlocks.repairturret, stack(Item.iron, 30)),
|
||||
new Recipe(power, DefenseBlocks.megarepairturret, stack(Item.iron, 20), stack(Item.steel, 30)),
|
||||
|
||||
new Recipe(liquid, DistributionBlocks.conduit, stack(Item.steel, 1)),
|
||||
new Recipe(liquid, DistributionBlocks.pulseconduit, stack(Item.titanium, 1), stack(Item.steel, 1)),
|
||||
new Recipe(liquid, DistributionBlocks.liquidrouter, stack(Item.steel, 2)),
|
||||
new Recipe(liquid, DistributionBlocks.liquidtank, stack(Item.steel, 2)),
|
||||
new Recipe(liquid, DistributionBlocks.liquidjunction, stack(Item.steel, 2)),
|
||||
new Recipe(liquid, DistributionBlocks.conduittunnel, stack(Item.titanium, 2), stack(Item.steel, 2)),
|
||||
|
||||
new Recipe(liquid, ProductionBlocks.pump, stack(Item.steel, 10)),
|
||||
new Recipe(liquid, ProductionBlocks.fluxpump, stack(Item.steel, 10), stack(Item.densealloy, 5)),
|
||||
|
||||
new Recipe(units, DebugBlocks.powerVoid, stack(Item.steel, 10)).setDebug(),
|
||||
new Recipe(units, DebugBlocks.powerInfinite, stack(Item.steel, 10), stack(Item.densealloy, 5)).setDebug()
|
||||
);
|
||||
|
||||
private static ItemStack stack(Item item, int amount){
|
||||
return new ItemStack(item, amount);
|
||||
}
|
||||
|
||||
public static Array<Recipe> all(){
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Recipe getByResult(Block block){
|
||||
for(Recipe recipe : list){
|
||||
if(recipe.result == block){
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Array<Recipe> getBy(Section section, Array<Recipe> r){
|
||||
for(Recipe recipe : list){
|
||||
if(recipe.section == section && !(Vars.android && recipe.desktopOnly) && !(!debug && recipe.debugOnly)) {
|
||||
r.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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, 60), stack(Item.steel, 80)),
|
||||
Weapon.clustergun, list(stack(Item.iron, 300), stack(Item.steel, 80)),
|
||||
Weapon.vulcan, list(stack(Item.iron, 100), stack(Item.steel, 150), stack(Item.titanium, 80)),
|
||||
Weapon.beam, list(stack(Item.steel, 260), stack(Item.titanium, 160), stack(Item.densealloy, 120)),
|
||||
Weapon.shockgun, list(stack(Item.steel, 240), stack(Item.titanium, 160), stack(Item.densealloy, 160))
|
||||
);
|
||||
|
||||
private static final ItemStack[] empty = {};
|
||||
|
||||
public static ItemStack[] get(Upgrade upgrade){
|
||||
return recipes.get(upgrade, empty);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import io.anuke.mindustry.entities.Bullet;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
@@ -15,82 +14,30 @@ import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Translator;
|
||||
|
||||
public class Weapon extends Upgrade{
|
||||
public static final Weapon
|
||||
|
||||
blaster = new Weapon("blaster", 12, BulletType.shot){
|
||||
{
|
||||
effect = Fx.laserShoot;
|
||||
length = 2f;
|
||||
}
|
||||
},
|
||||
triblaster = new Weapon("triblaster", 16, BulletType.spread){
|
||||
{
|
||||
shots = 3;
|
||||
effect = Fx.spreadShoot;
|
||||
roundrobin = true;
|
||||
}
|
||||
},
|
||||
clustergun = new Weapon("clustergun", 26f, BulletType.cluster){
|
||||
{
|
||||
effect = Fx.clusterShoot;
|
||||
inaccuracy = 17f;
|
||||
roundrobin = true;
|
||||
shots = 2;
|
||||
spacing = 0;
|
||||
}
|
||||
},
|
||||
beam = new Weapon("beam", 30f, BulletType.beamlaser){
|
||||
{
|
||||
effect = Fx.beamShoot;
|
||||
inaccuracy = 0;
|
||||
roundrobin = true;
|
||||
shake = 2f;
|
||||
}
|
||||
},
|
||||
vulcan = new Weapon("vulcan", 5, BulletType.vulcan){
|
||||
{
|
||||
effect = Fx.vulcanShoot;
|
||||
inaccuracy = 5;
|
||||
roundrobin = true;
|
||||
shake = 1f;
|
||||
inaccuracy = 4f;
|
||||
}
|
||||
},
|
||||
shockgun = new Weapon("shockgun", 36, BulletType.shockshell){
|
||||
{
|
||||
shootsound = "bigshot";
|
||||
effect = Fx.shockShoot;
|
||||
shake = 2f;
|
||||
roundrobin = true;
|
||||
shots = 7;
|
||||
inaccuracy = 15f;
|
||||
length = 3.5f;
|
||||
}
|
||||
};
|
||||
/**weapon reload in frames*/
|
||||
float reload;
|
||||
protected float reload;
|
||||
/**type of bullet shot*/
|
||||
BulletType type;
|
||||
protected BulletType type;
|
||||
/**sound made when shooting*/
|
||||
String shootsound = "shoot";
|
||||
protected String shootsound = "shoot";
|
||||
/**amount of shots per fire*/
|
||||
int shots = 1;
|
||||
protected int shots = 1;
|
||||
/**spacing in degrees between multiple shots, if applicable*/
|
||||
float spacing = 12f;
|
||||
protected float spacing = 12f;
|
||||
/**inaccuracy of degrees of each shot*/
|
||||
float inaccuracy = 0f;
|
||||
protected float inaccuracy = 0f;
|
||||
/**intensity and duration of each shot's screen shake*/
|
||||
float shake = 0f;
|
||||
protected float shake = 0f;
|
||||
/**effect displayed when shooting*/
|
||||
Effect effect;
|
||||
protected Effect effect;
|
||||
/**shoot barrel length*/
|
||||
float length = 3f;
|
||||
protected float length = 3f;
|
||||
/**whether to shoot the weapons in different arms one after another, rather an all at once*/
|
||||
boolean roundrobin = false;
|
||||
protected boolean roundrobin = false;
|
||||
/**translator for vector calulations*/
|
||||
Translator tr = new Translator();
|
||||
|
||||
private Weapon(String name, float reload, BulletType type){
|
||||
protected Translator tr = new Translator();
|
||||
|
||||
protected Weapon(String name, float reload, BulletType type){
|
||||
super(name);
|
||||
this.reload = reload;
|
||||
this.type = type;
|
||||
|
||||
Reference in New Issue
Block a user