From 85959052047fa256208717ceefdc10e3c84a53f1 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 14 May 2023 12:18:40 -0500 Subject: [PATCH] Add dowsing help --- src/data/help.tsx | 27 ++++++++++++++++++++++++++- src/data/nodeTypes.tsx | 9 ++++++++- src/data/projEntry.tsx | 5 +++-- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/data/help.tsx b/src/data/help.tsx index 3f4cfde..a43af15 100644 --- a/src/data/help.tsx +++ b/src/data/help.tsx @@ -1,6 +1,11 @@ import Modal from "components/Modal.vue"; import { JSXFunction, jsx } from "features/feature"; -import { persistent } from "game/persistence"; +import { Persistent, persistent } from "game/persistence"; + +export interface ModalData { + modal: JSXFunction; + showModal: Persistent; +} function createModal(title: string, body: JSXFunction) { const showModal = persistent(false); @@ -67,3 +72,23 @@ export function getForgeHelp() { )) ); } + +export function getDowsingHelp() { + return createModal( + "Dowsing", + jsx(() => ( +
+

+ You've created the dowsing rod (🥢)! This machine let's you bias the odds of + specified resources from mining. It will double the odds of each specified + resource, so keep in mind rare resources will still be fairly rare. +

+
+

+ Specify resources to boost by dragging them to the dowsing rod. You can only + select a single resource to start, but that can be increased using an action. +

+
+ )) + ); +} diff --git a/src/data/nodeTypes.tsx b/src/data/nodeTypes.tsx index 32e33d7..2c4ddc1 100644 --- a/src/data/nodeTypes.tsx +++ b/src/data/nodeTypes.tsx @@ -54,6 +54,7 @@ import { import { GenericPlane, createPlane } from "./planes"; import { main } from "./projEntry"; import { exponentialFormat } from "util/bignum"; +import { ModalData } from "./help"; export const mine = { shape: Shape.Diamond, @@ -186,6 +187,11 @@ export const factory = { main.board.selectedAction.value = null; main.board.selectedNode.value = null; node.state = undefined; + if (tool.type in main.helpModals) { + main.helpModals[ + tool.type as keyof (typeof main)["helpModals"] + ].showModal.value = true; + } } }, fillColor: node => @@ -335,7 +341,8 @@ export const dowsing = { actions: [ deselectAllAction, getIncreaseConnectionsAction(x => x.add(2).pow_base(100), 16), - togglePoweredAction + togglePoweredAction, + showHelpAction("dowsing") ], classes: node => ({ running: isPowered(node) diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 53607a6..e4a0f6c 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -78,7 +78,7 @@ import { upgrader } from "./nodeTypes"; import { GenericPlane, createPlane } from "./planes"; -import { getForgeHelp, getMineHelp } from "./help"; +import { getDowsingHelp, getForgeHelp, getMineHelp } from "./help"; const toast = useToast(); @@ -775,7 +775,8 @@ export const main = createLayer("main", function (this: BaseLayer) { const helpModals = { mine: getMineHelp(), - factory: getForgeHelp() + factory: getForgeHelp(), + dowsing: getDowsingHelp() }; helpModals.mine.showModal[DefaultValue] = true; helpModals.mine.showModal.value = true;