Heat conductor + phase heater

This commit is contained in:
Anuken
2021-12-10 11:31:32 -05:00
parent 761ee12e6f
commit 3e9747c59c
31 changed files with 143 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

View File

@@ -714,6 +714,7 @@ stat.showinmap = <load map to show>
stat.description = Purpose stat.description = Purpose
stat.input = Input stat.input = Input
stat.output = Output stat.output = Output
stat.maxefficiency = Max Efficiency
stat.booster = Booster stat.booster = Booster
stat.tiles = Required Tiles stat.tiles = Required Tiles
stat.affinities = Affinities stat.affinities = Affinities
@@ -815,6 +816,7 @@ bar.capacity = Capacity: {0}
bar.unitcap = {0} {1}/{2} bar.unitcap = {0} {1}/{2}
bar.liquid = Liquid bar.liquid = Liquid
bar.heat = Heat bar.heat = Heat
bar.heatamount = Heat: {0}
bar.heatpercent = Heat: {0} ({1}%) bar.heatpercent = Heat: {0} ({1}%)
bar.power = Power bar.power = Power
bar.progress = Build Progress bar.progress = Build Progress
@@ -1098,12 +1100,22 @@ item.metaglass.name = Metaglass
item.scrap.name = Scrap item.scrap.name = Scrap
item.fissile-matter.name = Fissile Matter item.fissile-matter.name = Fissile Matter
item.beryllium.name = Beryllium item.beryllium.name = Beryllium
item.tungsten.name = Tungsten
item.oxide.name = Oxide
item.carbide.name = Carbide
item.dormant-cyst.name = Dormant Cyst
liquid.water.name = Water liquid.water.name = Water
liquid.slag.name = Slag liquid.slag.name = Slag
liquid.oil.name = Oil liquid.oil.name = Oil
liquid.cryofluid.name = Cryofluid liquid.cryofluid.name = Cryofluid
liquid.neoplasm.name = Neoplasm liquid.neoplasm.name = Neoplasm
liquid.arkycite.name = Arkycite
liquid.gallium.name = Gallium
liquid.ozone.name = Ozone
liquid.hydrogen.name = Hydrogen
liquid.nitrogen.name = Nitrogen
liquid.cyanogen.name = Cyanogen
unit.dagger.name = Dagger unit.dagger.name = Dagger
unit.mace.name = Mace unit.mace.name = Mace

View File

@@ -480,3 +480,6 @@
63226=eletric-heater|block-eletric-heater-ui 63226=eletric-heater|block-eletric-heater-ui
63225=vent-condenser|block-vent-condenser-ui 63225=vent-condenser|block-vent-condenser-ui
63224=electric-heater|block-electric-heater-ui 63224=electric-heater|block-electric-heater-ui
63223=phase-heater|block-phase-heater-ui
63222=arkyic-wall|block-arkyic-wall-ui
63221=heat-redirector|block-heat-redirector-ui

Binary file not shown.

View File

