Surge crucible effects
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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);
|
||||
|
||||
49
core/src/mindustry/entities/effect/RadialEffect.java
Normal file
49
core/src/mindustry/entities/effect/RadialEffect.java
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -123,6 +123,7 @@ public class Pal{
|
||||
muddy = Color.valueOf("432722"),
|
||||
|
||||
redLight = Color.valueOf("feb380"),
|
||||
slagOrange = Color.valueOf("ffa166"),
|
||||
|
||||
vent = Color.valueOf("6b4e4e");
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
44
core/src/mindustry/world/draw/DrawCircles.java
Normal file
44
core/src/mindustry/world/draw/DrawCircles.java
Normal 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();
|
||||
}
|
||||
}
|
||||
46
core/src/mindustry/world/draw/DrawHeatRegion.java
Normal file
46
core/src/mindustry/world/draw/DrawHeatRegion.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user