Bugfix: ignore tanks with nil capacity

master
Tobias Dammers 3 years ago
parent a9fc99b947
commit a4bbd1cd2c

@ -232,8 +232,8 @@ var importFOB = func (ofp) {
amount = math.min(amount, maxAmount);
}
var tankCapacity =
tankNode.getNode('capacity-m3').getValue() *
tankNode.getNode('density-kgpm3').getValue();
(tankNode.getNode('capacity-m3').getValue() or 0) *
(tankNode.getNode('density-kgpm3').getValue() or 0);
amount = math.min(amount, tankCapacity);
logprint(3, sprintf("Allocating %1.1f/%1.1f kg to %s", amount, unallocated, tankName));
tankNode.getNode('level-kg').setValue(amount);

Loading…
Cancel
Save