@@ -44,7 +44,7 @@ public class Blocks{
redmat, bluemat, redmat, bluemat,
stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster, stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
redweed, purbush, coralChunk, yellowCoral, redweed, purbush, coralChunk, yellowCoral,
regolithWall, yellowStoneWall, rhyoliteWall, steamVent, carbonWall, redIceWall, ferricStoneWall, beryllicStoneWall, regolithWall, yellowStoneWall, rhyoliteWall, steamVent, carbonWall, redIceWall, ferricStoneWall, beryllicStoneWall, arkyicWall,
ferricStone, ferricCraters, carbonStone, beryllicStone, ferricStone, ferricCraters, carbonStone, beryllicStone,
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, grass, salt, iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, grass, salt,
shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, carbonBoulder, ferricBoulder, beryllicBoulder, yellowStoneBoulder, shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, carbonBoulder, ferricBoulder, beryllicBoulder, yellowStoneBoulder,
@@ -64,7 +64,7 @@ public class Blocks{
melter, separator, disassembler, sporePress, pulverizer, incinerator, coalCentrifuge, melter, separator, disassembler, sporePress, pulverizer, incinerator, coalCentrifuge,
//erekir //erekir
siliconArcFurnace, electrolyzer, oxidationChamber, atmosphericConcentrator, electricHeater, slagIncinerator, siliconArcFurnace, electrolyzer, oxidationChamber, atmosphericConcentrator, electricHeater, phaseHeater, heatRedirector, slagIncinerator,
carbideCrucible, slagCentrifuge, surgeCrucible, cyanogenSynthesizer, phaseSynthesizer, heatReactor, carbideCrucible, slagCentrifuge, surgeCrucible, cyanogenSynthesizer, phaseSynthesizer, heatReactor,
cellSynthesisChamber, cellSynthesisChamber,
@@ -519,6 +519,11 @@ public class Blocks{
attributes.set(Attribute.silicate, 1.2f); attributes.set(Attribute.silicate, 1.2f);
}}; }};
arkyicWall = new StaticWall("arkyic-wall"){{
variants = 3;
arkyciteFloor.asFloor().wall = arkyicStone.asFloor().wall = this;
}};
redIceWall = new StaticWall("red-ice-wall"){{ redIceWall = new StaticWall("red-ice-wall"){{
redIce.asFloor().wall = this; redIce.asFloor().wall = this;
}}; }};
@@ -1081,6 +1086,25 @@ public class Blocks{
consumes.power(0.5f / 60f); consumes.power(0.5f / 60f);
}}; }};
phaseHeater = new HeatProducer("phase-heater"){{
requirements(Category.crafting, with(Items.oxide, 30, Items.carbide, 30));
drawer = new DrawMulti(new DrawHeatOutput(true));
drawer.iconOverride = new String[]{""};
size = 2;
heatOutput = 10f;
craftTime = 60f * 8f;
consumes.item(Items.phaseFabric);
consumes.power(0.5f / 60f);
}};
heatRedirector = new HeatConductor("heat-redirector"){{
requirements(Category.crafting, with(Items.tungsten, 10, Items.graphite, 10));
size = 3;
drawer = new DrawMulti(new DrawHeatOutput(true), new DrawHeatInput("-heat"));
}};
slagIncinerator = new ItemIncinerator("slag-incinerator"){{ slagIncinerator = new ItemIncinerator("slag-incinerator"){{
requirements(Category.crafting, with(Items.tungsten, 15)); requirements(Category.crafting, with(Items.tungsten, 15));
size = 1; size = 1;

View File

@@ -89,7 +89,9 @@ public class ErekirTechTree{
node(carbideCrucible, () -> { node(carbideCrucible, () -> {
node(surgeCrucible, () -> { node(surgeCrucible, () -> {
node(phaseSynthesizer, () -> { node(phaseSynthesizer, () -> {
node(phaseHeater, () -> {
});
}); });
}); });
}); });

View File

@@ -34,6 +34,7 @@ import mindustry.world.blocks.ConstructBlock.*;
import mindustry.world.blocks.*; import mindustry.world.blocks.*;
import mindustry.world.blocks.environment.*; import mindustry.world.blocks.environment.*;
import mindustry.world.blocks.heat.*; import mindustry.world.blocks.heat.*;
import mindustry.world.blocks.heat.HeatConductor.*;
import mindustry.world.blocks.logic.LogicBlock.*; import mindustry.world.blocks.logic.LogicBlock.*;
import mindustry.world.blocks.payloads.*; import mindustry.world.blocks.payloads.*;
import mindustry.world.blocks.power.*; import mindustry.world.blocks.power.*;
@@ -285,17 +286,36 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
} }
public float calculateHeat(float[] sideHeat){ public float calculateHeat(float[] sideHeat){
return calculateHeat(sideHeat, null);
}
//TODO can cameFrom be an IntSet?
public float calculateHeat(float[] sideHeat, @Nullable IntSet cameFrom){
Arrays.fill(sideHeat, 0f); Arrays.fill(sideHeat, 0f);
if(cameFrom != null) cameFrom.clear();
float heat = 0f; float heat = 0f;
for(var edge : block.getEdges()){ for(var edge : block.getEdges()){
Building build = nearby(edge.x, edge.y); Building build = nearby(edge.x, edge.y);
if(build != null && build.team == team && build instanceof HeatBlock heater && (!build.block.rotate || (relativeTo(build) + 2) % 4 == build.rotation)){ if(build != null && build.team == team && build instanceof HeatBlock heater && (!build.block.rotate || (relativeTo(build) + 2) % 4 == build.rotation)){ //TODO hacky
//heat is distributed across building size
float add = heater.heat() / build.block.size;
sideHeat[Mathf.mod(relativeTo(build), 4)] += add; //if there's a cycle, ignore its heat
heat += add; if(!(build instanceof HeatConductorBuild hc && hc.cameFrom.contains(id()))){
//heat is distributed across building size
float add = heater.heat() / build.block.size;
sideHeat[Mathf.mod(relativeTo(build), 4)] += add;
heat += add;
}
//register traversed cycles
if(cameFrom != null){
cameFrom.add(build.id);
if(build instanceof HeatConductorBuild hc){
cameFrom.addAll(hc.cameFrom);
}
}
} }
} }
return heat; return heat;

View File

@@ -114,6 +114,8 @@ public class MinimapRenderer{
} }
Draw.reset(); Draw.reset();
//TODO might be useful in the standard minimap too
if(withLabels){ if(withLabels){
drawSpawns(x, y, w, h, scaling); drawSpawns(x, y, w, h, scaling);
} }

View File

@@ -225,10 +225,10 @@ public class JsonIO{
public UnlockableContent read(Json json, JsonValue jsonData, Class type){ public UnlockableContent read(Json json, JsonValue jsonData, Class type){
if(jsonData.isNull()) return null; if(jsonData.isNull()) return null;
String str = jsonData.asString(); String str = jsonData.asString();
Item item = Vars.content.getByName(ContentType.item, str); Item item = Vars.content.item(str);
Liquid liquid = Vars.content.getByName(ContentType.liquid, str); Liquid liquid = Vars.content.liquid(str);
Block block = Vars.content.getByName(ContentType.block, str); Block block = Vars.content.block(str);
UnitType unit = Vars.content.getByName(ContentType.unit, str); UnitType unit = Vars.content.unit(str);
return return
item != null ? item : item != null ? item :
liquid != null ? liquid : liquid != null ? liquid :

View File

@@ -45,7 +45,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
@Override @Override
public float getSizeScl(){ public float getSizeScl(){
return 2000; return 2000 * 1.06f;
} }
@Override @Override
@@ -92,7 +92,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
tile.block = tile.floor.asFloor().wall; tile.block = tile.floor.asFloor().wall;
if(Ridged.noise3d(1, position.x, position.y, position.z, 2, 25) > 0.19){ if(Ridged.noise3d(1, position.x, position.y, position.z, 2, 14) > 0.15){
tile.block = Blocks.air; tile.block = Blocks.air;
} }
@@ -160,6 +160,10 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
median(3, 0.6, Blocks.slag); median(3, 0.6, Blocks.slag);
pass((x, y) -> { pass((x, y) -> {
if((floor == Blocks.arkyciteFloor || floor == Blocks.arkyicStone) && block.isStatic()){
block = Blocks.arkyicWall;
}
float max = 0; float max = 0;
for(Point2 p : Geometry.d8){ for(Point2 p : Geometry.d8){
max = Math.max(max, world.getDarkness(x + p.x, y + p.y)); max = Math.max(max, world.getDarkness(x + p.x, y + p.y));

View File

@@ -9,6 +9,7 @@ import arc.math.geom.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.*; import mindustry.*;
import mindustry.content.*;
import mindustry.game.Saves.*; import mindustry.game.Saves.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
@@ -85,6 +86,12 @@ public class Sector{
public void loadInfo(){ public void loadInfo(){
info = Core.settings.getJson(planet.name + "-s-" + id + "-info", SectorInfo.class, SectorInfo::new); info = Core.settings.getJson(planet.name + "-s-" + id + "-info", SectorInfo.class, SectorInfo::new);
//fix an old naming bug; this doesn't happen with new saves, but old saves need manual fixes
if(info.resources.contains(Blocks.water)){
info.resources.remove(Blocks.water);
info.resources.add(Liquids.water);
}
} }
/** Removes any sector info. */ /** Removes any sector info. */

View File

@@ -1,6 +1,8 @@
package mindustry.world.blocks.heat; package mindustry.world.blocks.heat;
import arc.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.entities.units.*; import mindustry.entities.units.*;
import mindustry.gen.*; import mindustry.gen.*;
@@ -10,12 +12,13 @@ import mindustry.world.*;
import mindustry.world.draw.*; import mindustry.world.draw.*;
public class HeatConductor extends Block{ public class HeatConductor extends Block{
public float visualMaxHeat = 10f; public float visualMaxHeat = 15f;
public DrawBlock drawer = new DrawBlock(); public DrawBlock drawer = new DrawBlock();
public HeatConductor(String name){ public HeatConductor(String name){
super(name); super(name);
update = solid = rotate = true; update = solid = rotate = true;
rotateDraw = false;
size = 3; size = 3;
} }
@@ -23,7 +26,8 @@ public class HeatConductor extends Block{
public void setBars(){ public void setBars(){
super.setBars(); super.setBars();
bars.add("heat", (HeatConductorBuild entity) -> new Bar("bar.heat", Pal.lightOrange, () -> entity.heat / visualMaxHeat)); //TODO show number
bars.add("heat", (HeatConductorBuild entity) -> new Bar(() -> Core.bundle.format("bar.heatamount", (int)entity.heat), () -> Pal.lightOrange, () -> entity.heat / visualMaxHeat));
} }
@Override @Override
@@ -43,8 +47,10 @@ public class HeatConductor extends Block{
return drawer.finalIcons(this); return drawer.finalIcons(this);
} }
public class HeatConductorBuild extends Building implements HeatBlock{ public class HeatConductorBuild extends Building implements HeatBlock, HeatConsumer{
public float heat = 0f; public float heat = 0f;
public float[] sideHeat = new float[4];
public IntSet cameFrom = new IntSet();
@Override @Override
public void draw(){ public void draw(){
@@ -57,9 +63,19 @@ public class HeatConductor extends Block{
drawer.drawLights(this); drawer.drawLights(this);
} }
@Override
public float[] sideHeat(){
return sideHeat;
}
@Override
public float heatRequirement(){
return visualMaxHeat;
}
@Override @Override
public void updateTile(){ public void updateTile(){
heat = calculateHeat(null); heat = calculateHeat(sideHeat, cameFrom);
} }
@Override @Override

View File

@@ -0,0 +1,6 @@
package mindustry.world.blocks.heat;
public interface HeatConsumer{
float[] sideHeat();
float heatRequirement();
}

View File

@@ -4,6 +4,7 @@ import arc.*;
import arc.math.*; import arc.math.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.ui.*; import mindustry.ui.*;
import mindustry.world.blocks.heat.*;
import mindustry.world.meta.*; import mindustry.world.meta.*;
/** A crafter that requires contact from heater blocks to craft. */ /** A crafter that requires contact from heater blocks to craft. */
@@ -35,9 +36,10 @@ public class HeatCrafter extends GenericCrafter{
super.setStats(); super.setStats();
stats.add(Stat.input, heatRequirement, StatUnit.heatUnits); stats.add(Stat.input, heatRequirement, StatUnit.heatUnits);
stats.add(Stat.maxEfficiency, (int)(maxEfficiency * 100f), StatUnit.percent);
} }
public class HeatCrafterBuild extends GenericCrafterBuild{ public class HeatCrafterBuild extends GenericCrafterBuild implements HeatConsumer{
//TODO sideHeat could be smooth //TODO sideHeat could be smooth
public float[] sideHeat = new float[4]; public float[] sideHeat = new float[4];
public float heat = 0f; public float heat = 0f;
@@ -49,10 +51,16 @@ public class HeatCrafter extends GenericCrafter{
super.updateTile(); super.updateTile();
} }
@Override
public float heatRequirement(){ public float heatRequirement(){
return heatRequirement; return heatRequirement;
} }
@Override
public float[] sideHeat(){
return sideHeat;
}
@Override @Override
public float warmupTarget(){ public float warmupTarget(){
return Mathf.clamp(heat / heatRequirement); return Mathf.clamp(heat / heatRequirement);

View File

@@ -4,27 +4,42 @@ import arc.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.util.*;
import mindustry.entities.units.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.blocks.production.HeatCrafter.*; import mindustry.world.blocks.heat.*;
/** Not standalone. */ /** Not standalone. */
public class DrawHeatInput extends DrawBlock{ public class DrawHeatInput extends DrawBlock{
public String suffix = "-heat";
public Color heatColor = new Color(1f, 0.22f, 0.22f, 0.8f); public Color heatColor = new Color(1f, 0.22f, 0.22f, 0.8f);
public float heatPulse = 0.3f, heatPulseScl = 10f; public float heatPulse = 0.3f, heatPulseScl = 10f;
public TextureRegion heat; public TextureRegion heat;
public DrawHeatInput(String suffix){
this.suffix = suffix;
}
public DrawHeatInput(){
}
@Override
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
}
@Override @Override
public void drawBase(Building build){ public void drawBase(Building build){
Draw.z(Layer.blockAdditive); Draw.z(Layer.blockAdditive);
if(build instanceof HeatCrafterBuild hc){ if(build instanceof HeatConsumer hc){
float[] side = hc.sideHeat();
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
if(hc.sideHeat[i] > 0){ if(side[i] > 0){
Draw.blend(Blending.additive); Draw.blend(Blending.additive);
Draw.color(heatColor, hc.sideHeat[i] / hc.heatRequirement() * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse)))); Draw.color(heatColor, side[i] / hc.heatRequirement() * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse))));
Draw.rect(heat, build.x, build.y, i * 90f); Draw.rect(heat, build.x, build.y, i * 90f);
Draw.blend(); Draw.blend();
Draw.color(); Draw.color();
@@ -37,6 +52,6 @@ public class DrawHeatInput extends DrawBlock{
@Override @Override
public void load(Block block){ public void load(Block block){
heat = Core.atlas.find(block.name + "-heat"); heat = Core.atlas.find(block.name + suffix);
} }
} }

View File

@@ -61,6 +61,7 @@ public enum Stat{
input(StatCat.crafting), input(StatCat.crafting),
output(StatCat.crafting), output(StatCat.crafting),
productionTime(StatCat.crafting), productionTime(StatCat.crafting),
maxEfficiency(StatCat.crafting),
drillTier(StatCat.crafting), drillTier(StatCat.crafting),
drillSpeed(StatCat.crafting), drillSpeed(StatCat.crafting),
linkRange(StatCat.crafting), linkRange(StatCat.crafting),