Added groundwater pump, 3x3 solar panels

This commit is contained in:
Anuken
2018-03-12 22:02:52 -04:00
parent e67ddf9430
commit 94b815b8ab
27 changed files with 604 additions and 452 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 228 B

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 613 B

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 196 B

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 90 KiB

+2 -2
View File
@@ -1,7 +1,7 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Mon Mar 12 16:07:14 EDT 2018 #Mon Mar 12 22:01:24 EDT 2018
version=release version=release
androidBuildCode=461 androidBuildCode=474
name=Mindustry name=Mindustry
code=3.4 code=3.4
build=custom build build=custom build
+10 -1
View File
@@ -5,7 +5,7 @@ import com.badlogic.gdx.utils.Array;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Bundles; import io.anuke.ucore.util.Bundles;
public class Item{ public class Item implements Comparable<Item>{
private static final Array<Item> items = new Array<>(); private static final Array<Item> items = new Array<>();
public static final Item public static final Item
@@ -15,6 +15,7 @@ public class Item{
{ {
explosiveness = 0.2f; explosiveness = 0.2f;
flammability = 0.5f; flammability = 0.5f;
fluxiness = 0.5f;
material = false; material = false;
} }
}, },
@@ -30,6 +31,7 @@ public class Item{
quartz = new Item("quartz") { quartz = new Item("quartz") {
{ {
material = false; material = false;
fluxiness = 0.65f;
} }
}, },
glass = new Item("glass"), glass = new Item("glass"),
@@ -47,6 +49,8 @@ public class Item{
public float explosiveness = 0f; public float explosiveness = 0f;
public float flammability = 0f; public float flammability = 0f;
/**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/
public float fluxiness = 0f;
public boolean material = true; public boolean material = true;
public Item(String name) { public Item(String name) {
@@ -69,6 +73,11 @@ public class Item{
return localizedName(); return localizedName();
} }
@Override
public int compareTo(Item item) {
return Integer.compare(id, item.id);
}
public static Array<Item> getAllItems() { public static Array<Item> getAllItems() {
return Item.items; return Item.items;
} }
@@ -11,7 +11,11 @@ public class Liquid {
public static final Liquid public static final Liquid
none = new Liquid("none", Color.CLEAR), none = new Liquid("none", Color.CLEAR),
water = new Liquid("water", Color.ROYAL), water = new Liquid("water", Color.ROYAL){
{
heatCapacity = 0.7f;
}
},
plasma = new Liquid("plasma", Color.CORAL){ plasma = new Liquid("plasma", Color.CORAL){
{ {
flammability = 0.4f; flammability = 0.4f;
@@ -28,7 +32,7 @@ public class Liquid {
oil = new Liquid("oil", Color.valueOf("292929")){ oil = new Liquid("oil", Color.valueOf("292929")){
{ {
viscosity = 0.7f; viscosity = 0.7f;
flammability = 0.5f; flammability = 0.6f;
explosiveness = 0.6f; explosiveness = 0.6f;
} }
}, },
@@ -50,10 +54,15 @@ public class Liquid {
public final String name; public final String name;
public final int id; public final int id;
/**0-1, 0 is completely inflammable, anything above that may catch fire when exposed to heat, 0.5+ is very flammable.*/
public float flammability; public float flammability;
/**temperature: 0.5 is 'room' temperature, 0 is very cold, 1 is molten hot*/
public float temperature = 0.5f; public float temperature = 0.5f;
/**how much heat this liquid can store. 0.75=water (high), anything lower is probably less dense and bad at cooling.*/
public float heatCapacity = 0.5f; public float heatCapacity = 0.5f;
/**how thick this liquid is. 0.5=water (relatively viscous), 1 would be something like tar (very slow)*/
public float viscosity = 0.5f; public float viscosity = 0.5f;
/**how prone to exploding this liquid is, when heated. 0 = nothing, 1 = nuke*/
public float explosiveness; public float explosiveness;
public Liquid(String name, Color color) { public Liquid(String name, Color color) {
@@ -10,96 +10,97 @@ import static io.anuke.mindustry.resource.Section.*;
public class Recipes { public class Recipes {
private static final Array<Recipe> list = Array.with( private static final Array<Recipe> list = Array.with(
new Recipe(defense, DefenseBlocks.stonewall, stack(Item.stone, 12)), new Recipe(defense, DefenseBlocks.stonewall, stack(Item.stone, 12)),
new Recipe(defense, DefenseBlocks.ironwall, stack(Item.iron, 12)), new Recipe(defense, DefenseBlocks.ironwall, stack(Item.iron, 12)),
new Recipe(defense, DefenseBlocks.steelwall, stack(Item.steel, 12)), new Recipe(defense, DefenseBlocks.steelwall, stack(Item.steel, 12)),
new Recipe(defense, DefenseBlocks.titaniumwall, stack(Item.titanium, 12)), new Recipe(defense, DefenseBlocks.titaniumwall, stack(Item.titanium, 12)),
new Recipe(defense, DefenseBlocks.diriumwall, stack(Item.dirium, 12)), new Recipe(defense, DefenseBlocks.diriumwall, stack(Item.dirium, 12)),
new Recipe(defense, DefenseBlocks.steelwalllarge, stack(Item.steel, 12*4)), new Recipe(defense, DefenseBlocks.steelwalllarge, stack(Item.steel, 12*4)),
new Recipe(defense, DefenseBlocks.titaniumwalllarge, stack(Item.titanium, 12*4)), new Recipe(defense, DefenseBlocks.titaniumwalllarge, stack(Item.titanium, 12*4)),
new Recipe(defense, DefenseBlocks.diriumwalllarge, stack(Item.dirium, 12*4)), new Recipe(defense, DefenseBlocks.diriumwalllarge, stack(Item.dirium, 12*4)),
new Recipe(defense, DefenseBlocks.door, stack(Item.steel, 3), stack(Item.iron, 3*4)).setDesktop(), 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.largedoor, stack(Item.steel, 3*4), stack(Item.iron, 3*4*4)).setDesktop(),
new Recipe(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 16)), new Recipe(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 16)),
new Recipe(distribution, DistributionBlocks.conveyor, stack(Item.stone, 1)), new Recipe(distribution, DistributionBlocks.conveyor, stack(Item.stone, 1)),
new Recipe(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)), new Recipe(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)),
new Recipe(distribution, DistributionBlocks.pulseconveyor, stack(Item.dirium, 1)), new Recipe(distribution, DistributionBlocks.pulseconveyor, stack(Item.dirium, 1)),
new Recipe(distribution, DistributionBlocks.router, stack(Item.stone, 2)), new Recipe(distribution, DistributionBlocks.router, stack(Item.stone, 2)),
new Recipe(distribution, DistributionBlocks.multiplexer, stack(Item.iron, 8)), new Recipe(distribution, DistributionBlocks.multiplexer, stack(Item.iron, 8)),
new Recipe(distribution, DistributionBlocks.junction, stack(Item.iron, 2)), new Recipe(distribution, DistributionBlocks.junction, stack(Item.iron, 2)),
new Recipe(distribution, DistributionBlocks.tunnel, 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.sorter, stack(Item.steel, 2)),
new Recipe(distribution, DistributionBlocks.splitter, stack(Item.steel, 1)), new Recipe(distribution, DistributionBlocks.splitter, stack(Item.steel, 1)),
new Recipe(distribution, DistributionBlocks.vault, stack(Item.steel, 50)), new Recipe(distribution, DistributionBlocks.vault, stack(Item.steel, 50)),
new Recipe(distribution, DistributionBlocks.unloader, stack(Item.steel, 5)), new Recipe(distribution, DistributionBlocks.unloader, stack(Item.steel, 5)),
new Recipe(distribution, DistributionBlocks.sortedunloader, stack(Item.steel, 5)), new Recipe(distribution, DistributionBlocks.sortedunloader, stack(Item.steel, 5)),
new Recipe(weapon, WeaponBlocks.doubleturret, stack(Item.stone, 7)), new Recipe(weapon, WeaponBlocks.doubleturret, stack(Item.stone, 7)),
new Recipe(weapon, WeaponBlocks.gatlingturret, stack(Item.iron, 8), stack(Item.stone, 10)), new Recipe(weapon, WeaponBlocks.gatlingturret, stack(Item.iron, 8), stack(Item.stone, 10)),
new Recipe(weapon, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)), 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.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.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.flakturret, stack(Item.steel, 25), stack(Item.titanium, 15)),
new Recipe(weapon, WeaponBlocks.teslaturret, stack(Item.steel, 20), stack(Item.titanium, 25), stack(Item.dirium, 15)), new Recipe(weapon, WeaponBlocks.teslaturret, stack(Item.steel, 20), stack(Item.titanium, 25), stack(Item.dirium, 15)),
new Recipe(weapon, WeaponBlocks.magmaturret, stack(Item.steel, 80), stack(Item.titanium, 70), stack(Item.dirium, 60)), new Recipe(weapon, WeaponBlocks.magmaturret, stack(Item.steel, 80), stack(Item.titanium, 70), stack(Item.dirium, 60)),
new Recipe(weapon, WeaponBlocks.chainturret, stack(Item.steel, 50), stack(Item.titanium, 25), stack(Item.dirium, 40)), new Recipe(weapon, WeaponBlocks.chainturret, stack(Item.steel, 50), stack(Item.titanium, 25), stack(Item.dirium, 40)),
new Recipe(weapon, WeaponBlocks.titanturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)), new Recipe(weapon, WeaponBlocks.titanturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)),
new Recipe(weapon, WeaponBlocks.missileturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)), new Recipe(weapon, WeaponBlocks.missileturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)),
new Recipe(weapon, WeaponBlocks.fornaxcannon, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)), new Recipe(weapon, WeaponBlocks.fornaxcannon, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)),
new Recipe(crafting, ProductionBlocks.smelter, stack(Item.stone, 40), stack(Item.iron, 40)), new Recipe(crafting, ProductionBlocks.smelter, stack(Item.stone, 40), stack(Item.iron, 40)),
new Recipe(crafting, ProductionBlocks.alloysmelter, stack(Item.titanium, 50), stack(Item.steel, 50)), 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.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.titaniumextractor, stack(Item.steel, 30), stack(Item.iron, 30)),
new Recipe(crafting, ProductionBlocks.uraniumextractor, 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.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.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.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.pulverizer, 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.siliconextractor, stack(Item.steel, 30), stack(Item.titanium, 15)), //new Recipe(crafting, ProductionBlocks.centrifuge, stack(Item.steel, 30), stack(Item.iron, 30)),
new Recipe(crafting, ProductionBlocks.weaponFactory, stack(Item.steel, 60), stack(Item.iron, 60)).setDesktop(),
new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)), new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
new Recipe(production, ProductionBlocks.irondrill, stack(Item.stone, 25)), new Recipe(production, ProductionBlocks.irondrill, stack(Item.stone, 25)),
new Recipe(production, ProductionBlocks.coaldrill, stack(Item.stone, 25), stack(Item.iron, 40)), new Recipe(production, ProductionBlocks.coaldrill, stack(Item.stone, 25), stack(Item.iron, 40)),
new Recipe(production, ProductionBlocks.titaniumdrill, stack(Item.iron, 50), stack(Item.steel, 50)), new Recipe(production, ProductionBlocks.titaniumdrill, stack(Item.iron, 50), stack(Item.steel, 50)),
new Recipe(production, ProductionBlocks.uraniumdrill, stack(Item.iron, 40), stack(Item.steel, 40)), new Recipe(production, ProductionBlocks.uraniumdrill, stack(Item.iron, 40), stack(Item.steel, 40)),
new Recipe(production, ProductionBlocks.quartzextractor, stack(Item.titanium, 40), stack(Item.dirium, 40)), new Recipe(production, ProductionBlocks.quartzextractor, stack(Item.titanium, 40), stack(Item.dirium, 40)),
new Recipe(production, ProductionBlocks.cultivator, stack(Item.titanium, 40), stack(Item.dirium, 40)), new Recipe(production, ProductionBlocks.cultivator, stack(Item.titanium, 40), stack(Item.dirium, 40)),
new Recipe(production, ProductionBlocks.laserdrill, stack(Item.titanium, 40), stack(Item.dirium, 40)), new Recipe(production, ProductionBlocks.laserdrill, stack(Item.titanium, 40), stack(Item.dirium, 40)),
new Recipe(production, ProductionBlocks.waterextractor, stack(Item.titanium, 40), stack(Item.dirium, 40)),
new Recipe(power, ProductionBlocks.coalgenerator, stack(Item.iron, 30), stack(Item.stone, 20)), new Recipe(power, ProductionBlocks.coalgenerator, stack(Item.iron, 30), stack(Item.stone, 20)),
new Recipe(power, ProductionBlocks.thermalgenerator, stack(Item.steel, 30), stack(Item.iron, 30)), new Recipe(power, ProductionBlocks.thermalgenerator, stack(Item.steel, 30), stack(Item.iron, 30)),
new Recipe(power, ProductionBlocks.combustiongenerator, stack(Item.iron, 30), stack(Item.stone, 20)), new Recipe(power, ProductionBlocks.combustiongenerator, stack(Item.iron, 30), stack(Item.stone, 20)),
new Recipe(power, ProductionBlocks.solarpanel, stack(Item.iron, 30), stack(Item.silicon, 20)), new Recipe(power, ProductionBlocks.solarpanel, 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.largesolarpanel, stack(Item.iron, 30), stack(Item.silicon, 20)),
new Recipe(power, ProductionBlocks.nuclearReactor, stack(Item.titanium, 40), stack(Item.dirium, 40), stack(Item.steel, 50)), new Recipe(power, ProductionBlocks.rtgenerator, stack(Item.titanium, 20), stack(Item.steel, 20)),
new Recipe(power, DistributionBlocks.powerlaser, stack(Item.steel, 3), stack(Item.iron, 3)), new Recipe(power, ProductionBlocks.nuclearReactor, stack(Item.titanium, 40), stack(Item.dirium, 40), stack(Item.steel, 50)),
new Recipe(power, DistributionBlocks.powerlasercorner, stack(Item.steel, 4), stack(Item.iron, 4)), new Recipe(power, DistributionBlocks.powerlaser, stack(Item.steel, 3), stack(Item.iron, 3)),
new Recipe(power, DistributionBlocks.powerlaserrouter, stack(Item.steel, 5), stack(Item.iron, 5)), new Recipe(power, DistributionBlocks.powerlasercorner, stack(Item.steel, 4), stack(Item.iron, 4)),
new Recipe(power, DistributionBlocks.battery, stack(Item.steel, 5), stack(Item.iron, 5)), new Recipe(power, DistributionBlocks.powerlaserrouter, stack(Item.steel, 5), stack(Item.iron, 5)),
new Recipe(power, DistributionBlocks.batteryLarge, stack(Item.steel, 5), stack(Item.iron, 5)), 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.dirium, 30)), new Recipe(power, DefenseBlocks.shieldgenerator, stack(Item.titanium, 30), stack(Item.dirium, 30)),
new Recipe(distribution, DistributionBlocks.teleporter, stack(Item.steel, 30), stack(Item.dirium, 40)), new Recipe(distribution, DistributionBlocks.teleporter, stack(Item.steel, 30), stack(Item.dirium, 40)),
new Recipe(power, DefenseBlocks.repairturret, stack(Item.iron, 30)), new Recipe(power, DefenseBlocks.repairturret, stack(Item.iron, 30)),
new Recipe(power, DefenseBlocks.megarepairturret, stack(Item.iron, 20), stack(Item.steel, 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.conduit, stack(Item.steel, 1)),
new Recipe(liquid, DistributionBlocks.pulseconduit, stack(Item.titanium, 1), 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.liquidrouter, stack(Item.steel, 2)),
new Recipe(liquid, DistributionBlocks.liquidsilo, 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.liquidjunction, stack(Item.steel, 2)),
new Recipe(liquid, DistributionBlocks.conduittunnel, stack(Item.titanium, 2), 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.pump, stack(Item.steel, 10)),
new Recipe(liquid, ProductionBlocks.fluxpump, stack(Item.steel, 10), stack(Item.dirium, 5)), new Recipe(liquid, ProductionBlocks.fluxpump, stack(Item.steel, 10), stack(Item.dirium, 5)),
new Recipe(units, DebugBlocks.powerVoid, stack(Item.steel, 10)).setDebug(), new Recipe(units, DebugBlocks.powerVoid, stack(Item.steel, 10)).setDebug(),
new Recipe(units, DebugBlocks.powerInfinite, stack(Item.steel, 10), stack(Item.dirium, 5)).setDebug() new Recipe(units, DebugBlocks.powerInfinite, stack(Item.steel, 10), stack(Item.dirium, 5)).setDebug()
); );
private static ItemStack stack(Item item, int amount){ private static ItemStack stack(Item item, int amount){
@@ -26,9 +26,9 @@ public class DistributionBlocks{
liquidRegion = "liquidrouter-liquid"; liquidRegion = "liquidrouter-liquid";
}}, }},
liquidsilo = new LiquidRouter("liquidsilo"){{ liquidtank = new LiquidRouter("liquidtank"){{
size = 3; size = 3;
liquidRegion = "liquidsilo-liquid"; liquidRegion = "liquidtank-liquid";
liquidCapacity = 1300f; liquidCapacity = 1300f;
}}, }},
@@ -2,13 +2,14 @@ package io.anuke.mindustry.world.blocks;
import io.anuke.mindustry.graphics.Fx; import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.resource.Liquid; import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.types.generation.*; 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.generation.SolarGenerator;
import io.anuke.mindustry.world.blocks.types.storage.CoreBlock;
import io.anuke.mindustry.world.blocks.types.production.*; import io.anuke.mindustry.world.blocks.types.production.*;
import io.anuke.mindustry.world.blocks.types.storage.CoreBlock;
public class ProductionBlocks{ public class ProductionBlocks{
public static final Block public static final Block
@@ -29,6 +30,7 @@ public class ProductionBlocks{
inputs = new Item[]{Item.iron}; inputs = new Item[]{Item.iron};
fuel = Item.coal; fuel = Item.coal;
result = Item.steel; result = Item.steel;
craftTime = 25f;
} }
}, },
@@ -38,27 +40,41 @@ public class ProductionBlocks{
inputs = new Item[]{Item.titanium, Item.steel}; inputs = new Item[]{Item.titanium, Item.steel};
fuel = Item.coal; fuel = Item.coal;
result = Item.dirium; result = Item.dirium;
burnDuration = 40f; burnDuration = 45f;
craftTime = 20f; 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;*/
} }
}, },
coalextractor = new LiquidCrafter("coalextractor"){ coalextractor = new LiquidCrafter("coalextractor"){
{ {
input = Item.stone; input = Item.stone;
inputAmount = 5; inputAmount = 6;
inputLiquid = Liquid.water; inputLiquid = Liquid.water;
liquidAmount = 18.99f; liquidAmount = 19f;
output = Item.coal; output = Item.coal;
health = 50; health = 50;
purifyTime = 50; purifyTime = 50;
health = 60;
} }
}, },
titaniumextractor = new LiquidCrafter("titaniumextractor"){ titaniumextractor = new LiquidCrafter("titaniumextractor"){
{ {
input = Item.iron; input = Item.iron;
inputAmount = 6; inputAmount = 8;
inputLiquid = Liquid.water; inputLiquid = Liquid.water;
liquidAmount = 40f; liquidAmount = 40f;
liquidCapacity = 41f; liquidCapacity = 41f;
@@ -67,19 +83,6 @@ public class ProductionBlocks{
health = 70; health = 70;
} }
}, },
uraniumextractor = new LiquidCrafter("uraniumextractor"){
{
input = Item.iron;
inputAmount = 6;
inputLiquid = Liquid.water;
liquidAmount = 40f;
liquidCapacity = 41f;
purifyTime = 60;
output = Item.uranium;
health = 70;
}
},
oilrefinery = new LiquidCrafter("oilrefinery"){ oilrefinery = new LiquidCrafter("oilrefinery"){
{ {
@@ -120,17 +123,6 @@ public class ProductionBlocks{
} }
}, },
pulverizer = new PowerSmelter("pulverizer"){
{
inputs = new ItemStack[]{new ItemStack(Item.stone, 5)};
result = Item.quartz;
health = 50;
craftTime = 60f;
powerDrain = 0.02f;
craftEffect = Fx.pulverize;
}
},
siliconextractor = new LiquidCrafter("siliconextractor"){ siliconextractor = new LiquidCrafter("siliconextractor"){
{ {
input = Item.quartz; input = Item.quartz;
@@ -221,6 +213,15 @@ public class ProductionBlocks{
} }
}, },
//TODO test it
waterextractor = new SolidPump("waterextractor"){
{
result = Liquid.water;
powerUse = 0.1f;
size = 2;
}
},
cultivator = new GenericDrill("cultivator"){ cultivator = new GenericDrill("cultivator"){
{ {
resource = Blocks.grass; resource = Blocks.grass;
@@ -267,7 +268,15 @@ public class ProductionBlocks{
} }
}, },
solarpanel = new SolarGenerator("solarpanel"){ solarpanel = new SolarGenerator("solarpanel"){
{
generation = 0.003f;
}
},
largesolarpanel = new SolarGenerator("largesolarpanel"){
{
size = 3;
generation = 0.012f;
}
}, },
nuclearReactor = new NuclearReactor("nuclearreactor"){ nuclearReactor = new NuclearReactor("nuclearreactor"){
{ {
@@ -198,7 +198,7 @@ public class Generator extends PowerBlock{
t1.trns(rotation * 90, 1 * tilesize / 2 + 2f + t1.trns(rotation * 90, 1 * tilesize / 2 + 2f +
(interfering ? Vector2.dst(tile.worldx(), tile.worldy(), target.worldx(), (interfering ? Vector2.dst(tile.worldx(), tile.worldy(), target.worldx(),
target.worldy()) / 2f - tilesize / 2f * 1 + 1 : 0)); target.worldy()) / 2f - tilesize / 2f * 1 : 0));
t2.trns(rotation * 90, size * tilesize / 2 + 2f); t2.trns(rotation * 90, size * tilesize / 2 + 2f);
@@ -12,7 +12,6 @@ import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings; import io.anuke.ucore.util.Strings;
public class LiquidPowerGenerator extends Generator{ public class LiquidPowerGenerator extends Generator{
public int generateTime = 15;
public Liquid generateLiquid; public Liquid generateLiquid;
public float powerPerLiquid = 0.13f; public float powerPerLiquid = 0.13f;
/**Maximum liquid used per frame.*/ /**Maximum liquid used per frame.*/
@@ -85,9 +85,12 @@ public class NuclearReactor extends LiquidPowerGenerator{
} }
if(entity.liquid.amount > 0){ if(entity.liquid.amount > 0){
float maxCool = Math.min(entity.liquid.amount * coolantPower, entity.heat); //TODO proper coolant usage
entity.heat -= maxCool; //TODO steam when cooling large amounts? float coolDirection = Mathf.clamp(10f * (0.6f - entity.liquid.liquid.temperature), -2f, 2f);
entity.liquid.amount -= maxCool / coolantPower; float maxCool = entity.liquid.amount * coolantPower * entity.liquid.liquid.heatCapacity;
entity.heat -= maxCool * coolDirection; //TODO steam when cooling large amounts?
entity.heat = Mathf.clamp(entity.heat);
entity.liquid.amount -= Math.min(entity.liquid.amount, entity.heat / coolantPower);
} }
if(entity.heat > smokeThreshold){ if(entity.heat > smokeThreshold){
@@ -162,7 +165,13 @@ public class NuclearReactor extends LiquidPowerGenerator{
public boolean acceptItem(Item item, Tile tile, Tile source){ public boolean acceptItem(Item item, Tile tile, Tile source){
return item == generateItem && tile.entity.inventory.getItem(generateItem) < itemCapacity; return item == generateItem && tile.entity.inventory.getItem(generateItem) < itemCapacity;
} }
@Override
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
return tile.entity.liquid.amount + amount < liquidCapacity
&& (tile.entity.liquid.liquid == liquid || tile.entity.liquid.amount <= 0.001f);
}
@Override @Override
public void draw(Tile tile){ public void draw(Tile tile){
super.draw(tile); super.draw(tile);
@@ -9,6 +9,7 @@ public class SolarGenerator extends Generator {
public SolarGenerator(String name){ public SolarGenerator(String name){
super(name); super(name);
hasInventory = false;
} }
@Override @Override
@@ -35,7 +35,7 @@ public class LiquidCrafter extends LiquidBlock{
health = 60; health = 60;
hasInventory = true; hasInventory = true;
itemCapacity = 90; itemCapacity = 90;
liquidCapacity = 21f; liquidCapacity = 20f;
} }
@Override @Override
@@ -1,28 +1,28 @@
package io.anuke.mindustry.world.blocks.types.production; package io.anuke.mindustry.world.blocks.types.production;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectSet;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Fx; import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.BarType;
import io.anuke.mindustry.world.BlockBar; import io.anuke.mindustry.world.BlockBar;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.PowerBlock; import io.anuke.mindustry.world.blocks.types.PowerBlock;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings; import io.anuke.ucore.util.Strings;
import java.util.Arrays;
public class PowerSmelter extends PowerBlock { public class PowerSmelter extends PowerBlock {
protected final int timerDump = timers++; protected final int timerDump = timers++;
protected final int timerCraft = timers++; protected final int timerCraft = timers++;
protected ItemStack[] inputs; /**Recipe format:
protected Item result; * First item in each array: result
* Everything else in each array: requirements. Can have duplicates.*/
protected Item[][] recipes;
protected float powerDrain = 0.01f; protected float powerDrain = 0.01f;
protected float heatUpTime = 80f; protected float heatUpTime = 80f;
@@ -46,17 +46,35 @@ public class PowerSmelter extends PowerBlock {
super.setBars(); super.setBars();
bars.remove(BarType.inventory); bars.remove(BarType.inventory);
for(ItemStack item : inputs){ if(true) return;
bars.add(new BlockBar(BarType.inventory, true, tile -> (float)tile.entity.inventory.getItem(item.item)/capacity));
//TODO
ObjectSet<Item> set = new ObjectSet<>();
for(Item[] items : recipes){
for(int i = 1; i < items.length; i ++) {
set.add(items[i]);
}
}
Array<Item> items = new Array<>();
set.forEach(items::add);
items.sort();
for(Item item : items){
bars.add(new BlockBar(BarType.inventory, true, tile -> (float) tile.entity.inventory.getItem(item) / capacity));
} }
} }
@Override @Override
public void setStats(){ public void setStats(){
super.setStats(); super.setStats();
stats.add("input", Arrays.toString(inputs)); //TODO input/outputs
// stats.add("input", Arrays.toString(inputs));
stats.add("powersecond", Strings.toFixed(powerDrain*60f, 2)); stats.add("powersecond", Strings.toFixed(powerDrain*60f, 2));
stats.add("output", result); //stats.add("output", result);
stats.add("fuelduration", Strings.toFixed(burnDuration/60f, 1)); stats.add("fuelduration", Strings.toFixed(burnDuration/60f, 1));
stats.add("maxoutputsecond", Strings.toFixed(60f/craftTime, 1)); stats.add("maxoutputsecond", Strings.toFixed(60f/craftTime, 1));
stats.add("inputcapacity", capacity); stats.add("inputcapacity", capacity);
@@ -65,6 +83,7 @@ public class PowerSmelter extends PowerBlock {
@Override @Override
public void update(Tile tile){ public void update(Tile tile){
/*
PowerSmelterEntity entity = tile.entity(); PowerSmelterEntity entity = tile.entity();
if(entity.timer.get(timerDump, 5) && entity.inventory.hasItem(result)){ if(entity.timer.get(timerDump, 5) && entity.inventory.hasItem(result)){
@@ -102,17 +121,20 @@ public class PowerSmelter extends PowerBlock {
} }
offloadNear(tile, result); offloadNear(tile, result);
Effects.effect(craftEffect, entity); Effects.effect(craftEffect, entity);*/
} }
@Override @Override
public boolean acceptItem(Item item, Tile tile, Tile source){ public boolean acceptItem(Item item, Tile tile, Tile source){
boolean isInput = false; boolean isInput = false;
for(ItemStack req : inputs){ out:
if(req.item == item){ for(Item[] items : recipes){
isInput = true; for(int i = 1; i < items.length; i ++){
break; if(items[i] == item){
isInput = true;
break out;
}
} }
} }
@@ -21,6 +21,7 @@ public class Pump extends LiquidBlock{
layer = Layer.overlay; layer = Layer.overlay;
liquidFlowFactor = 3f; liquidFlowFactor = 3f;
group = BlockGroup.liquids; group = BlockGroup.liquids;
liquidRegion = "pump-liquid";
} }
@Override @Override
@@ -36,11 +37,11 @@ public class Pump extends LiquidBlock{
@Override @Override
public void draw(Tile tile){ public void draw(Tile tile){
Draw.rect(name(), tile.worldx(), tile.worldy()); Draw.rect(name(), tile.drawx(), tile.drawy());
Draw.color(tile.entity.liquid.liquid.color); Draw.color(tile.entity.liquid.liquid.color);
Draw.alpha(tile.entity.liquid.amount / liquidCapacity); Draw.alpha(tile.entity.liquid.amount / liquidCapacity);
Draw.rect("blank", tile.worldx(), tile.worldy(), 2, 2); Draw.rect(liquidRegion, tile.drawx(), tile.drawy());
Draw.color(); Draw.color();
} }
@@ -57,7 +58,7 @@ public class Pump extends LiquidBlock{
@Override @Override
public void drawLayer(Tile tile){ public void drawLayer(Tile tile){
Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f)); Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f));
Draw.rect("cross-"+size, tile.worldx(), tile.worldy()); Draw.rect("cross-"+size, tile.drawx(), tile.drawy());
Draw.color(); Draw.color();
} }
@@ -0,0 +1,64 @@
package io.anuke.mindustry.world.blocks.types.production;
import com.badlogic.gdx.utils.Array;
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 float powerUse = 0.1f;
protected final Array<Tile> drawTiles = new Array<>();
public SolidPump(String name){
super(name);
hasPower = true;
liquidRegion = name + "-liquid";
}
@Override
public void update(Tile tile){
float used = Math.min(powerUse * Timers.delta(), powerCapacity);
float fraction = 0f;
if(isMultiblock()){
for(Tile other : tile.getLinkedTiles(tempTiles)){
if(isValid(other)){
fraction += 1f/ size;
}
}
}else{
if(isValid(tile)) fraction = 1f;
}
if(tile.entity.power.amount >= used){
float maxPump = Math.min(liquidCapacity - tile.entity.liquid.amount, pumpAmount * Timers.delta() * fraction);
tile.entity.liquid.liquid = result;
tile.entity.liquid.amount += maxPump;
tile.entity.power.amount -= used;
}
tryDumpLiquid(tile);
}
@Override
public boolean isLayer(Tile tile) {
if(isMultiblock()){
for(Tile other : tile.getLinkedTiles(drawTiles)){
if(isValid(other)){
return false;
}
}
return true;
}else{
return !isValid(tile);
}
}
protected boolean isValid(Tile tile){
return !tile.floor().liquid;
}
}