Many crazy things
This commit is contained in:
@@ -2,7 +2,10 @@ package mindustry.world.draw;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.blocks.production.GenericCrafter.*;
|
||||
|
||||
/** An implementation of custom rendering behavior for a crafter block.
|
||||
@@ -20,6 +23,11 @@ public class DrawBlock{
|
||||
|
||||
}
|
||||
|
||||
/** Draws the planned version of this block. */
|
||||
public void drawPlan(GenericCrafter crafter, BuildPlan plan, Eachable<BuildPlan> list){
|
||||
crafter.drawPlanBase(plan, list);
|
||||
}
|
||||
|
||||
/** Load any relevant texture regions. */
|
||||
public void load(Block block){
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package mindustry.world.draw;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.heat.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.blocks.production.GenericCrafter.*;
|
||||
|
||||
public class DrawHeatOutput extends DrawBlock{
|
||||
public TextureRegion heat, glow, top1, top2;
|
||||
|
||||
public Color heatColor = new Color(1f, 0.22f, 0.22f, 0.8f);
|
||||
public float heatPulse = 0.3f, heatPulseScl = 10f, glowMult = 1.2f;
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterBuild build){
|
||||
Draw.rect(build.block.region, build.x, build.y);
|
||||
|
||||
Draw.rect(build.rotation > 1 ? top2 : top1, build.x, build.y, build.rotdeg());
|
||||
|
||||
if(build instanceof HeatBlock heater && heater.heat() > 0){
|
||||
Draw.z(Layer.blockAdditive);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.color(heatColor, heater.heatFrac() * (heatColor.a * (1f - heatPulse + Mathf.absin(heatPulseScl, heatPulse))));
|
||||
Draw.rect(heat, build.x, build.y, build.rotdeg());
|
||||
Draw.color(Draw.getColor().mul(glowMult));
|
||||
Draw.rect(glow, build.x, build.y);
|
||||
Draw.blend();
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPlan(GenericCrafter block, BuildPlan plan, Eachable<BuildPlan> list){
|
||||
Draw.rect(block.region, plan.drawx(), plan.drawy());
|
||||
Draw.rect(plan.rotation > 1 ? top2 : top1, plan.drawx(), plan.drawy(), plan.rotation * 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Block block){
|
||||
heat = Core.atlas.find(block.name + "-heat");
|
||||
glow = Core.atlas.find(block.name + "-glow");
|
||||
top1 = Core.atlas.find(block.name + "-top1");
|
||||
top2 = Core.atlas.find(block.name + "-top2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(Block block){
|
||||
return new TextureRegion[]{block.region, top1};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user