Fill factory based on affordability

This commit is contained in:
thepaperpilot 2023-04-23 23:02:13 -05:00
parent 3c8f1be7d4
commit e9d4adda9c

View file

@ -652,6 +652,18 @@ export const main = createLayer("main", function (this: BaseLayer) {
: { text: "Cannot afford", color: "var(--danger)" }
}
],
progress: node =>
node.state == null || toolNodes.value[node.state as Resources] != null
? 0
: Decimal.div(energy.value, tools[node.state as Resources].cost)
.clampMax(1)
.toNumber(),
progressDisplay: ProgressDisplay.Fill,
progressColor: node =>
node.state != null &&
Decimal.gte(energy.value, tools[node.state as Resources].cost)
? "var(--accent2)"
: "var(--foreground)",
canAccept(node, otherNode) {
return otherNode.type === "resource";
},
@ -808,7 +820,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
actionDistance: Math.PI / 4,
actions: [
deselectAllAction,
getIncreaseConnectionsAction(x => x.add(2).pow_base(10000), 16),
getIncreaseConnectionsAction(x => x.add(3).pow_base(1000), 16),
togglePoweredAction
],
canAccept: canAcceptTool,