From cc35cc6be8a8f62d2405646b1bc9825502a18177 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 23 Apr 2023 18:01:18 -0500 Subject: [PATCH] Made affected nodes glow --- src/data/main.css | 4 ++++ src/data/projEntry.tsx | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/data/main.css b/src/data/main.css index 85b076b..4d9fd19 100644 --- a/src/data/main.css +++ b/src/data/main.css @@ -13,3 +13,7 @@ padding-right: 10px; margin-right: 10px; } + +.affected-node { + filter: drop-shadow(0px 0px 20px var(--accent1)); +} diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 81df8b4..c816c15 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -8,7 +8,7 @@ import { createBoard, getUniqueNodeID } from "features/boards/board"; -import { JSXFunction, jsx } from "features/feature"; +import { jsx } from "features/feature"; import { createResource } from "features/resources/resource"; import { createTabFamily } from "features/tabs/tabFamily"; import Formula, { calculateCost } from "game/formulas/formulas"; @@ -20,7 +20,7 @@ import { createMultiplicativeModifier, createSequentialModifier } from "game/modifiers"; -import { Persistent, State, persistent } from "game/persistence"; +import { State, persistent } from "game/persistence"; import type { Player } from "game/player"; import player from "game/player"; import settings from "game/settings"; @@ -476,6 +476,14 @@ export const main = createLayer("main", function (this: BaseLayer) { onClick() {}, progressDisplay: ProgressDisplay.Outline, progressColor: "var(--accent3)", + classes: node => ({ + "affected-node": + dowsing.value != null && + isPowered(dowsing.value) && + (dowsing.value.state as unknown as DowsingState).resources.includes( + (node.state as unknown as ResourceState).type + ) + }), draggable: true }, passive: { @@ -609,6 +617,7 @@ export const main = createLayer("main", function (this: BaseLayer) { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion startNode: dowsing.value!, endNode: resourceNodes.value[resource], + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion stroke: isPowered(dowsing.value!) ? "var(--accent1)" : "var(--foreground)", strokeWidth: 4 }); @@ -625,8 +634,12 @@ export const main = createLayer("main", function (this: BaseLayer) { const mine: ComputedRef = computed( () => board.nodes.value.find(n => n.type === "mine") as BoardNode ); - const factory = computed(() => board.nodes.value.find(n => n.type === "factory")); - const dowsing = computed(() => board.nodes.value.find(n => n.type === "dowsing")); + const factory: ComputedRef = computed(() => + board.nodes.value.find(n => n.type === "factory") + ); + const dowsing: ComputedRef = computed(() => + board.nodes.value.find(n => n.type === "dowsing") + ); function grantResource(type: Resources, amount: DecimalSource) { let node = resourceNodes.value[type];