oxidation chamber implementation

This commit is contained in:
Anuken
2021-11-16 14:54:23 -05:00
parent 67f8cffca0
commit 8d05b878d7
21 changed files with 50 additions and 29 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -444,3 +444,4 @@
63262=electrolyzer|block-electrolyzer-ui 63262=electrolyzer|block-electrolyzer-ui
63261=ozone|liquid-ozone-ui 63261=ozone|liquid-ozone-ui
63260=reinforced-liquid-junction|block-reinforced-liquid-junction-ui 63260=reinforced-liquid-junction|block-reinforced-liquid-junction-ui
63259=oxidation-chamber|block-oxidation-chamber-ui

Binary file not shown.

View File

@@ -935,7 +935,7 @@ public class Blocks implements ContentList{
craftTime = 30f; craftTime = 30f;
size = 2; size = 2;
hasPower = hasItems = hasLiquids = true; hasPower = hasItems = hasLiquids = true;
rotatePlan = false; rotateDraw = false;
consumes.liquid(Liquids.oil, 0.1f); consumes.liquid(Liquids.oil, 0.1f);
consumes.power(0.7f); consumes.power(0.7f);
@@ -987,8 +987,6 @@ public class Blocks implements ContentList{
}}; }};
//TODO sprite //TODO sprite
//TODO 'oxidation chamber'
if(false)
oxidationChamber = new HeatProducer("oxidation-chamber"){{ oxidationChamber = new HeatProducer("oxidation-chamber"){{
requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 30)); requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 30));
size = 3; size = 3;
@@ -999,11 +997,19 @@ public class Blocks implements ContentList{
consumes.item(Items.beryllium); consumes.item(Items.beryllium);
consumes.power(1f); consumes.power(1f);
rotateDraw = false;
//TODO rotor?
//TODO vent
iconOverride = new String[]{"-bottom", "", "-top1", "-glass"};
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(), new DrawBlock(), new DrawHeatOutput(), new DrawRegion("-glass"));
craftTime = 60f * 3f; craftTime = 60f * 3f;
liquidCapacity = 30f; liquidCapacity = 30f;
heatOutput = 8f; heatOutput = 8f;
}}; }};
//TODO check sprite correctness
heatReactor = new HeatProducer("heat-reactor"){{ heatReactor = new HeatProducer("heat-reactor"){{
//TODO quadvent //TODO quadvent
//TODO coolant? //TODO coolant?
@@ -1021,7 +1027,7 @@ public class Blocks implements ContentList{
size = 3; size = 3;
itemCapacity = 20; itemCapacity = 20;
hasPower = hasItems = true; hasPower = hasItems = true;
drawer = new DrawMulti(new DrawCrucible(), new DrawHeat()); drawer = new DrawMulti(new DrawCrucible(), new DrawHeatInput());
ambientSound = Sounds.smelter; ambientSound = Sounds.smelter;
ambientSoundVolume = 0.07f; ambientSoundVolume = 0.07f;

View File

@@ -337,6 +337,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
return rotation * 90; return rotation * 90;
} }
/** @return preferred rotation of main texture region to be drawn */
public float drawrot(){
return block.rotate && block.rotateDraw ? rotation * 90 : 0f;
}
public Floor floor(){ public Floor floor(){
return tile.floor(); return tile.floor();
} }
@@ -930,9 +935,9 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public void draw(){ public void draw(){
if(block.variants == 0){ if(block.variants == 0){
Draw.rect(block.region, x, y, block.rotate ? rotdeg() : 0); Draw.rect(block.region, x, y, drawrot());
}else{ }else{
Draw.rect(block.variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, block.variantRegions.length - 1))], x, y, block.rotate ? rotdeg() : 0); Draw.rect(block.variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, block.variantRegions.length - 1))], x, y, drawrot());
} }
drawTeamTop(); drawTeamTop();

View File

