diff --git a/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r0.png b/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r0.png deleted file mode 100644 index 82bcbcb1b4..0000000000 Binary files a/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r0.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r1.png b/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r1.png deleted file mode 100644 index 8a54c43db1..0000000000 Binary files a/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r1.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r2.png b/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r2.png deleted file mode 100644 index d01216b2be..0000000000 Binary files a/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r2.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r3.png b/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r3.png deleted file mode 100644 index b29602c273..0000000000 Binary files a/core/assets-raw/sprites/blocks/liquid/conduits/conduit-liquid-r3.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/production/atmospheric-concentrator-bottom.png b/core/assets-raw/sprites/blocks/production/atmospheric-concentrator-bottom.png new file mode 100644 index 0000000000..4f4b6a2b8f Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/atmospheric-concentrator-bottom.png differ diff --git a/core/assets-raw/sprites/blocks/production/atmospheric-concentrator-heat.png b/core/assets-raw/sprites/blocks/production/atmospheric-concentrator-heat.png new file mode 100644 index 0000000000..aa49eeb57d Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/atmospheric-concentrator-heat.png differ diff --git a/core/assets-raw/sprites/blocks/production/atmospheric-concentrator.png b/core/assets-raw/sprites/blocks/production/atmospheric-concentrator.png index 2bc1dcf21d..031e3873ed 100644 Binary files a/core/assets-raw/sprites/blocks/production/atmospheric-concentrator.png and b/core/assets-raw/sprites/blocks/production/atmospheric-concentrator.png differ diff --git a/core/assets-raw/sprites/blocks/production/carbide-crucible-top.png b/core/assets-raw/sprites/blocks/production/carbide-crucible-top.png deleted file mode 100644 index a5bef0741f..0000000000 Binary files a/core/assets-raw/sprites/blocks/production/carbide-crucible-top.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/production/carbide-crucible.png b/core/assets-raw/sprites/blocks/production/carbide-crucible.png index bb09add910..dc23c2a8fe 100644 Binary files a/core/assets-raw/sprites/blocks/production/carbide-crucible.png and b/core/assets-raw/sprites/blocks/production/carbide-crucible.png differ diff --git a/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-heat-top.png b/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-heat-top.png new file mode 100644 index 0000000000..96f1322152 Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-heat-top.png differ diff --git a/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-heat.png b/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-heat.png index aa49eeb57d..38598c0d6d 100644 Binary files a/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-heat.png and b/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-heat.png differ diff --git a/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-liquid.png b/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-liquid.png deleted file mode 100644 index 4bd1161ff0..0000000000 Binary files a/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-liquid.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-top.png b/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-top.png deleted file mode 100644 index 2926a4396c..0000000000 Binary files a/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer-top.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer.png b/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer.png index 440678fddb..52c25ba6c4 100644 Binary files a/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer.png and b/core/assets-raw/sprites/blocks/production/cyanogen-synthesizer.png differ diff --git a/core/assets-raw/sprites/blocks/production/electrolyzer-liquid.png b/core/assets-raw/sprites/blocks/production/electrolyzer-liquid.png deleted file mode 100644 index 0ecd1df73e..0000000000 Binary files a/core/assets-raw/sprites/blocks/production/electrolyzer-liquid.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/production/electrolyzer-top.png b/core/assets-raw/sprites/blocks/production/electrolyzer-top.png deleted file mode 100644 index a316b98025..0000000000 Binary files a/core/assets-raw/sprites/blocks/production/electrolyzer-top.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/production/electrolyzer.png b/core/assets-raw/sprites/blocks/production/electrolyzer.png index 4558855096..ee3954fb7e 100644 Binary files a/core/assets-raw/sprites/blocks/production/electrolyzer.png and b/core/assets-raw/sprites/blocks/production/electrolyzer.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 deleted file mode 100644 index 129d100c57..0000000000 Binary files a/core/assets-raw/sprites/blocks/production/oxidation-chamber-glass.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/production/oxidation-chamber.png b/core/assets-raw/sprites/blocks/production/oxidation-chamber.png index 0b74465726..ebee304b7b 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-top-alt.png b/core/assets-raw/sprites/blocks/production/silicon-arc-furnace-top-alt.png deleted file mode 100644 index f199ba271b..0000000000 Binary files a/core/assets-raw/sprites/blocks/production/silicon-arc-furnace-top-alt.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/production/silicon-arc-furnace-top.png b/core/assets-raw/sprites/blocks/production/silicon-arc-furnace-top.png deleted file mode 100644 index 486fd5d123..0000000000 Binary files a/core/assets-raw/sprites/blocks/production/silicon-arc-furnace-top.png and /dev/null 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 d4481b2f65..0c7055569b 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-raw/sprites/blocks/production/slag-heater-top.png b/core/assets-raw/sprites/blocks/production/slag-heater-top.png deleted file mode 100644 index cadd63b0c6..0000000000 Binary files a/core/assets-raw/sprites/blocks/production/slag-heater-top.png and /dev/null differ diff --git a/core/assets-raw/sprites/blocks/production/slag-heater.png b/core/assets-raw/sprites/blocks/production/slag-heater.png index 2ab51c583f..d559a894d4 100644 Binary files a/core/assets-raw/sprites/blocks/production/slag-heater.png and b/core/assets-raw/sprites/blocks/production/slag-heater.png differ diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 5f20278030..0f5e630c43 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -810,7 +810,7 @@ bar.capacity = Capacity: {0} bar.unitcap = {0} {1}/{2} bar.liquid = Liquid bar.heat = Heat -bar.heatpercent = Heat: {0} +bar.heatpercent = Heat: {0} ({1}%) bar.power = Power bar.progress = Build Progress bar.input = Input diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index 0ab4ea3f32..49c3f940ec 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -461,3 +461,4 @@ 63245=reinforced-container|block-reinforced-container-ui 63244=reinforced-vault|block-reinforced-vault-ui 63243=nitrogen|liquid-nitrogen-ui +63242=atmospheric-concentrator|block-atmospheric-concentrator-ui diff --git a/core/assets/logicids.dat b/core/assets/logicids.dat index 07b796f304..01ea5f0764 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 a72a50eaa8..f8fdb6bedb 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1,6 +1,7 @@ package mindustry.content; import arc.graphics.*; +import arc.math.*; import arc.struct.*; import mindustry.*; import mindustry.ctype.*; @@ -965,7 +966,7 @@ public class Blocks implements ContentList{ drawer = new DrawMulti( new DrawRegion("-bottom"), - new DrawLiquidRegion(Liquids.water), + new DrawLiquidTile(Liquids.water, 2f), new DrawBubbles(Color.valueOf("7693e3")){{ sides = 10; recurrence = 3f; @@ -975,7 +976,6 @@ public class Blocks implements ContentList{ }}, new DrawRegion(), new DrawLiquidOutputs(), - new DrawRegion("-top"), new DrawGlowRegion(){{ alpha = 0.7f; color = Color.valueOf("c4bdf3"); @@ -984,23 +984,33 @@ public class Blocks implements ContentList{ }} ); - iconOverride = new String[]{"-bottom", "", "-top"}; + iconOverride = new String[]{"-bottom", ""}; outputLiquids = LiquidStack.with(Liquids.ozone, 2f * craftTime / 60, Liquids.hydrogen, 3f * craftTime / 60); liquidOutputDirections = new int[]{1, 3}; }}; - if(false) atmosphericConcentrator = new HeatCrafter("atmospheric-concentrator"){{ requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 30)); size = 3; - craftTime = 60f; + craftTime = 10f; + hasLiquids = true; - liquidCapacity = 50f; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.nitrogen, 4.1f), new DrawBlock(), new DrawHeatInput(), + new DrawParticles(){{ + color = Color.valueOf("d4f0ff"); + alpha = 0.6f; + particleSize = 4f; + particles = 10; + particleRad = 12f; + particleLife = 140f; + }}); + + liquidCapacity = 40f; consumes.power(2f); heatRequirement = 5f; - outputLiquid = new LiquidStack(Liquids.nitrogen, 4f / 60f); + outputLiquid = new LiquidStack(Liquids.nitrogen, 4f * craftTime / 60f); }}; oxidationChamber = new HeatProducer("oxidation-chamber"){{ @@ -1016,8 +1026,8 @@ public class Blocks implements ContentList{ rotateDraw = false; //TODO vent? - iconOverride = new String[]{"-bottom", "", "-top1", "-glass"}; - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(), new DrawBlock(), new DrawHeatOutput(), new DrawRegion("-glass")); + iconOverride = new String[]{"-bottom", "", "-top1"}; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(), new DrawBlock(), new DrawHeatOutput()); craftTime = 60f * 3f; liquidCapacity = 30f; @@ -1027,8 +1037,8 @@ public class Blocks implements ContentList{ slagHeater = new HeatProducer("slag-heater"){{ requirements(Category.crafting, with(Items.tungsten, 30, Items.graphite, 30)); - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(Liquids.slag), new DrawRegion("-top"), new DrawHeatOutput(true)); - iconOverride = new String[]{"-bottom", "", "-top"}; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.slag, 9f), new DrawHeatOutput(true)); + iconOverride = new String[]{"-bottom", ""}; size = 2; craftTime = 60f * 1f; heatOutput = 2f; @@ -1043,13 +1053,16 @@ public class Blocks implements ContentList{ }}; heatReactor = new HeatProducer("heat-reactor"){{ - //TODO quadvent? - //TODO coolant? - //TODO extra output, should have other uses + //TODO gas/liquid requirement? requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 30)); size = 3; craftTime = 60f * 10f; - consumes.item(Items.fissileMatter, 1); + + craftEffect = new RadialEffect(Fx.heatReactorSmoke, 4, 90f, 7f); + + itemCapacity = 20; + consumes.item(Items.thorium, 2); + outputItem = new ItemStack(Items.fissileMatter, 1); }}; carbideCrucible = new HeatCrafter("carbide-crucible"){{ @@ -1060,7 +1073,8 @@ public class Blocks implements ContentList{ size = 3; itemCapacity = 20; hasPower = hasItems = true; - drawer = new DrawMulti(new DrawCrucible(), new DrawHeatInput()); + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawCrucible(), new DrawBlock(), new DrawHeatInput()); + iconOverride = new String[]{"-bottom", ""}; ambientSound = Sounds.smelter; ambientSoundVolume = 0.07f; @@ -1127,10 +1141,10 @@ public class Blocks implements ContentList{ amount = 3; }}, new DrawLiquidRegion(Liquids.slag), new DrawBlock(), new DrawHeatInput(), new DrawHeatRegion(){{ - heatColor = Color.valueOf("ff6060ff"); + color = Color.valueOf("ff6060ff"); }}, new DrawHeatRegion("-vents"){{ - heatColor.a = 1f; + color.a = 1f; }}); iconOverride = new String[]{"-bottom", ""}; @@ -1147,17 +1161,19 @@ public class Blocks implements ContentList{ heatRequirement = 5f; - drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(Liquids.hydrogen), new DrawBlock(), new DrawRegion("-top"), new DrawHeatInput(), - new DrawParticlesIn(){{ - color = Color.valueOf("d4f0ff"); - alpha = 0.6f; - particleSize = 4f; + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.cyanogen), + new DrawParticles(){{ + color = Color.valueOf("89e8b6"); + alpha = 0.5f; + particleSize = 3f; particles = 10; - particleRad = 12f; - particleLife = 140f; - }}); + particleRad = 9f; + particleLife = 200f; + reverse = true; + particleSizeInterp = Interp.one; + }}, new DrawBlock(), new DrawHeatInput(), new DrawHeatRegion("-heat-top")); - iconOverride = new String[]{"-bottom", "", "-top"}; + iconOverride = new String[]{"-bottom", ""}; size = 3; @@ -1165,7 +1181,7 @@ public class Blocks implements ContentList{ outputLiquid = new LiquidStack(Liquids.cyanogen, 3f); craftTime = 60f * 1f; - consumes.liquid(Liquids.hydrogen, 3f / 60f); + consumes.liquids(LiquidStack.with(Liquids.hydrogen, 3f / 60f, Liquids.nitrogen, 2f / 60f)); consumes.item(Items.graphite); consumes.power(2f); }}; @@ -1196,7 +1212,7 @@ public class Blocks implements ContentList{ }}, new DrawMultiWeave(){{ glowColor = new Color(1f, 0.4f, 0.4f, 0.8f); }}, new DrawBlock(), new DrawHeatInput(), new DrawHeatRegion("-vents"){{ - heatColor = new Color(1f, 0.4f, 0.3f, 1f); + color = new Color(1f, 0.4f, 0.3f, 1f); }}); iconOverride = new String[]{"-bottom", "-weave", ""}; diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 37b6c1d6bc..dd02b18ece 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -1368,6 +1368,21 @@ public class Fx{ } }), + heatReactorSmoke = new Effect(180f, e -> { + color(Color.gray); + + rand.setSeed(e.id); + for(int i = 0; i < 5; i++){ + float len = rand.random(6f), rot = rand.range(50f) + e.rotation; + + e.scaled(e.lifetime * rand.random(0.3f, 1f), b -> { + alpha(0.9f * b.fout()); + v.trns(rot, len * b.finpow()); + Fill.circle(e.x + v.x, e.y + v.y, 2.4f * b.fin() + 0.6f); + }); + } + }), + berylSpark = new Effect(21f, e -> { color(Color.white, Pal.berylShot, e.fin()); stroke(e.fout() * 1.1f + 0.5f); diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index 09f8e1c73c..d9294520ea 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -53,7 +53,7 @@ public class Renderer implements ApplicationListener{ public Seq envRenderers = new Seq<>(); public ObjectMap customBackgrounds = new ObjectMap<>(); public TextureRegion[] bubbles = new TextureRegion[16], splashes = new TextureRegion[12]; - public TextureRegion[][] fluidFrames = new TextureRegion[2][Liquid.animationFrames]; + public TextureRegion[][] fluidFrames; private @Nullable CoreBuild landCore; private @Nullable CoreBlock launchCoreType; @@ -113,14 +113,7 @@ public class Renderer implements ApplicationListener{ for(int i = 0; i < bubbles.length; i++) bubbles[i] = atlas.find("bubble-" + i); for(int i = 0; i < splashes.length; i++) splashes[i] = atlas.find("splash-" + i); - String[] fluidTypes = {"liquid", "gas"}; - - for(int i = 0; i < fluidTypes.length; i++){ - - for(int j = 0; j < Liquid.animationFrames; j++){ - fluidFrames[i][j] = atlas.find("fluid-" + fluidTypes[i] + "-" + j); - } - } + loadFluidFrames(); assets.load("sprites/clouds.png", Texture.class).loaded = t -> { t.setWrap(TextureWrap.repeat); @@ -136,6 +129,26 @@ public class Renderer implements ApplicationListener{ }); } + public void loadFluidFrames(){ + if(fluidFrames != null) return; + + fluidFrames = new TextureRegion[2][Liquid.animationFrames]; + + String[] fluidTypes = {"liquid", "gas"}; + + for(int i = 0; i < fluidTypes.length; i++){ + + for(int j = 0; j < Liquid.animationFrames; j++){ + fluidFrames[i][j] = atlas.find("fluid-" + fluidTypes[i] + "-" + j); + } + } + } + + public TextureRegion[][] getFluidFrames(){ + loadFluidFrames(); + return fluidFrames; + } + @Override public void update(){ Color.white.set(1f, 1f, 1f, 1f); diff --git a/core/src/mindustry/world/blocks/liquid/Conduit.java b/core/src/mindustry/world/blocks/liquid/Conduit.java index 62d42885f0..75f50a2d10 100644 --- a/core/src/mindustry/world/blocks/liquid/Conduit.java +++ b/core/src/mindustry/world/blocks/liquid/Conduit.java @@ -23,6 +23,9 @@ import static mindustry.Vars.*; import static mindustry.type.Liquid.*; public class Conduit extends LiquidBlock implements Autotiler{ + static final float rotatePad = 6, hpad = rotatePad / 2f / 4f; + static final float[][] rotateOffsets = {{hpad, hpad}, {-hpad, hpad}, {-hpad, -hpad}, {hpad, -hpad}}; + public final int timerFlow = timers++; public Color botColor = Color.valueOf("565656"); @@ -31,8 +34,8 @@ public class Conduit extends LiquidBlock implements Autotiler{ public @Load(value = "@-bottom-#", length = 5, fallback = "conduit-bottom-#") TextureRegion[] botRegions; public @Load("@-cap") TextureRegion capRegion; - public @Load(value = "conduit-liquid-r#1-gas-#2", lengths = {4, animationFrames}) TextureRegion[][] rotateGasRegions; - public @Load(value = "conduit-liquid-r#1-liquid-#2", lengths = {4, animationFrames}) TextureRegion[][] rotateLiquidRegions; + /** indices: [rotation] [fluid type] [frame] */ + public TextureRegion[][][] rotateRegions; public boolean leaks = true; public @Nullable Block junctionReplacement, bridgeReplacement, rotBridgeReplacement; @@ -55,6 +58,44 @@ public class Conduit extends LiquidBlock implements Autotiler{ if(bridgeReplacement == null || !(bridgeReplacement instanceof ItemBridge)) bridgeReplacement = Blocks.bridgeConduit; } + @Override + public void load(){ + super.load(); + + rotateRegions = new TextureRegion[4][2][animationFrames]; + + if(renderer != null){ + float pad = rotatePad; + var frames = renderer.getFluidFrames(); + + for(int rot = 0; rot < 4; rot++){ + for(int fluid = 0; fluid < 2; fluid++){ + for(int frame = 0; frame < animationFrames; frame++){ + TextureRegion base = frames[fluid][frame]; + TextureRegion result = new TextureRegion(); + result.set(base); + + if(rot == 0){ + result.setX(result.getX() + pad); + result.setHeight(result.height - pad); + }else if(rot == 1){ + result.setWidth(result.width - pad); + result.setHeight(result.height - pad); + }else if(rot == 2){ + result.setWidth(result.width - pad); + result.setY(result.getY() + pad); + }else{ + result.setX(result.getX() + pad); + result.setY(result.getY() + pad); + } + + rotateRegions[rot][fluid][frame] = result; + } + } + } + } + } + @Override public void drawRequestRegion(BuildPlan plan, Eachable list){ int[] bits = getTiling(plan, list); @@ -138,17 +179,21 @@ public class Conduit extends LiquidBlock implements Autotiler{ int offset = yscl == -1 ? 3 : 0; - //TODO move out of conduit int frame = liquids.current().getAnimationFrame(); - TextureRegion liquidr = - liquids.current().gas ? - (bits == 1 ? rotateGasRegions[(rotation + offset) % 4][frame] : renderer.fluidFrames[1][frame]) : - (bits == 1 ? rotateLiquidRegions[(rotation + offset) % 4][frame] : renderer.fluidFrames[0][frame]); + int gas = liquids.current().gas ? 1 : 0; + float ox = 0f, oy = 0f; + int wrapRot = (rotation + offset) % 4; + TextureRegion liquidr = bits == 1 ? rotateRegions[wrapRot][gas][frame] : renderer.fluidFrames[gas][frame]; + + if(bits == 1){ + ox = rotateOffsets[wrapRot][0]; + oy = rotateOffsets[wrapRot][1]; + } //the drawing state machine sure was a great design choice with no downsides or hidden behavior!!! float xscl = Draw.xscl, yscl = Draw.yscl; Draw.scl(1f, 1f); - Drawf.liquid(sliced(liquidr, slice), x, y, smoothLiquid, liquids.current().color.write(Tmp.c1).a(1f)); + Drawf.liquid(sliced(liquidr, slice), x + ox, y + oy, smoothLiquid, liquids.current().color.write(Tmp.c1).a(1f)); Draw.scl(xscl, yscl); Draw.rect(sliced(topRegions[bits], slice), x, y, angle); diff --git a/core/src/mindustry/world/blocks/liquid/LiquidBlock.java b/core/src/mindustry/world/blocks/liquid/LiquidBlock.java index 1f84ba73c9..a73d85d506 100644 --- a/core/src/mindustry/world/blocks/liquid/LiquidBlock.java +++ b/core/src/mindustry/world/blocks/liquid/LiquidBlock.java @@ -50,6 +50,8 @@ public class LiquidBlock extends Block{ float squishX = rightBorder + tilesize/2f - bounds, squishY = topBorder + tilesize/2f - bounds; float ox = 0f, oy = 0f; + if(squishX >= 8 || squishY >= 8) continue; + //cut out the parts that don't fit inside the padding if(squishX > 0){ toDraw.setWidth(toDraw.width - squishX * 4f); diff --git a/core/src/mindustry/world/blocks/production/GenericCrafter.java b/core/src/mindustry/world/blocks/production/GenericCrafter.java index 65134a9104..a04f04cd98 100644 --- a/core/src/mindustry/world/blocks/production/GenericCrafter.java +++ b/core/src/mindustry/world/blocks/production/GenericCrafter.java @@ -29,6 +29,8 @@ public class GenericCrafter extends Block{ /** Liquid output directions, specified in the same order as outputLiquids. Use -1 to dump in every direction. Rotations are relative to block. */ public int[] liquidOutputDirections = {-1}; + /** 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 float craftTime = 80; public Effect craftEffect = Fx.none; public Effect updateEffect = Fx.none; @@ -109,6 +111,10 @@ public class GenericCrafter extends Block{ outputLiquid = outputLiquids[0]; } outputsLiquid = outputLiquids != null; + + if(outputItems != null) hasItems = true; + if(outputLiquids != null) hasLiquids = true; + super.init(); } @@ -169,11 +175,22 @@ public class GenericCrafter extends Block{ } } if(outputLiquids != null){ + boolean allFull = true; for(var output : outputLiquids){ if(liquids.get(output.liquid) >= liquidCapacity - 0.001f){ - return false; + if(!dumpExtraLiquid){ + return false; + } + }else{ + //if there's still space left, it's not full for all liquids + allFull = false; } } + + //if there is no space left for any liquid, it can't reproduce + if(allFull){ + return false; + } } return enabled; diff --git a/core/src/mindustry/world/blocks/production/HeatCrafter.java b/core/src/mindustry/world/blocks/production/HeatCrafter.java index 7505ded727..e63cce35be 100644 --- a/core/src/mindustry/world/blocks/production/HeatCrafter.java +++ b/core/src/mindustry/world/blocks/production/HeatCrafter.java @@ -29,16 +29,9 @@ public class HeatCrafter extends GenericCrafter{ bars.add("heat", (HeatCrafterBuild entity) -> new Bar(() -> - Core.bundle.format("bar.heatpercent", (int)entity.heat), + Core.bundle.format("bar.heatpercent", (int)entity.heat, (int)(entity.efficiencyScale() * 100)), () -> Pal.lightOrange, () -> entity.heat / heatRequirement)); - - //TODO unnecessary? - bars.add("efficiency", (HeatCrafterBuild entity) -> - new Bar(() -> - Core.bundle.format("bar.efficiency", (int)(entity.efficiencyScale() * 100)), - () -> Pal.ammo, - entity::efficiencyScale)); } @Override diff --git a/core/src/mindustry/world/draw/DrawArcSmelter.java b/core/src/mindustry/world/draw/DrawArcSmelter.java index b8b43ec815..8bec2c68ea 100644 --- a/core/src/mindustry/world/draw/DrawArcSmelter.java +++ b/core/src/mindustry/world/draw/DrawArcSmelter.java @@ -8,8 +8,9 @@ import arc.util.*; import mindustry.gen.*; import mindustry.world.*; +//TODO make non-standalone? public class DrawArcSmelter extends DrawBlock{ - public TextureRegion top, bottom; + public TextureRegion bottom; public Color flameColor = Color.valueOf("f58349"), midColor = Color.valueOf("f2d585"); public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 3f, flameRadiusMag = 0.3f, circleStroke = 1.5f; @@ -17,7 +18,7 @@ public class DrawArcSmelter extends DrawBlock{ 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 boolean drawBottom = true, drawRegion = true; public Blending blending = Blending.additive; @Override @@ -53,17 +54,15 @@ public class DrawArcSmelter extends DrawBlock{ } if(drawRegion) Draw.rect(build.block.region, build.x, build.y); - if(drawTop && top.found()) Draw.rect(top, build.x, build.y); } @Override public void load(Block block){ - top = Core.atlas.find(block.name + "-top"); bottom = Core.atlas.find(block.name + "-bottom"); } @Override public TextureRegion[] icons(Block block){ - return new TextureRegion[]{bottom, block.region, top}; + return new TextureRegion[]{bottom, block.region}; } } diff --git a/core/src/mindustry/world/draw/DrawBubbles.java b/core/src/mindustry/world/draw/DrawBubbles.java index 14323b8611..57377a1751 100644 --- a/core/src/mindustry/world/draw/DrawBubbles.java +++ b/core/src/mindustry/world/draw/DrawBubbles.java @@ -13,6 +13,7 @@ public class DrawBubbles extends DrawBlock{ public int amount = 12, sides = 8; public float strokeMin = 0.2f, spread = 3f, timeScl = 30f; public float recurrence = 6f, radius = 3f; + public boolean fill = false; public DrawBubbles(Color color){ this.color = color; @@ -37,8 +38,13 @@ public class DrawBubbles extends DrawBlock{ float life = 1f - ((Time.time / timeScl + rand.random(recurrence)) % recurrence); if(life > 0){ - Lines.stroke(build.warmup() * (life + strokeMin)); - Lines.poly(build.x + x, build.y + y, sides, (1f - life) * radius); + float rad = (1f - life) * radius; + if(fill){ + Fill.circle(build.x + x, build.y + y, rad); + }else{ + Lines.stroke(build.warmup() * (life + strokeMin)); + Lines.poly(build.x + x, build.y + y, sides, rad); + } } } diff --git a/core/src/mindustry/world/draw/DrawCrucible.java b/core/src/mindustry/world/draw/DrawCrucible.java index 8f08ea16c6..10d1c74308 100644 --- a/core/src/mindustry/world/draw/DrawCrucible.java +++ b/core/src/mindustry/world/draw/DrawCrucible.java @@ -1,16 +1,15 @@ package mindustry.world.draw; -import arc.*; import arc.graphics.*; import arc.graphics.g2d.*; import arc.math.*; import arc.math.Interp.*; import arc.util.*; +import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.world.*; public class DrawCrucible extends DrawBlock{ - public TextureRegion top, bottom; public Color flameColor = Color.valueOf("f58349"), midColor = Color.valueOf("f2d585"); public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 10f, flameRadiusMag = 0.6f, circleStroke = 1.5f; @@ -21,7 +20,6 @@ public class DrawCrucible extends DrawBlock{ @Override public void drawBase(Building build){ - Draw.rect(bottom, build.x, build.y); if(build.warmup() > 0f && flameColor.a > 0.001f){ Lines.stroke(circleStroke * build.warmup()); @@ -53,19 +51,8 @@ public class DrawCrucible extends DrawBlock{ Draw.blend(); Draw.reset(); } - - Draw.rect(build.block.region, build.x, build.y); - if(top.found()) Draw.rect(top, build.x, build.y); } @Override - public void load(Block block){ - top = Core.atlas.find(block.name + "-top"); - bottom = Core.atlas.find(block.name + "-bottom"); - } - - @Override - public TextureRegion[] icons(Block block){ - return new TextureRegion[]{bottom, block.region, top}; - } + public void drawPlan(Block block, BuildPlan plan, Eachable list){} } diff --git a/core/src/mindustry/world/draw/DrawHeatRegion.java b/core/src/mindustry/world/draw/DrawHeatRegion.java index 9abdc5ea24..45b6c4ce1a 100644 --- a/core/src/mindustry/world/draw/DrawHeatRegion.java +++ b/core/src/mindustry/world/draw/DrawHeatRegion.java @@ -11,8 +11,8 @@ import mindustry.world.blocks.production.HeatCrafter.*; /** Not standalone. */ public class DrawHeatRegion extends DrawBlock{ - public Color heatColor = new Color(1f, 0.22f, 0.22f, 0.8f); - public float heatPulse = 0.3f, heatPulseScl = 10f; + public Color color = new Color(1f, 0.22f, 0.22f, 0.8f); + public float pulse = 0.3f, pulseScl = 10f; public TextureRegion heat; public String suffix = "-glow"; @@ -30,7 +30,7 @@ public class DrawHeatRegion extends DrawBlock{ Draw.z(Layer.blockAdditive); if(build instanceof HeatCrafterBuild hc && hc.heat > 0){ Draw.blend(Blending.additive); - Draw.color(heatColor, Mathf.clamp(hc.heat / hc.heatRequirement()) * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse)))); + Draw.color(color, Mathf.clamp(hc.heat / hc.heatRequirement()) * (color.a * (1f - pulse + Mathf.absin(pulseScl, pulse)))); Draw.rect(heat, build.x, build.y); Draw.blend(); Draw.color(); diff --git a/core/src/mindustry/world/draw/DrawLiquidTile.java b/core/src/mindustry/world/draw/DrawLiquidTile.java new file mode 100644 index 0000000000..3b6e3cfefa --- /dev/null +++ b/core/src/mindustry/world/draw/DrawLiquidTile.java @@ -0,0 +1,36 @@ +package mindustry.world.draw; + +import arc.util.*; +import mindustry.entities.units.*; +import mindustry.gen.*; +import mindustry.type.*; +import mindustry.world.*; +import mindustry.world.blocks.liquid.*; + +/** Not standalone. */ +public class DrawLiquidTile extends DrawBlock{ + public Liquid drawLiquid; + public float padding; + public float alpha = 1f; + + public DrawLiquidTile(Liquid drawLiquid, float padding){ + this.drawLiquid = drawLiquid; + this.padding = padding; + } + + public DrawLiquidTile(Liquid drawLiquid){ + this.drawLiquid = drawLiquid; + } + + public DrawLiquidTile(){ + } + + @Override + public void drawPlan(Block block, BuildPlan plan, Eachable list){} + + @Override + public void drawBase(Building build){ + Liquid drawn = drawLiquid != null ? drawLiquid : build.liquids.current(); + LiquidBlock.drawTiledFrames(build.block.size, build.x, build.y, padding, drawn, build.liquids.get(drawn) / build.block.liquidCapacity * alpha); + } +} diff --git a/core/src/mindustry/world/draw/DrawParticlesIn.java b/core/src/mindustry/world/draw/DrawParticles.java similarity index 86% rename from core/src/mindustry/world/draw/DrawParticlesIn.java rename to core/src/mindustry/world/draw/DrawParticles.java index 3ca9f82f08..16d1c70a52 100644 --- a/core/src/mindustry/world/draw/DrawParticlesIn.java +++ b/core/src/mindustry/world/draw/DrawParticles.java @@ -8,12 +8,13 @@ import arc.util.*; import mindustry.gen.*; /** Not standalone. */ -public class DrawParticlesIn extends DrawBlock{ +public class DrawParticles extends DrawBlock{ public Color color = Color.valueOf("f2d585"); public float alpha = 0.5f; public int particles = 30; public float particleLife = 70f, particleRad = 7f, particleSize = 3f, fadeMargin = 0.4f, rotateScl = 3f; + public boolean reverse = false; public Interp particleInterp = new PowIn(1.5f); public Interp particleSizeInterp = Interp.slope; public Blending blending = Blending.normal; @@ -30,7 +31,9 @@ public class DrawParticlesIn extends DrawBlock{ float base = (Time.time / particleLife); rand.setSeed(build.id); for(int i = 0; i < particles; i++){ - float fin = (rand.random(1f) + base) % 1f, fout = 1f - fin; + float fin = (rand.random(2f) + base) % 1f; + if(reverse) fin = 1f - fin; + float fout = 1f - fin; float angle = rand.random(360f) + (Time.time / rotateScl) % 360f; float len = particleRad * particleInterp.apply(fout); Draw.alpha(a * (1f - Mathf.curve(fin, 1f - fadeMargin))); diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index b8c21fe13f..c8bebc23d4 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java @@ -128,7 +128,7 @@ public class Generators{ generate("gas-frames", () -> { int frames = Liquid.animationFrames; - String[] stencils = {"fluid", "conduit-liquid-r0", "conduit-liquid-r1", "conduit-liquid-r2", "conduit-liquid-r3"}; + String[] stencils = {"fluid"}; String[] types = {"liquid", "gas"}; int typeIndex = 0;