carbide crucible implementation
This commit is contained in:
@@ -49,8 +49,8 @@ public class DrawArcSmelter extends DrawBlock{
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
Draw.rect(top, build.x, build.y);
|
||||
Draw.rect(build.block.region, build.x, build.y);
|
||||
if(top.found()) Draw.rect(top, build.x, build.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
72
core/src/mindustry/world/draw/DrawCrucible.java
Normal file
72
core/src/mindustry/world/draw/DrawCrucible.java
Normal file
@@ -0,0 +1,72 @@
|
||||
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.world.*;
|
||||
import mindustry.world.blocks.production.GenericCrafter.*;
|
||||
|
||||
//TODO
|
||||
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;
|
||||
|
||||
public float alpha = 0.5f;
|
||||
public int particles = 30;
|
||||
public float particleLife = 70f, particleRad = 7f, particleSize = 3f, fadeMargin = 0.4f;
|
||||
public Interp particleInterp = new PowIn(1.5f);
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterBuild build){
|
||||
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.color(midColor, a);
|
||||
Fill.circle(build.x, build.y, flameRad + si);
|
||||
|
||||
Draw.color(flameColor, a);
|
||||
Lines.circle(build.x, build.y, (flameRad + circleSpace + si) * build.warmup);
|
||||
|
||||
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 angle = rand.random(360f);
|
||||
float len = particleRad * particleInterp.apply(fout);
|
||||
Draw.alpha(a * (1f - Mathf.curve(fin, 1f - fadeMargin)));
|
||||
Fill.circle(
|
||||
build.x + Angles.trnsx(angle, len),
|
||||
build.y + Angles.trnsy(angle, len),
|
||||
particleSize * fin * build.warmup
|
||||
);
|
||||
}
|
||||
|
||||
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};
|
||||
}
|
||||
}
|
||||
41
core/src/mindustry/world/draw/DrawHeat.java
Normal file
41
core/src/mindustry/world/draw/DrawHeat.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package mindustry.world.draw;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.production.GenericCrafter.*;
|
||||
import mindustry.world.blocks.production.HeatCrafter.*;
|
||||
|
||||
public class DrawHeat extends DrawBlock{
|
||||
public Color heatColor = new Color(1f, 0.22f, 0.22f, 0.8f);
|
||||
public float heatPulse = 0.3f, heatPulseScl = 10f;
|
||||
|
||||
public TextureRegion heat;
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterBuild build){
|
||||
|
||||
Draw.z(Layer.blockAdditive);
|
||||
if(build instanceof HeatCrafterBuild hc){
|
||||
for(int i = 0; i < 4; i++){
|
||||
if(hc.sideHeat[i] > 0){
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.color(heatColor, hc.sideHeat[i] / hc.heatRequirement() * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse))));
|
||||
Draw.rect(heat, build.x, build.y, i * 90f);
|
||||
Draw.blend();
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
}
|
||||
Draw.z(Layer.block);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Block block){
|
||||
heat = Core.atlas.find(block.name + "-heat");
|
||||
}
|
||||
}
|
||||
45
core/src/mindustry/world/draw/DrawMulti.java
Normal file
45
core/src/mindustry/world/draw/DrawMulti.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package mindustry.world.draw;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.production.GenericCrafter.*;
|
||||
|
||||
/** combined several DrawBlocks into one */
|
||||
public class DrawMulti extends DrawBlock{
|
||||
public DrawBlock[] drawers = {};
|
||||
/** specifies the drawer index that sources the icon (since there can only be one icon source) */
|
||||
public int iconIndex = 0;
|
||||
|
||||
public DrawMulti(){
|
||||
}
|
||||
|
||||
public DrawMulti(DrawBlock... drawers){
|
||||
this.drawers = drawers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterBuild build){
|
||||
for(var draw : drawers){
|
||||
draw.draw(build);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLight(GenericCrafterBuild build){
|
||||
for(var draw : drawers){
|
||||
draw.drawLight(build);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Block block){
|
||||
for(var draw : drawers){
|
||||
draw.load(block);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(Block block){
|
||||
return drawers.length <= iconIndex ? super.icons(block) : drawers[iconIndex].icons(block);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user