From d43899e938237bec2f1a2471b3fe1d37d4e204d4 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Fri, 23 Dec 2022 08:55:36 -0600 Subject: [PATCH] Fix build errors --- src/data/layers/factory.tsx | 66 +++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/src/data/layers/factory.tsx b/src/data/layers/factory.tsx index 1884ca7..f7f6b51 100644 --- a/src/data/layers/factory.tsx +++ b/src/data/layers/factory.tsx @@ -206,7 +206,10 @@ const factory = createLayer(id, () => { createMultiplicativeModifier(() => ({ multiplier: Decimal.lt(energyEfficiency.value, 1) ? 1 - : Decimal.sub(2, Decimal.div(energyConsumption.value, Decimal.max(computedEnergy.value, 1))), + : Decimal.sub( + 2, + Decimal.div(energyConsumption.value, Decimal.max(computedEnergy.value, 1)) + ), description: "Brighter work rooms", enabled: () => upgrades[2][0].bought.value })), @@ -287,17 +290,29 @@ const factory = createLayer(id, () => { // ---------------------------------------------- Components - function generateComponentDescription(declaration: FactoryComponentDeclaration) { - let str = declaration.inputs === undefined ? "Produces " : "Turns "; if (declaration.inputs !== undefined) { - str += formatList(Object.entries(declaration.inputs) - .map(x => formatWhole(unref(x[1].amount)) + " " + RESOURCES[x[0] as ResourceNames].name)) + " into "; + str += + formatList( + Object.entries(declaration.inputs).map( + x => + formatWhole(unref(x[1].amount)) + + " " + + RESOURCES[x[0] as ResourceNames].name + ) + ) + " into "; } if (declaration.outputs !== undefined) { - str += formatList(Object.entries(declaration.outputs) - .map(x => formatWhole(unref(x[1].amount)) + " " + RESOURCES[x[0] as ResourceNames].name)) + " per tick."; + str += + formatList( + Object.entries(declaration.outputs).map( + x => + formatWhole(unref(x[1].amount)) + + " " + + RESOURCES[x[0] as ResourceNames].name + ) + ) + " per tick."; } return str; } @@ -569,7 +584,9 @@ const factory = createLayer(id, () => { key: "shift+8", name: "Circuit Board Manufacturer", type: "processor", - description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.circuitBoard)), + description: computed(() => + generateComponentDescription(FACTORY_COMPONENTS.circuitBoard) + ), energyCost: 2, tick: 1, inputs: { @@ -691,7 +708,9 @@ const factory = createLayer(id, () => { key: "ctrl+5", name: "Shovel and Pail Maker", type: "processor", - description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.bucketShovel)), + description: computed(() => + generateComponentDescription(FACTORY_COMPONENTS.bucketShovel) + ), energyCost: 20, tick: 1, inputs: { @@ -1548,7 +1567,11 @@ const factory = createLayer(id, () => { lastProdTimes: !isConveyor ? (reactive([]) as number[]) : undefined, lastFactoryProd: !isConveyor ? Date.now() - - 1000 * Decimal.div(data.ticksDone ?? 0, computedActualTickRate.value).toNumber() + 1000 * + Decimal.div( + (data as FactoryComponentProcessor).ticksDone ?? 0, + computedActualTickRate.value + ).toNumber() : undefined, average: !isConveyor ? computed(() => { @@ -1914,32 +1937,41 @@ const factory = createLayer(id, () => { compInternalHovered.value.type !== "conveyor" ? ( <> {showStockAmount( - compHovered.value.inputStock, + (compHovered.value as FactoryComponentProcessor).inputStock, FACTORY_COMPONENTS[compHovered.value.type].inputs, "Inputs:" )} {showStockAmount( - compHovered.value.outputStock, + (compHovered.value as FactoryComponentProcessor).outputStock, FACTORY_COMPONENTS[compHovered.value.type].outputs, "Outputs:", false )}
Efficency:{" "} - {compInternalHovered.value.average.value !== undefined ? ( + {(compInternalHovered.value as FactoryInternalProcessor).average.value !== + undefined ? ( 1 + (compInternalHovered.value as FactoryInternalProcessor) + .average.value! > 1 ? "purple" - : compInternalHovered.value.average.value >= 0.9 + : ( + compInternalHovered.value as FactoryInternalProcessor + ).average.value! >= 0.9 ? "green" - : compInternalHovered.value.average.value >= 0.5 + : ( + compInternalHovered.value as FactoryInternalProcessor + ).average.value! >= 0.5 ? "yellow" : "red" }} > - {formatWhole(compInternalHovered.value.average.value * 100)} + {formatWhole( + (compInternalHovered.value as FactoryInternalProcessor).average + .value! * 100 + )} ) : ( "--"