Content class reorganization, beginning work on unit factory
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import io.anuke.mindustry.core.*;
|
||||
import io.anuke.mindustry.io.BlockLoader;
|
||||
import io.anuke.mindustry.core.ContentLoader;
|
||||
import io.anuke.mindustry.io.BundleLoader;
|
||||
import io.anuke.mindustry.io.Platform;
|
||||
import io.anuke.ucore.modules.ModuleCore;
|
||||
@@ -17,7 +17,7 @@ public class Mindustry extends ModuleCore {
|
||||
|
||||
Log.setUseColors(false);
|
||||
BundleLoader.load();
|
||||
BlockLoader.load();
|
||||
ContentLoader.load();
|
||||
|
||||
module(logic = new Logic());
|
||||
module(world = new World());
|
||||
|
||||
@@ -122,7 +122,7 @@ public class Vars{
|
||||
public static final int port = 6567;
|
||||
public static final int webPort = 6568;
|
||||
|
||||
public static final GameState state = new GameState();
|
||||
public static GameState state;
|
||||
public static final ThreadHandler threads = new ThreadHandler(Platform.instance.getThreadProvider());
|
||||
|
||||
public static final ServerDebug serverDebug = new ServerDebug();
|
||||
|
||||
39
core/src/io/anuke/mindustry/content/Items.java
Normal file
39
core/src/io/anuke/mindustry/content/Items.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
|
||||
public class Items {
|
||||
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;
|
||||
}
|
||||
};
|
||||
}
|
||||
49
core/src/io/anuke/mindustry/content/Liquids.java
Normal file
49
core/src/io/anuke/mindustry/content/Liquids.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
|
||||
public class Liquids {
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
}
|
||||
10
core/src/io/anuke/mindustry/content/Mechs.java
Normal file
10
core/src/io/anuke/mindustry/content/Mechs.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import io.anuke.mindustry.resource.Mech;
|
||||
|
||||
public class Mechs {
|
||||
public static final Mech
|
||||
|
||||
standard = new Mech("standard-mech", false),
|
||||
standardShip = new Mech("standard-ship", true);
|
||||
}
|
||||
139
core/src/io/anuke/mindustry/content/Recipes.java
Normal file
139
core/src/io/anuke/mindustry/content/Recipes.java
Normal file
@@ -0,0 +1,139 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.blocks.*;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Recipe;
|
||||
import io.anuke.mindustry.resource.Section;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
|
||||
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(Items.iron, 12)),
|
||||
new Recipe(defense, DefenseBlocks.steelwall, stack(Items.steel, 12)),
|
||||
new Recipe(defense, DefenseBlocks.titaniumwall, stack(Items.titanium, 12)),
|
||||
new Recipe(defense, DefenseBlocks.diriumwall, stack(Items.densealloy, 12)),
|
||||
new Recipe(defense, DefenseBlocks.steelwalllarge, stack(Items.steel, 12*4)),
|
||||
new Recipe(defense, DefenseBlocks.titaniumwalllarge, stack(Items.titanium, 12*4)),
|
||||
new Recipe(defense, DefenseBlocks.diriumwall, stack(Items.densealloy, 12*4)),
|
||||
new Recipe(defense, DefenseBlocks.door, stack(Items.steel, 3), stack(Items.iron, 3*4)).setDesktop(),
|
||||
new Recipe(defense, DefenseBlocks.largedoor, stack(Items.steel, 3*4), stack(Items.iron, 3*4*4)).setDesktop(),
|
||||
new Recipe(defense, DefenseBlocks.titaniumshieldwall, stack(Items.titanium, 16)),
|
||||
|
||||
new Recipe(distribution, DistributionBlocks.conveyor, stack(Items.iron, 1)),
|
||||
new Recipe(distribution, DistributionBlocks.steelconveyor, stack(Items.steel, 1)),
|
||||
new Recipe(distribution, DistributionBlocks.pulseconveyor, stack(Items.densealloy, 1)),
|
||||
new Recipe(distribution, DistributionBlocks.router, stack(Items.iron, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.multiplexer, stack(Items.iron, 8)),
|
||||
new Recipe(distribution, DistributionBlocks.junction, stack(Items.iron, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.tunnel, stack(Items.iron, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.sorter, stack(Items.steel, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.splitter, stack(Items.steel, 1)),
|
||||
new Recipe(distribution, StorageBlocks.vault, stack(Items.steel, 50)),
|
||||
new Recipe(distribution, StorageBlocks.core, stack(Items.steel, 50)),
|
||||
new Recipe(distribution, StorageBlocks.unloader, stack(Items.steel, 5)),
|
||||
new Recipe(distribution, StorageBlocks.sortedunloader, stack(Items.steel, 5)),
|
||||
|
||||
new Recipe(weapon, WeaponBlocks.doubleturret, stack(Items.iron, 7)),
|
||||
new Recipe(weapon, WeaponBlocks.gatlingturret, stack(Items.iron, 8)),
|
||||
new Recipe(weapon, WeaponBlocks.flameturret, stack(Items.iron, 12), stack(Items.steel, 9)),
|
||||
new Recipe(weapon, WeaponBlocks.railgunturret, stack(Items.iron, 15), stack(Items.steel, 10)),
|
||||
new Recipe(weapon, WeaponBlocks.laserturret, stack(Items.steel, 12), stack(Items.titanium, 12)),
|
||||
new Recipe(weapon, WeaponBlocks.flakturret, stack(Items.steel, 25), stack(Items.titanium, 15)),
|
||||
new Recipe(weapon, WeaponBlocks.teslaturret, stack(Items.steel, 20), stack(Items.titanium, 25), stack(Items.densealloy, 15)),
|
||||
new Recipe(weapon, WeaponBlocks.magmaturret, stack(Items.steel, 80), stack(Items.titanium, 70), stack(Items.densealloy, 60)),
|
||||
new Recipe(weapon, WeaponBlocks.chainturret, stack(Items.steel, 50), stack(Items.titanium, 25), stack(Items.densealloy, 40)),
|
||||
new Recipe(weapon, WeaponBlocks.titanturret, stack(Items.steel, 70), stack(Items.titanium, 50), stack(Items.densealloy, 55)),
|
||||
new Recipe(weapon, WeaponBlocks.missileturret, stack(Items.steel, 70), stack(Items.titanium, 50), stack(Items.densealloy, 55)),
|
||||
new Recipe(weapon, WeaponBlocks.fornaxcannon, stack(Items.steel, 70), stack(Items.titanium, 50), stack(Items.densealloy, 55)),
|
||||
|
||||
new Recipe(crafting, ProductionBlocks.smelter, stack(Items.iron, 40)),
|
||||
new Recipe(crafting, ProductionBlocks.alloysmelter, stack(Items.titanium, 50), stack(Items.steel, 50)),
|
||||
new Recipe(crafting, ProductionBlocks.coalextractor, stack(Items.steel, 10), stack(Items.iron, 10)),
|
||||
new Recipe(crafting, ProductionBlocks.titaniumextractor, stack(Items.steel, 30), stack(Items.iron, 30)),
|
||||
new Recipe(crafting, ProductionBlocks.oilrefinery, stack(Items.steel, 15), stack(Items.iron, 15)),
|
||||
new Recipe(crafting, ProductionBlocks.stoneformer, stack(Items.steel, 10), stack(Items.iron, 10)),
|
||||
new Recipe(crafting, ProductionBlocks.lavasmelter, stack(Items.steel, 30), stack(Items.titanium, 15)),
|
||||
new Recipe(crafting, ProductionBlocks.siliconextractor, stack(Items.steel, 30), stack(Items.titanium, 15)),
|
||||
new Recipe(crafting, ProductionBlocks.cryofluidmixer, stack(Items.steel, 30), stack(Items.titanium, 15)),
|
||||
new Recipe(crafting, ProductionBlocks.weaponFactory, stack(Items.steel, 60), stack(Items.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(Items.iron, 25)),
|
||||
new Recipe(production, ProductionBlocks.leaddrill, stack(Items.iron, 25)),
|
||||
new Recipe(production, ProductionBlocks.coaldrill, stack(Items.iron, 25), stack(Items.iron, 40)),
|
||||
new Recipe(production, ProductionBlocks.titaniumdrill, stack(Items.iron, 50), stack(Items.steel, 50)),
|
||||
new Recipe(production, ProductionBlocks.thoriumdrill, stack(Items.iron, 40), stack(Items.steel, 40)),
|
||||
new Recipe(production, ProductionBlocks.quartzextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.cultivator, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.laserdrill, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.waterextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.oilextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
|
||||
new Recipe(power, PowerBlocks.coalgenerator, stack(Items.iron, 30)),
|
||||
new Recipe(power, PowerBlocks.thermalgenerator, stack(Items.steel, 30)),
|
||||
new Recipe(power, PowerBlocks.combustiongenerator, stack(Items.iron, 30)),
|
||||
new Recipe(power, PowerBlocks.solarpanel, stack(Items.iron, 30), stack(Items.silicon, 20)),
|
||||
new Recipe(power, PowerBlocks.largesolarpanel, stack(Items.iron, 30), stack(Items.silicon, 20)),
|
||||
new Recipe(power, PowerBlocks.rtgenerator, stack(Items.titanium, 20), stack(Items.steel, 20)),
|
||||
new Recipe(power, PowerBlocks.nuclearReactor, stack(Items.titanium, 40), stack(Items.densealloy, 40), stack(Items.steel, 50)),
|
||||
new Recipe(power, PowerBlocks.powernode, stack(Items.steel, 3), stack(Items.iron, 3)),
|
||||
new Recipe(power, PowerBlocks.battery, stack(Items.steel, 5), stack(Items.iron, 5)),
|
||||
new Recipe(power, PowerBlocks.batteryLarge, stack(Items.steel, 5), stack(Items.iron, 5)),
|
||||
|
||||
new Recipe(power, PowerBlocks.shieldgenerator, stack(Items.titanium, 30), stack(Items.densealloy, 30)),
|
||||
|
||||
new Recipe(distribution, PowerBlocks.teleporter, stack(Items.steel, 30), stack(Items.densealloy, 40)),
|
||||
|
||||
new Recipe(power, PowerBlocks.repairturret, stack(Items.iron, 30)),
|
||||
new Recipe(power, PowerBlocks.megarepairturret, stack(Items.iron, 20), stack(Items.steel, 30)),
|
||||
|
||||
new Recipe(liquid, LiquidBlocks.conduit, stack(Items.steel, 1)),
|
||||
new Recipe(liquid, LiquidBlocks.pulseconduit, stack(Items.titanium, 1), stack(Items.steel, 1)),
|
||||
new Recipe(liquid, LiquidBlocks.liquidrouter, stack(Items.steel, 2)),
|
||||
new Recipe(liquid, LiquidBlocks.liquidtank, stack(Items.steel, 2)),
|
||||
new Recipe(liquid, LiquidBlocks.liquidjunction, stack(Items.steel, 2)),
|
||||
new Recipe(liquid, LiquidBlocks.conduittunnel, stack(Items.titanium, 2), stack(Items.steel, 2)),
|
||||
|
||||
new Recipe(liquid, LiquidBlocks.pump, stack(Items.steel, 10)),
|
||||
new Recipe(liquid, LiquidBlocks.fluxpump, stack(Items.steel, 10), stack(Items.densealloy, 5)),
|
||||
|
||||
new Recipe(units, UnitBlocks.flierFactory, stack(Items.steel, 10)),
|
||||
new Recipe(units, DebugBlocks.powerVoid, stack(Items.steel, 10)).setDebug(),
|
||||
new Recipe(units, DebugBlocks.powerInfinite, stack(Items.steel, 10), stack(Items.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;
|
||||
}
|
||||
}
|
||||
12
core/src/io/anuke/mindustry/content/UnitTypes.java
Normal file
12
core/src/io/anuke/mindustry/content/UnitTypes.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import io.anuke.mindustry.entities.units.UnitType;
|
||||
import io.anuke.mindustry.entities.units.types.Flier;
|
||||
import io.anuke.mindustry.entities.units.types.Scout;
|
||||
|
||||
public class UnitTypes {
|
||||
public static final UnitType
|
||||
|
||||
scout = new Scout(),
|
||||
flier = new Flier();
|
||||
}
|
||||
@@ -1,16 +1,19 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.ObjectMap.Entries;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Upgrade;
|
||||
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))
|
||||
Weapons.triblaster, list(stack(Items.iron, 60), stack(Items.steel, 80)),
|
||||
Weapons.clustergun, list(stack(Items.iron, 300), stack(Items.steel, 80)),
|
||||
Weapons.vulcan, list(stack(Items.iron, 100), stack(Items.steel, 150), stack(Items.titanium, 80)),
|
||||
Weapons.beam, list(stack(Items.steel, 260), stack(Items.titanium, 160), stack(Items.densealloy, 120)),
|
||||
Weapons.shockgun, list(stack(Items.steel, 240), stack(Items.titanium, 160), stack(Items.densealloy, 160))
|
||||
);
|
||||
|
||||
private static final ItemStack[] empty = {};
|
||||
60
core/src/io/anuke/mindustry/content/Weapons.java
Normal file
60
core/src/io/anuke/mindustry/content/Weapons.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
|
||||
public class Weapons {
|
||||
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;
|
||||
}
|
||||
};
|
||||
}
|
||||
153
core/src/io/anuke/mindustry/content/blocks/Blocks.java
Normal file
153
core/src/io/anuke/mindustry/content/blocks/Blocks.java
Normal file
@@ -0,0 +1,153 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.graphics.DrawLayer;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.*;
|
||||
|
||||
public class Blocks {
|
||||
public static final Block
|
||||
|
||||
air = new Block("air") {
|
||||
//don't draw
|
||||
public void draw(Tile tile) {}
|
||||
},
|
||||
|
||||
//player/enemy spawnpoint?
|
||||
spawn = new Block("spawn"),
|
||||
|
||||
blockpart = new BlockPart(),
|
||||
|
||||
deepwater = new Floor("deepwater") {{
|
||||
variants = 0;
|
||||
solid = true;
|
||||
liquidDrop = Liquids.water;
|
||||
liquid = true;
|
||||
drawLayer = DrawLayer.water;
|
||||
}},
|
||||
|
||||
water = new Floor("water") {{
|
||||
variants = 0;
|
||||
solid = true;
|
||||
liquidDrop = Liquids.water;
|
||||
liquid = true;
|
||||
drawLayer = DrawLayer.water;
|
||||
}},
|
||||
|
||||
lava = new Floor("lava") {{
|
||||
variants = 0;
|
||||
solid = true;
|
||||
liquidDrop = Liquids.lava;
|
||||
liquid = true;
|
||||
drawLayer = DrawLayer.lava;
|
||||
}},
|
||||
|
||||
oil = new Floor("oil") {{
|
||||
variants = 0;
|
||||
solid = true;
|
||||
liquidDrop = Liquids.oil;
|
||||
liquid = true;
|
||||
drawLayer = DrawLayer.oil;
|
||||
}},
|
||||
|
||||
stone = new Floor("stone") {{
|
||||
drops = new ItemStack(Items.stone, 1);
|
||||
blends = block -> block != this && !(block instanceof Ore);
|
||||
}},
|
||||
|
||||
blackstone = new Floor("blackstone") {{
|
||||
drops = new ItemStack(Items.stone, 1);
|
||||
}},
|
||||
|
||||
iron = new Ore("iron") {{
|
||||
drops = new ItemStack(Items.iron, 1);
|
||||
}},
|
||||
|
||||
lead = new Ore("lead") {{
|
||||
drops = new ItemStack(Items.lead, 1);
|
||||
}},
|
||||
|
||||
coal = new Ore("coal") {{
|
||||
drops = new ItemStack(Items.coal, 1);
|
||||
}},
|
||||
|
||||
titanium = new Ore("titanium") {{
|
||||
drops = new ItemStack(Items.titanium, 1);
|
||||
}},
|
||||
|
||||
thorium = new Ore("thorium") {{
|
||||
drops = new ItemStack(Items.thorium, 1);
|
||||
}},
|
||||
|
||||
dirt = new Floor("dirt") {
|
||||
},
|
||||
|
||||
sand = new Floor("sand") {{
|
||||
drops = new ItemStack(Items.silicon, 1);
|
||||
}},
|
||||
|
||||
ice = new Floor("ice") {
|
||||
},
|
||||
|
||||
snow = new Floor("snow") {
|
||||
},
|
||||
|
||||
grass = new Floor("grass") {
|
||||
},
|
||||
|
||||
sandblock = new StaticBlock("sandblock") {{
|
||||
solid = true;
|
||||
variants = 3;
|
||||
}},
|
||||
|
||||
snowblock = new StaticBlock("snowblock") {{
|
||||
solid = true;
|
||||
variants = 3;
|
||||
}},
|
||||
|
||||
stoneblock = new StaticBlock("stoneblock") {{
|
||||
solid = true;
|
||||
variants = 3;
|
||||
}},
|
||||
|
||||
blackstoneblock = new StaticBlock("blackstoneblock") {{
|
||||
solid = true;
|
||||
variants = 3;
|
||||
}},
|
||||
|
||||
grassblock = new StaticBlock("grassblock") {{
|
||||
solid = true;
|
||||
variants = 2;
|
||||
}},
|
||||
|
||||
mossblock = new StaticBlock("mossblock") {{
|
||||
solid = true;
|
||||
}},
|
||||
|
||||
shrub = new Rock("shrub"),
|
||||
|
||||
rock = new Rock("rock") {{
|
||||
variants = 2;
|
||||
varyShadow = true;
|
||||
drops = new ItemStack(Items.stone, 3);
|
||||
}},
|
||||
|
||||
icerock = new Rock("icerock") {{
|
||||
variants = 2;
|
||||
varyShadow = true;
|
||||
drops = new ItemStack(Items.stone, 3);
|
||||
}},
|
||||
|
||||
blackrock = new Rock("blackrock") {{
|
||||
variants = 1;
|
||||
varyShadow = true;
|
||||
drops = new ItemStack(Items.stone, 3);
|
||||
}},
|
||||
|
||||
dirtblock = new StaticBlock("dirtblock") {{
|
||||
solid = true;
|
||||
}};
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@@ -0,0 +1,66 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.Wall;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.*;
|
||||
|
||||
public class DefenseBlocks {
|
||||
static final int wallHealthMultiplier = 4;
|
||||
|
||||
public static final Block
|
||||
|
||||
stonewall = new Wall("stonewall") {{
|
||||
health = 40 * wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
ironwall = new Wall("ironwall") {{
|
||||
health = 80 * wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
steelwall = new Wall("steelwall") {{
|
||||
health = 110 * wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
titaniumwall = new Wall("titaniumwall") {{
|
||||
health = 150 * wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
diriumwall = new Wall("duriumwall") {{
|
||||
health = 190 * wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
compositewall = new Wall("compositewall") {{
|
||||
health = 270 * wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
steelwalllarge = new Wall("steelwall-large") {{
|
||||
health = 110 * 4 * wallHealthMultiplier;
|
||||
size = 2;
|
||||
}},
|
||||
|
||||
titaniumwalllarge = new Wall("titaniumwall-large") {{
|
||||
health = 150 * 4 * wallHealthMultiplier;
|
||||
size = 2;
|
||||
}},
|
||||
|
||||
diriumwalllarge = new Wall("duriumwall-large") {{
|
||||
health = 190 * 4 * wallHealthMultiplier;
|
||||
size = 2;
|
||||
}},
|
||||
|
||||
titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall") {{
|
||||
health = 150 * wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
door = new Door("door") {{
|
||||
health = 90 * wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
largedoor = new Door("door-large") {{
|
||||
openfx = Fx.dooropenlarge;
|
||||
closefx = Fx.doorcloselarge;
|
||||
health = 90 * 4 * wallHealthMultiplier;
|
||||
size = 2;
|
||||
}};
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.distribution.*;
|
||||
|
||||
public class DistributionBlocks{
|
||||
|
||||
public static final Block
|
||||
|
||||
conveyor = new Conveyor("conveyor"){{
|
||||
health = 40;
|
||||
speed = 0.02f;
|
||||
}},
|
||||
|
||||
steelconveyor = new Conveyor("steelconveyor"){{
|
||||
health = 55;
|
||||
speed = 0.04f;
|
||||
}},
|
||||
|
||||
pulseconveyor = new Conveyor("poweredconveyor"){{
|
||||
health = 75;
|
||||
speed = 0.09f;
|
||||
}},
|
||||
|
||||
router = new Router("router"),
|
||||
|
||||
multiplexer = new Router("multiplexer"){{
|
||||
size = 2;
|
||||
itemCapacity = 80;
|
||||
}},
|
||||
|
||||
junction = new Junction("junction"){{
|
||||
speed = 26;
|
||||
capacity = 32;
|
||||
}},
|
||||
|
||||
tunnel = new TunnelConveyor("conveyortunnel"){{
|
||||
speed = 53;
|
||||
}},
|
||||
|
||||
sorter = new Sorter("sorter"),
|
||||
|
||||
splitter = new Splitter("splitter");
|
||||
}
|
||||
45
core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java
Normal file
45
core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.distribution.Conduit;
|
||||
import io.anuke.mindustry.world.blocks.types.distribution.LiquidJunction;
|
||||
import io.anuke.mindustry.world.blocks.types.distribution.LiquidRouter;
|
||||
import io.anuke.mindustry.world.blocks.types.distribution.TunnelConduit;
|
||||
import io.anuke.mindustry.world.blocks.types.production.Pump;
|
||||
|
||||
public class LiquidBlocks {
|
||||
public static final Block
|
||||
|
||||
pump = new Pump("pump") {{
|
||||
pumpAmount = 0.8f;
|
||||
}},
|
||||
|
||||
fluxpump = new Pump("fluxpump") {{
|
||||
pumpAmount = 1.2f;
|
||||
}},
|
||||
|
||||
conduit = new Conduit("conduit") {{
|
||||
health = 45;
|
||||
}},
|
||||
|
||||
pulseconduit = new Conduit("pulseconduit") {{
|
||||
liquidCapacity = 16f;
|
||||
liquidFlowFactor = 4.9f;
|
||||
health = 65;
|
||||
}},
|
||||
|
||||
liquidrouter = new LiquidRouter("liquidrouter") {{
|
||||
liquidCapacity = 40f;
|
||||
}},
|
||||
|
||||
liquidtank = new LiquidRouter("liquidtank") {{
|
||||
size = 3;
|
||||
liquidCapacity = 1500f;
|
||||
}},
|
||||
|
||||
liquidjunction = new LiquidJunction("liquidjunction"),
|
||||
|
||||
conduittunnel = new TunnelConduit("conduittunnel") {{
|
||||
speed = 53;
|
||||
}};
|
||||
}
|
||||
89
core/src/io/anuke/mindustry/content/blocks/PowerBlocks.java
Normal file
89
core/src/io/anuke/mindustry/content/blocks/PowerBlocks.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.RepairTurret;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.ShieldBlock;
|
||||
import io.anuke.mindustry.world.blocks.types.distribution.Teleporter;
|
||||
import io.anuke.mindustry.world.blocks.types.generation.*;
|
||||
|
||||
public class PowerBlocks {
|
||||
public static final Block
|
||||
|
||||
coalgenerator = new ItemPowerGenerator("coalgenerator") {{
|
||||
generateItem = Items.coal;
|
||||
powerOutput = 0.04f;
|
||||
powerCapacity = 40f;
|
||||
}},
|
||||
|
||||
thermalgenerator = new LiquidPowerGenerator("thermalgenerator") {{
|
||||
generateLiquid = Liquids.lava;
|
||||
maxLiquidGenerate = 0.5f;
|
||||
powerPerLiquid = 0.08f;
|
||||
powerCapacity = 40f;
|
||||
generateEffect = Fx.redgeneratespark;
|
||||
}},
|
||||
|
||||
combustiongenerator = new LiquidPowerGenerator("combustiongenerator") {{
|
||||
generateLiquid = Liquids.oil;
|
||||
maxLiquidGenerate = 0.4f;
|
||||
powerPerLiquid = 0.12f;
|
||||
powerCapacity = 40f;
|
||||
}},
|
||||
|
||||
rtgenerator = new ItemPowerGenerator("rtgenerator") {{
|
||||
generateItem = Items.thorium;
|
||||
powerCapacity = 40f;
|
||||
powerOutput = 0.03f;
|
||||
itemDuration = 240f;
|
||||
}},
|
||||
|
||||
solarpanel = new SolarGenerator("solarpanel") {{
|
||||
generation = 0.003f;
|
||||
}},
|
||||
|
||||
largesolarpanel = new SolarGenerator("largesolarpanel") {{
|
||||
size = 3;
|
||||
generation = 0.012f;
|
||||
}},
|
||||
|
||||
nuclearReactor = new NuclearReactor("nuclearreactor") {{
|
||||
size = 3;
|
||||
health = 600;
|
||||
breaktime *= 2.3f;
|
||||
}},
|
||||
|
||||
repairturret = new RepairTurret("repairturret") {{
|
||||
range = 30;
|
||||
reload = 20f;
|
||||
health = 60;
|
||||
powerUsed = 0.08f;
|
||||
}},
|
||||
|
||||
megarepairturret = new RepairTurret("megarepairturret") {{
|
||||
range = 44;
|
||||
reload = 12f;
|
||||
health = 90;
|
||||
powerUsed = 0.13f;
|
||||
size = 2;
|
||||
}},
|
||||
|
||||
shieldgenerator = new ShieldBlock("shieldgenerator") {{
|
||||
health = 400;
|
||||
}},
|
||||
|
||||
battery = new PowerGenerator("battery") {{
|
||||
powerCapacity = 320f;
|
||||
}},
|
||||
|
||||
batteryLarge = new PowerGenerator("batterylarge") {{
|
||||
size = 3;
|
||||
powerCapacity = 2000f;
|
||||
}},
|
||||
|
||||
powernode = new PowerDistributor("powernode"),
|
||||
|
||||
teleporter = new Teleporter("teleporter");
|
||||
}
|
||||
215
core/src/io/anuke/mindustry/content/blocks/ProductionBlocks.java
Normal file
215
core/src/io/anuke/mindustry/content/blocks/ProductionBlocks.java
Normal file
@@ -0,0 +1,215 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.production.*;
|
||||
|
||||
public class ProductionBlocks {
|
||||
public static final Block
|
||||
|
||||
smelter = new Smelter("smelter") {{
|
||||
health = 70;
|
||||
inputs = new Item[]{Items.iron};
|
||||
fuel = Items.coal;
|
||||
result = Items.steel;
|
||||
craftTime = 25f;
|
||||
}},
|
||||
|
||||
alloysmelter = new Smelter("alloysmelter") {{
|
||||
health = 90;
|
||||
inputs = new Item[]{Items.titanium, Items.steel};
|
||||
fuel = Items.coal;
|
||||
result = Items.densealloy;
|
||||
burnDuration = 45f;
|
||||
craftTime = 25f;
|
||||
}},
|
||||
|
||||
powersmelter = new PowerSmelter("powersmelter") {{
|
||||
/*
|
||||
health = 90;
|
||||
inputs = new Item[]{Item.titanium, Item.steel};
|
||||
fuel = Item.coal;
|
||||
results = Item.dirium;
|
||||
burnDuration = 45f;
|
||||
craftTime = 25f;
|
||||
size = 2;*/
|
||||
}},
|
||||
|
||||
cryofluidmixer = new LiquidMixer("cryofluidmixer") {{
|
||||
health = 200;
|
||||
inputLiquid = Liquids.water;
|
||||
outputLiquid = Liquids.cryofluid;
|
||||
inputItem = Items.titanium;
|
||||
liquidPerItem = 50f;
|
||||
itemCapacity = 50;
|
||||
powerUse = 0.1f;
|
||||
size = 2;
|
||||
}},
|
||||
|
||||
coalextractor = new LiquidCrafter("coalextractor") {{
|
||||
input = Items.stone;
|
||||
inputAmount = 6;
|
||||
inputLiquid = Liquids.water;
|
||||
liquidAmount = 19f;
|
||||
output = Items.coal;
|
||||
health = 50;
|
||||
purifyTime = 50;
|
||||
health = 60;
|
||||
}},
|
||||
|
||||
titaniumextractor = new LiquidCrafter("titaniumextractor") {{
|
||||
input = Items.stone;
|
||||
inputAmount = 8;
|
||||
inputLiquid = Liquids.water;
|
||||
liquidAmount = 40f;
|
||||
liquidCapacity = 41f;
|
||||
purifyTime = 60;
|
||||
output = Items.titanium;
|
||||
health = 70;
|
||||
}},
|
||||
|
||||
oilrefinery = new LiquidCrafter("oilrefinery") {{
|
||||
inputLiquid = Liquids.oil;
|
||||
liquidAmount = 55f;
|
||||
liquidCapacity = 56f;
|
||||
purifyTime = 65;
|
||||
output = Items.coal;
|
||||
health = 80;
|
||||
craftEffect = Fx.purifyoil;
|
||||
}},
|
||||
|
||||
stoneformer = new LiquidCrafter("stoneformer") {{
|
||||
input = null;
|
||||
inputLiquid = Liquids.lava;
|
||||
liquidAmount = 16f;
|
||||
liquidCapacity = 21f;
|
||||
purifyTime = 12;
|
||||
output = Items.stone;
|
||||
health = 80;
|
||||
craftEffect = Fx.purifystone;
|
||||
}},
|
||||
|
||||
lavasmelter = new LiquidCrafter("lavasmelter") {{
|
||||
input = Items.iron;
|
||||
inputAmount = 1;
|
||||
inputLiquid = Liquids.lava;
|
||||
liquidAmount = 40f;
|
||||
liquidCapacity = 41f;
|
||||
purifyTime = 30;
|
||||
output = Items.steel;
|
||||
health = 80;
|
||||
craftEffect = Fx.purifystone;
|
||||
}},
|
||||
|
||||
siliconextractor = new LiquidCrafter("siliconextractor") {{
|
||||
input = Items.stone;
|
||||
inputAmount = 5;
|
||||
inputLiquid = Liquids.water;
|
||||
liquidAmount = 18.99f;
|
||||
output = Items.silicon;
|
||||
health = 50;
|
||||
purifyTime = 50;
|
||||
}},
|
||||
|
||||
stonedrill = new Drill("stonedrill") {{
|
||||
resource = Blocks.stone;
|
||||
result = Items.stone;
|
||||
drillTime = 240;
|
||||
}},
|
||||
|
||||
irondrill = new Drill("irondrill") {{
|
||||
resource = Blocks.iron;
|
||||
result = Items.iron;
|
||||
drillTime = 360;
|
||||
}},
|
||||
|
||||
leaddrill = new Drill("leaddrill") {{
|
||||
resource = Blocks.lead;
|
||||
result = Items.lead;
|
||||
drillTime = 400;
|
||||
}},
|
||||
|
||||
coaldrill = new Drill("coaldrill") {{
|
||||
resource = Blocks.coal;
|
||||
result = Items.coal;
|
||||
drillTime = 420;
|
||||
}},
|
||||
|
||||
thoriumdrill = new Drill("thoriumdrill") {{
|
||||
resource = Blocks.thorium;
|
||||
result = Items.thorium;
|
||||
drillTime = 600;
|
||||
}},
|
||||
|
||||
titaniumdrill = new Drill("titaniumdrill") {{
|
||||
resource = Blocks.titanium;
|
||||
result = Items.titanium;
|
||||
drillTime = 540;
|
||||
}},
|
||||
|
||||
laserdrill = new GenericDrill("laserdrill") {{
|
||||
drillTime = 200;
|
||||
size = 2;
|
||||
powerUse = 0.2f;
|
||||
hasPower = true;
|
||||
}},
|
||||
|
||||
nucleardrill = new GenericDrill("nucleardrill") {{
|
||||
drillTime = 240;
|
||||
size = 3;
|
||||
powerUse = 0.32f;
|
||||
hasPower = true;
|
||||
}},
|
||||
|
||||
plasmadrill = new GenericDrill("plasmadrill") {{
|
||||
inputLiquid = Liquids.plasma;
|
||||
drillTime = 240;
|
||||
size = 4;
|
||||
powerUse = 0.16f;
|
||||
hasLiquids = true;
|
||||
hasPower = true;
|
||||
}},
|
||||
|
||||
quartzextractor = new GenericDrill("quartzextractor") {{
|
||||
powerUse = 0.1f;
|
||||
resource = Blocks.sand;
|
||||
result = Items.silicon;
|
||||
drillTime = 320;
|
||||
size = 2;
|
||||
}},
|
||||
|
||||
waterextractor = new SolidPump("waterextractor") {{
|
||||
result = Liquids.water;
|
||||
powerUse = 0.1f;
|
||||
pumpAmount = 0.4f;
|
||||
size = 2;
|
||||
liquidCapacity = 30f;
|
||||
}},
|
||||
|
||||
oilextractor = new SolidPump("oilextractor") {{
|
||||
result = Liquids.oil;
|
||||
powerUse = 0.5f;
|
||||
pumpAmount = 0.4f;
|
||||
size = 3;
|
||||
liquidCapacity = 80f;
|
||||
}},
|
||||
|
||||
cultivator = new GenericDrill("cultivator") {{
|
||||
resource = Blocks.grass;
|
||||
result = Items.biomatter;
|
||||
inputLiquid = Liquids.water;
|
||||
liquidUse = 0.1f;
|
||||
drillTime = 300;
|
||||
size = 2;
|
||||
hasLiquids = true;
|
||||
hasPower = true;
|
||||
}},
|
||||
|
||||
weaponFactory = new WeaponFactory("weaponfactory") {{
|
||||
size = 2;
|
||||
health = 250;
|
||||
}};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.storage.CoreBlock;
|
||||
import io.anuke.mindustry.world.blocks.types.storage.SortedUnloader;
|
||||
import io.anuke.mindustry.world.blocks.types.storage.Unloader;
|
||||
import io.anuke.mindustry.world.blocks.types.storage.Vault;
|
||||
|
||||
public class StorageBlocks {
|
||||
public static final Block
|
||||
|
||||
core = new CoreBlock("core"){{
|
||||
health = 800;
|
||||
}},
|
||||
|
||||
vault = new Vault("vault"){{
|
||||
size = 3;
|
||||
}},
|
||||
|
||||
unloader = new Unloader("unloader"){{
|
||||
speed = 5;
|
||||
}},
|
||||
|
||||
sortedunloader = new SortedUnloader("sortedunloader"){{
|
||||
speed = 5;
|
||||
}};
|
||||
}
|
||||
13
core/src/io/anuke/mindustry/content/blocks/UnitBlocks.java
Normal file
13
core/src/io/anuke/mindustry/content/blocks/UnitBlocks.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.content.UnitTypes;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.production.UnitFactory;
|
||||
|
||||
public class UnitBlocks {
|
||||
public static final Block
|
||||
|
||||
flierFactory = new UnitFactory("flierfactory"){{
|
||||
type = UnitTypes.flier;
|
||||
}};
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.effect.TeslaOrb;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.LaserTurret;
|
||||
@@ -24,7 +24,7 @@ public class WeaponBlocks{
|
||||
range = 44;
|
||||
reload = 13f;
|
||||
bullet = BulletType.stone;
|
||||
ammo = Item.stone;
|
||||
ammo = Items.stone;
|
||||
health = 45;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class WeaponBlocks{
|
||||
range = 65;
|
||||
reload = 7f;
|
||||
bullet = BulletType.iron;
|
||||
ammo = Item.iron;
|
||||
ammo = Items.iron;
|
||||
health = 65;
|
||||
}
|
||||
},
|
||||
@@ -54,7 +54,7 @@ public class WeaponBlocks{
|
||||
range = 45f;
|
||||
reload = 5f;
|
||||
bullet = BulletType.flame;
|
||||
ammo = Item.coal;
|
||||
ammo = Items.coal;
|
||||
health = 90;
|
||||
inaccuracy = 4f;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class WeaponBlocks{
|
||||
range = 120;
|
||||
reload = 50f;
|
||||
bullet = BulletType.sniper;
|
||||
ammo = Item.steel;
|
||||
ammo = Items.steel;
|
||||
health = 70;
|
||||
shootEffect = Fx.railshot;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class WeaponBlocks{
|
||||
bullet = BulletType.flak;
|
||||
shots = 3;
|
||||
inaccuracy = 9f;
|
||||
ammo = Item.coal;
|
||||
ammo = Items.coal;
|
||||
ammoMultiplier = 5;
|
||||
health = 110;
|
||||
shootEffect = Fx.mortarshot;
|
||||
@@ -128,7 +128,7 @@ public class WeaponBlocks{
|
||||
range = 90f;
|
||||
reload = 7f;
|
||||
bullet = BulletType.plasmaflame;
|
||||
ammoLiquid = Liquid.lava;
|
||||
ammoLiquid = Liquids.lava;
|
||||
liquidPerShot = 3f;
|
||||
health = 180*3;
|
||||
size = 2;
|
||||
@@ -142,7 +142,7 @@ public class WeaponBlocks{
|
||||
range = 60f;
|
||||
reload = 3f;
|
||||
bullet = BulletType.plasmaflame;
|
||||
ammo = Item.coal;
|
||||
ammo = Items.coal;
|
||||
health = 180;
|
||||
ammoMultiplier = 40;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public class WeaponBlocks{
|
||||
range = 80f;
|
||||
reload = 8f;
|
||||
bullet = BulletType.chain;
|
||||
ammo = Item.thorium;
|
||||
ammo = Items.thorium;
|
||||
health = 430;
|
||||
size = 2;
|
||||
shootCone = 9f;
|
||||
@@ -188,7 +188,7 @@ public class WeaponBlocks{
|
||||
range = 120f;
|
||||
reload = 23f;
|
||||
bullet = BulletType.titanshell;
|
||||
ammo = Item.thorium;
|
||||
ammo = Items.thorium;
|
||||
health = 800;
|
||||
ammoMultiplier = 4;
|
||||
size = 3;
|
||||
@@ -205,7 +205,7 @@ public class WeaponBlocks{
|
||||
range = 120f;
|
||||
reload = 23f;
|
||||
bullet = BulletType.titanshell;
|
||||
ammo = Item.thorium;
|
||||
ammo = Items.thorium;
|
||||
health = 800;
|
||||
ammoMultiplier = 4;
|
||||
size = 3;
|
||||
@@ -221,7 +221,7 @@ public class WeaponBlocks{
|
||||
range = 120f;
|
||||
reload = 23f;
|
||||
bullet = BulletType.titanshell;
|
||||
ammo = Item.thorium;
|
||||
ammo = Items.thorium;
|
||||
health = 800;
|
||||
ammoMultiplier = 4;
|
||||
size = 2;
|
||||
58
core/src/io/anuke/mindustry/core/ContentLoader.java
Normal file
58
core/src/io/anuke/mindustry/core/ContentLoader.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package io.anuke.mindustry.core;
|
||||
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.content.blocks.*;
|
||||
import io.anuke.mindustry.entities.units.UnitType;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.resource.Mech;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.ucore.util.Log;
|
||||
|
||||
/**Loads all game content by creating class instances.
|
||||
* Call load() before doing anything with content.*/
|
||||
public class ContentLoader {
|
||||
|
||||
public static void load(){
|
||||
|
||||
Object[] content = {
|
||||
//blocks
|
||||
new Blocks(),
|
||||
new DefenseBlocks(),
|
||||
new DistributionBlocks(),
|
||||
new ProductionBlocks(),
|
||||
new WeaponBlocks(),
|
||||
new DebugBlocks(),
|
||||
new LiquidBlocks(),
|
||||
new StorageBlocks(),
|
||||
new UnitBlocks(),
|
||||
new PowerBlocks(),
|
||||
|
||||
//items
|
||||
new Items(),
|
||||
|
||||
//liquids
|
||||
new Liquids(),
|
||||
|
||||
//mechs
|
||||
new Mechs(),
|
||||
|
||||
//weapons
|
||||
new Weapons(),
|
||||
|
||||
//units
|
||||
new UnitTypes(),
|
||||
};
|
||||
|
||||
for(Block block : Block.getAllBlocks()){
|
||||
block.init();
|
||||
}
|
||||
|
||||
Log.info("--- CONTENT INFO ---");
|
||||
Log.info("Blocks loaded: {0}\nItems loaded: {1}\nLiquids loaded: {2}\nUpgrades loaded: {3}\nUnits loaded: {4}",
|
||||
Block.getAllBlocks().size, Item.getAllItems().size, Liquid.getAllLiquids().size,
|
||||
Mech.getAllUpgrades().size, UnitType.getAllTypes().size);
|
||||
|
||||
Log.info("-------------------");
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package io.anuke.mindustry.core;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Buttons;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.content.Weapons;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
@@ -18,8 +20,6 @@ import io.anuke.mindustry.io.Platform;
|
||||
import io.anuke.mindustry.io.Saves;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Mech;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.ucore.UCore;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.core.Inputs.DeviceType;
|
||||
@@ -123,7 +123,7 @@ public class Control extends Module{
|
||||
|
||||
player = new Player();
|
||||
player.name = Settings.getString("name");
|
||||
player.mech = android ? Mech.standardShip : Mech.standard;
|
||||
player.mech = android ? Mechs.standardShip : Mechs.standard;
|
||||
player.color.set(Settings.getInt("color"));
|
||||
player.isLocal = true;
|
||||
|
||||
@@ -149,7 +149,7 @@ public class Control extends Module{
|
||||
|
||||
Events.on(ResetEvent.class, () -> {
|
||||
upgrades.reset();
|
||||
player.weaponLeft = player.weaponRight = Weapon.blaster;
|
||||
player.weaponLeft = player.weaponRight = Weapons.blaster;
|
||||
player.team = Team.blue;
|
||||
|
||||
player.add();
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package io.anuke.mindustry.core;
|
||||
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import io.anuke.mindustry.game.Difficulty;
|
||||
import io.anuke.mindustry.game.EventType.StateChangeEvent;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.Inventory;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.game.TeamInfo;
|
||||
import io.anuke.ucore.core.Events;
|
||||
|
||||
public class GameState{
|
||||
@@ -21,8 +20,7 @@ public class GameState{
|
||||
public GameMode mode = GameMode.waves;
|
||||
public Difficulty difficulty = Difficulty.normal;
|
||||
public boolean friendlyFire;
|
||||
public ObjectSet<Team> enemyTeams = new ObjectSet<>(), //enemies to the player team
|
||||
allyTeams = new ObjectSet<>(); //allies to the player team, includes the player team
|
||||
public TeamInfo teams = new TeamInfo();
|
||||
|
||||
public void set(State astate){
|
||||
Events.fire(StateChangeEvent.class, state, astate);
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package io.anuke.mindustry.core;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.game.EnemySpawn;
|
||||
import io.anuke.mindustry.game.EventType.GameOverEvent;
|
||||
import io.anuke.mindustry.game.EventType.PlayEvent;
|
||||
import io.anuke.mindustry.game.EventType.ResetEvent;
|
||||
import io.anuke.mindustry.game.EventType.WaveEvent;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.game.WaveCreator;
|
||||
import io.anuke.mindustry.game.TeamInfo;
|
||||
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.ucore.core.Events;
|
||||
@@ -27,7 +26,10 @@ import static io.anuke.mindustry.Vars.*;
|
||||
* This class should <i>not</i> call any outside methods to change state of modules, but instead fire events.
|
||||
*/
|
||||
public class Logic extends Module {
|
||||
private final Array<EnemySpawn> spawns = WaveCreator.getSpawns();
|
||||
|
||||
public Logic(){
|
||||
state = new GameState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
@@ -52,10 +54,9 @@ public class Logic extends Module {
|
||||
state.enemies = 0;
|
||||
state.gameOver = false;
|
||||
state.inventory.clearItems();
|
||||
state.allyTeams.clear();
|
||||
state.allyTeams.add(Team.blue);
|
||||
state.enemyTeams.clear();
|
||||
state.enemyTeams.add(Team.red);
|
||||
state.teams = new TeamInfo();
|
||||
state.teams.add(Team.blue, true);
|
||||
state.teams.add(Team.red, false);
|
||||
|
||||
Timers.clear();
|
||||
Entities.clear();
|
||||
@@ -86,8 +87,16 @@ public class Logic extends Module {
|
||||
if(!Net.client())
|
||||
world.pathfinder().update();
|
||||
|
||||
boolean gameOver = true;
|
||||
|
||||
if(world.getAllyCores().size == 0 && !state.gameOver){ //TODO gameover state
|
||||
for(TeamData data : state.teams.getTeams(true)){
|
||||
if(data.cores.size > 0){
|
||||
gameOver = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(gameOver && !state.gameOver){ //TODO better gameover state, victory state?
|
||||
state.gameOver = true;
|
||||
if(Net.server()) NetEvents.handleGameOver();
|
||||
Events.fire(GameOverEvent.class);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package io.anuke.mindustry.core;
|
||||
|
||||
import com.badlogic.gdx.utils.*;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.content.Recipes;
|
||||
import io.anuke.mindustry.content.UpgradeRecipes;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
@@ -12,7 +15,9 @@ import io.anuke.mindustry.net.*;
|
||||
import io.anuke.mindustry.net.Administration.PlayerInfo;
|
||||
import io.anuke.mindustry.net.Net.SendMode;
|
||||
import io.anuke.mindustry.net.Packets.*;
|
||||
import io.anuke.mindustry.resource.*;
|
||||
import io.anuke.mindustry.resource.Recipe;
|
||||
import io.anuke.mindustry.resource.Upgrade;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Placement;
|
||||
import io.anuke.ucore.core.Events;
|
||||
@@ -95,7 +100,7 @@ public class NetServer extends Module{
|
||||
player.isAdmin = admins.isAdmin(uuid, ip);
|
||||
player.clientid = id;
|
||||
player.name = packet.name;
|
||||
player.mech = packet.android ? Mech.standardShip : Mech.standard;
|
||||
player.mech = packet.android ? Mechs.standardShip : Mechs.standard;
|
||||
player.set(world.getSpawnX(), world.getSpawnY());
|
||||
player.setNet(player.x, player.y);
|
||||
player.setNet(player.x, player.y);
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.anuke.mindustry.ui.fragments.ToolFragment;
|
||||
import io.anuke.mindustry.world.BlockBar;
|
||||
import io.anuke.mindustry.world.Layer;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.entities.EffectEntity;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
|
||||
@@ -12,8 +12,8 @@ import io.anuke.mindustry.io.Maps;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.WorldGenerator;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.ProductionBlocks;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import io.anuke.ucore.modules.Module;
|
||||
@@ -29,8 +29,6 @@ public class World extends Module{
|
||||
private Tile[][] tiles;
|
||||
private Pathfind pathfind = new Pathfind();
|
||||
private Maps maps = new Maps();
|
||||
private Array<Tile> allyCores = new Array<>();
|
||||
private Array<Tile> enemyCores = new Array<>();
|
||||
|
||||
private Array<Tile> tempTiles = new Array<>();
|
||||
|
||||
@@ -51,14 +49,6 @@ public class World extends Module{
|
||||
return pathfind;
|
||||
}
|
||||
|
||||
public Array<Tile> getAllyCores() {
|
||||
return allyCores;
|
||||
}
|
||||
|
||||
public Array<Tile> getEnemyCores() {
|
||||
return enemyCores;
|
||||
}
|
||||
|
||||
//TODO proper spawnpoints!
|
||||
public float getSpawnX(){
|
||||
return width() * tilesize/2f;
|
||||
@@ -179,7 +169,7 @@ public class World extends Module{
|
||||
|
||||
Entities.resizeTree(0, 0, width * tilesize, height * tilesize);
|
||||
|
||||
WorldGenerator.generate(tiles, MapIO.readTileData(map), allyCores);
|
||||
WorldGenerator.generate(tiles, MapIO.readTileData(map));
|
||||
}
|
||||
|
||||
void set(int x, int y, Block type, int rot){
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.io.MapTileData;
|
||||
import io.anuke.mindustry.io.MapTileData.TileDataMarker;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.Floor;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.ColorMapper;
|
||||
import io.anuke.mindustry.world.ColorMapper.BlockPair;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.badlogic.gdx.utils.OrderedMap;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.ColorMapper;
|
||||
import io.anuke.mindustry.world.ColorMapper.BlockPair;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.Floor;
|
||||
import io.anuke.ucore.graphics.Pixmaps;
|
||||
import io.anuke.ucore.noise.RidgedPerlin;
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.utils.IntSet;
|
||||
import com.badlogic.gdx.utils.IntSet.IntSetIterator;
|
||||
import io.anuke.mindustry.io.MapTileData.TileDataMarker;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
@@ -2,6 +2,9 @@ package io.anuke.mindustry.entities;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.content.Weapons;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
@@ -10,8 +13,10 @@ import io.anuke.mindustry.resource.Mech;
|
||||
import io.anuke.mindustry.resource.Upgrade;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.SolidEntity;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
@@ -34,9 +39,9 @@ public class Player extends Unit{
|
||||
public boolean isAdmin;
|
||||
public Color color = new Color();
|
||||
|
||||
public Weapon weaponLeft = Weapon.blaster;
|
||||
public Weapon weaponRight = Weapon.blaster;
|
||||
public Mech mech = Mech.standard;
|
||||
public Weapon weaponLeft = Weapons.blaster;
|
||||
public Weapon weaponRight = Weapons.blaster;
|
||||
public Mech mech = Mechs.standard;
|
||||
|
||||
public float targetAngle = 0f;
|
||||
public float stucktime = 0f;
|
||||
|
||||
@@ -70,14 +70,7 @@ public class Units {
|
||||
|
||||
/**Iterates over all units that are enemies of this team.*/
|
||||
public static void getNearbyEnemies(Team team, Rectangle rect, Consumer<Unit> cons){
|
||||
//check if it's an ally team to the 'main team'
|
||||
boolean ally = state.allyTeams.contains(team);
|
||||
boolean enemy = state.enemyTeams.contains(team);
|
||||
|
||||
//this team isn't even in the game, so target nothing!
|
||||
if(!ally && !enemy) return;
|
||||
|
||||
ObjectSet<Team> targets = ally ? state.enemyTeams : state.allyTeams;
|
||||
ObjectSet<Team> targets = state.teams.enemiesOf(team);
|
||||
|
||||
for(Team other : targets){
|
||||
EntityGroup<BaseUnit> group = unitGroups[other.ordinal()];
|
||||
@@ -93,12 +86,4 @@ public class Units {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**Returns whether these two teams are enemies.*/
|
||||
public static boolean areEnemies(Team team, Team other){
|
||||
if(team == other) return false; //fast fail to be more efficient
|
||||
boolean ally = state.allyTeams.contains(team);
|
||||
boolean ally2 = state.allyTeams.contains(other);
|
||||
return ally == ally2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Physics;
|
||||
import io.anuke.ucore.util.Translator;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
@@ -88,7 +89,7 @@ public class DamageArea{
|
||||
for(int dx = -trad; dx <= trad; dx ++){
|
||||
for(int dy= -trad; dy <= trad; dy ++){
|
||||
Tile tile = world.tile(Mathf.scl2(x, tilesize) + dx, Mathf.scl2(y, tilesize) + dy);
|
||||
if(tile != null && tile.entity != null && (team == null || Units.areEnemies(team, tile.getTeam())) && Vector2.dst(dx, dy, 0, 0) <= trad){
|
||||
if(tile != null && tile.entity != null && (team == null || state.teams.areEnemies(team, tile.getTeam())) && Vector2.dst(dx, dy, 0, 0) <= trad){
|
||||
int amount = calculateDamage(x, y, tile.worldx(), tile.worldy(), radius, damage);
|
||||
tile.entity.damage(amount);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import io.anuke.ucore.entities.SolidEntity;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Timer;
|
||||
@@ -17,7 +18,7 @@ public class BaseUnit extends Unit {
|
||||
public UnitType type;
|
||||
public Timer timer = new Timer(5);
|
||||
public float walkTime = 0f;
|
||||
public Unit target;
|
||||
public Entity target;
|
||||
|
||||
public BaseUnit(UnitType type, Team team){
|
||||
this.type = type;
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
package io.anuke.mindustry.entities.units;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
|
||||
public class FlyingUnitType extends UnitType {
|
||||
private static Vector2 vec = new Vector2();
|
||||
|
||||
public FlyingUnitType(String name) {
|
||||
super(name);
|
||||
speed = 1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -20,6 +29,36 @@ public class FlyingUnitType extends UnitType {
|
||||
|
||||
@Override
|
||||
public void behavior(BaseUnit unit) {
|
||||
vec.set(unit.target.x - unit.x, unit.target.y - unit.y);
|
||||
vec.setLength(speed);
|
||||
|
||||
unit.velocity.lerp(vec, 0.1f * Timers.delta()); //TODO clamp it so it doesn't glitch out at low fps
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTargeting(BaseUnit unit) {
|
||||
if(!unit.timer.get(timerTarget, 20)) return;
|
||||
|
||||
ObjectSet<TeamData> teams = state.teams.enemyDataOf(unit.team);
|
||||
|
||||
Tile closest = null;
|
||||
float cdist = 0f;
|
||||
|
||||
for(TeamData data : teams){
|
||||
for(Tile tile : data.cores){
|
||||
float dist = Vector2.dst(unit.x, unit.y, tile.drawx(), tile.drawy());
|
||||
if(closest == null || dist < cdist){
|
||||
closest = tile;
|
||||
cdist = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(closest != null){
|
||||
unit.target = closest.entity;
|
||||
}else{
|
||||
unit.target = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.entities.units;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
@@ -78,11 +79,11 @@ public abstract class UnitType {
|
||||
public abstract void behavior(BaseUnit unit);
|
||||
|
||||
public void updateTargeting(BaseUnit unit){
|
||||
if(unit.target == null || unit.target.isDead()){
|
||||
if(unit.target == null || (unit.target instanceof Unit && ((Unit)unit.target).isDead())){
|
||||
unit.target = null;
|
||||
}
|
||||
|
||||
if(unit.timer.get(timerTarget, 30)){
|
||||
if(unit.timer.get(timerTarget, 20)){
|
||||
unit.target = Units.getClosestEnemy(unit.team, unit.x, unit.y, range, e -> true);
|
||||
}
|
||||
}
|
||||
@@ -113,4 +114,8 @@ public abstract class UnitType {
|
||||
public static UnitType getByID(byte id){
|
||||
return types.get(id);
|
||||
}
|
||||
|
||||
public static Array<UnitType> getAllTypes(){
|
||||
return types;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package io.anuke.mindustry.entities.units;
|
||||
|
||||
import io.anuke.mindustry.entities.units.types.Scout;
|
||||
|
||||
public class UnitTypes {
|
||||
public static final UnitType
|
||||
|
||||
scout = new Scout();
|
||||
}
|
||||
11
core/src/io/anuke/mindustry/entities/units/types/Flier.java
Normal file
11
core/src/io/anuke/mindustry/entities/units/types/Flier.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package io.anuke.mindustry.entities.units.types;
|
||||
|
||||
import io.anuke.mindustry.entities.units.FlyingUnitType;
|
||||
|
||||
public class Flier extends FlyingUnitType {
|
||||
|
||||
public Flier(){
|
||||
super("flier");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
|
||||
@@ -29,7 +30,7 @@ public class Inventory {
|
||||
if(item.material) items[item.id] = 99999;
|
||||
}
|
||||
}else{
|
||||
addItem(Item.iron, 40);
|
||||
addItem(Items.iron, 40);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
99
core/src/io/anuke/mindustry/game/TeamInfo.java
Normal file
99
core/src/io/anuke/mindustry/game/TeamInfo.java
Normal file
@@ -0,0 +1,99 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
/**Wrapper around an ObjectMap for team data.*/
|
||||
public class TeamInfo {
|
||||
private final static ObjectSet<Team> empty = new ObjectSet<>();
|
||||
private final static ObjectSet<TeamData> emptyData = new ObjectSet<>();
|
||||
|
||||
private ObjectMap<Team, TeamData> map = new ObjectMap<>();
|
||||
private ObjectSet<Team> allies = new ObjectSet<>(),
|
||||
enemies = new ObjectSet<>();
|
||||
private ObjectSet<TeamData> allyData = new ObjectSet<>(),
|
||||
enemyData = new ObjectSet<>();
|
||||
|
||||
public ObjectSet<TeamData> getTeams(boolean ally) {
|
||||
return ally ? allyData : enemyData;
|
||||
}
|
||||
|
||||
/**Register a team.
|
||||
* @param team The team type enum.
|
||||
* @param ally Whether this team is an ally with the player or an enemy with the player.
|
||||
* In PvP situations with dedicated servers, the sides can be arbitrary.
|
||||
*/
|
||||
public void add(Team team, boolean ally){
|
||||
if(has(team)) throw new RuntimeException("Can't define team information twice!");
|
||||
|
||||
TeamData data = new TeamData(team, ally);
|
||||
|
||||
if(ally) {
|
||||
allies.add(team);
|
||||
allyData.add(data);
|
||||
}else {
|
||||
enemies.add(team);
|
||||
enemyData.add(data);
|
||||
}
|
||||
|
||||
map.put(team, data);
|
||||
}
|
||||
|
||||
/**Returns team data by type. Call {@link #has(Team)} first to make sure it's active!*/
|
||||
public TeamData get(Team team){
|
||||
if(!has(team)) throw new RuntimeException("This team is not active! Check has() before calling get().");
|
||||
return map.get(team);
|
||||
}
|
||||
|
||||
/**Returns whether the specified team is active, e.g. whether it is participating in the game.*/
|
||||
public boolean has(Team team){
|
||||
return map.containsKey(team);
|
||||
}
|
||||
|
||||
/**Returns a set of all teams that are enemies of this team.
|
||||
* For teams not active, an empty set is returned.
|
||||
*/
|
||||
public ObjectSet<Team> enemiesOf(Team team) {
|
||||
boolean ally = allies.contains(team);
|
||||
boolean enemy = enemies.contains(team);
|
||||
|
||||
//this team isn't even in the game, so target nothing!
|
||||
if(!ally && !enemy) return empty;
|
||||
|
||||
return ally ? enemies : allies;
|
||||
}
|
||||
|
||||
/**Returns a set of all teams that are enemies of this team.
|
||||
* For teams not active, an empty set is returned.
|
||||
*/
|
||||
public ObjectSet<TeamData> enemyDataOf(Team team) {
|
||||
boolean ally = allies.contains(team);
|
||||
boolean enemy = enemies.contains(team);
|
||||
|
||||
//this team isn't even in the game, so target nothing!
|
||||
if(!ally && !enemy) return emptyData;
|
||||
|
||||
return ally ? enemyData : allyData;
|
||||
}
|
||||
|
||||
/**Returns whether or not these two teams are enemies.*/
|
||||
public boolean areEnemies(Team team, Team other){
|
||||
if(team == other) return false; //fast fail to be more efficient
|
||||
boolean ally = allies.contains(team);
|
||||
boolean ally2 = enemies.contains(other);
|
||||
return ally == ally2;
|
||||
}
|
||||
|
||||
public class TeamData {
|
||||
public final Array<Tile> cores = new Array<>();
|
||||
public final Team team;
|
||||
public final boolean ally;
|
||||
|
||||
public TeamData(Team team, boolean ally) {
|
||||
this.team = team;
|
||||
this.ally = ally;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.DistributionBlocks;
|
||||
import io.anuke.mindustry.content.blocks.ProductionBlocks;
|
||||
import io.anuke.mindustry.content.blocks.WeaponBlocks;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.builders.button;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
@@ -404,15 +407,15 @@ public class Tutorial{
|
||||
canForward = false;
|
||||
showBlock = true;
|
||||
canPlace = true;
|
||||
targetBlock = ProductionBlocks.pump;
|
||||
//targetBlock = ProductionBlocks.pump;
|
||||
blockPlaceX = 6;
|
||||
blockPlaceY = -2;
|
||||
}
|
||||
|
||||
void onSwitch(){
|
||||
ui.<ImageButton>find("sectionbuttonproduction").fireClick();
|
||||
state.inventory.addItem(Item.steel, 60);
|
||||
state.inventory.addItem(Item.iron, 60);
|
||||
state.inventory.addItem(Items.steel, 60);
|
||||
state.inventory.addItem(Items.iron, 60);
|
||||
}
|
||||
},
|
||||
conduitUse{
|
||||
@@ -421,7 +424,7 @@ public class Tutorial{
|
||||
canForward = false;
|
||||
showBlock = true;
|
||||
canPlace = true;
|
||||
targetBlock = DistributionBlocks.conduit;
|
||||
//targetBlock = DistributionBlocks.conduit;
|
||||
blockPlaceX = 5;
|
||||
blockPlaceY = -2;
|
||||
blockRotation = 2;
|
||||
@@ -438,8 +441,8 @@ public class Tutorial{
|
||||
canForward = false;
|
||||
showBlock = true;
|
||||
canPlace = true;
|
||||
targetBlock = DistributionBlocks.conduit;
|
||||
blockPlaceX = 4;
|
||||
//targetBlock = DistributionBlocks.conduit;
|
||||
//blockPlaceX = 4;
|
||||
blockPlaceY = -2;
|
||||
blockRotation = 1;
|
||||
}
|
||||
@@ -454,7 +457,7 @@ public class Tutorial{
|
||||
canForward = false;
|
||||
showBlock = true;
|
||||
canPlace = true;
|
||||
targetBlock = DistributionBlocks.conduit;
|
||||
//targetBlock = DistributionBlocks.conduit;
|
||||
blockPlaceX = 4;
|
||||
blockPlaceY = -1;
|
||||
blockRotation = 1;
|
||||
@@ -470,7 +473,7 @@ public class Tutorial{
|
||||
canForward = false;
|
||||
showBlock = true;
|
||||
canPlace = true;
|
||||
targetBlock = ProductionBlocks.combustiongenerator;
|
||||
//targetBlock = ProductionBlocks.combustiongenerator;
|
||||
blockPlaceX = 4;
|
||||
blockPlaceY = 0;
|
||||
}
|
||||
@@ -478,8 +481,8 @@ public class Tutorial{
|
||||
void onSwitch(){
|
||||
//world.tile(blockPlaceX + world.getCore().x, blockPlaceY + world.getCore().y).setBlock(Blocks.air);
|
||||
ui.<ImageButton>find("sectionbuttonpower").fireClick();
|
||||
state.inventory.addItem(Item.steel, 60);
|
||||
state.inventory.addItem(Item.iron, 60);
|
||||
state.inventory.addItem(Items.steel, 60);
|
||||
state.inventory.addItem(Items.iron, 60);
|
||||
}
|
||||
},
|
||||
generatorExplain{
|
||||
@@ -522,7 +525,7 @@ public class Tutorial{
|
||||
canBack = false;
|
||||
blockPlaceX = 1;
|
||||
blockPlaceY = 4;
|
||||
targetBlock = DefenseBlocks.repairturret;
|
||||
//targetBlock = DefenseBlocks.repairturret;
|
||||
}
|
||||
|
||||
void onSwitch(){
|
||||
@@ -547,8 +550,8 @@ public class Tutorial{
|
||||
}
|
||||
|
||||
void onSwitch(){
|
||||
state.inventory.addItem(Item.stone, 40);
|
||||
state.inventory.addItem(Item.iron, 40);
|
||||
state.inventory.addItem(Items.stone, 40);
|
||||
state.inventory.addItem(Items.iron, 40);
|
||||
ui.<ImageButton>find("sectionbuttoncrafting").fireClick();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Weapons;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
|
||||
public class UpgradeInventory {
|
||||
@@ -20,6 +21,6 @@ public class UpgradeInventory {
|
||||
|
||||
public void reset(){
|
||||
weapons.clear();
|
||||
weapons.add(Weapon.blaster);
|
||||
weapons.add(Weapons.blaster);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Layer;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.StaticBlock;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
|
||||
@@ -10,7 +10,7 @@ import io.anuke.mindustry.resource.Recipe;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Placement;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
package io.anuke.mindustry.io;
|
||||
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.ObjectIntMap;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
import io.anuke.ucore.util.Log;
|
||||
|
||||
public class BlockLoader {
|
||||
static final ObjectIntMap<String> defaultMap = map(
|
||||
"air", 0,
|
||||
"blockpart", 1,
|
||||
"deepwater", 2,
|
||||
"water", 3,
|
||||
"lava", 4,
|
||||
"oil", 5,
|
||||
"stone", 6,
|
||||
"blackstone", 7,
|
||||
"iron", 8,
|
||||
"coal", 9,
|
||||
"titanium", 10,
|
||||
"thorium", 11,
|
||||
"dirt", 12,
|
||||
"sand", 13,
|
||||
"ice", 14,
|
||||
"snow", 15,
|
||||
"grass", 16,
|
||||
"sandblock", 17,
|
||||
"snowblock", 18,
|
||||
"stoneblock", 19,
|
||||
"blackstoneblock", 20,
|
||||
"grassblock", 21,
|
||||
"mossblock", 22,
|
||||
"shrub", 23,
|
||||
"rock", 24,
|
||||
"icerock", 25,
|
||||
"blackrock", 26,
|
||||
"dirtblock", 27,
|
||||
"stonewall", 28,
|
||||
"ironwall", 29,
|
||||
"steelwall", 30,
|
||||
"titaniumwall", 31,
|
||||
"duriumwall", 32,
|
||||
"compositewall", 33,
|
||||
"steelwall-large", 34,
|
||||
"titaniumwall-large", 35,
|
||||
"duriumwall-large", 36,
|
||||
"titaniumshieldwall", 37,
|
||||
"repairturret", 38,
|
||||
"megarepairturret", 39,
|
||||
"shieldgenerator", 40,
|
||||
"door", 41,
|
||||
"door-large", 42,
|
||||
"conduit", 43,
|
||||
"pulseconduit", 44,
|
||||
"liquidrouter", 45,
|
||||
"conveyor", 46,
|
||||
"steelconveyor", 47,
|
||||
"poweredconveyor", 48,
|
||||
"router", 49,
|
||||
"junction", 50,
|
||||
"conveyortunnel", 51,
|
||||
"liquidjunction", 52,
|
||||
"liquiditemjunction", 53,
|
||||
"powerbooster", 54,
|
||||
"powerlaser", 55,
|
||||
"powerlaserrouter", 56,
|
||||
"powerlasercorner", 57,
|
||||
"teleporter", 58,
|
||||
"sorter", 59,
|
||||
"core", 60,
|
||||
"pump", 61,
|
||||
"fluxpump", 62,
|
||||
"smelter", 63,
|
||||
"crucible", 64,
|
||||
"coalpurifier", 65,
|
||||
"titaniumpurifier", 66,
|
||||
"oilrefinery", 67,
|
||||
"stoneformer", 68,
|
||||
"lavasmelter", 69,
|
||||
"stonedrill", 70,
|
||||
"irondrill", 71,
|
||||
"coaldrill", 72,
|
||||
"thoriumdrill", 73,
|
||||
"titaniumdrill", 74,
|
||||
"omnidrill", 75,
|
||||
"coalgenerator", 76,
|
||||
"thermalgenerator", 77,
|
||||
"combustiongenerator", 78,
|
||||
"rtgenerator", 79,
|
||||
"nuclearreactor", 80,
|
||||
"turret", 81,
|
||||
"doubleturret", 82,
|
||||
"machineturret", 83,
|
||||
"shotgunturret", 84,
|
||||
"flameturret", 85,
|
||||
"sniperturret", 86,
|
||||
"mortarturret", 87,
|
||||
"laserturret", 88,
|
||||
"waveturret", 89,
|
||||
"plasmaturret", 90,
|
||||
"chainturret", 91,
|
||||
"titancannon", 92,
|
||||
"playerspawn", 93,
|
||||
"enemyspawn", 94
|
||||
);
|
||||
static final IntMap<Block> blockmap = new IntMap<>();
|
||||
|
||||
public static void load(){
|
||||
|
||||
Block[] blockClasses = {
|
||||
Blocks.air,
|
||||
DefenseBlocks.compositewall,
|
||||
DistributionBlocks.conduit,
|
||||
ProductionBlocks.coaldrill,
|
||||
WeaponBlocks.chainturret,
|
||||
DebugBlocks.powerVoid
|
||||
//add any new block sections here
|
||||
};
|
||||
|
||||
for(String string : defaultMap.keys()){
|
||||
Block block = Block.getByName(string);
|
||||
blockmap.put(defaultMap.get(string, -1), block);
|
||||
}
|
||||
|
||||
for(Block block : Block.getAllBlocks()){
|
||||
block.init();
|
||||
}
|
||||
|
||||
Log.info("Total blocks loaded: {0}", Block.getAllBlocks().size);
|
||||
}
|
||||
|
||||
public static Block getByOldID(int id){
|
||||
return blockmap.get(id);
|
||||
}
|
||||
|
||||
private static ObjectIntMap<String> map(Object... objects){
|
||||
ObjectIntMap<String> map = new ObjectIntMap<>();
|
||||
for(int i = 0; i < objects.length/2; i ++){
|
||||
map.put((String)objects[i*2], (int)objects[i*2+1]);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,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.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -22,6 +22,7 @@ import static io.anuke.mindustry.Vars.mapExtension;
|
||||
|
||||
/**Reads and writes map files.*/
|
||||
//TODO GWT support
|
||||
//TODO map header that maps block names to IDs for backwards compatibility
|
||||
public class MapIO {
|
||||
private static final int version = 0;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.io.versions;
|
||||
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.mindustry.content.Weapons;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.entities.units.UnitType;
|
||||
import io.anuke.mindustry.game.Difficulty;
|
||||
@@ -10,10 +11,9 @@ import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.io.SaveFileVersion;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Upgrade;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.BlockPart;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
@@ -75,8 +75,8 @@ public class Save16 extends SaveFileVersion {
|
||||
|
||||
//weapons
|
||||
control.upgrades().getWeapons().clear();
|
||||
control.upgrades().getWeapons().add(Weapon.blaster);
|
||||
player.weaponLeft = player.weaponRight = Weapon.blaster;
|
||||
control.upgrades().getWeapons().add(Weapons.blaster);
|
||||
player.weaponLeft = player.weaponRight = Weapons.blaster;
|
||||
|
||||
int weapons = stream.readByte();
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@ package io.anuke.mindustry.net;
|
||||
|
||||
import com.badlogic.gdx.utils.ByteArray;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.mindustry.content.Weapons;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.io.Version;
|
||||
import io.anuke.mindustry.resource.Upgrade;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.BlockPart;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
@@ -128,7 +128,7 @@ public class NetworkIO {
|
||||
ui.hudfrag.updateItems();
|
||||
|
||||
control.upgrades().getWeapons().clear();
|
||||
control.upgrades().getWeapons().add(Weapon.blaster);
|
||||
control.upgrades().getWeapons().add(Weapons.blaster);
|
||||
|
||||
byte weapons = stream.readByte();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.anuke.mindustry.net;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
|
||||
public class TraceInfo {
|
||||
public int playerid;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.scene.Element;
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Colors;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Recipes;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.resource.*;
|
||||
@@ -81,7 +82,7 @@ public class BlocksFragment implements Fragment{
|
||||
|
||||
for (Section sec : Section.values()) {
|
||||
recipes.clear();
|
||||
Recipes.getBy(sec, recipes);
|
||||
io.anuke.mindustry.content.Recipes.getBy(sec, recipes);
|
||||
maxcol = Math.max((int) ((float) recipes.size / rows + 1), maxcol);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.entities.units.UnitTypes;
|
||||
import io.anuke.mindustry.content.UnitTypes;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
package io.anuke.mindustry.world;
|
||||
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Edges;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
public abstract class BaseBlock {
|
||||
@@ -13,7 +13,6 @@ import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.blocks.BaseBlock;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
@@ -47,6 +46,8 @@ public class Block extends BaseBlock {
|
||||
public boolean update;
|
||||
/**whether this block has health and can be destroyed*/
|
||||
public boolean destructible;
|
||||
/**if true, this block cannot be broken by normal means.*/
|
||||
public boolean unbreakable;
|
||||
/**whether this is solid*/
|
||||
public boolean solid;
|
||||
/**whether this block CAN be solid.*/
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.badlogic.gdx.utils.IntIntMap;
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.IntMap.Entry;
|
||||
import com.badlogic.gdx.utils.ObjectIntMap;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
|
||||
public class ColorMapper{
|
||||
/**maps color IDs to their actual RGBA8888 colors*/
|
||||
|
||||
@@ -3,15 +3,14 @@ package io.anuke.mindustry.world;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Recipes;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Recipe;
|
||||
import io.anuke.mindustry.resource.Recipes;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
|
||||
@@ -157,9 +156,9 @@ public class Placement {
|
||||
public static boolean validBreak(Team team, int x, int y){
|
||||
Tile tile = world.tile(x, y);
|
||||
|
||||
if(tile == null || tile.block() == ProductionBlocks.core) return false;
|
||||
if(tile == null || tile.block().unbreakable) return false;
|
||||
|
||||
if(tile.isLinked() && tile.getLinked().block() == ProductionBlocks.core){
|
||||
if(tile.isLinked() && tile.getLinked().block().unbreakable){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.modules.InventoryModule;
|
||||
import io.anuke.mindustry.world.blocks.types.modules.LiquidModule;
|
||||
import io.anuke.mindustry.world.blocks.types.modules.PowerModule;
|
||||
@@ -50,8 +50,8 @@ public class Tile{
|
||||
this.floor = floor;
|
||||
this.wall = wall;
|
||||
this.rotation = rotation;
|
||||
this.team = team;
|
||||
changed();
|
||||
this.team = team;
|
||||
}
|
||||
|
||||
public int packedPosition(){
|
||||
@@ -115,7 +115,6 @@ public class Tile{
|
||||
return Block.getByID(getWallID());
|
||||
}
|
||||
|
||||
//TODO save team
|
||||
public Team getTeam(){
|
||||
return Team.values()[team];
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package io.anuke.mindustry.world;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.IntArray;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.io.MapTileData;
|
||||
import io.anuke.mindustry.io.MapTileData.TileDataMarker;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||
import io.anuke.ucore.noise.Noise;
|
||||
import io.anuke.ucore.util.Log;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
|
||||
@@ -22,7 +23,7 @@ public class WorldGenerator {
|
||||
}};
|
||||
|
||||
/**Should fill spawns with the correct spawnpoints.*/
|
||||
public static void generate(Tile[][] tiles, MapTileData data, Array<Tile> cores){
|
||||
public static void generate(Tile[][] tiles, MapTileData data){
|
||||
Noise.setSeed(world.getSeed());
|
||||
|
||||
IntArray multiblocks = new IntArray();
|
||||
@@ -32,12 +33,15 @@ public class WorldGenerator {
|
||||
TileDataMarker tile = data.read();
|
||||
tiles[x][y] = new Tile(x, y, tile.floor, tile.wall, tile.rotation, tile.team);
|
||||
|
||||
Team team = Team.values()[tile.team];
|
||||
|
||||
if(tiles[x][y].block().isMultiblock()){
|
||||
multiblocks.add(tiles[x][y].packedPosition());
|
||||
}
|
||||
|
||||
if(tiles[x][y].block() == ProductionBlocks.core){
|
||||
cores.add(tiles[x][y]);
|
||||
if(tiles[x][y].block() == StorageBlocks.core &&
|
||||
state.teams.has(team)){
|
||||
state.teams.get(team).cores.add(tiles[x][y]);
|
||||
}
|
||||
|
||||
//TODO ores, plants, extra decoration?
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.graphics.DrawLayer;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.*;
|
||||
|
||||
public class Blocks{
|
||||
public static final Block
|
||||
|
||||
air = new Block("air"){
|
||||
//no drawing here
|
||||
public void drawCache(Tile tile){}
|
||||
|
||||
//update floor blocks for effects, if needed
|
||||
public void draw(Tile tile){}
|
||||
},
|
||||
|
||||
//player/enemy spawnpoint
|
||||
spawn = new Block("spawn"){},
|
||||
|
||||
blockpart = new BlockPart(){
|
||||
|
||||
},
|
||||
|
||||
deepwater = new Floor("deepwater"){{
|
||||
variants = 0;
|
||||
solid = true;
|
||||
liquidDrop = Liquid.water;
|
||||
liquid = true;
|
||||
drawLayer = DrawLayer.water;
|
||||
}},
|
||||
|
||||
water = new Floor("water"){{
|
||||
variants = 0;
|
||||
solid = true;
|
||||
liquidDrop = Liquid.water;
|
||||
liquid = true;
|
||||
drawLayer = DrawLayer.water;
|
||||
}},
|
||||
|
||||
lava = new Floor("lava"){
|
||||
{
|
||||
variants = 0;
|
||||
solid = true;
|
||||
liquidDrop = Liquid.lava;
|
||||
liquid = true;
|
||||
drawLayer = DrawLayer.lava;
|
||||
}
|
||||
},
|
||||
|
||||
oil = new Floor("oil"){
|
||||
{
|
||||
variants = 0;
|
||||
solid = true;
|
||||
liquidDrop = Liquid.oil;
|
||||
liquid = true;
|
||||
drawLayer = DrawLayer.oil;
|
||||
}
|
||||
},
|
||||
|
||||
stone = new Floor("stone"){{
|
||||
drops = new ItemStack(Item.stone, 1);
|
||||
blends = block -> block != this && !(block instanceof Ore);
|
||||
}},
|
||||
|
||||
blackstone = new Floor("blackstone"){{
|
||||
drops = new ItemStack(Item.stone, 1);
|
||||
}},
|
||||
|
||||
iron = new Ore("iron"){{
|
||||
drops = new ItemStack(Item.iron, 1);
|
||||
}},
|
||||
|
||||
lead = new Ore("lead"){{
|
||||
drops = new ItemStack(Item.lead, 1);
|
||||
}},
|
||||
|
||||
coal = new Ore("coal"){{
|
||||
drops = new ItemStack(Item.coal, 1);
|
||||
}},
|
||||
|
||||
titanium = new Ore("titanium"){{
|
||||
drops = new ItemStack(Item.titanium, 1);
|
||||
}},
|
||||
|
||||
thorium = new Ore("thorium"){{
|
||||
drops = new ItemStack(Item.thorium, 1);
|
||||
}},
|
||||
|
||||
dirt = new Floor("dirt"){},
|
||||
|
||||
sand = new Floor("sand"){{
|
||||
drops = new ItemStack(Item.silicon, 1);
|
||||
}},
|
||||
|
||||
ice = new Floor("ice"){},
|
||||
|
||||
snow = new Floor("snow"){},
|
||||
|
||||
grass = new Floor("grass"){},
|
||||
|
||||
sandblock = new StaticBlock("sandblock"){{
|
||||
solid = true;
|
||||
variants = 3;
|
||||
}},
|
||||
|
||||
snowblock = new StaticBlock("snowblock"){{
|
||||
solid = true;
|
||||
variants = 3;
|
||||
}},
|
||||
|
||||
stoneblock = new StaticBlock("stoneblock"){{
|
||||
solid = true;
|
||||
variants = 3;
|
||||
}},
|
||||
|
||||
blackstoneblock = new StaticBlock("blackstoneblock"){{
|
||||
solid = true;
|
||||
variants = 3;
|
||||
}},
|
||||
|
||||
grassblock = new StaticBlock("grassblock"){{
|
||||
solid = true;
|
||||
variants = 2;
|
||||
}},
|
||||
|
||||
mossblock = new StaticBlock("mossblock"){{
|
||||
solid = true;
|
||||
}},
|
||||
|
||||
shrub = new Rock("shrub"){
|
||||
|
||||
},
|
||||
|
||||
rock = new Rock("rock"){{
|
||||
variants = 2;
|
||||
varyShadow = true;
|
||||
drops = new ItemStack(Item.stone, 3);
|
||||
}},
|
||||
|
||||
icerock = new Rock("icerock"){{
|
||||
variants = 2;
|
||||
varyShadow = true;
|
||||
drops = new ItemStack(Item.stone, 3);
|
||||
}},
|
||||
|
||||
blackrock = new Rock("blackrock"){{
|
||||
variants = 1;
|
||||
varyShadow = true;
|
||||
drops = new ItemStack(Item.stone, 3);
|
||||
}},
|
||||
|
||||
dirtblock = new StaticBlock("dirtblock"){{
|
||||
solid = true;
|
||||
}};
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.Wall;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.*;
|
||||
|
||||
public class DefenseBlocks{
|
||||
static final int wallHealthMultiplier = 4;
|
||||
|
||||
public static final Block
|
||||
|
||||
stonewall = new Wall("stonewall"){{
|
||||
health = 40*wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
ironwall = new Wall("ironwall"){{
|
||||
health = 80*wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
steelwall = new Wall("steelwall"){{
|
||||
health = 110*wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
titaniumwall = new Wall("titaniumwall"){{
|
||||
health = 150*wallHealthMultiplier;
|
||||
}},
|
||||
diriumwall = new Wall("duriumwall"){{
|
||||
health = 190*wallHealthMultiplier;
|
||||
}},
|
||||
compositewall = new Wall("compositewall"){{
|
||||
health = 270*wallHealthMultiplier;
|
||||
}},
|
||||
steelwalllarge = new Wall("steelwall-large"){{
|
||||
health = 110*4*wallHealthMultiplier;
|
||||
size = 2;
|
||||
}},
|
||||
titaniumwalllarge = new Wall("titaniumwall-large"){{
|
||||
health = 150*4*wallHealthMultiplier;
|
||||
size = 2;
|
||||
}},
|
||||
diriumwalllarge = new Wall("duriumwall-large"){{
|
||||
health = 190*4*wallHealthMultiplier;
|
||||
size = 2;
|
||||
}},
|
||||
titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{
|
||||
health = 150*wallHealthMultiplier;
|
||||
}},
|
||||
|
||||
repairturret = new RepairTurret("repairturret"){
|
||||
{
|
||||
range = 30;
|
||||
reload = 20f;
|
||||
health = 60;
|
||||
powerUsed = 0.08f;
|
||||
}
|
||||
},
|
||||
|
||||
megarepairturret = new RepairTurret("megarepairturret"){
|
||||
{
|
||||
range = 44;
|
||||
reload = 12f;
|
||||
health = 90;
|
||||
powerUsed = 0.13f;
|
||||
size = 2;
|
||||
}
|
||||
},
|
||||
|
||||
shieldgenerator = new ShieldBlock("shieldgenerator"){
|
||||
{
|
||||
health = 100*wallHealthMultiplier;
|
||||
}
|
||||
},
|
||||
door = new Door("door"){{
|
||||
health = 90*wallHealthMultiplier;
|
||||
}},
|
||||
largedoor = new Door("door-large"){{
|
||||
openfx = Fx.dooropenlarge;
|
||||
closefx = Fx.doorcloselarge;
|
||||
health = 90*4*wallHealthMultiplier;
|
||||
size = 2;
|
||||
}};
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.distribution.*;
|
||||
import io.anuke.mindustry.world.blocks.types.generation.PowerDistributor;
|
||||
import io.anuke.mindustry.world.blocks.types.generation.PowerGenerator;
|
||||
import io.anuke.mindustry.world.blocks.types.storage.SortedUnloader;
|
||||
import io.anuke.mindustry.world.blocks.types.storage.Unloader;
|
||||
import io.anuke.mindustry.world.blocks.types.storage.Vault;
|
||||
|
||||
public class DistributionBlocks{
|
||||
|
||||
public static final Block
|
||||
|
||||
conduit = new Conduit("conduit"){{
|
||||
health = 45;
|
||||
}},
|
||||
|
||||
pulseconduit = new Conduit("pulseconduit"){{
|
||||
liquidCapacity = 16f;
|
||||
liquidFlowFactor = 4.9f;
|
||||
health = 65;
|
||||
}},
|
||||
|
||||
liquidrouter = new LiquidRouter("liquidrouter"){{
|
||||
liquidCapacity = 40f;
|
||||
}},
|
||||
|
||||
liquidtank = new LiquidRouter("liquidtank"){{
|
||||
size = 3;
|
||||
liquidCapacity = 1500f;
|
||||
}},
|
||||
|
||||
conveyor = new Conveyor("conveyor"){{
|
||||
}},
|
||||
|
||||
steelconveyor = new Conveyor("steelconveyor"){{
|
||||
health = 55;
|
||||
speed = 0.04f;
|
||||
}},
|
||||
|
||||
pulseconveyor = new Conveyor("poweredconveyor"){{
|
||||
health = 75;
|
||||
speed = 0.09f;
|
||||
}},
|
||||
|
||||
router = new Router("router"){{
|
||||
|
||||
}},
|
||||
|
||||
multiplexer = new Router("multiplexer"){{
|
||||
size = 2;
|
||||
itemCapacity = 80;
|
||||
}},
|
||||
|
||||
vault = new Vault("vault"){{
|
||||
size = 3;
|
||||
}},
|
||||
|
||||
unloader = new Unloader("unloader"){{
|
||||
|
||||
}},
|
||||
|
||||
sortedunloader = new SortedUnloader("sortedunloader"){{
|
||||
|
||||
}},
|
||||
|
||||
junction = new Junction("junction"){{
|
||||
|
||||
}},
|
||||
tunnel = new TunnelConveyor("conveyortunnel"){{
|
||||
}},
|
||||
conduittunnel = new TunnelConduit("conduittunnel"){{
|
||||
|
||||
}},
|
||||
liquidjunction = new LiquidJunction("liquidjunction"){{
|
||||
|
||||
}},
|
||||
powernode = new PowerDistributor("powernode"){{
|
||||
}},
|
||||
battery = new PowerGenerator("battery"){{
|
||||
powerCapacity = 320f;
|
||||
}},
|
||||
batteryLarge = new PowerGenerator("batterylarge"){{
|
||||
size = 3;
|
||||
powerCapacity = 2000f;
|
||||
}},
|
||||
teleporter = new Teleporter("teleporter"){{
|
||||
}},
|
||||
sorter = new Sorter("sorter"){{
|
||||
}},
|
||||
splitter = new Splitter("splitter"){{
|
||||
}};
|
||||
}
|
||||
@@ -1,331 +0,0 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.generation.ItemPowerGenerator;
|
||||
import io.anuke.mindustry.world.blocks.types.generation.LiquidPowerGenerator;
|
||||
import io.anuke.mindustry.world.blocks.types.generation.NuclearReactor;
|
||||
import io.anuke.mindustry.world.blocks.types.generation.SolarGenerator;
|
||||
import io.anuke.mindustry.world.blocks.types.production.*;
|
||||
import io.anuke.mindustry.world.blocks.types.storage.CoreBlock;
|
||||
|
||||
public class ProductionBlocks{
|
||||
public static final Block
|
||||
|
||||
core = new CoreBlock("core"){},
|
||||
|
||||
pump = new Pump("pump"){
|
||||
{
|
||||
pumpAmount = 0.8f;
|
||||
}
|
||||
},
|
||||
|
||||
fluxpump = new Pump("fluxpump"){
|
||||
{
|
||||
pumpAmount = 1.2f;
|
||||
}
|
||||
},
|
||||
|
||||
smelter = new Smelter("smelter"){
|
||||
{
|
||||
health = 70;
|
||||
inputs = new Item[]{Item.iron};
|
||||
fuel = Item.coal;
|
||||
result = Item.steel;
|
||||
craftTime = 25f;
|
||||
}
|
||||
},
|
||||
|
||||
alloysmelter = new Smelter("alloysmelter"){
|
||||
{
|
||||
health = 90;
|
||||
inputs = new Item[]{Item.titanium, Item.steel};
|
||||
fuel = Item.coal;
|
||||
result = Item.densealloy;
|
||||
burnDuration = 45f;
|
||||
craftTime = 25f;
|
||||
}
|
||||
},
|
||||
|
||||
powersmelter = new PowerSmelter("powersmelter"){
|
||||
{
|
||||
/*
|
||||
health = 90;
|
||||
inputs = new Item[]{Item.titanium, Item.steel};
|
||||
fuel = Item.coal;
|
||||
results = Item.dirium;
|
||||
burnDuration = 45f;
|
||||
craftTime = 25f;
|
||||
size = 2;*/
|
||||
}
|
||||
},
|
||||
|
||||
cryofluidmixer = new LiquidMixer("cryofluidmixer"){
|
||||
{
|
||||
health = 200;
|
||||
inputLiquid = Liquid.water;
|
||||
outputLiquid = Liquid.cryofluid;
|
||||
inputItem = Item.titanium;
|
||||
liquidPerItem = 50f;
|
||||
itemCapacity = 50;
|
||||
powerUse = 0.1f;
|
||||
size = 2;
|
||||
}
|
||||
},
|
||||
|
||||
coalextractor = new LiquidCrafter("coalextractor"){
|
||||
{
|
||||
input = Item.stone;
|
||||
inputAmount = 6;
|
||||
inputLiquid = Liquid.water;
|
||||
liquidAmount = 19f;
|
||||
output = Item.coal;
|
||||
health = 50;
|
||||
purifyTime = 50;
|
||||
health = 60;
|
||||
}
|
||||
},
|
||||
|
||||
titaniumextractor = new LiquidCrafter("titaniumextractor"){
|
||||
{
|
||||
input = Item.stone;
|
||||
inputAmount = 8;
|
||||
inputLiquid = Liquid.water;
|
||||
liquidAmount = 40f;
|
||||
liquidCapacity = 41f;
|
||||
purifyTime = 60;
|
||||
output = Item.titanium;
|
||||
health = 70;
|
||||
}
|
||||
},
|
||||
|
||||
oilrefinery = new LiquidCrafter("oilrefinery"){
|
||||
{
|
||||
inputLiquid = Liquid.oil;
|
||||
liquidAmount = 55f;
|
||||
liquidCapacity = 56f;
|
||||
purifyTime = 65;
|
||||
output = Item.coal;
|
||||
health = 80;
|
||||
craftEffect = Fx.purifyoil;
|
||||
}
|
||||
},
|
||||
|
||||
stoneformer = new LiquidCrafter("stoneformer"){
|
||||
{
|
||||
input = null;
|
||||
inputLiquid = Liquid.lava;
|
||||
liquidAmount = 16f;
|
||||
liquidCapacity = 21f;
|
||||
purifyTime = 12;
|
||||
output = Item.stone;
|
||||
health = 80;
|
||||
craftEffect = Fx.purifystone;
|
||||
}
|
||||
},
|
||||
|
||||
lavasmelter = new LiquidCrafter("lavasmelter"){
|
||||
{
|
||||
input = Item.iron;
|
||||
inputAmount = 1;
|
||||
inputLiquid = Liquid.lava;
|
||||
liquidAmount = 40f;
|
||||
liquidCapacity = 41f;
|
||||
purifyTime = 30;
|
||||
output = Item.steel;
|
||||
health = 80;
|
||||
craftEffect = Fx.purifystone;
|
||||
}
|
||||
},
|
||||
|
||||
siliconextractor = new LiquidCrafter("siliconextractor"){
|
||||
{
|
||||
input = Item.stone;
|
||||
inputAmount = 5;
|
||||
inputLiquid = Liquid.water;
|
||||
liquidAmount = 18.99f;
|
||||
output = Item.silicon;
|
||||
health = 50;
|
||||
purifyTime = 50;
|
||||
}
|
||||
},
|
||||
|
||||
stonedrill = new Drill("stonedrill"){
|
||||
{
|
||||
resource = Blocks.stone;
|
||||
result = Item.stone;
|
||||
drillTime = 240;
|
||||
}
|
||||
},
|
||||
|
||||
irondrill = new Drill("irondrill"){
|
||||
{
|
||||
resource = Blocks.iron;
|
||||
result = Item.iron;
|
||||
drillTime = 360;
|
||||
}
|
||||
},
|
||||
|
||||
leaddrill = new Drill("leaddrill"){
|
||||
{
|
||||
resource = Blocks.lead;
|
||||
result = Item.lead;
|
||||
drillTime = 400;
|
||||
}
|
||||
},
|
||||
|
||||
coaldrill = new Drill("coaldrill"){
|
||||
{
|
||||
resource = Blocks.coal;
|
||||
result = Item.coal;
|
||||
drillTime = 420;
|
||||
}
|
||||
},
|
||||
|
||||
thoriumdrill = new Drill("thoriumdrill"){
|
||||
{
|
||||
resource = Blocks.thorium;
|
||||
result = Item.thorium;
|
||||
drillTime = 600;
|
||||
}
|
||||
},
|
||||
|
||||
titaniumdrill = new Drill("titaniumdrill"){
|
||||
{
|
||||
resource = Blocks.titanium;
|
||||
result = Item.titanium;
|
||||
drillTime = 540;
|
||||
}
|
||||
},
|
||||
|
||||
laserdrill = new GenericDrill("laserdrill"){
|
||||
{
|
||||
drillTime = 200;
|
||||
size = 2;
|
||||
powerUse = 0.2f;
|
||||
hasPower = true;
|
||||
}
|
||||
},
|
||||
|
||||
nucleardrill = new GenericDrill("nucleardrill"){
|
||||
{
|
||||
drillTime = 240;
|
||||
size = 3;
|
||||
powerUse = 0.32f;
|
||||
hasPower = true;
|
||||
}
|
||||
},
|
||||
|
||||
plasmadrill = new GenericDrill("plasmadrill"){
|
||||
{
|
||||
inputLiquid = Liquid.plasma;
|
||||
drillTime = 240;
|
||||
size = 4;
|
||||
powerUse = 0.16f;
|
||||
hasLiquids = true;
|
||||
hasPower = true;
|
||||
}
|
||||
},
|
||||
|
||||
quartzextractor = new GenericDrill("quartzextractor"){
|
||||
{
|
||||
powerUse = 0.1f;
|
||||
resource = Blocks.sand;
|
||||
result = Item.silicon;
|
||||
drillTime = 320;
|
||||
size = 2;
|
||||
}
|
||||
},
|
||||
|
||||
waterextractor = new SolidPump("waterextractor"){
|
||||
{
|
||||
result = Liquid.water;
|
||||
powerUse = 0.1f;
|
||||
pumpAmount = 0.4f;
|
||||
size = 2;
|
||||
liquidCapacity = 30f;
|
||||
}
|
||||
},
|
||||
|
||||
oilextractor = new SolidPump("oilextractor"){
|
||||
{
|
||||
result = Liquid.oil;
|
||||
powerUse = 0.5f;
|
||||
pumpAmount = 0.4f;
|
||||
size = 3;
|
||||
liquidCapacity = 80f;
|
||||
}
|
||||
},
|
||||
|
||||
cultivator = new GenericDrill("cultivator"){
|
||||
{
|
||||
resource = Blocks.grass;
|
||||
result = Item.biomatter;
|
||||
inputLiquid = Liquid.water;
|
||||
liquidUse = 0.1f;
|
||||
drillTime = 300;
|
||||
size = 2;
|
||||
hasLiquids = true;
|
||||
hasPower = true;
|
||||
}
|
||||
},
|
||||
|
||||
coalgenerator = new ItemPowerGenerator("coalgenerator"){
|
||||
{
|
||||
generateItem = Item.coal;
|
||||
powerOutput = 0.04f;
|
||||
powerCapacity = 40f;
|
||||
}
|
||||
},
|
||||
thermalgenerator = new LiquidPowerGenerator("thermalgenerator"){
|
||||
{
|
||||
generateLiquid = Liquid.lava;
|
||||
maxLiquidGenerate = 0.5f;
|
||||
powerPerLiquid = 0.08f;
|
||||
powerCapacity = 40f;
|
||||
generateEffect = Fx.redgeneratespark;
|
||||
}
|
||||
},
|
||||
combustiongenerator = new LiquidPowerGenerator("combustiongenerator"){
|
||||
{
|
||||
generateLiquid = Liquid.oil;
|
||||
maxLiquidGenerate = 0.4f;
|
||||
powerPerLiquid = 0.12f;
|
||||
powerCapacity = 40f;
|
||||
}
|
||||
},
|
||||
rtgenerator = new ItemPowerGenerator("rtgenerator"){
|
||||
{
|
||||
generateItem = Item.thorium;
|
||||
powerCapacity = 40f;
|
||||
powerOutput = 0.03f;
|
||||
itemDuration = 240f;
|
||||
}
|
||||
},
|
||||
solarpanel = new SolarGenerator("solarpanel"){
|
||||
{
|
||||
generation = 0.003f;
|
||||
}
|
||||
},
|
||||
largesolarpanel = new SolarGenerator("largesolarpanel"){
|
||||
{
|
||||
size = 3;
|
||||
generation = 0.012f;
|
||||
}
|
||||
},
|
||||
nuclearReactor = new NuclearReactor("nuclearreactor"){
|
||||
{
|
||||
size = 3;
|
||||
health = 600;
|
||||
breaktime *= 2.3f;
|
||||
}
|
||||
},
|
||||
weaponFactory = new WeaponFactory("weaponfactory"){
|
||||
{
|
||||
size = 2;
|
||||
health = 250;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.types;
|
||||
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
|
||||
public class Ore extends Floor{
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package io.anuke.mindustry.world.blocks.types.defense;
|
||||
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public abstract class LiquidTurret extends Turret{
|
||||
public Liquid ammoLiquid = Liquid.water;
|
||||
public Liquid ammoLiquid = Liquids.water;
|
||||
public float liquidCapacity = 60f;
|
||||
public float liquidPerShot = 1f;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.types.distribution;
|
||||
import com.badlogic.gdx.utils.LongArray;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.BlockGroup;
|
||||
import io.anuke.mindustry.world.Layer;
|
||||
@@ -32,7 +33,7 @@ public class Conveyor extends Block{
|
||||
private final Translator tr1 = new Translator();
|
||||
private final Translator tr2 = new Translator();
|
||||
|
||||
public float speed = 0.02f;
|
||||
public float speed = 0f;
|
||||
|
||||
protected Conveyor(String name) {
|
||||
super(name);
|
||||
@@ -53,7 +54,7 @@ public class Conveyor extends Block{
|
||||
byte rotation = tile.getRotation();
|
||||
|
||||
Draw.rect(name() +
|
||||
(Timers.time() % ((20 / 100f) / speed) < (10 / 100f) / speed && acceptItem(Item.stone, tile, null) ? "" : "move"),
|
||||
(Timers.time() % ((20 / 100f) / speed) < (10 / 100f) / speed && acceptItem(Items.stone, tile, null) ? "" : "move"),
|
||||
tile.worldx(), tile.worldy(), rotation * 90);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ public class LiquidJunction extends LiquidBlock{
|
||||
Tile to = tile.getNearby(dir);
|
||||
|
||||
Timers.run(20f, () -> {
|
||||
if(to.block() instanceof LiquidBlock && ((LiquidBlock)to.block()).acceptLiquid(to, tile, liquid, amount))
|
||||
((LiquidBlock)to.block()).handleLiquid(to, tile, liquid, amount);
|
||||
if(to.block().hasLiquids && to.block().acceptLiquid(to, tile, liquid, amount))
|
||||
to.block().handleLiquid(to, tile, liquid, amount);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class LiquidJunction extends LiquidBlock{
|
||||
int dir = source.relativeTo(dest.x, dest.y);
|
||||
dir = (dir+4)%4;
|
||||
Tile to = dest.getNearby(dir);
|
||||
return to != null && to.block() instanceof LiquidBlock &&
|
||||
((LiquidBlock)to.block()).acceptLiquid(to, dest, liquid, amount);
|
||||
return to != null && to.block().hasLiquids &&
|
||||
to.block().acceptLiquid(to, dest, liquid, amount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.BlockGroup;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@@ -143,7 +144,7 @@ public class Sorter extends Block{
|
||||
}
|
||||
|
||||
public static class SorterEntity extends TileEntity{
|
||||
public Item sortItem = Item.iron;
|
||||
public Item sortItem = Items.iron;
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException{
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package io.anuke.mindustry.world.blocks.types.generation;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.effect.DamageArea;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.BarType;
|
||||
import io.anuke.mindustry.world.BlockBar;
|
||||
@@ -41,8 +43,8 @@ public class NuclearReactor extends LiquidPowerGenerator{
|
||||
|
||||
public NuclearReactor(String name) {
|
||||
super(name);
|
||||
generateItem = Item.thorium;
|
||||
generateLiquid = Liquid.water;
|
||||
generateItem = Items.thorium;
|
||||
generateLiquid = Liquids.water;
|
||||
itemCapacity = 30;
|
||||
liquidCapacity = 50;
|
||||
explosionEffect = Fx.nuclearShockwave;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.types.modules;
|
||||
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.blocks.types.BlockModule;
|
||||
|
||||
@@ -9,7 +10,7 @@ import java.io.IOException;
|
||||
|
||||
public class LiquidModule extends BlockModule {
|
||||
public float amount;
|
||||
public Liquid liquid = Liquid.none;
|
||||
public Liquid liquid = Liquids.none;
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
@@ -14,7 +15,7 @@ public class GenericDrill extends Drill{
|
||||
public float powerUse = 0.08f;
|
||||
/**liquid use per frame.*/
|
||||
protected float liquidUse = 0.1f;
|
||||
protected Liquid inputLiquid = Liquid.water;
|
||||
protected Liquid inputLiquid = Liquids.water;
|
||||
|
||||
private Array<Item> toAdd = new Array<>();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
@@ -8,8 +9,8 @@ import io.anuke.mindustry.world.blocks.types.LiquidBlock;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
public class LiquidMixer extends LiquidBlock{
|
||||
protected Liquid inputLiquid = Liquid.none;
|
||||
protected Liquid outputLiquid = Liquid.none;
|
||||
protected Liquid inputLiquid = Liquids.none;
|
||||
protected Liquid outputLiquid = Liquids.none;
|
||||
protected Item inputItem = null;
|
||||
protected float liquidPerItem = 50f;
|
||||
protected float powerUse = 0f;
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
/**Pump that makes liquid from solids and takes in power. Only works on solid floor blocks.*/
|
||||
public class SolidPump extends Pump {
|
||||
protected Liquid result = Liquid.water;
|
||||
protected Liquid result = Liquids.water;
|
||||
/**Power use per liquid unit.*/
|
||||
protected float powerUse = 0.1f;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Upgrade;
|
||||
import io.anuke.mindustry.resource.UpgradeRecipes;
|
||||
import io.anuke.mindustry.content.UpgradeRecipes;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
@@ -5,7 +5,6 @@ import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class CoreBlock extends StorageBlock {
|
||||
protected int capacity = 1000;
|
||||
@@ -13,9 +12,9 @@ public class CoreBlock extends StorageBlock {
|
||||
public CoreBlock(String name) {
|
||||
super(name);
|
||||
|
||||
health = 800;
|
||||
solid = true;
|
||||
destructible = true;
|
||||
unbreakable = true;
|
||||
size = 3;
|
||||
hasInventory = false;
|
||||
}
|
||||
@@ -23,7 +22,10 @@ public class CoreBlock extends StorageBlock {
|
||||
public void onDestroyed(Tile tile){
|
||||
//TODO more dramatic effects
|
||||
super.onDestroyed(tile);
|
||||
world.getAllyCores().removeValue(tile, true);
|
||||
|
||||
if(state.teams.has(tile.getTeam())){
|
||||
state.teams.get(tile.getTeam()).cores.removeValue(tile, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
||||
@@ -26,7 +27,7 @@ public class SortedUnloader extends Unloader {
|
||||
public void update(Tile tile){
|
||||
SortedUnloaderEntity entity = tile.entity();
|
||||
|
||||
if(entity.inventory.totalItems() == 0 && entity.timer.get(timerUnload, 5)){
|
||||
if(entity.inventory.totalItems() == 0 && entity.timer.get(timerUnload, speed)){
|
||||
tile.allNearby(other -> {
|
||||
if(other.block() instanceof StorageBlock && entity.inventory.totalItems() == 0 &&
|
||||
((StorageBlock)other.block()).hasItem(other, entity.sortItem)){
|
||||
@@ -103,7 +104,7 @@ public class SortedUnloader extends Unloader {
|
||||
}
|
||||
|
||||
public static class SortedUnloaderEntity extends TileEntity{
|
||||
public Item sortItem = Item.iron;
|
||||
public Item sortItem = Items.iron;
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException {
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class Unloader extends Block {
|
||||
protected final int timerUnload = timers++;
|
||||
protected int speed = 5;
|
||||
|
||||
public Unloader(String name){
|
||||
super(name);
|
||||
@@ -18,7 +19,7 @@ public class Unloader extends Block {
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
if(tile.entity.inventory.totalItems() == 0 && tile.entity.timer.get(timerUnload, 5)){
|
||||
if(tile.entity.inventory.totalItems() == 0 && tile.entity.timer.get(timerUnload, speed)){
|
||||
tile.allNearby(other -> {
|
||||
if(other.block() instanceof StorageBlock && tile.entity.inventory.totalItems() == 0 &&
|
||||
((StorageBlock)other.block()).hasItem(other, null)){
|
||||
|
||||
Reference in New Issue
Block a user