diff --git a/src/data/layers/Factory.vue b/src/data/layers/Factory.vue index a9ef034..6d2c2b5 100644 --- a/src/data/layers/Factory.vue +++ b/src/data/layers/Factory.vue @@ -10,7 +10,7 @@ const element = shallowRef(null); const props = defineProps<{ application: Application; }>(); -console.log(props.application); + onMounted(() => { if (element.value !== null) { element.value?.append(props.application.view); diff --git a/src/data/layers/factory.tsx b/src/data/layers/factory.tsx index 1e0258d..c1cbede 100644 --- a/src/data/layers/factory.tsx +++ b/src/data/layers/factory.tsx @@ -65,6 +65,8 @@ const id = "factory"; // what is the actual day? const day = 18; +const toyGoal = 1e3; + // 20x20 block size // TODO: unhardcode stuff @@ -129,16 +131,16 @@ const factory = createLayer(id, () => { .map(c => FACTORY_COMPONENTS[c.type]?.energyCost ?? 0) .reduce((a, b) => a + b, 0) ); + const energyEfficiency = computed(() => + Decimal.div(energyConsumption.value, computedEnergy.value).recip().pow(2).min(1) + ); const tickRate = createSequentialModifier(() => [ createMultiplicativeModifier(() => ({ multiplier: elvesEffect, description: "Trained Elves" })), createMultiplicativeModifier(() => ({ - multiplier: Decimal.div(energyConsumption.value, computedEnergy.value) - .recip() - .pow(2) - .min(1), + multiplier: energyEfficiency, description: "Energy Consumption", enabled: () => Decimal.gt(energyConsumption.value, computedEnergy.value) })) @@ -166,8 +168,8 @@ const factory = createLayer(id, () => {
{formatWhole(energyConsumption.value)} / {formatWhole(computedEnergy.value)}{" "} energy used - {Decimal.lt(tickRate.value, 1) ? ( - <>{" (" + format(Decimal.mul(tickRate.value, 100))}% efficiency) + {Decimal.gt(energyConsumption.value, computedEnergy.value) ? ( + <>{" (" + format(Decimal.mul(energyEfficiency.value, 100))}% efficiency) ) : ( "" )} @@ -1325,7 +1327,7 @@ const factory = createLayer(id, () => { <>
{main.day.value === day - ? `Do something to complete the day` + ? `Reach ${format(toyGoal)} for each toy to complete the day` : `${name} Complete!`}{" "} -{" "}