Fixed smelter not using items, unit factory recipe
This commit is contained in:
@@ -60,13 +60,13 @@ public class Recipes implements ContentList{
|
|||||||
//processing
|
//processing
|
||||||
new Recipe(crafting, CraftingBlocks.biomatterCompressor, new ItemStack(Items.lead, 70), new ItemStack(Items.silicon, 60));
|
new Recipe(crafting, CraftingBlocks.biomatterCompressor, new ItemStack(Items.lead, 70), new ItemStack(Items.silicon, 60));
|
||||||
new Recipe(crafting, CraftingBlocks.separator, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 50));
|
new Recipe(crafting, CraftingBlocks.separator, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 50));
|
||||||
new Recipe(crafting, CraftingBlocks.centrifuge, new ItemStack(Items.tungsten, 130), new ItemStack(Items.carbide, 130), new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 40));
|
new Recipe(crafting, CraftingBlocks.centrifuge, new ItemStack(Items.tungsten, 130), new ItemStack(Items.carbide, 130), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 50));
|
||||||
|
|
||||||
//POWER
|
//POWER
|
||||||
new Recipe(power, PowerBlocks.powernode, new ItemStack(Items.tungsten, 2), new ItemStack(Items.lead, 6));
|
new Recipe(power, PowerBlocks.powernode, new ItemStack(Items.tungsten, 2), new ItemStack(Items.lead, 6));
|
||||||
new Recipe(power, PowerBlocks.powernodelarge, new ItemStack(Items.carbide, 10), new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 6));
|
new Recipe(power, PowerBlocks.powernodelarge, new ItemStack(Items.carbide, 10), new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 6));
|
||||||
new Recipe(power, PowerBlocks.battery, new ItemStack(Items.tungsten, 8), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 4));
|
new Recipe(power, PowerBlocks.battery, new ItemStack(Items.tungsten, 8), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 4));
|
||||||
new Recipe(power, PowerBlocks.batteryLarge, new ItemStack(Items.carbide, 16), new ItemStack(Items.tungsten, 16), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 20));
|
new Recipe(power, PowerBlocks.batteryLarge, new ItemStack(Items.carbide, 40), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 30));
|
||||||
|
|
||||||
//generators
|
//generators
|
||||||
new Recipe(power, PowerBlocks.combustiongenerator, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 30));
|
new Recipe(power, PowerBlocks.combustiongenerator, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 30));
|
||||||
@@ -80,8 +80,8 @@ public class Recipes implements ContentList{
|
|||||||
|
|
||||||
//DRILLS, PRODUCERS
|
//DRILLS, PRODUCERS
|
||||||
new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 30));
|
new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 30));
|
||||||
new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 40), new ItemStack(Items.carbide, 40));
|
new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 60));
|
||||||
new Recipe(production, ProductionBlocks.laserdrill, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 70), new ItemStack(Items.silicon, 60), new ItemStack(Items.carbide, 60));
|
new Recipe(production, ProductionBlocks.laserdrill, new ItemStack(Items.tungsten, 80), new ItemStack(Items.carbide, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 80));
|
||||||
|
|
||||||
new Recipe(production, ProductionBlocks.waterextractor, new ItemStack(Items.tungsten, 50), new ItemStack(Items.carbide, 50), new ItemStack(Items.lead, 40));
|
new Recipe(production, ProductionBlocks.waterextractor, new ItemStack(Items.tungsten, 50), new ItemStack(Items.carbide, 50), new ItemStack(Items.lead, 40));
|
||||||
new Recipe(production, ProductionBlocks.cultivator, new ItemStack(Items.tungsten, 20), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 20));
|
new Recipe(production, ProductionBlocks.cultivator, new ItemStack(Items.tungsten, 20), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 20));
|
||||||
@@ -93,8 +93,8 @@ public class Recipes implements ContentList{
|
|||||||
//new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30));
|
//new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30));
|
||||||
|
|
||||||
//actual unit related stuff
|
//actual unit related stuff
|
||||||
new Recipe(units, UnitBlocks.droneFactory, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30));
|
new Recipe(units, UnitBlocks.droneFactory, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 80));
|
||||||
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 20));
|
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 30));
|
||||||
|
|
||||||
//LIQUIDS
|
//LIQUIDS
|
||||||
new Recipe(liquid, LiquidBlocks.conduit, new ItemStack(Items.lead, 1));
|
new Recipe(liquid, LiquidBlocks.conduit, new ItemStack(Items.lead, 1));
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class UnitBlocks extends BlockList implements ContentList {
|
|||||||
produceTime = 300;
|
produceTime = 300;
|
||||||
size = 2;
|
size = 2;
|
||||||
requirements = new ItemStack[]{
|
requirements = new ItemStack[]{
|
||||||
new ItemStack(Items.tungsten, 20)
|
new ItemStack(Items.silicon, 20), new ItemStack(Items.lead, 20)
|
||||||
};
|
};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import io.anuke.mindustry.net.Net;
|
|||||||
import io.anuke.mindustry.type.AmmoType;
|
import io.anuke.mindustry.type.AmmoType;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.mindustry.world.blocks.units.UnitFactory.UnitFactoryEntity;
|
||||||
import io.anuke.mindustry.world.meta.BlockFlag;
|
import io.anuke.mindustry.world.meta.BlockFlag;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
@@ -52,12 +53,17 @@ public abstract class BaseUnit extends Unit{
|
|||||||
|
|
||||||
protected boolean isWave;
|
protected boolean isWave;
|
||||||
protected Squad squad;
|
protected Squad squad;
|
||||||
|
protected UnitFactoryEntity spawner;
|
||||||
|
|
||||||
public BaseUnit(UnitType type, Team team){
|
public BaseUnit(UnitType type, Team team){
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.team = team;
|
this.team = team;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSpawner(UnitFactoryEntity spawner) {
|
||||||
|
this.spawner = spawner;
|
||||||
|
}
|
||||||
|
|
||||||
public UnitType getType() {
|
public UnitType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@@ -259,6 +265,14 @@ public abstract class BaseUnit extends Unit{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removed() {
|
||||||
|
if(spawner != null){
|
||||||
|
spawner.hasSpawned = false;
|
||||||
|
spawner = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float drawSize(){
|
public float drawSize(){
|
||||||
return 14;
|
return 14;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class Smelter extends Block{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean consumeInputs = false;
|
boolean consumeInputs = true;
|
||||||
|
|
||||||
if(useFlux){
|
if(useFlux){
|
||||||
//remove flux materials if present
|
//remove flux materials if present
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
package io.anuke.mindustry.world.blocks.units;
|
package io.anuke.mindustry.world.blocks.units;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
import io.anuke.annotations.Annotations.Loc;
|
||||||
|
import io.anuke.annotations.Annotations.Remote;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.content.fx.BlockFx;
|
import io.anuke.mindustry.content.fx.BlockFx;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||||
import io.anuke.mindustry.entities.units.UnitType;
|
import io.anuke.mindustry.entities.units.UnitType;
|
||||||
|
import io.anuke.mindustry.gen.CallBlocks;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
import io.anuke.mindustry.graphics.Shaders;
|
||||||
|
import io.anuke.mindustry.net.In;
|
||||||
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.world.BarType;
|
import io.anuke.mindustry.world.BarType;
|
||||||
@@ -119,7 +124,7 @@ public class UnitFactory extends Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasRequirements(entity.items, entity.buildTime/produceTime) &&
|
if(!entity.hasSpawned && hasRequirements(entity.items, entity.buildTime/produceTime) &&
|
||||||
entity.power.amount >= used && !entity.open){
|
entity.power.amount >= used && !entity.open){
|
||||||
|
|
||||||
entity.buildTime += Timers.delta();
|
entity.buildTime += Timers.delta();
|
||||||
@@ -132,16 +137,7 @@ public class UnitFactory extends Block {
|
|||||||
if(entity.buildTime >= produceTime && !entity.open){
|
if(entity.buildTime >= produceTime && !entity.open){
|
||||||
entity.open = true;
|
entity.open = true;
|
||||||
|
|
||||||
Timers.run(openDuration/1.5f, () -> {
|
Timers.run(openDuration / 1.5f, () -> CallBlocks.onUnitFactorySpawn(tile));
|
||||||
entity.buildTime = 0f;
|
|
||||||
Effects.shake(2f, 3f, entity);
|
|
||||||
Effects.effect(BlockFx.producesmoke, tile.drawx(), tile.drawy());
|
|
||||||
|
|
||||||
BaseUnit unit = type.create(tile.getTeam());
|
|
||||||
unit.set(tile.drawx(), tile.drawy());
|
|
||||||
unit.add();
|
|
||||||
unit.getVelocity().y = launchVelocity;
|
|
||||||
});
|
|
||||||
|
|
||||||
entity.openCountdown = openDuration;
|
entity.openCountdown = openDuration;
|
||||||
|
|
||||||
@@ -175,12 +171,33 @@ public class UnitFactory extends Block {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Remote(called = Loc.server, in = In.blocks)
|
||||||
|
public static void onUnitFactorySpawn(Tile tile){
|
||||||
|
UnitFactoryEntity entity = tile.entity();
|
||||||
|
UnitFactory factory = (UnitFactory)tile.block();
|
||||||
|
|
||||||
|
entity.buildTime = 0f;
|
||||||
|
entity.hasSpawned = true;
|
||||||
|
|
||||||
|
Effects.shake(2f, 3f, entity);
|
||||||
|
Effects.effect(BlockFx.producesmoke, tile.drawx(), tile.drawy());
|
||||||
|
|
||||||
|
if(!Net.client()) {
|
||||||
|
BaseUnit unit = factory.type.create(tile.getTeam());
|
||||||
|
unit.setSpawner(entity);
|
||||||
|
unit.set(tile.drawx(), tile.drawy());
|
||||||
|
unit.add();
|
||||||
|
unit.getVelocity().y = factory.launchVelocity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class UnitFactoryEntity extends TileEntity{
|
public static class UnitFactoryEntity extends TileEntity{
|
||||||
public float buildTime;
|
public float buildTime;
|
||||||
public boolean open;
|
public boolean open;
|
||||||
public float openCountdown;
|
public float openCountdown;
|
||||||
public float time;
|
public float time;
|
||||||
public float speedScl;
|
public float speedScl;
|
||||||
|
public boolean hasSpawned;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutputStream stream) throws IOException {
|
public void write(DataOutputStream stream) throws IOException {
|
||||||
|
|||||||
Reference in New Issue
Block a user