Heat conductor + phase heater

This commit is contained in:
Anuken
2021-12-10 11:31:32 -05:00
parent 761ee12e6f
commit 3e9747c59c
31 changed files with 143 additions and 23 deletions

View File

@@ -4,27 +4,42 @@ import arc.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.world.*;
import mindustry.world.blocks.production.HeatCrafter.*;
import mindustry.world.blocks.heat.*;
/** Not standalone. */
public class DrawHeatInput extends DrawBlock{
public String suffix = "-heat";
public Color heatColor = new Color(1f, 0.22f, 0.22f, 0.8f);
public float heatPulse = 0.3f, heatPulseScl = 10f;
public TextureRegion heat;
public DrawHeatInput(String suffix){
this.suffix = suffix;
}
public DrawHeatInput(){
}
@Override
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
}
@Override
public void drawBase(Building build){
Draw.z(Layer.blockAdditive);
if(build instanceof HeatCrafterBuild hc){
if(build instanceof HeatConsumer hc){
float[] side = hc.sideHeat();
for(int i = 0; i < 4; i++){
if(hc.sideHeat[i] > 0){
if(side[i] > 0){
Draw.blend(Blending.additive);
Draw.color(heatColor, hc.sideHeat[i] / hc.heatRequirement() * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse))));
Draw.color(heatColor, side[i] / hc.heatRequirement() * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse))));
Draw.rect(heat, build.x, build.y, i * 90f);
Draw.blend();
Draw.color();
@@ -37,6 +52,6 @@ public class DrawHeatInput extends DrawBlock{
@Override
public void load(Block block){
heat = Core.atlas.find(block.name + "-heat");
heat = Core.atlas.find(block.name + suffix);
}
}