Surge crucible effects

This commit is contained in:
Anuken
2021-11-17 13:37:51 -05:00
parent 4567ee9a13
commit 4d13b8df7a
18 changed files with 179 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 534 B

View File

@@ -445,3 +445,4 @@
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 63259=oxidation-chamber|block-oxidation-chamber-ui
63258=surge-crucible|block-surge-crucible-ui

Binary file not shown.

View File

@@ -1043,21 +1043,38 @@ public class Blocks implements ContentList{
outputLiquids = new LiquidStack[]{}; outputLiquids = new LiquidStack[]{};
}}; }};
//TODO implement
//TODO "crucible" is getting old //TODO "crucible" is getting old
//TODO should have a useful turret ammo byproduct? //TODO should have a useful turret ammo byproduct?
//original: consumes.items(with(Items.copper, 3, Items.lead, 4, Items.titanium, 2, Items.silicon, 3)); //original: consumes.items(with(Items.copper, 3, Items.lead, 4, Items.titanium, 2, Items.silicon, 3));
if(false)
surgeCrucible = new HeatCrafter("surge-crucible"){{ surgeCrucible = new HeatCrafter("surge-crucible"){{
requirements(Category.crafting, with(Items.tungsten, 60, Items.graphite, 60, Items.carbide, 30));
size = 3; size = 3;
itemCapacity = 20; itemCapacity = 20;
heatRequirement = 5f; heatRequirement = 5f;
craftTime = 60f * 2.5f; craftTime = 60f * 3f;
liquidCapacity = 80f * 5;
ambientSound = Sounds.smelter; ambientSound = Sounds.smelter;
ambientSoundVolume = 0.07f; 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); consumes.item(Items.silicon, 3);
//TODO must consume from 2 pumps, 1, or 1.5? //TODO must consume from 2 pumps, 1, or 1.5?
//TODO consume hydrogen/ozone? //TODO consume hydrogen/ozone?

View File

@@ -12,7 +12,7 @@ import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.Block; import mindustry.world.*;
import static arc.graphics.g2d.Draw.rect; import static arc.graphics.g2d.Draw.rect;
import static arc.graphics.g2d.Draw.*; 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 -> { berylSpark = new Effect(21f, e -> {
color(Color.white, Pal.berylShot, e.fin()); color(Color.white, Pal.berylShot, e.fin());
stroke(e.fout() * 1.1f + 0.5f); stroke(e.fout() * 1.1f + 0.5f);

View File

@@ -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);
}
}

View File

@@ -123,6 +123,7 @@ public class Pal{
muddy = Color.valueOf("432722"), muddy = Color.valueOf("432722"),
redLight = Color.valueOf("feb380"), redLight = Color.valueOf("feb380"),
slagOrange = Color.valueOf("ffa166"),
vent = Color.valueOf("6b4e4e"); vent = Color.valueOf("6b4e4e");
} }

View File

@@ -39,7 +39,7 @@ public class DirectionLiquidBridge extends DirectionBridge{
var link = findLink(); var link = findLink();
if(link != null){ if(link != null){
Draw.z(Layer.power); 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));
} }
} }

View File

@@ -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<BuildPlan> 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();
}
}

View File

@@ -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);
}
}

View File

@@ -36,7 +36,7 @@ def transformColors = { List<List<String>> list ->
//TODO implementing this in gradle is a bad idea //TODO implementing this in gradle is a bad idea
//d4816b //d4816b
transformColors([["4a4b53", "6e7080", "989aa4"], ["3a5651", "3a8f64", "92dd7e"], ["bf92f9", "8a73c6", "665c9f"], /*["6e7080", "989aa4", "b0bac0"],*/ ["bc5452", "ea8878", "feb380"], 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"], ["ffffff", "dcc6c6", "9d7f7f"], ["df7646", "b23a4d", "752249"], ["3c3837", "515151", "646567"],
["5757c1", "6f80e8", "88a4ff"], ["8f665b", "b28768", "c9a58f"], ["4c5878", "768a9a", "a0b0c8"]]) ["5757c1", "6f80e8", "88a4ff"], ["8f665b", "b28768", "c9a58f"], ["4c5878", "768a9a", "a0b0c8"]])