Cytopia icon indicating copy to clipboard operation
Cytopia copied to clipboard

Calculating power usage of buildings with no power

Open SimplyLiz opened this issue 2 years ago • 0 comments

In PowerManager, each conductive node is added, represented by coordinates and powerLevel. So it can happen that there are duplicate entries when a zone and a building on top is added. For all buildings besides power plants, power production is 0. But should be set to 0.

We should change the way nodes are added. When something is placed or demolish, check if the mapNode.isConductive() flag is still true, and add or remove it. So we won't have duplicates and don't have to care about what is on the node. When we calculate power levels, we can then check if the buildings layer is occupied and use power usage -1 then

SimplyLiz avatar May 29 '22 18:05 SimplyLiz