why is this hardcoded anyway (#7617)

This commit is contained in:
null 2022-09-24 13:49:54 +02:00 committed by GitHub
parent c818611bb4
commit fd0d4fb097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,10 +12,15 @@ import mindustry.world.blocks.production.HeatCrafter.*;
public class DrawHeatRegion extends DrawBlock{ public class DrawHeatRegion extends DrawBlock{
public Color color = new Color(1f, 0.22f, 0.22f, 0.8f); public Color color = new Color(1f, 0.22f, 0.22f, 0.8f);
public float pulse = 0.3f, pulseScl = 10f; public float pulse = 0.3f, pulseScl = 10f;
public float layer = Layer.blockAdditive;
public TextureRegion heat; public TextureRegion heat;
public String suffix = "-glow"; public String suffix = "-glow";
public DrawHeatRegion(float layer){
this.layer = layer;
}
public DrawHeatRegion(String suffix){ public DrawHeatRegion(String suffix){
this.suffix = suffix; this.suffix = suffix;
} }
@ -27,13 +32,16 @@ public class DrawHeatRegion extends DrawBlock{
public void draw(Building build){ public void draw(Building build){
Draw.z(Layer.blockAdditive); Draw.z(Layer.blockAdditive);
if(build instanceof HeatCrafterBuild hc && hc.heat > 0){ if(build instanceof HeatCrafterBuild hc && hc.heat > 0){
float z = Draw.z();
if(layer > 0) Draw.z(layer);
Draw.blend(Blending.additive); Draw.blend(Blending.additive);
Draw.color(color, Mathf.clamp(hc.heat / hc.heatRequirement()) * (color.a * (1f - pulse + Mathf.absin(pulseScl, pulse)))); 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.rect(heat, build.x, build.y);
Draw.blend(); Draw.blend();
Draw.color(); Draw.color();
Draw.z(z);
} }
Draw.z(Layer.block);
} }
@Override @Override