diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/storage/BasicStorageGraphNode.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/storage/BasicStorageGraphNode.kt index c03431184..0b880d52e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/storage/BasicStorageGraphNode.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/storage/BasicStorageGraphNode.kt @@ -30,7 +30,7 @@ open class BasicStorageGraphNode(private val energyDemander: IMatteryEnergyStora override fun attachComponents(to: StorageNetworkGraph) { if (energyDemander != null) { - if (!demandingEnergy && energyDemander.missingPower.isPositive) { + if (energyDemander.missingPower.isPositive) { demandingEnergy = true to.powerDemandingNodes.add(energyDemander) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/storage/IStorageGraphNode.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/storage/IStorageGraphNode.kt index 9772cd605..4362f1b55 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/storage/IStorageGraphNode.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/storage/IStorageGraphNode.kt @@ -11,6 +11,9 @@ interface IStorageGraphNode { /** * Called by storage graph on node being detached from it + * + * This is NOT called when graph is being destroyed (e.g. even by merging + * with another graph). */ fun removeComponents(from: StorageNetworkGraph)