Show notif on portal nodes with an interaction available

This commit is contained in:
thepaperpilot 2023-04-29 16:13:09 -05:00
parent 65c5c392bd
commit 5acd885f5f
3 changed files with 44 additions and 3 deletions

View file

@ -21,3 +21,7 @@
.achievement.final {
border-color: var(--accent3);
}
.showNotif .body {
filter: drop-shadow(0px 0px 20px var(--foreground));
}

View file

@ -18,14 +18,14 @@ import Decimal, { DecimalSource } from "util/bignum";
import { format } from "util/break_eternity";
import { Direction, WithRequired, camelToTitle } from "util/common";
import { VueFeature, render, renderRow, trackHover } from "util/vue";
import { ComputedRef, Ref, computed, ref } from "vue";
import { ComputedRef, Ref, computed, ref, unref } from "vue";
import { createCollapsibleModifierSections, createFormulaPreview, estimateTime } from "./common";
import { main, Resources, resourceNames, mineLootTable, ResourceState } from "./projEntry";
import { getColor, getName, sfc32 } from "./utils";
import ModalVue from "components/Modal.vue";
import { addTooltip } from "features/tooltips/tooltip";
import { GenericAchievement, createAchievement } from "features/achievements/achievement";
import { Computable } from "util/computed";
import { Computable, ProcessedComputable } from "util/computed";
import { BoardNode } from "features/boards/board";
import { createExponentialModifier } from "game/modifiers";
@ -404,6 +404,40 @@ export function createPlane(id: string, tier: Resources, seed: number) {
return earned;
});
const showNotif = computed(
() =>
Decimal.lt(earnedTreasures.value.length, length) &&
features.some(features =>
features.some(feature => {
if (
"earned" in feature &&
unref(feature.earned as ProcessedComputable<boolean>)
) {
return false;
}
if (
"bought" in feature &&
unref(feature.bought as ProcessedComputable<boolean>)
) {
return false;
}
if (
"canClick" in feature &&
unref(feature.canClick as ProcessedComputable<boolean>)
) {
return true;
}
if (
"canPurchase" in feature &&
unref(feature.canPurchase as ProcessedComputable<boolean>)
) {
return true;
}
return true;
})
)
);
return {
tier: persistent(tier),
seed: persistent(seed),
@ -420,6 +454,7 @@ export function createPlane(id: string, tier: Resources, seed: number) {
links,
resourceMultis,
earnedTreasures,
showNotif,
display: jsx(() => (
<>
<StickyVue class="nav-container">

View file

@ -1015,7 +1015,9 @@ export const main = createLayer("main", function (this: BaseLayer) {
actionDistance: Math.PI / 4,
actions: [togglePoweredAction],
classes: node => ({
running: isPowered(node)
running: isPowered(node),
showNotif: (layers[(node.state as unknown as PortalState).id] as GenericPlane)
.showNotif.value
}),
outlineColor: node =>
(layers[(node.state as unknown as PortalState).id] as GenericPlane).background,