Fix visibility issues in planes

This commit is contained in:
thepaperpilot 2023-04-28 07:47:56 -05:00
parent 5611a7c052
commit 86eba7ddb0

View file

@ -19,7 +19,7 @@ import { Resources, resourceNames } from "./projEntry";
import { getColor, getName, sfc32 } from "./utils"; import { getColor, getName, sfc32 } from "./utils";
import ModalVue from "components/Modal.vue"; import ModalVue from "components/Modal.vue";
import { addTooltip } from "features/tooltips/tooltip"; import { addTooltip } from "features/tooltips/tooltip";
import { createAchievement } from "features/achievements/achievement"; import { GenericAchievement, createAchievement } from "features/achievements/achievement";
import { Computable } from "util/computed"; import { Computable } from "util/computed";
export function createPlane(id: string, tier: Resources, seed: number) { export function createPlane(id: string, tier: Resources, seed: number) {
@ -122,6 +122,7 @@ export function createPlane(id: string, tier: Resources, seed: number) {
break; break;
} }
} }
const upgradeVisibility = visibility;
const upgrade = createUpgrade(() => ({ const upgrade = createUpgrade(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(resource), resource: noPersist(resource),
@ -131,7 +132,7 @@ export function createPlane(id: string, tier: Resources, seed: number) {
title, title,
description description
}, },
visibility visibility: upgradeVisibility
})); }));
const eta = estimateTime(resource, computedResourceGain, cost); const eta = estimateTime(resource, computedResourceGain, cost);
addTooltip(upgrade, { addTooltip(upgrade, {
@ -174,12 +175,13 @@ export function createPlane(id: string, tier: Resources, seed: number) {
.pow_base(2) .pow_base(2)
.times(10) .times(10)
.times(costFormula.evaluate()); .times(costFormula.evaluate());
const milestoneVisibility = visibility;
const milestone = createAchievement(() => ({ const milestone = createAchievement(() => ({
requirements: createCostRequirement(() => ({ requirements: createCostRequirement(() => ({
resource: noPersist(resource), resource: noPersist(resource),
cost cost
})), })),
visibility, visibility: milestoneVisibility,
display: { display: {
requirement: `${format(cost)} ${resource.displayName}`, requirement: `${format(cost)} ${resource.displayName}`,
effectDisplay: description effectDisplay: description
@ -188,7 +190,7 @@ export function createPlane(id: string, tier: Resources, seed: number) {
classes: { classes: {
final: i === length - 1 final: i === length - 1
} }
})); })) as GenericAchievement;
features.push([milestone]); features.push([milestone]);
visibility = milestone.earned; visibility = milestone.earned;
} }