Cyanogen synthesis retexture
This commit is contained in:
@@ -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", ""};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Renderer implements ApplicationListener{
|
||||
public Seq<EnvRenderer> envRenderers = new Seq<>();
|
||||
public ObjectMap<String, Runnable> 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);
|
||||
|
||||
@@ -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<BuildPlan> 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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<BuildPlan> list){}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
36
core/src/mindustry/world/draw/DrawLiquidTile.java
Normal file
36
core/src/mindustry/world/draw/DrawLiquidTile.java
Normal file
@@ -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<BuildPlan> 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);
|
||||
}
|
||||
}
|
||||
@@ -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)));
|
||||
Reference in New Issue
Block a user