conductsTo() returning whether to conduct itself to adjacent builds (#4354)

* conductsTo

* insulated block no longer conducts

* moved both checks to be symmetrical
This commit is contained in:
Sunny Kim
2021-01-18 17:45:45 -05:00
committed by GitHub
parent 2da128678a
commit f91910e84f
@@ -779,6 +779,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
power.links.clear(); power.links.clear();
} }
public boolean conductsTo(Building other){
return !block.insulated;
}
public Seq<Building> getPowerConnections(Seq<Building> out){ public Seq<Building> getPowerConnections(Seq<Building> out){
out.clear(); out.clear();
if(power == null) return out; if(power == null) return out;
@@ -786,7 +790,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
for(Building other : proximity){ for(Building other : proximity){
if(other != null && other.power != null if(other != null && other.power != null
&& !(block.consumesPower && other.block.consumesPower && !block.outputsPower && !other.block.outputsPower) && !(block.consumesPower && other.block.consumesPower && !block.outputsPower && !other.block.outputsPower)
&& !power.links.contains(other.pos())){ && conductsTo(other) && other.conductsTo(self()) && !power.links.contains(other.pos())){
out.add(other); out.add(other);
} }
} }