This commit is contained in:
Anuken
2020-09-28 11:02:53 -04:00
parent f1d09053f3
commit 231902aec5
2 changed files with 12 additions and 7 deletions

View File

@@ -35,7 +35,7 @@ public class BlockRenderer implements Disposable{
private FrameBuffer dark = new FrameBuffer();
private Seq<Building> outArray2 = new Seq<>();
private Seq<Tile> shadowEvents = new Seq<>();
private IntSet processedEntities = new IntSet();
private IntSet processedEntities = new IntSet(), processedLinks = new IntSet();
private boolean displayStatus = false;
public BlockRenderer(){
@@ -180,6 +180,7 @@ public class BlockRenderer implements Disposable{
tileview.clear();
lightview.clear();
processedEntities.clear();
processedLinks.clear();
int minx = Math.max(avgx - rangex - expandr, 0);
int miny = Math.max(avgy - rangey - expandr, 0);
@@ -196,10 +197,15 @@ public class BlockRenderer implements Disposable{
tile = tile.build.tile;
}
if(block != Blocks.air && block.cacheLayer == CacheLayer.normal && (tile.build == null || !processedEntities.contains(tile.build.id()))){
if(block != Blocks.air && block.cacheLayer == CacheLayer.normal && (tile.build == null || !processedEntities.contains(tile.build.id))){
if(block.expanded || !expanded){
tileview.add(tile);
if(tile.build != null) processedEntities.add(tile.build.id());
if(tile.build == null || processedLinks.add(tile.build.id)){
tileview.add(tile);
if(tile.build != null){
processedEntities.add(tile.build.id);
processedLinks.add(tile.build.id);
}
}
}
//lights are drawn even in the expanded range
@@ -209,7 +215,7 @@ public class BlockRenderer implements Disposable{
if(tile.build != null && tile.build.power != null && tile.build.power.links.size > 0){
for(Building other : tile.build.getPowerConnections(outArray2)){
if(other.block instanceof PowerNode){ //TODO need a generic way to render connections!
if(other.block instanceof PowerNode && processedLinks.add(other.id)){ //TODO need a generic way to render connections!
tileview.add(other.tile);
}
}

View File

@@ -37,7 +37,6 @@ public class PowerNode extends PowerBlock{
public PowerNode(String name){
super(name);
expanded = true;
configurable = true;
consumesPower = false;
outputsPower = false;
@@ -392,7 +391,7 @@ public class PowerNode extends PowerBlock{
if(!linkValid(this, link)) continue;
if(link.block instanceof PowerNode && !(link.pos() < tile.pos())) continue;
if(link.block instanceof PowerNode && link.id >= id) continue;
drawLaser(team, x, y, link.x, link.y, size, link.block.size);
}