Add dowsing help

This commit is contained in:
thepaperpilot 2023-05-14 12:18:40 -05:00
parent f2cc6195c7
commit 8595905204
3 changed files with 37 additions and 4 deletions

View file

@ -1,6 +1,11 @@
import Modal from "components/Modal.vue"; import Modal from "components/Modal.vue";
import { JSXFunction, jsx } from "features/feature"; import { JSXFunction, jsx } from "features/feature";
import { persistent } from "game/persistence"; import { Persistent, persistent } from "game/persistence";
export interface ModalData {
modal: JSXFunction;
showModal: Persistent<boolean>;
}
function createModal(title: string, body: JSXFunction) { function createModal(title: string, body: JSXFunction) {
const showModal = persistent<boolean>(false); const showModal = persistent<boolean>(false);
@ -67,3 +72,23 @@ export function getForgeHelp() {
)) ))
); );
} }
export function getDowsingHelp() {
return createModal(
"Dowsing",
jsx(() => (
<div>
<p>
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.
</p>
<br />
<p>
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.
</p>
</div>
))
);
}

View file

@ -54,6 +54,7 @@ import {
import { GenericPlane, createPlane } from "./planes"; import { GenericPlane, createPlane } from "./planes";
import { main } from "./projEntry"; import { main } from "./projEntry";
import { exponentialFormat } from "util/bignum"; import { exponentialFormat } from "util/bignum";
import { ModalData } from "./help";
export const mine = { export const mine = {
shape: Shape.Diamond, shape: Shape.Diamond,
@ -186,6 +187,11 @@ export const factory = {
main.board.selectedAction.value = null; main.board.selectedAction.value = null;
main.board.selectedNode.value = null; main.board.selectedNode.value = null;
node.state = undefined; node.state = undefined;
if (tool.type in main.helpModals) {
main.helpModals[
tool.type as keyof (typeof main)["helpModals"]
].showModal.value = true;
}
} }
}, },
fillColor: node => fillColor: node =>
@ -335,7 +341,8 @@ export const dowsing = {
actions: [ actions: [
deselectAllAction, deselectAllAction,
getIncreaseConnectionsAction(x => x.add(2).pow_base(100), 16), getIncreaseConnectionsAction(x => x.add(2).pow_base(100), 16),
togglePoweredAction togglePoweredAction,
showHelpAction("dowsing")
], ],
classes: node => ({ classes: node => ({
running: isPowered(node) running: isPowered(node)

View file

@ -78,7 +78,7 @@ import {
upgrader upgrader
} from "./nodeTypes"; } from "./nodeTypes";
import { GenericPlane, createPlane } from "./planes"; import { GenericPlane, createPlane } from "./planes";
import { getForgeHelp, getMineHelp } from "./help"; import { getDowsingHelp, getForgeHelp, getMineHelp } from "./help";
const toast = useToast(); const toast = useToast();
@ -775,7 +775,8 @@ export const main = createLayer("main", function (this: BaseLayer) {
const helpModals = { const helpModals = {
mine: getMineHelp(), mine: getMineHelp(),
factory: getForgeHelp() factory: getForgeHelp(),
dowsing: getDowsingHelp()
}; };
helpModals.mine.showModal[DefaultValue] = true; helpModals.mine.showModal[DefaultValue] = true;
helpModals.mine.showModal.value = true; helpModals.mine.showModal.value = true;