Added splitter, power smelter, new sections
This commit is contained in:
@@ -30,22 +30,19 @@ public class Recipes {
|
||||
new Recipe(distribution, DistributionBlocks.router, stack(Item.stone, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.junction, stack(Item.iron, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.tunnel, stack(Item.iron, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.conduit, stack(Item.steel, 1)),
|
||||
new Recipe(distribution, DistributionBlocks.pulseconduit, stack(Item.titanium, 1), stack(Item.steel, 1)),
|
||||
new Recipe(distribution, DistributionBlocks.liquidrouter, stack(Item.steel, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.liquidjunction, stack(Item.steel, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.sorter, stack(Item.steel, 2)),
|
||||
new Recipe(distribution, DistributionBlocks.splitter, stack(Item.steel, 1)),
|
||||
|
||||
new Recipe(weapon, WeaponBlocks.turret, stack(Item.stone, 4)),
|
||||
//new Recipe(weapon, WeaponBlocks.turret, stack(Item.stone, 4)),
|
||||
new Recipe(weapon, WeaponBlocks.doubleturret, stack(Item.stone, 7)),
|
||||
new Recipe(weapon, WeaponBlocks.machineturret, stack(Item.iron, 8), stack(Item.stone, 10)),
|
||||
new Recipe(weapon, WeaponBlocks.shotgunturret, stack(Item.iron, 10), stack(Item.stone, 10)),
|
||||
//new Recipe(weapon, WeaponBlocks.shotgunturret, stack(Item.iron, 10), stack(Item.stone, 10)),
|
||||
new Recipe(weapon, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)),
|
||||
new Recipe(weapon, WeaponBlocks.sniperturret, 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.mortarturret, 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.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 20), stack(Item.dirium, 15)),
|
||||
//new Recipe(weapon, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 20), stack(Item.dirium, 15)),
|
||||
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)),
|
||||
|
||||
@@ -82,6 +79,11 @@ public class Recipes {
|
||||
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.liquidjunction, stack(Item.steel, 2)),
|
||||
|
||||
new Recipe(production, ProductionBlocks.pump, stack(Item.steel, 10)),
|
||||
new Recipe(production, ProductionBlocks.fluxpump, stack(Item.steel, 10), stack(Item.dirium, 5))
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
public enum Section{
|
||||
weapon, production, distribution, power, defense, crafting;
|
||||
weapon, production, distribution, liquid, power, defense, crafting, units
|
||||
}
|
||||
|
||||
@@ -86,6 +86,8 @@ public class BlocksFragment implements Fragment{
|
||||
}
|
||||
|
||||
for (Section sec : Section.values()) {
|
||||
int secrows = 4;
|
||||
|
||||
recipes.clear();
|
||||
Recipes.getBy(sec, recipes);
|
||||
|
||||
@@ -97,12 +99,13 @@ public class BlocksFragment implements Fragment{
|
||||
input.recipe = null;
|
||||
}
|
||||
});
|
||||
|
||||
button.setName("sectionbutton" + sec.name());
|
||||
add(button).growX().height(54).padLeft(-1).padTop(sec.ordinal() <= 2 ? -10 : -5);
|
||||
add(button).growX().height(54).padLeft(-1).padTop(sec.ordinal() <= secrows-1 ? -10 : -5);
|
||||
button.getImageCell().size(40).padBottom(4).padTop(2);
|
||||
group.add(button);
|
||||
|
||||
if (sec.ordinal() % 3 == 2 && sec.ordinal() > 0) {
|
||||
if (sec.ordinal() % secrows == secrows-1) {
|
||||
row();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,29 +55,13 @@ public class DebugFragment implements Fragment {
|
||||
row();
|
||||
new button("paths", "toggle", () -> showPaths = !showPaths);
|
||||
row();
|
||||
new button("infammo", "toggle", () -> infiniteAmmo = !infiniteAmmo);
|
||||
row();
|
||||
new button("wave", () -> state.wavetime = 0f);
|
||||
row();
|
||||
new button("clear", () -> {
|
||||
enemyGroup.clear();
|
||||
state.enemies = 0;
|
||||
netClient.clearRecieved();
|
||||
});
|
||||
row();
|
||||
new button("spawn", () -> {
|
||||
for(int i = 0; i < 30; i ++){
|
||||
new Enemy(EnemyTypes.healer).set(player.x + Mathf.range(50f), player.y + Mathf.range(50f)).add();
|
||||
}
|
||||
});
|
||||
row();
|
||||
new button("time", () -> {
|
||||
Timers.resetTime(1080000 - 60*10);
|
||||
});
|
||||
row();
|
||||
new button("time2", () -> {
|
||||
Timers.resetTime(0);
|
||||
});
|
||||
}}.end();
|
||||
|
||||
row();
|
||||
|
||||
@@ -59,5 +59,7 @@ public class DistributionBlocks{
|
||||
teleporter = new Teleporter("teleporter"){{
|
||||
}},
|
||||
sorter = new Sorter("sorter"){{
|
||||
}},
|
||||
splitter = new Splitter("splitter"){{
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -104,6 +104,18 @@ public class ProductionBlocks{
|
||||
}
|
||||
},
|
||||
|
||||
pulverizer = new LiquidCrafter("siliconextractor"){
|
||||
{
|
||||
input = Item.sand;
|
||||
inputAmount = 5;
|
||||
inputLiquid = Liquid.water;
|
||||
liquidAmount = 18.99f;
|
||||
output = Item.sand;
|
||||
health = 50;
|
||||
purifyTime = 50;
|
||||
}
|
||||
},
|
||||
|
||||
siliconextractor = new LiquidCrafter("siliconextractor"){
|
||||
{
|
||||
input = Item.sand;
|
||||
@@ -160,6 +172,13 @@ public class ProductionBlocks{
|
||||
time = 4;
|
||||
}
|
||||
},
|
||||
|
||||
sandextractor = new Omnidrill("omnidrill"){
|
||||
{
|
||||
time = 4;
|
||||
}
|
||||
},
|
||||
|
||||
coalgenerator = new ItemPowerGenerator("coalgenerator"){
|
||||
{
|
||||
generateItem = Item.coal;
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.BlockBar;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
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.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class PowerSmelter extends PowerBlock {
|
||||
protected final int timerDump = timers++;
|
||||
protected final int timerCraft = timers++;
|
||||
|
||||
protected Item[] inputs;
|
||||
protected Item result;
|
||||
protected float powerDrain = 0.01f;
|
||||
|
||||
protected float heatUpTime = 80f;
|
||||
protected float minHeat = 0.5f;
|
||||
|
||||
protected float craftTime = 20f; //time to craft one item, so max 3 items per second by default
|
||||
protected float burnDuration = 50f; //by default, the fuel will burn 45 frames, so that's 2.5 items/fuel at most
|
||||
protected float burnEffectChance = 0.01f;
|
||||
protected Effect craftEffect = Fx.smelt, burnEffect = Fx.fuelburn;
|
||||
|
||||
protected int capacity = 20;
|
||||
|
||||
public PowerSmelter(String name) {
|
||||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
for(Item item : inputs){
|
||||
bars.add(new BlockBar(Color.GREEN, true, tile -> (float)tile.entity.getItem(item)/capacity));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getStats(Array<String> list){
|
||||
super.getStats(list);
|
||||
list.add("[craftinfo]Input: " + Arrays.toString(inputs));
|
||||
list.add("[craftinfo]Power drain/second: " + Strings.toFixed(powerDrain*60f, 2));
|
||||
list.add("[craftinfo]Output: " + result);
|
||||
list.add("[craftinfo]Fuel Duration: " + Strings.toFixed(burnDuration/60f, 1));
|
||||
list.add("[craftinfo]Max output/second: " + Strings.toFixed(60f/craftTime, 1));
|
||||
list.add("[craftinfo]Input Capacity: " + capacity);
|
||||
list.add("[craftinfo]Output Capacity: " + capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
PowerSmelterEntity entity = tile.entity();
|
||||
|
||||
if(entity.timer.get(timerDump, 5) && entity.hasItem(result)){
|
||||
tryDump(tile, -1, result);
|
||||
}
|
||||
|
||||
float used = powerDrain * Timers.delta();
|
||||
|
||||
//heat it up if there's enough power
|
||||
if(entity.power > used){
|
||||
entity.power -= used;
|
||||
entity.heat += 1f /heatUpTime;
|
||||
if(Mathf.chance(Timers.delta() * burnEffectChance)) Effects.effect(burnEffect, entity.x + Mathf.range(2f), entity.y + Mathf.range(2f));
|
||||
}else{
|
||||
entity.heat -= 1f /heatUpTime;
|
||||
}
|
||||
|
||||
entity.heat = Mathf.clamp(entity.heat);
|
||||
|
||||
//make sure it has all the items
|
||||
for(Item item : inputs){
|
||||
if(!entity.hasItem(item)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(entity.getItem(result) >= capacity //output full
|
||||
|| entity.heat <= minHeat //not burning
|
||||
|| !entity.timer.get(timerCraft, craftTime)){ //not yet time
|
||||
return;
|
||||
}
|
||||
|
||||
for(Item item : inputs){
|
||||
entity.removeItem(item, 1);
|
||||
}
|
||||
|
||||
offloadNear(tile, result);
|
||||
Effects.effect(craftEffect, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
boolean isInput = false;
|
||||
|
||||
for(Item req : inputs){
|
||||
if(req == item){
|
||||
isInput = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (isInput && tile.entity.getItem(item) < capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
Smelter.CrafterEntity entity = tile.entity();
|
||||
|
||||
//draw glowing center
|
||||
if(entity.burnTime > 0){
|
||||
Draw.color(1f, 1f, 1f, Mathf.absin(Timers.time(), 9f, 0.4f) + Mathf.random(0.05f));
|
||||
Draw.rect("smelter-middle", tile.worldx(), tile.worldy());
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity() {
|
||||
return new PowerSmelterEntity();
|
||||
}
|
||||
|
||||
class PowerSmelterEntity extends PowerEntity{
|
||||
public float heat;
|
||||
}
|
||||
}
|
||||
@@ -42,9 +42,6 @@ public class Smelter extends Block{
|
||||
for(Item item : inputs){
|
||||
bars.add(new BlockBar(Color.GREEN, true, tile -> (float)tile.entity.getItem(item)/capacity));
|
||||
}
|
||||
//fuel and output bars, respectively: should these be added, or is it too cluttery?
|
||||
//bars.add(new BlockBar(Color.ORANGE, true, tile -> (float)tile.entity.getItem(fuel)/capacity));
|
||||
//bars.add(new BlockBar(Color.LIGHT_GRAY, true, tile -> (float)tile.entity.getItem(result)/capacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user