Battery Graphical Updates (#8323)
* Battery Graphical Updates * Add the vanilla fields back * Add back topRegion and depricate it
This commit is contained in:
@@ -4,18 +4,24 @@ import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.draw.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Battery extends PowerDistributor{
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
public DrawBlock drawer;
|
||||
|
||||
public Color emptyLightColor = Color.valueOf("f8c266");
|
||||
public Color fullLightColor = Color.valueOf("fb9567");
|
||||
|
||||
@Deprecated
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
|
||||
public Battery(String name){
|
||||
super(name);
|
||||
outputsPower = true;
|
||||
@@ -29,14 +35,54 @@ public class Battery extends PowerDistributor{
|
||||
update = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
|
||||
if(drawer == null){
|
||||
drawer = new DrawMulti(new DrawDefault(), new DrawPower(){{
|
||||
emptyLightColor = Battery.this.emptyLightColor;
|
||||
fullLightColor = Battery.this.fullLightColor;
|
||||
}}, new DrawRegion("-top"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
drawer.load(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawer.drawPlan(this, plan, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(){
|
||||
return drawer.finalIcons(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRegionsToOutline(Seq<TextureRegion> out){
|
||||
drawer.getRegionsToOutline(this, out);
|
||||
}
|
||||
|
||||
public class BatteryBuild extends Building{
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.color(emptyLightColor, fullLightColor, power.status);
|
||||
Fill.square(x, y, (tilesize * size / 2f - 1) * Draw.xscl);
|
||||
Draw.color();
|
||||
drawer.draw(this);
|
||||
}
|
||||
|
||||
Draw.rect(topRegion, x, y);
|
||||
@Override
|
||||
public void drawLight(){
|
||||
super.drawLight();
|
||||
drawer.drawLight(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float warmup(){
|
||||
return power.status;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user