Vent condenser block

This commit is contained in:
Anuken
2021-12-09 17:16:32 -05:00
parent 8a2908374a
commit 57e5acdbd7
26 changed files with 222 additions and 75 deletions

View File

@@ -64,8 +64,8 @@ public class Blocks{
melter, separator, disassembler, sporePress, pulverizer, incinerator, coalCentrifuge,
//erekir
siliconArcFurnace, electrolyzer, oxidationChamber, atmosphericConcentrator, slagHeater, slagIncinerator, heatReactor,
carbideCrucible, slagCentrifuge, surgeCrucible, cyanogenSynthesizer, phaseSynthesizer,
siliconArcFurnace, electrolyzer, oxidationChamber, atmosphericConcentrator, electricHeater, slagIncinerator,
carbideCrucible, slagCentrifuge, surgeCrucible, cyanogenSynthesizer, phaseSynthesizer, heatReactor,
cellSynthesisChamber,
//sandbox
@@ -104,7 +104,7 @@ public class Blocks{
//power - erekir
//TODO rename chemicalCombustionChamber
turbineCondenser, chemicalCombustionChamber, pyrolysisGenerator,
turbineCondenser, ventCondenser, chemicalCombustionChamber, pyrolysisGenerator,
beamNode, beamTower,
//production
@@ -1055,7 +1055,7 @@ public class Blocks{
outputItem = new ItemStack(Items.oxide, 1);
consumes.liquid(Liquids.ozone, 2f / 60f);
consumes.liquid(Liquids.ozone, 1f / 60f);
consumes.item(Items.beryllium);
consumes.power(1f);
@@ -1069,15 +1069,13 @@ public class Blocks{
heatOutput = 5f;
}};
slagHeater = new HeatProducer("slag-heater"){{
electricHeater = new HeatProducer("electric-heater"){{
requirements(Category.crafting, with(Items.tungsten, 30, Items.graphite, 30));
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.slag, 9f), new DrawHeatOutput(true));
drawer.iconOverride = new String[]{"-bottom", ""};
drawer = new DrawMulti(new DrawHeatOutput(true));
drawer.iconOverride = new String[]{""};
size = 2;
craftTime = 60f * 1f;
heatOutput = 2f;
consumes.liquid(Liquids.slag, 20f / 60f);
consumes.power(0.5f / 60f);
}};
@@ -1087,20 +1085,6 @@ public class Blocks{
consumes.liquid(Liquids.slag, 2f / 60f);
}};
heatReactor = new HeatProducer("heat-reactor"){{
//TODO gas/liquid requirement?
requirements(Category.crafting, with(Items.oxide, 70, Items.graphite, 20, Items.carbide, 10, Items.thorium, 80));
size = 3;
craftTime = 60f * 10f;
craftEffect = new RadialEffect(Fx.heatReactorSmoke, 4, 90f, 7f);
itemCapacity = 20;
consumes.item(Items.thorium, 3);
consumes.liquid(Liquids.nitrogen, 1f / 60f);
outputItem = new ItemStack(Items.fissileMatter, 1);
}};
carbideCrucible = new HeatCrafter("carbide-crucible"){{
requirements(Category.crafting, with(Items.tungsten, 90, Items.thorium, 70, Items.oxide, 50));
craftEffect = Fx.none;
@@ -1256,6 +1240,20 @@ public class Blocks{
consumes.power(8f);
}};
heatReactor = new HeatProducer("heat-reactor"){{
//TODO gas/liquid requirement?
requirements(Category.crafting, with(Items.oxide, 70, Items.graphite, 20, Items.carbide, 10, Items.thorium, 80));
size = 3;
craftTime = 60f * 10f;
craftEffect = new RadialEffect(Fx.heatReactorSmoke, 4, 90f, 7f);
itemCapacity = 20;
consumes.item(Items.thorium, 3);
consumes.liquid(Liquids.nitrogen, 1f / 60f);
outputItem = new ItemStack(Items.fissileMatter, 1);
}};
//TODO needs to be completely redone from the ground up
if(false)
cellSynthesisChamber = new LiquidConverter("cell-synthesis-chamber"){{
@@ -2017,7 +2015,7 @@ public class Blocks{
spinSpeed = 0.6f;
spinners = true;
hasLiquids = true;
liquidOutput = new LiquidStack(Liquids.water, 10f / 60f / 9f);
outputLiquid = new LiquidStack(Liquids.water, 10f / 60f / 9f);
liquidCapacity = 20f;
}};
@@ -2132,23 +2130,6 @@ public class Blocks{
consumes.liquid(Liquids.water, 0.1f).boost();
}};
//TODO should be crusher or something
impactDrill = new BurstDrill("impact-drill"){{
requirements(Category.production, with(Items.silicon, 60, Items.beryllium, 90, Items.graphite, 50));
drillTime = 60f * 12f;
size = 4;
hasPower = true;
tier = 6;
drillEffect = new MultiEffect(Fx.mineImpact, Fx.drillSteam);
shake = 4f;
itemCapacity = 40;
consumes.power(3f);
consumes.liquid(Liquids.water, 0.2f);
}};
//TODO higher tier impact drill, 5x5
waterExtractor = new SolidPump("water-extractor"){{
requirements(Category.production, with(Items.metaglass, 30, Items.graphite, 30, Items.lead, 30, Items.copper, 30));
result = Liquids.water;
@@ -2200,6 +2181,31 @@ public class Blocks{
consumes.liquid(Liquids.water, 0.15f);
}};
//TODO output heat
ventCondenser = new AttributeCrafter("vent-condenser"){{
requirements(Category.production, with(Items.graphite, 20, Items.beryllium, 60));
attribute = Attribute.vent;
displayEfficiencyScale = 1f / 9f;
minEfficiency = 9f - 0.0001f;
displayEfficiency = false;
craftEffect = Fx.turbinegenerate;
drawer = new DrawMulti(new DrawBlock(), new DrawRegion("-rotator-blur"){{
spinSprite = true;
drawPlan = false;
rotateSpeed = 6f;
}});
drawer.iconOverride = new String[]{"", "-rotator"};
ignoreLiquidFullness = true;
craftTime = 30f;
size = 3;
ambientSound = Sounds.hum;
ambientSoundVolume = 0.06f;
hasLiquids = true;
outputLiquid = new LiquidStack(Liquids.water, 30f / 60f / 9f);
consumes.power(0.5f);
liquidCapacity = 20f;
}};
cliffCrusher = new WallCrafter("cliff-crusher"){{
requirements(Category.production, with(Items.graphite, 20, Items.beryllium, 20));
@@ -2236,6 +2242,23 @@ public class Blocks{
consumes.liquid(Liquids.hydrogen, 2f / 60f).boost();
}};
//TODO should be crusher or something
impactDrill = new BurstDrill("impact-drill"){{
requirements(Category.production, with(Items.silicon, 60, Items.beryllium, 90, Items.graphite, 50));
drillTime = 60f * 12f;
size = 4;
hasPower = true;
tier = 6;
drillEffect = new MultiEffect(Fx.mineImpact, Fx.drillSteam);
shake = 4f;
itemCapacity = 40;
consumes.power(3f);
consumes.liquid(Liquids.water, 0.2f);
}};
//TODO higher tier impact drill, 5x5
//endregion
//region storage
@@ -2891,15 +2914,22 @@ public class Blocks{
consumes.liquid(Liquids.hydrogen, 1.5f / 60f);
shots = 1;
//TODO cool reload animation
draw = new DrawTurret("reinforced-");
draw = new DrawTurret("reinforced-"){{
parts.addAll(new RegionPart("-glow"){{
drawRegion = false;
heatColor = Color.valueOf("768a9a");
useReload = false;
useProgressHeat = true;
}});
}};
shootShake = 1f;
shootLength = 5f;
shootLength = 4f;
outlineColor = Pal.darkOutline;
size = 2;
envEnabled |= Env.space;
reloadTime = 25f;
restitution = 0.1f;
cooldown = 0.04f;
recoilAmount = 2.5f;
range = 90;
shootCone = 15f;

View File

@@ -75,27 +75,29 @@ public class ErekirTechTree{
});
});
node(siliconArcFurnace, () -> {
node(electrolyzer, () -> {
node(oxidationChamber, () -> {
node(atmosphericConcentrator, () -> {
node(cyanogenSynthesizer, () -> {
node(ventCondenser, () -> {
node(siliconArcFurnace, () -> {
node(electrolyzer, () -> {
node(oxidationChamber, () -> {
node(electricHeater, () -> {
node(atmosphericConcentrator, () -> {
node(cyanogenSynthesizer, () -> {
});
});
});
});
node(carbideCrucible, () -> {
node(surgeCrucible, () -> {
node(phaseSynthesizer, () -> {
node(carbideCrucible, () -> {
node(surgeCrucible, () -> {
node(phaseSynthesizer, () -> {
});
});
});
});
});
});
node(slagIncinerator, () -> {
//when is this actually needed?
node(slagHeater, () -> {
node(slagIncinerator, () -> {
node(slagCentrifuge, () -> {
});

View File

@@ -1,10 +1,12 @@
package mindustry.content;
import arc.*;
import arc.scene.style.*;
import arc.struct.*;
import arc.util.*;
import mindustry.ctype.*;
import mindustry.game.Objectives.*;
import mindustry.gen.*;
import mindustry.type.*;
/** Class for storing a list of TechNodes with some utility tree builder methods; context dependent. See {@link SerpuloTechTree#load} source for example usage. */
@@ -75,6 +77,8 @@ public class TechTree{
public static class TechNode{
/** Depth in tech tree. */
public int depth;
/** Icon displayed in tech tree selector. */
public @Nullable Drawable icon;
/** Name for root node - used in tech tree selector. */
public @Nullable String name;
/** Requirement node. */
@@ -111,6 +115,10 @@ public class TechTree{
all.add(this);
}
public Drawable icon(){
return icon == null ? Icon.tree : icon;
}
public String localizedName(){
return Core.bundle.get("techtree." + name);
}

View File

@@ -995,7 +995,7 @@ public class UnitTypes{
accel = 0.08f;
drag = 0.016f;
flying = true;
hitSize = 9f;
hitSize = 10f;
targetAir = false;
engineOffset = 7.8f;
range = 140f;

View File

@@ -71,6 +71,7 @@ public class UnitType extends UnlockableContent{
public boolean createWreck = true;
public boolean useUnitCap = true;
public boolean destructibleWreck = true;
public boolean squareShadow = false;
public float groundLayer = Layer.groundUnit;
public float payloadCapacity = 8;
public float aimDst = -1f;
@@ -496,7 +497,13 @@ public class UnitType extends UnlockableContent{
legBaseRegion = Core.atlas.find(name + "-leg-base", name + "-leg");
baseRegion = Core.atlas.find(name + "-base");
cellRegion = Core.atlas.find(name + "-cell", Core.atlas.find("power-cell"));
softShadowRegion = Core.atlas.find("circle-shadow");
//when linear filtering is on, it's acceptable to use the relatively low-res 'particle' region
softShadowRegion =
squareShadow ? Core.atlas.find("square-shadow") :
hitSize <= 10f || (Core.settings != null && Core.settings.getBool("linear", true)) ?
Core.atlas.find("particle") :
Core.atlas.find("circle-shadow");
outlineRegion = Core.atlas.find(name + "-outline");
shadowRegion = fullIcon;

View File

@@ -48,7 +48,7 @@ public class ResearchDialog extends BaseDialog{
titleTable.clear();
titleTable.button(b -> {
//TODO custom icon here.
b.image(Icon.tree).padRight(8).size(iconMed);
b.imageDraw(() -> root.node.icon()).padRight(8).size(iconMed);
b.add().growX();
b.label(() -> root.node.localizedName()).color(Pal.accent);
b.add().growX();

View File

@@ -0,0 +1,80 @@
package mindustry.world.blocks.heat;
import arc.graphics.g2d.*;
import arc.util.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.draw.*;
public class HeatConductor extends Block{
public float visualMaxHeat = 10f;
public DrawBlock drawer = new DrawBlock();
public HeatConductor(String name){
super(name);
update = solid = rotate = true;
size = 3;
}
@Override
public void setBars(){
super.setBars();
bars.add("heat", (HeatConductorBuild entity) -> new Bar("bar.heat", Pal.lightOrange, () -> entity.heat / visualMaxHeat));
}
@Override
public void load(){
super.load();
drawer.load(this);
}
@Override
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
drawer.drawPlan(this, plan, list);
}
@Override
public TextureRegion[] icons(){
return drawer.finalIcons(this);
}
public class HeatConductorBuild extends Building implements HeatBlock{
public float heat = 0f;
@Override
public void draw(){
drawer.drawBase(this);
}
@Override
public void drawLight(){
super.drawLight();
drawer.drawLights(this);
}
@Override
public void updateTile(){
heat = calculateHeat(null);
}
@Override
public float warmup(){
return heat;
}
@Override
public float heat(){
return heat;
}
@Override
public float heatFrac(){
return heat / visualMaxHeat;
}
}
}

View File

@@ -22,7 +22,7 @@ public class ThermalGenerator extends PowerGenerator{
public float displayEfficiencyScale = 1f;
public boolean spinners = false;
public boolean displayEfficiency = true;
public @Nullable LiquidStack liquidOutput;
public @Nullable LiquidStack outputLiquid;
public Attribute attribute = Attribute.heat;
public @Load("@-rotator") TextureRegion rotatorRegion;
@@ -34,7 +34,7 @@ public class ThermalGenerator extends PowerGenerator{
@Override
public void init(){
if(liquidOutput != null){
if(outputLiquid != null){
outputsLiquid = true;
hasLiquids = true;
}
@@ -49,8 +49,8 @@ public class ThermalGenerator extends PowerGenerator{
stats.add(Stat.tiles, attribute, floating, size * size * displayEfficiencyScale, !displayEfficiency);
if(liquidOutput != null){
stats.add(Stat.output, StatValues.liquid(liquidOutput.liquid, liquidOutput.amount * size * size * 60f, true));
if(outputLiquid != null){
stats.add(Stat.output, StatValues.liquid(outputLiquid.liquid, outputLiquid.amount * size * size * 60f, true));
}
}
@@ -88,10 +88,10 @@ public class ThermalGenerator extends PowerGenerator{
spinRotation += productionEfficiency * spinSpeed;
if(liquidOutput != null){
float added = Math.min(productionEfficiency * delta() * liquidOutput.amount, liquidCapacity - liquids.get(liquidOutput.liquid));
liquids.add(liquidOutput.liquid, added);
dumpLiquid(liquidOutput.liquid);
if(outputLiquid != null){
float added = Math.min(productionEfficiency * delta() * outputLiquid.amount, liquidCapacity - liquids.get(outputLiquid.liquid));
liquids.add(outputLiquid.liquid, added);
dumpLiquid(outputLiquid.liquid);
}
}

View File

@@ -1,8 +1,10 @@
package mindustry.world.blocks.production;
import arc.*;
import mindustry.game.*;
import mindustry.graphics.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.meta.*;
/** A crafter that gains efficiency from attribute tiles. */
@@ -11,6 +13,9 @@ public class AttributeCrafter extends GenericCrafter{
public float baseEfficiency = 1f;
public float boostScale = 1f;
public float maxBoost = 1f;
public float minEfficiency = -1f;
public float displayEfficiencyScale = 1f;
public boolean displayEfficiency = true;
public AttributeCrafter(String name){
super(name);
@@ -18,6 +23,10 @@ public class AttributeCrafter extends GenericCrafter{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
super.drawPlace(x, y, rotation, valid);
if(!displayEfficiency) return;
drawPlaceText(Core.bundle.format("bar.efficiency",
(int)((baseEfficiency + Math.min(maxBoost, boostScale * sumAttribute(attribute, x, y))) * 100f)), x, y, valid);
}
@@ -28,11 +37,17 @@ public class AttributeCrafter extends GenericCrafter{
bars.add("efficiency", (AttributeCrafterBuild entity) ->
new Bar(() ->
Core.bundle.format("bar.efficiency", (int)(entity.efficiencyScale() * 100)),
Core.bundle.format("bar.efficiency", (int)(entity.efficiencyScale() * 100 * displayEfficiencyScale)),
() -> Pal.lightOrange,
entity::efficiencyScale));
}
@Override
public boolean canPlaceOn(Tile tile, Team team, int rotation){
//make sure there's enough efficiency at this location
return tile.getLinkedTilesAs(this, tempTiles).sumf(other -> other.floor().attributes.get(attribute)) > minEfficiency;
}
@Override
public void setStats(){
super.setStats();

View File

@@ -30,6 +30,7 @@ public class GenericCrafter extends Block{
/** if true, crafters with multiple liquid outputs will dump excess when there's still space for at least one liquid type */
public boolean dumpExtraLiquid = true;
public boolean ignoreLiquidFullness = false;
public float craftTime = 80;
public Effect craftEffect = Fx.none;
public Effect updateEffect = Fx.none;
@@ -115,10 +116,6 @@ public class GenericCrafter extends Block{
super.init();
}
public void drawPlanBase(BuildPlan req, Eachable<BuildPlan> list){
super.drawRequestRegion(req, list);
}
@Override
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
drawer.drawPlan(this, plan, list);
@@ -164,7 +161,7 @@ public class GenericCrafter extends Block{
}
}
}
if(outputLiquids != null){
if(outputLiquids != null && !ignoreLiquidFullness){
boolean allFull = true;
for(var output : outputLiquids){
if(liquids.get(output.liquid) >= liquidCapacity - 0.001f){

View File

@@ -13,6 +13,7 @@ public class DrawRegion extends DrawBlock{
public TextureRegion region;
public String suffix = "";
public boolean spinSprite = false;
public boolean drawPlan = true;
public float rotateSpeed, x, y;
/** Any number <=0 disables layer changes. */
public float layer = -1;
@@ -38,6 +39,7 @@ public class DrawRegion extends DrawBlock{
@Override
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
if(!drawPlan) return;
Draw.rect(region, plan.drawx(), plan.drawy());
}

View File

@@ -168,6 +168,7 @@ public class DrawTurret extends DrawBlock{
progress = interp.apply(progress);
for(int i = 0; i < regions.length; i++){
//can be null if drawRegion == false
var region = regions[i];
float sign = i == 1 ? -1 : 1;
Tmp.v1.set((x + moveX * progress) * sign, y + moveY * progress).rotate((build.rotation - 90));
@@ -218,6 +219,8 @@ public class DrawTurret extends DrawBlock{
regions = new TextureRegion[]{Core.atlas.find(block.name + suffix)};
outlines = new TextureRegion[]{Core.atlas.find(block.name + suffix + "-outline")};
}
}else{
regions = new TextureRegion[1];
}
heat = Core.atlas.find(block.name + suffix + "-heat");