Implemented #1335
Before Width: | Height: | Size: 347 B |
BIN
core/assets-raw/sprites/blocks/power/solar/solar-panel-0.png
Normal file
After Width: | Height: | Size: 944 B |
BIN
core/assets-raw/sprites/blocks/power/solar/solar-panel-1.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
core/assets-raw/sprites/blocks/power/solar/solar-panel-2.png
Normal file
After Width: | Height: | Size: 513 B |
BIN
core/assets-raw/sprites/blocks/power/solar/solar-panel-3.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
core/assets-raw/sprites/blocks/power/solar/solar-panel-4.png
Normal file
After Width: | Height: | Size: 943 B |
BIN
core/assets-raw/sprites/blocks/power/solar/solar-panel-5.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
core/assets-raw/sprites/blocks/power/solar/solar-panel-6.png
Normal file
After Width: | Height: | Size: 522 B |
BIN
core/assets-raw/sprites/blocks/power/solar/solar-panel-7.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
core/assets-raw/sprites/blocks/power/solar/solar-panel.png
Normal file
After Width: | Height: | Size: 1002 B |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 181 KiB After Width: | Height: | Size: 184 KiB |
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 186 KiB |
@ -1141,7 +1141,7 @@ public class Blocks implements ContentList{
|
||||
itemDuration = 500f;
|
||||
}};
|
||||
|
||||
solarPanel = new SolarGenerator("solar-panel"){{
|
||||
solarPanel = new SeamlessSolarGenerator("solar-panel"){{
|
||||
requirements(Category.power, with(Items.lead, 10, Items.silicon, 15));
|
||||
powerProduction = 0.06f;
|
||||
}};
|
||||
|
@ -0,0 +1,64 @@
|
||||
package mindustry.world.blocks.power;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class SeamlessSolarGenerator extends SolarGenerator{
|
||||
@Load(value = "@-#", length = 8)
|
||||
public TextureRegion[] edges;
|
||||
|
||||
public SeamlessSolarGenerator(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextureRegion[] icons(){
|
||||
return new TextureRegion[]{Core.atlas.find(name + "-icon")};
|
||||
}
|
||||
|
||||
public class SeamlessSolarGeneratorEntity extends SolarGeneratorEntity{
|
||||
boolean up, right, down, left;
|
||||
|
||||
@Override
|
||||
public void onProximityUpdate(){
|
||||
super.onProximityUpdate();
|
||||
|
||||
up = foreign(tile, 0, 1);
|
||||
right = foreign(tile, 1, 0);
|
||||
down = foreign(tile, 0, -1);
|
||||
left = foreign(tile, -1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
// outside edges
|
||||
if(up) Draw.rect(edges[0], x, y);
|
||||
if(right) Draw.rect(edges[2], x, y);
|
||||
if(down) Draw.rect(edges[4], x, y);
|
||||
if(left) Draw.rect(edges[6], x, y);
|
||||
|
||||
// outside corners
|
||||
if(up && right) Draw.rect(edges[1], x, y);
|
||||
if(right && down) Draw.rect(edges[3], x, y);
|
||||
if(down && left) Draw.rect(edges[5], x, y);
|
||||
if(left && up) Draw.rect(edges[7], x, y);
|
||||
|
||||
//inside corners
|
||||
if(!right && !down && foreign(tile, 1, -1)) Draw.rect(edges[7], x + (tilesize * 0.75f), y - (tilesize * 0.75f));
|
||||
if(!left && !down && foreign(tile, -1, -1)) Draw.rect(edges[1], x - (tilesize * 0.75f), y - (tilesize * 0.75f));
|
||||
if(!left && !up && foreign(tile, -1, 1)) Draw.rect(edges[3], x - (tilesize * 0.75f), y + (tilesize * 0.75f));
|
||||
if(!right && !up && foreign(tile, 1, 1)) Draw.rect(edges[5], x + (tilesize * 0.75f), y + (tilesize * 0.75f));
|
||||
}
|
||||
|
||||
private boolean foreign(Tile tile, int dx, int dy){
|
||||
Tile other = tile.getNearby(dx, dy);
|
||||
return other == null || other.block() != SeamlessSolarGenerator.this;
|
||||
}
|
||||
}
|
||||
}
|