diff --git a/core/assets-raw/sprites/blocks/production/oxidation-chamber-bottom.png b/core/assets-raw/sprites/blocks/production/oxidation-chamber-bottom.png new file mode 100644 index 0000000000..4f4b6a2b8f Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/oxidation-chamber-bottom.png differ diff --git a/core/assets-raw/sprites/blocks/production/oxidation-chamber-glass.png b/core/assets-raw/sprites/blocks/production/oxidation-chamber-glass.png new file mode 100644 index 0000000000..129d100c57 Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/oxidation-chamber-glass.png differ diff --git a/core/assets-raw/sprites/blocks/production/oxidation-chamber-glow.png b/core/assets-raw/sprites/blocks/production/oxidation-chamber-glow.png new file mode 100644 index 0000000000..f1a3713cb8 Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/oxidation-chamber-glow.png differ diff --git a/core/assets-raw/sprites/blocks/production/oxidation-chamber-heat.png b/core/assets-raw/sprites/blocks/production/oxidation-chamber-heat.png new file mode 100644 index 0000000000..1fbb3a69f3 Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/oxidation-chamber-heat.png differ diff --git a/core/assets-raw/sprites/blocks/production/oxidation-chamber-liquid.png b/core/assets-raw/sprites/blocks/production/oxidation-chamber-liquid.png new file mode 100644 index 0000000000..6cad59a0bd Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/oxidation-chamber-liquid.png differ diff --git a/core/assets-raw/sprites/blocks/production/oxidation-chamber-top1.png b/core/assets-raw/sprites/blocks/production/oxidation-chamber-top1.png new file mode 100644 index 0000000000..6d4fb92302 Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/oxidation-chamber-top1.png differ diff --git a/core/assets-raw/sprites/blocks/production/oxidation-chamber-top2.png b/core/assets-raw/sprites/blocks/production/oxidation-chamber-top2.png new file mode 100644 index 0000000000..c946c052c8 Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/oxidation-chamber-top2.png differ diff --git a/core/assets-raw/sprites/blocks/production/oxidation-chamber.png b/core/assets-raw/sprites/blocks/production/oxidation-chamber.png index 30703cf5ea..9c2f9518e9 100644 Binary files a/core/assets-raw/sprites/blocks/production/oxidation-chamber.png and b/core/assets-raw/sprites/blocks/production/oxidation-chamber.png differ diff --git a/core/assets-raw/sprites/blocks/production/silicon-arc-furnace.png b/core/assets-raw/sprites/blocks/production/silicon-arc-furnace.png index 4696b92ab1..d4481b2f65 100644 Binary files a/core/assets-raw/sprites/blocks/production/silicon-arc-furnace.png and b/core/assets-raw/sprites/blocks/production/silicon-arc-furnace.png differ diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index c4b96bcd6c..f306ac249f 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -444,3 +444,4 @@ 63262=electrolyzer|block-electrolyzer-ui 63261=ozone|liquid-ozone-ui 63260=reinforced-liquid-junction|block-reinforced-liquid-junction-ui +63259=oxidation-chamber|block-oxidation-chamber-ui diff --git a/core/assets/logicids.dat b/core/assets/logicids.dat index 337afe3179..80c73da037 100644 Binary files a/core/assets/logicids.dat and b/core/assets/logicids.dat differ diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index d0c9b976cc..ddd3696c5b 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -935,7 +935,7 @@ public class Blocks implements ContentList{ craftTime = 30f; size = 2; hasPower = hasItems = hasLiquids = true; - rotatePlan = false; + rotateDraw = false; consumes.liquid(Liquids.oil, 0.1f); consumes.power(0.7f); @@ -987,8 +987,6 @@ public class Blocks implements ContentList{ }}; //TODO sprite - //TODO 'oxidation chamber' - if(false) oxidationChamber = new HeatProducer("oxidation-chamber"){{ requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 30)); size = 3; @@ -999,11 +997,19 @@ public class Blocks implements ContentList{ consumes.item(Items.beryllium); 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; liquidCapacity = 30f; heatOutput = 8f; }}; + //TODO check sprite correctness heatReactor = new HeatProducer("heat-reactor"){{ //TODO quadvent //TODO coolant? @@ -1021,7 +1027,7 @@ public class Blocks implements ContentList{ size = 3; itemCapacity = 20; hasPower = hasItems = true; - drawer = new DrawMulti(new DrawCrucible(), new DrawHeat()); + drawer = new DrawMulti(new DrawCrucible(), new DrawHeatInput()); ambientSound = Sounds.smelter; ambientSoundVolume = 0.07f; diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 81e5064f18..3eb4c2573d 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -337,6 +337,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, 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(){ return tile.floor(); } @@ -930,9 +935,9 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, public void draw(){ if(block.variants == 0){ - Draw.rect(block.region, x, y, block.rotate ? rotdeg() : 0); + Draw.rect(block.region, x, y, drawrot()); }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(); diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index f5840f7df6..6e9f49d035 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -64,6 +64,7 @@ public class ContentParser{ }); put(Sortf.class, (type, data) -> field(UnitSorts.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(Attribute.class, (type, data) -> Attribute.get(data.asString())); put(Schematic.class, (type, data) -> { diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 2a2c137d29..e77f139333 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -90,8 +90,8 @@ public class Block extends UnlockableContent{ public boolean solidifes; /** whether this is rotatable */ public boolean rotate; - /** if set to plan, the plan region won't rotate when drawing */ - public boolean rotatePlan = true; + /** if rotate is true and this is false, the region won't rotate when drawing */ + public boolean rotateDraw = true; /** number of different variant regions to use */ public int variants = 0; /** 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 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(teamRegions[player.team().id] == teamRegion) Draw.color(player.team().color); diff --git a/core/src/mindustry/world/blocks/heat/HeatProducer.java b/core/src/mindustry/world/blocks/heat/HeatProducer.java index c547923be8..9ccb8497e3 100644 --- a/core/src/mindustry/world/blocks/heat/HeatProducer.java +++ b/core/src/mindustry/world/blocks/heat/HeatProducer.java @@ -14,9 +14,13 @@ public class HeatProducer extends GenericCrafter{ public HeatProducer(String name){ super(name); - drawer = new DrawHeatOutput(); - update = solid = rotate = true; + drawer = new DrawMulti(new DrawHeatOutput(){{ + drawRegion = true; + }}); + rotateDraw = false; + rotate = true; canOverdrive = false; + drawArrow = true; } @Override diff --git a/core/src/mindustry/world/draw/DrawArcSmelter.java b/core/src/mindustry/world/draw/DrawArcSmelter.java index 1291d35722..d093d6e3b4 100644 --- a/core/src/mindustry/world/draw/DrawArcSmelter.java +++ b/core/src/mindustry/world/draw/DrawArcSmelter.java @@ -16,23 +16,26 @@ public class DrawArcSmelter extends DrawBlock{ public float alpha = 0.68f; public int particles = 25; 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 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){ Lines.stroke(circleStroke * build.warmup); float si = Mathf.absin(flameRadiusScl, flameRadiusMag); float a = alpha * build.warmup; - Draw.blend(Blending.additive); + Draw.blend(blending); 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); - 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); @@ -49,8 +52,8 @@ public class DrawArcSmelter extends DrawBlock{ Draw.reset(); } - Draw.rect(build.block.region, build.x, build.y); - if(top.found()) Draw.rect(top, build.x, build.y); + if(drawRegion) Draw.rect(build.block.region, build.x, build.y); + if(drawTop && top.found()) Draw.rect(top, build.x, build.y); } @Override diff --git a/core/src/mindustry/world/draw/DrawBlock.java b/core/src/mindustry/world/draw/DrawBlock.java index e769c1585f..f1f32c5560 100644 --- a/core/src/mindustry/world/draw/DrawBlock.java +++ b/core/src/mindustry/world/draw/DrawBlock.java @@ -15,7 +15,7 @@ public class DrawBlock{ /** Draws the block. */ 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. */ diff --git a/core/src/mindustry/world/draw/DrawHeat.java b/core/src/mindustry/world/draw/DrawHeatInput.java similarity index 94% rename from core/src/mindustry/world/draw/DrawHeat.java rename to core/src/mindustry/world/draw/DrawHeatInput.java index a67c10f4d3..a0361bdd8f 100644 --- a/core/src/mindustry/world/draw/DrawHeat.java +++ b/core/src/mindustry/world/draw/DrawHeatInput.java @@ -9,7 +9,8 @@ import mindustry.world.*; import mindustry.world.blocks.production.GenericCrafter.*; 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 float heatPulse = 0.3f, heatPulseScl = 10f; diff --git a/core/src/mindustry/world/draw/DrawHeatOutput.java b/core/src/mindustry/world/draw/DrawHeatOutput.java index 1a8bf20e6d..36783e09ed 100644 --- a/core/src/mindustry/world/draw/DrawHeatOutput.java +++ b/core/src/mindustry/world/draw/DrawHeatOutput.java @@ -17,10 +17,11 @@ public class DrawHeatOutput extends DrawBlock{ public Color heatColor = new Color(1f, 0.22f, 0.22f, 0.8f); public float heatPulse = 0.3f, heatPulseScl = 10f, glowMult = 1.2f; + public boolean drawRegion = false; @Override 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()); @@ -28,9 +29,9 @@ public class DrawHeatOutput extends DrawBlock{ Draw.z(Layer.blockAdditive); Draw.blend(Blending.additive); 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.rect(glow, build.x, build.y); + if(glow.found()) Draw.rect(glow, build.x, build.y); Draw.blend(); Draw.color(); } @@ -38,7 +39,7 @@ public class DrawHeatOutput extends DrawBlock{ @Override public void drawPlan(GenericCrafter block, BuildPlan plan, Eachable 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); } diff --git a/core/src/mindustry/world/draw/DrawLiquidRegion.java b/core/src/mindustry/world/draw/DrawLiquidRegion.java index ac2e1ce14f..fe2c00787f 100644 --- a/core/src/mindustry/world/draw/DrawLiquidRegion.java +++ b/core/src/mindustry/world/draw/DrawLiquidRegion.java @@ -29,12 +29,11 @@ public class DrawLiquidRegion extends DrawBlock{ @Override public void draw(GenericCrafterBuild build){ - if(drawLiquid != null){ - Drawf.liquid(liquid, build.x, build.y, - build.liquids.get(drawLiquid) / build.block.liquidCapacity, - drawLiquid.color - ); - } + Liquid drawn = drawLiquid != null ? drawLiquid : build.liquids.current(); + Drawf.liquid(liquid, build.x, build.y, + build.liquids.get(drawn) / build.block.liquidCapacity, + drawn.color + ); } @Override