Fixed #4064
This commit is contained in:
@@ -194,6 +194,7 @@ public class LogicBlock extends Block{
|
|||||||
public LExecutor executor = new LExecutor();
|
public LExecutor executor = new LExecutor();
|
||||||
public float accumulator = 0;
|
public float accumulator = 0;
|
||||||
public Seq<LogicLink> links = new Seq<>();
|
public Seq<LogicLink> links = new Seq<>();
|
||||||
|
public boolean checkedDuplicates = false;
|
||||||
|
|
||||||
public void readCompressed(byte[] data, boolean relative){
|
public void readCompressed(byte[] data, boolean relative){
|
||||||
DataInputStream stream = new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(data)));
|
DataInputStream stream = new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(data)));
|
||||||
@@ -362,6 +363,21 @@ public class LogicBlock extends Block{
|
|||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
executor.team = team;
|
executor.team = team;
|
||||||
|
|
||||||
|
if(!checkedDuplicates){
|
||||||
|
checkedDuplicates = true;
|
||||||
|
var removal = new IntSet();
|
||||||
|
var removeLinks = new Seq<LogicLink>();
|
||||||
|
for(var link : links){
|
||||||
|
var build = world.build(link.x, link.y);
|
||||||
|
if(build != null){
|
||||||
|
if(!removal.add(build.id)){
|
||||||
|
removeLinks.add(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
links.removeAll(removeLinks);
|
||||||
|
}
|
||||||
|
|
||||||
//check for previously invalid links to add after configuration
|
//check for previously invalid links to add after configuration
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
@@ -371,7 +387,7 @@ public class LogicBlock extends Block{
|
|||||||
if(!l.active) continue;
|
if(!l.active) continue;
|
||||||
|
|
||||||
boolean valid = validLink(world.build(l.x, l.y));
|
boolean valid = validLink(world.build(l.x, l.y));
|
||||||
if(valid != l.valid ){
|
if(valid != l.valid){
|
||||||
changed = true;
|
changed = true;
|
||||||
l.valid = valid;
|
l.valid = valid;
|
||||||
if(valid){
|
if(valid){
|
||||||
|
|||||||
Reference in New Issue
Block a user