Fix cable path heuristics

This commit is contained in:
DBotThePony 2025-01-14 18:27:20 +07:00
parent 07121d8b41
commit 436456dcc5
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -99,8 +99,14 @@ class EnergyCableGraph : GraphNodeList<EnergyCableBlockEntity.Node, EnergyCableG
var transferredLastTick = Decimal.ZERO
private set
val availableThroughput: Decimal
get() = throughput - transferredLastTick
val availableThroughput: Decimal get() {
if (!throughputKnown) {
throughput = nodes.maxOf { it.energyThroughput }
throughputKnown = true
}
return throughput - transferredLastTick
}
private var throughputKnown = false
private var lastTick = 0