Fill in portal generator based on affordability

This commit is contained in:
thepaperpilot 2023-05-14 10:27:54 -05:00
parent 852050f474
commit d64610f7e0

View file

@ -590,6 +590,21 @@ export const portalGenerator = {
}
main.board.selectedNode.value = node;
},
progress: node =>
(node.state as unknown as PortalGeneratorState).tier == null
? 0
: Decimal.div(
Decimal.sqrt(main.energy.value),
Decimal.sqrt(main.computedPortalCost.value)
)
.clampMax(1)
.toNumber(),
progressDisplay: ProgressDisplay.Fill,
progressColor: node =>
(node.state as unknown as PortalGeneratorState).tier != null &&
Decimal.gte(main.energy.value, main.computedPortalCost.value)
? "var(--accent2)"
: "var(--foreground)",
draggable: true
} as NodeTypeOptions;