Merge pull request #1514 from Arkanic/patch-7
make batteries glow based on power contents (a redo that works)
BIN
core/assets-raw/sprites/blocks/power/battery-base.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
core/assets-raw/sprites/blocks/power/battery-icon.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
core/assets-raw/sprites/blocks/power/battery-large-base.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
core/assets-raw/sprites/blocks/power/battery-large-icon.png
Normal file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 751 B After Width: | Height: | Size: 753 B |
Before Width: | Height: | Size: 723 KiB After Width: | Height: | Size: 939 KiB |
Before Width: | Height: | Size: 278 KiB After Width: | Height: | Size: 304 KiB |
Before Width: | Height: | Size: 900 KiB After Width: | Height: | Size: 1001 KiB |
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 187 KiB |
Before Width: | Height: | Size: 262 KiB After Width: | Height: | Size: 333 KiB |
@ -1,10 +1,41 @@
|
||||
package mindustry.world.blocks.power;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.Color;
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class Battery extends PowerDistributor{
|
||||
|
||||
public TextureRegion baseRegion;
|
||||
|
||||
public Color emptyLightColor = Color.valueOf("6e7080");
|
||||
public Color fullLightColor = Color.valueOf("fb9567");
|
||||
|
||||
public Battery(String name){
|
||||
super(name);
|
||||
outputsPower = true;
|
||||
consumesPower = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
|
||||
baseRegion = Core.atlas.find(name + "-base");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
Draw.color(emptyLightColor, fullLightColor, tile.entity.power.status);
|
||||
Draw.rect(baseRegion, tile.drawx(), tile.drawy());
|
||||
Draw.reset();
|
||||
|
||||
super.draw(tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] generateIcons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-icon")};
|
||||
}
|
||||
}
|
||||
|