Fix build errors

This commit is contained in:
thepaperpilot 2022-12-23 08:55:36 -06:00
parent dcabdac385
commit d43899e938

View file

@ -206,7 +206,10 @@ const factory = createLayer(id, () => {
createMultiplicativeModifier(() => ({ createMultiplicativeModifier(() => ({
multiplier: Decimal.lt(energyEfficiency.value, 1) multiplier: Decimal.lt(energyEfficiency.value, 1)
? 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", description: "Brighter work rooms",
enabled: () => upgrades[2][0].bought.value enabled: () => upgrades[2][0].bought.value
})), })),
@ -287,17 +290,29 @@ const factory = createLayer(id, () => {
// ---------------------------------------------- Components // ---------------------------------------------- Components
function generateComponentDescription(declaration: FactoryComponentDeclaration) { function generateComponentDescription(declaration: FactoryComponentDeclaration) {
let str = declaration.inputs === undefined ? "Produces " : "Turns "; let str = declaration.inputs === undefined ? "Produces " : "Turns ";
if (declaration.inputs !== undefined) { if (declaration.inputs !== undefined) {
str += formatList(Object.entries(declaration.inputs) str +=
.map(x => formatWhole(unref(x[1].amount)) + " " + RESOURCES[x[0] as ResourceNames].name)) + " into "; formatList(
Object.entries(declaration.inputs).map(
x =>
formatWhole(unref(x[1].amount)) +
" " +
RESOURCES[x[0] as ResourceNames].name
)
) + " into ";
} }
if (declaration.outputs !== undefined) { if (declaration.outputs !== undefined) {
str += formatList(Object.entries(declaration.outputs) str +=
.map(x => formatWhole(unref(x[1].amount)) + " " + RESOURCES[x[0] as ResourceNames].name)) + " per tick."; formatList(
Object.entries(declaration.outputs).map(
x =>
formatWhole(unref(x[1].amount)) +
" " +
RESOURCES[x[0] as ResourceNames].name
)
) + " per tick.";
} }
return str; return str;
} }
@ -569,7 +584,9 @@ const factory = createLayer(id, () => {
key: "shift+8", key: "shift+8",
name: "Circuit Board Manufacturer", name: "Circuit Board Manufacturer",
type: "processor", type: "processor",
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.circuitBoard)), description: computed(() =>
generateComponentDescription(FACTORY_COMPONENTS.circuitBoard)
),
energyCost: 2, energyCost: 2,
tick: 1, tick: 1,
inputs: { inputs: {
@ -691,7 +708,9 @@ const factory = createLayer(id, () => {
key: "ctrl+5", key: "ctrl+5",
name: "Shovel and Pail Maker", name: "Shovel and Pail Maker",
type: "processor", type: "processor",
description: computed(() => generateComponentDescription(FACTORY_COMPONENTS.bucketShovel)), description: computed(() =>
generateComponentDescription(FACTORY_COMPONENTS.bucketShovel)
),
energyCost: 20, energyCost: 20,
tick: 1, tick: 1,
inputs: { inputs: {
@ -1548,7 +1567,11 @@ const factory = createLayer(id, () => {
lastProdTimes: !isConveyor ? (reactive([]) as number[]) : undefined, lastProdTimes: !isConveyor ? (reactive([]) as number[]) : undefined,
lastFactoryProd: !isConveyor lastFactoryProd: !isConveyor
? Date.now() - ? Date.now() -
1000 * Decimal.div(data.ticksDone ?? 0, computedActualTickRate.value).toNumber() 1000 *
Decimal.div(
(data as FactoryComponentProcessor).ticksDone ?? 0,
computedActualTickRate.value
).toNumber()
: undefined, : undefined,
average: !isConveyor average: !isConveyor
? computed(() => { ? computed(() => {
@ -1914,32 +1937,41 @@ const factory = createLayer(id, () => {
compInternalHovered.value.type !== "conveyor" ? ( compInternalHovered.value.type !== "conveyor" ? (
<> <>
{showStockAmount( {showStockAmount(
compHovered.value.inputStock, (compHovered.value as FactoryComponentProcessor).inputStock,
FACTORY_COMPONENTS[compHovered.value.type].inputs, FACTORY_COMPONENTS[compHovered.value.type].inputs,
"Inputs:" "Inputs:"
)} )}
{showStockAmount( {showStockAmount(
compHovered.value.outputStock, (compHovered.value as FactoryComponentProcessor).outputStock,
FACTORY_COMPONENTS[compHovered.value.type].outputs, FACTORY_COMPONENTS[compHovered.value.type].outputs,
"Outputs:", "Outputs:",
false false
)} )}
<br /> <br />
Efficency:{" "} Efficency:{" "}
{compInternalHovered.value.average.value !== undefined ? ( {(compInternalHovered.value as FactoryInternalProcessor).average.value !==
undefined ? (
<span <span
style={{ style={{
color: color:
compInternalHovered.value.average.value > 1 (compInternalHovered.value as FactoryInternalProcessor)
.average.value! > 1
? "purple" ? "purple"
: compInternalHovered.value.average.value >= 0.9 : (
compInternalHovered.value as FactoryInternalProcessor
).average.value! >= 0.9
? "green" ? "green"
: compInternalHovered.value.average.value >= 0.5 : (
compInternalHovered.value as FactoryInternalProcessor
).average.value! >= 0.5
? "yellow" ? "yellow"
: "red" : "red"
}} }}
> >
{formatWhole(compInternalHovered.value.average.value * 100)} {formatWhole(
(compInternalHovered.value as FactoryInternalProcessor).average
.value! * 100
)}
</span> </span>
) : ( ) : (
"--" "--"