From 231902aec51986f90795ce63dcc96b601631f06b Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 28 Sep 2020 11:02:53 -0400 Subject: [PATCH] Fixed #2756 --- core/src/mindustry/graphics/BlockRenderer.java | 16 +++++++++++----- .../mindustry/world/blocks/power/PowerNode.java | 3 +-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/src/mindustry/graphics/BlockRenderer.java b/core/src/mindustry/graphics/BlockRenderer.java index 99996f09eb..c65b3cae7c 100644 --- a/core/src/mindustry/graphics/BlockRenderer.java +++ b/core/src/mindustry/graphics/BlockRenderer.java @@ -35,7 +35,7 @@ public class BlockRenderer implements Disposable{ private FrameBuffer dark = new FrameBuffer(); private Seq outArray2 = new Seq<>(); private Seq 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); } } diff --git a/core/src/mindustry/world/blocks/power/PowerNode.java b/core/src/mindustry/world/blocks/power/PowerNode.java index 3751f9d152..5d4431afef 100644 --- a/core/src/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/mindustry/world/blocks/power/PowerNode.java @@ -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); }