@@ -64,6 +64,7 @@ public class ContentParser{
}); });
put(Sortf.class, (type, data) -> field(UnitSorts.class, data)); put(Sortf.class, (type, data) -> field(UnitSorts.class, data));
put(Interp.class, (type, data) -> field(Interp.class, data)); put(Interp.class, (type, data) -> field(Interp.class, data));
put(Blending.class, (type, data) -> field(Blending.class, data));
put(CacheLayer.class, (type, data) -> field(CacheLayer.class, data)); put(CacheLayer.class, (type, data) -> field(CacheLayer.class, data));
put(Attribute.class, (type, data) -> Attribute.get(data.asString())); put(Attribute.class, (type, data) -> Attribute.get(data.asString()));
put(Schematic.class, (type, data) -> { put(Schematic.class, (type, data) -> {

View File

@@ -90,8 +90,8 @@ public class Block extends UnlockableContent{
public boolean solidifes; public boolean solidifes;
/** whether this is rotatable */ /** whether this is rotatable */
public boolean rotate; public boolean rotate;
/** if set to plan, the plan region won't rotate when drawing */ /** if rotate is true and this is false, the region won't rotate when drawing */
public boolean rotatePlan = true; public boolean rotateDraw = true;
/** number of different variant regions to use */ /** number of different variant regions to use */
public int variants = 0; public int variants = 0;
/** whether to draw a rotation arrow - this does not apply to lines of blocks */ /** whether to draw a rotation arrow - this does not apply to lines of blocks */
@@ -579,7 +579,7 @@ public class Block extends UnlockableContent{
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){ public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
TextureRegion reg = getRequestRegion(plan, list); TextureRegion reg = getRequestRegion(plan, list);
Draw.rect(reg, plan.drawx(), plan.drawy(), !rotate || !rotatePlan ? 0 : plan.rotation * 90); Draw.rect(reg, plan.drawx(), plan.drawy(), !rotate || !rotateDraw ? 0 : plan.rotation * 90);
if(plan.worldContext && player != null && teamRegion != null && teamRegion.found()){ if(plan.worldContext && player != null && teamRegion != null && teamRegion.found()){
if(teamRegions[player.team().id] == teamRegion) Draw.color(player.team().color); if(teamRegions[player.team().id] == teamRegion) Draw.color(player.team().color);

View File

@@ -14,9 +14,13 @@ public class HeatProducer extends GenericCrafter{
public HeatProducer(String name){ public HeatProducer(String name){
super(name); super(name);
drawer = new DrawHeatOutput(); drawer = new DrawMulti(new DrawHeatOutput(){{
update = solid = rotate = true; drawRegion = true;
}});
rotateDraw = false;
rotate = true;
canOverdrive = false; canOverdrive = false;
drawArrow = true;
} }
@Override @Override

View File

@@ -16,23 +16,26 @@ public class DrawArcSmelter extends DrawBlock{
public float alpha = 0.68f; public float alpha = 0.68f;
public int particles = 25; public int particles = 25;
public float particleLife = 40f, particleRad = 7f, particleStroke = 1.1f, particleLen = 3f; public float particleLife = 40f, particleRad = 7f, particleStroke = 1.1f, particleLen = 3f;
public boolean drawCenter = true;
public boolean drawBottom = true, drawTop = true, drawRegion = true;
public Blending blending = Blending.additive;
@Override @Override
public void draw(GenericCrafterBuild build){ public void draw(GenericCrafterBuild build){
Draw.rect(bottom, build.x, build.y); if(drawBottom) Draw.rect(bottom, build.x, build.y);
if(build.warmup > 0f && flameColor.a > 0.001f){ if(build.warmup > 0f && flameColor.a > 0.001f){
Lines.stroke(circleStroke * build.warmup); Lines.stroke(circleStroke * build.warmup);
float si = Mathf.absin(flameRadiusScl, flameRadiusMag); float si = Mathf.absin(flameRadiusScl, flameRadiusMag);
float a = alpha * build.warmup; float a = alpha * build.warmup;
Draw.blend(Blending.additive); Draw.blend(blending);
Draw.color(midColor, a); Draw.color(midColor, a);
Fill.circle(build.x, build.y, flameRad + si); if(drawCenter) Fill.circle(build.x, build.y, flameRad + si);
Draw.color(flameColor, a); Draw.color(flameColor, a);
Lines.circle(build.x, build.y, (flameRad + circleSpace + si) * build.warmup); if(drawCenter) Lines.circle(build.x, build.y, (flameRad + circleSpace + si) * build.warmup);
Lines.stroke(particleStroke * build.warmup); Lines.stroke(particleStroke * build.warmup);
@@ -49,8 +52,8 @@ public class DrawArcSmelter extends DrawBlock{
Draw.reset(); Draw.reset();
} }
Draw.rect(build.block.region, build.x, build.y); if(drawRegion) Draw.rect(build.block.region, build.x, build.y);
if(top.found()) Draw.rect(top, build.x, build.y); if(drawTop && top.found()) Draw.rect(top, build.x, build.y);
} }
@Override @Override

View File

@@ -15,7 +15,7 @@ public class DrawBlock{
/** Draws the block. */ /** Draws the block. */
public void draw(GenericCrafterBuild build){ public void draw(GenericCrafterBuild build){
Draw.rect(build.block.region, build.x, build.y, build.block.rotate ? build.rotdeg() : 0); Draw.rect(build.block.region, build.x, build.y, build.drawrot());
} }
/** Draws any extra light for the block. */ /** Draws any extra light for the block. */

View File

@@ -9,7 +9,8 @@ import mindustry.world.*;
import mindustry.world.blocks.production.GenericCrafter.*; import mindustry.world.blocks.production.GenericCrafter.*;
import mindustry.world.blocks.production.HeatCrafter.*; import mindustry.world.blocks.production.HeatCrafter.*;
public class DrawHeat extends DrawBlock{ /** Not standalone. */
public class DrawHeatInput extends DrawBlock{
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;

View File

@@ -17,10 +17,11 @@ public class DrawHeatOutput extends DrawBlock{
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, glowMult = 1.2f; public float heatPulse = 0.3f, heatPulseScl = 10f, glowMult = 1.2f;
public boolean drawRegion = false;
@Override @Override
public void draw(GenericCrafterBuild build){ public void draw(GenericCrafterBuild build){
Draw.rect(build.block.region, build.x, build.y); if(drawRegion) Draw.rect(build.block.region, build.x, build.y);
Draw.rect(build.rotation > 1 ? top2 : top1, build.x, build.y, build.rotdeg()); Draw.rect(build.rotation > 1 ? top2 : top1, build.x, build.y, build.rotdeg());
@@ -28,9 +29,9 @@ public class DrawHeatOutput extends DrawBlock{
Draw.z(Layer.blockAdditive); Draw.z(Layer.blockAdditive);
Draw.blend(Blending.additive); Draw.blend(Blending.additive);
Draw.color(heatColor, heater.heatFrac() * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse)))); Draw.color(heatColor, heater.heatFrac() * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse))));
Draw.rect(heat, build.x, build.y, build.rotdeg()); if(heat.found()) Draw.rect(heat, build.x, build.y, build.rotdeg());
Draw.color(Draw.getColor().mul(glowMult)); Draw.color(Draw.getColor().mul(glowMult));
Draw.rect(glow, build.x, build.y); if(glow.found()) Draw.rect(glow, build.x, build.y);
Draw.blend(); Draw.blend();
Draw.color(); Draw.color();
} }
@@ -38,7 +39,7 @@ public class DrawHeatOutput extends DrawBlock{
@Override @Override
public void drawPlan(GenericCrafter block, BuildPlan plan, Eachable<BuildPlan> list){ public void drawPlan(GenericCrafter block, BuildPlan plan, Eachable<BuildPlan> list){
Draw.rect(block.region, plan.drawx(), plan.drawy()); if(drawRegion) Draw.rect(block.region, plan.drawx(), plan.drawy());
Draw.rect(plan.rotation > 1 ? top2 : top1, plan.drawx(), plan.drawy(), plan.rotation * 90); Draw.rect(plan.rotation > 1 ? top2 : top1, plan.drawx(), plan.drawy(), plan.rotation * 90);
} }

View File

@@ -29,12 +29,11 @@ public class DrawLiquidRegion extends DrawBlock{
@Override @Override
public void draw(GenericCrafterBuild build){ public void draw(GenericCrafterBuild build){
if(drawLiquid != null){ Liquid drawn = drawLiquid != null ? drawLiquid : build.liquids.current();
Drawf.liquid(liquid, build.x, build.y, Drawf.liquid(liquid, build.x, build.y,
build.liquids.get(drawLiquid) / build.block.liquidCapacity, build.liquids.get(drawn) / build.block.liquidCapacity,
drawLiquid.color drawn.color
); );
}
} }
@Override @Override