This commit is contained in:
Anuken
2020-08-05 09:47:11 -04:00
parent 75eed2926a
commit 54d37b63b3
11 changed files with 42 additions and 22 deletions

View File

@@ -40,6 +40,7 @@ public class PowerNode extends PowerBlock{
configurable = true;
consumesPower = false;
outputsPower = false;
config(Integer.class, (entity, value) -> {
PowerModule power = entity.power;
Building other = world.build(value);
@@ -80,12 +81,20 @@ public class PowerNode extends PowerBlock{
config(Point2[].class, (tile, value) -> {
tile.power.links.clear();
IntSeq old = new IntSeq(tile.power.links);
//clear old
for(int i = 0; i < old.size; i++){
int cur = old.get(i);
configurations.get(Integer.class).get(tile, cur);
}
//set new
for(Point2 p : value){
if(tile.power.links.size < maxNodes){
tile.power.links.add(Point2.pack(p.x + tile.tileX(), p.y + tile.tileY()));
}
int newPos = Point2.pack(p.x + tile.tileX(), p.y + tile.tileY());
configurations.get(Integer.class).get(tile, newPos);
}
tile.updatePowerGraph();
});
}