Skip to content

Commit

Permalink
fixed error on wire blocks blown up
Browse files Browse the repository at this point in the history
fixed error on blowing up wires without energy node
  • Loading branch information
MineExplorer committed Jun 12, 2021
1 parent ad8fd0a commit bbeb2b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions library/energy-net.js
Expand Up @@ -640,8 +640,10 @@ var EnergyGridBuilder;
Callback.addCallback("PopBlockResources", function (coords, block, f, i, region) {
if (EnergyRegistry.isWire(block.id)) {
var node = EnergyNet.getNodeOnCoords(region, coords.x, coords.y, coords.z);
node.removeCoords(coords.x, coords.y, coords.z);
node.rebuild = true;
if (node) {
node.removeCoords(coords.x, coords.y, coords.z);
node.rebuild = true;
}
}
});
})(EnergyGridBuilder || (EnergyGridBuilder = {}));
Expand Down
6 changes: 4 additions & 2 deletions source/energy-net/EnergyGridBuilder.ts
Expand Up @@ -89,8 +89,10 @@ namespace EnergyGridBuilder {
Callback.addCallback("PopBlockResources", function(coords: Vector, block: Tile, f: number, i: number, region: BlockSource) {
if (EnergyRegistry.isWire(block.id)) {
let node = EnergyNet.getNodeOnCoords(region, coords.x, coords.y, coords.z) as EnergyGrid;
node.removeCoords(coords.x, coords.y, coords.z);
node.rebuild = true;
if (node) {
node.removeCoords(coords.x, coords.y, coords.z);
node.rebuild = true;
}
}
});
}

0 comments on commit bbeb2b9

Please sign in to comment.