diff --git a/core/assets-raw/sprites/blocks/production/surge-crucible-bottom.png b/core/assets-raw/sprites/blocks/production/surge-crucible-bottom.png new file mode 100644 index 0000000000..4f4b6a2b8f Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/surge-crucible-bottom.png differ diff --git a/core/assets-raw/sprites/blocks/production/surge-crucible-glow.png b/core/assets-raw/sprites/blocks/production/surge-crucible-glow.png new file mode 100644 index 0000000000..9cbb441b7e Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/surge-crucible-glow.png differ diff --git a/core/assets-raw/sprites/blocks/production/surge-crucible-heat.png b/core/assets-raw/sprites/blocks/production/surge-crucible-heat.png new file mode 100644 index 0000000000..92151659ec Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/surge-crucible-heat.png differ diff --git a/core/assets-raw/sprites/blocks/production/surge-crucible-liquid.png b/core/assets-raw/sprites/blocks/production/surge-crucible-liquid.png new file mode 100644 index 0000000000..e2e3a85b82 Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/surge-crucible-liquid.png differ diff --git a/core/assets-raw/sprites/blocks/production/surge-crucible-vents.png b/core/assets-raw/sprites/blocks/production/surge-crucible-vents.png new file mode 100644 index 0000000000..0386580503 Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/surge-crucible-vents.png differ diff --git a/core/assets-raw/sprites/blocks/production/surge-crucible.png b/core/assets-raw/sprites/blocks/production/surge-crucible.png new file mode 100644 index 0000000000..8380ad3d4b Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/surge-crucible.png differ diff --git a/core/assets-raw/sprites/blocks/production/surge-smelter.png b/core/assets-raw/sprites/blocks/production/surge-smelter.png index f9a0a1fc17..0d8a3b5475 100644 Binary files a/core/assets-raw/sprites/blocks/production/surge-smelter.png and b/core/assets-raw/sprites/blocks/production/surge-smelter.png differ diff --git a/core/assets-raw/sprites/items/item-surge-alloy.png b/core/assets-raw/sprites/items/item-surge-alloy.png index 4cac00c5e4..07d73c762e 100644 Binary files a/core/assets-raw/sprites/items/item-surge-alloy.png and b/core/assets-raw/sprites/items/item-surge-alloy.png differ diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index 40de711bcb..7e4f889eed 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -445,3 +445,4 @@ 63261=ozone|liquid-ozone-ui 63260=reinforced-liquid-junction|block-reinforced-liquid-junction-ui 63259=oxidation-chamber|block-oxidation-chamber-ui +63258=surge-crucible|block-surge-crucible-ui diff --git a/core/assets/logicids.dat b/core/assets/logicids.dat index 63cf162710..f595f82542 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 1c59c5b9bb..ba04795c5b 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1043,21 +1043,38 @@ public class Blocks implements ContentList{ outputLiquids = new LiquidStack[]{}; }}; - //TODO implement //TODO "crucible" is getting old //TODO should have a useful turret ammo byproduct? //original: consumes.items(with(Items.copper, 3, Items.lead, 4, Items.titanium, 2, Items.silicon, 3)); - if(false) surgeCrucible = new HeatCrafter("surge-crucible"){{ + requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 60, Items.carbide, 30)); + size = 3; itemCapacity = 20; heatRequirement = 5f; - craftTime = 60f * 2.5f; + craftTime = 60f * 3f; + liquidCapacity = 80f * 5; ambientSound = Sounds.smelter; ambientSoundVolume = 0.07f; + outputItem = new ItemStack(Items.surgeAlloy, 1); + + craftEffect = new RadialEffect(Fx.surgeCruciSmoke, 4, 90f, 5f); + + drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawCircles(){{ + color = Color.valueOf("ffc073").a(0.24f); + strokeMax = 2.5f; + radius = 10f; + amount = 3; + }}, new DrawLiquidRegion(Liquids.slag), new DrawBlock(), new DrawHeatInput(), new DrawHeatRegion(){{ + heatColor = Color.valueOf("ff6060ff"); + }}, new DrawHeatRegion("-vents"){{ + heatColor.a = 1f; + }}); + iconOverride = new String[]{"-bottom", ""}; + consumes.item(Items.silicon, 3); //TODO must consume from 2 pumps, 1, or 1.5? //TODO consume hydrogen/ozone? diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index a3faa52d6a..639b2fb98d 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -12,7 +12,7 @@ import mindustry.game.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.type.*; -import mindustry.world.Block; +import mindustry.world.*; import static arc.graphics.g2d.Draw.rect; import static arc.graphics.g2d.Draw.*; @@ -1345,6 +1345,21 @@ public class Fx{ }); }), + surgeCruciSmoke = new Effect(160f, e -> { + color(Pal.slagOrange); + alpha(0.6f); + + rand.setSeed(e.id); + for(int i = 0; i < 3; i++){ + float len = rand.random(6f), rot = rand.range(40f) + e.rotation; + + e.scaled(e.lifetime * rand.random(0.3f, 1f), b -> { + v.trns(rot, len * b.finpow()); + Fill.circle(e.x + v.x, e.y + v.y, 2f * b.fslope() + 0.2f); + }); + } + }), + 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/entities/effect/RadialEffect.java b/core/src/mindustry/entities/effect/RadialEffect.java new file mode 100644 index 0000000000..99289d3e02 --- /dev/null +++ b/core/src/mindustry/entities/effect/RadialEffect.java @@ -0,0 +1,49 @@ +package mindustry.entities.effect; + +import arc.math.*; +import mindustry.content.*; +import mindustry.entities.*; + +/** Renders one particle effect repeatedly at specified angle intervals. */ +public class RadialEffect extends Effect{ + public Effect effect = Fx.none; + public float rotationSpacing = 90f, rotationOffset = 0f; + public float lengthOffset = 0f; + public int amount = 4; + + public RadialEffect(){ + clip = 100f; + } + + public RadialEffect(Effect effect, int amount, float spacing, float lengthOffset){ + this(); + this.amount = amount; + this.effect = effect; + this.rotationSpacing = spacing; + this.lengthOffset = lengthOffset; + } + + @Override + public void init(){ + effect.init(); + clip = Math.max(clip, effect.clip); + lifetime = effect.lifetime; + } + + @Override + public void render(EffectContainer e){ + float x = e.x, y = e.y; + + e.rotation += rotationOffset; + + for(int i = 0; i < amount; i++){ + e.x = x + Angles.trnsx(e.rotation, lengthOffset); + e.y = y + Angles.trnsy(e.rotation, lengthOffset); + effect.render(e); + e.rotation += rotationSpacing; + e.id ++; + } + + clip = Math.max(clip, effect.clip); + } +} diff --git a/core/src/mindustry/graphics/Pal.java b/core/src/mindustry/graphics/Pal.java index fc55c3510f..02b1571bd3 100644 --- a/core/src/mindustry/graphics/Pal.java +++ b/core/src/mindustry/graphics/Pal.java @@ -123,6 +123,7 @@ public class Pal{ muddy = Color.valueOf("432722"), redLight = Color.valueOf("feb380"), + slagOrange = Color.valueOf("ffa166"), vent = Color.valueOf("6b4e4e"); } diff --git a/core/src/mindustry/world/blocks/distribution/DirectionLiquidBridge.java b/core/src/mindustry/world/blocks/distribution/DirectionLiquidBridge.java index 7fc32fe061..288802b11a 100644 --- a/core/src/mindustry/world/blocks/distribution/DirectionLiquidBridge.java +++ b/core/src/mindustry/world/blocks/distribution/DirectionLiquidBridge.java @@ -39,7 +39,7 @@ public class DirectionLiquidBridge extends DirectionBridge{ var link = findLink(); if(link != null){ Draw.z(Layer.power); - drawBridge(rotation, x, y, link.x, link.y, Tmp.c1.set(liquids.current().color).a(liquids.currentAmount() / liquidCapacity)); + drawBridge(rotation, x, y, link.x, link.y, Tmp.c1.set(liquids.current().color).a(liquids.currentAmount() / liquidCapacity * liquids.current().color.a)); } } diff --git a/core/src/mindustry/world/draw/DrawCircles.java b/core/src/mindustry/world/draw/DrawCircles.java new file mode 100644 index 0000000000..9b167e9835 --- /dev/null +++ b/core/src/mindustry/world/draw/DrawCircles.java @@ -0,0 +1,44 @@ +package mindustry.world.draw; + +import arc.graphics.*; +import arc.graphics.g2d.*; +import arc.math.*; +import arc.util.*; +import mindustry.entities.units.*; +import mindustry.gen.*; +import mindustry.world.*; + +public class DrawCircles extends DrawBlock{ + public Color color = Color.valueOf("7457ce"); + + public int amount = 5, sides = 15; + public float strokeMin = 0.2f, strokeMax = 2f, timeScl = 160f; + public float radius = 12f; + public Interp strokeInterp = Interp.pow3In; + + public DrawCircles(Color color){ + this.color = color; + } + + public DrawCircles(){ + } + + @Override + public void drawPlan(Block block, BuildPlan plan, Eachable list){} + + @Override + public void drawBase(Building build){ + if(build.warmup() <= 0.001f) return; + + Draw.color(color, build.warmup() * color.a); + + for(int i = 0; i < amount; i++){ + float life = ((Time.time / timeScl + i/(float)amount) % 1f); + + Lines.stroke(build.warmup() * strokeInterp.apply(strokeMax, strokeMin, life)); + Lines.poly(build.x, build.y, sides, life * radius); + } + + Draw.color(); + } +} diff --git a/core/src/mindustry/world/draw/DrawHeatRegion.java b/core/src/mindustry/world/draw/DrawHeatRegion.java new file mode 100644 index 0000000000..9abdc5ea24 --- /dev/null +++ b/core/src/mindustry/world/draw/DrawHeatRegion.java @@ -0,0 +1,46 @@ +package mindustry.world.draw; + +import arc.*; +import arc.graphics.*; +import arc.graphics.g2d.*; +import arc.math.*; +import mindustry.gen.*; +import mindustry.graphics.*; +import mindustry.world.*; +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 TextureRegion heat; + public String suffix = "-glow"; + + public DrawHeatRegion(String suffix){ + this.suffix = suffix; + } + + public DrawHeatRegion(){ + } + + @Override + public void drawBase(Building build){ + + 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.rect(heat, build.x, build.y); + Draw.blend(); + Draw.color(); + } + Draw.z(Layer.block); + + } + + @Override + public void load(Block block){ + heat = Core.atlas.find(block.name + suffix); + } +} diff --git a/tools/build.gradle b/tools/build.gradle index 20f2995b6b..cde24bcfb2 100644 --- a/tools/build.gradle +++ b/tools/build.gradle @@ -36,7 +36,7 @@ def transformColors = { List> list -> //TODO implementing this in gradle is a bad idea //d4816b transformColors([["4a4b53", "6e7080", "989aa4"], ["3a5651", "3a8f64", "92dd7e"], ["bf92f9", "8a73c6", "665c9f"], /*["6e7080", "989aa4", "b0bac0"],*/ ["bc5452", "ea8878", "feb380"], - ["de9458", "f8c266", "ffe18f"], ["feb380", "ea8878", "bc5452"], ["d4816b", "eab678", "ffd37f"], + ["de9458", "f8c266", "ffe18f"], ["feb380", "ea8878", "bc5452"], ["d4816b", "eab678", "ffd37f"], ["d57c65", "e3ae6f", "f7e97e"], ["ffffff", "dcc6c6", "9d7f7f"], ["df7646", "b23a4d", "752249"], ["3c3837", "515151", "646567"], ["5757c1", "6f80e8", "88a4ff"], ["8f665b", "b28768", "c9a58f"], ["4c5878", "768a9a", "a0b0c8"]])