Fix infinite recursion

This commit is contained in:
Anthony Lawn 2022-12-12 19:40:14 -06:00
parent 872d6208b6
commit 2803a99736

View file

@ -329,9 +329,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
]) as WithRequired<Modifier, "description" | "revert">; ]) as WithRequired<Modifier, "description" | "revert">;
const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0)); const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0));
const lastAutoCuttingAmount = ref<DecimalSource>(0); const lastAutoCuttingAmount = ref<DecimalSource>(0);
watch(computedAutoCuttingAmount, cut => { setInterval(() => watch(computedAutoCuttingAmount, cut => {
lastAutoCuttingAmount.value = cut; lastAutoCuttingAmount.value = cut;
}); }), 0);
const manualPlantingAmount = createSequentialModifier(() => [ const manualPlantingAmount = createSequentialModifier(() => [
createAdditiveModifier(() => ({ createAdditiveModifier(() => ({
@ -420,9 +420,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
]) as WithRequired<Modifier, "description" | "revert">; ]) as WithRequired<Modifier, "description" | "revert">;
const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0)); const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0));
const lastAutoPlantedAmount = ref<DecimalSource>(0); const lastAutoPlantedAmount = ref<DecimalSource>(0);
watch(computedAutoPlantingAmount, planted => { setInterval(() => watch(computedAutoPlantingAmount, planted => {
lastAutoPlantedAmount.value = planted; lastAutoPlantedAmount.value = planted;
}); }), 0);
const logGain = createSequentialModifier(() => [ const logGain = createSequentialModifier(() => [
createMultiplicativeModifier(() => ({ createMultiplicativeModifier(() => ({