Merge remote-tracking branch 'template/main'

This commit is contained in:
thepaperpilot 2022-03-05 22:51:12 -06:00
commit b03fd26b3c
86 changed files with 623 additions and 477 deletions

33
CHANGELOG.md Normal file
View file

@ -0,0 +1,33 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.1.1] - 2022-03-02
### Added
- Configuration for Glitch projects
- Configuration for Replit projects
- Hide versionTitle if blank
### Changed
- **BREAKING** Renamed modInfo.json -> projInfo.json
- **BREAKING** Renamed mod.tsx -> projEntry.tsx
- Improved performance of branch drawing code
- Improved performance of formatting numbers
- Changed some projInfo default values to empty strings
- Renamed projInfo.allowSmall -> projInfo.defaultShowSmall
### Fixed
- Spacing on discord logo in NaN screen
- Some files accessing old location for persistence code
- Fixed lint-staged not being listed in devDependencies
- Branch locations were not accurate after scrolling
- Saves Manager displayed "default body" while closing
- Reset buttons activating when held down when canClick is false
- Lifting up on auto clickable elements not stopping the auto clicker
### Removed
- Removed Theme.stackedInfoboxes
- Removed Theme.showSingleTab
## [0.1.0] - Initial Release

View file

@ -1,6 +1,6 @@
{ {
"name": "profectus", "name": "profectus",
"version": "0.1.0", "version": "0.1.1",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "vue-cli-service serve", "start": "vue-cli-service serve",
@ -41,7 +41,7 @@
"sass": "^1.48.0", "sass": "^1.48.0",
"sass-loader": "^10.2.0", "sass-loader": "^10.2.0",
"tsconfig-paths-webpack-plugin": "^3.5.1", "tsconfig-paths-webpack-plugin": "^3.5.1",
"typescript": "^4.5.4" "typescript": "~4.5.5"
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",

View file

@ -16,7 +16,7 @@ import GameOverScreen from "./components/GameOverScreen.vue";
import NaNScreen from "./components/NaNScreen.vue"; import NaNScreen from "./components/NaNScreen.vue";
import Nav from "./components/Nav.vue"; import Nav from "./components/Nav.vue";
import TPS from "./components/TPS.vue"; import TPS from "./components/TPS.vue";
import modInfo from "./data/modInfo.json"; import projInfo from "./data/projInfo.json";
import themes from "./data/themes"; import themes from "./data/themes";
import settings from "./game/settings"; import settings from "./game/settings";
import "./main.css"; import "./main.css";
@ -25,7 +25,7 @@ function updateMouse(/* event */) {
// TODO use event to update mouse position for particles // TODO use event to update mouse position for particles
} }
const useHeader = modInfo.useHeader; const useHeader = projInfo.useHeader;
const theme = computed(() => themes[settings.theme].variables); const theme = computed(() => themes[settings.theme].variables);
const showTPS = toRef(settings, "showTPS"); const showTPS = toRef(settings, "showTPS");
</script> </script>

View file

@ -17,16 +17,16 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
import { GenericLayer, layers } from "@/game/layers"; import { GenericLayer, layers } from "game/layers";
import player from "@/game/player"; import player from "game/player";
import { computed, toRef } from "vue"; import { computed, toRef } from "vue";
import Layer from "./Layer.vue"; import Layer from "./Layer.vue";
import Nav from "./Nav.vue"; import Nav from "./Nav.vue";
const tabs = toRef(player, "tabs"); const tabs = toRef(player, "tabs");
const layerKeys = computed(() => Object.keys(layers)); const layerKeys = computed(() => Object.keys(layers));
const useHeader = modInfo.useHeader; const useHeader = projInfo.useHeader;
function gatherLayerProps(layer: GenericLayer) { function gatherLayerProps(layer: GenericLayer) {
const { display, minimized, minWidth, name, color, style, classes, links, minimizable } = layer; const { display, minimized, minWidth, name, color, style, classes, links, minimizable } = layer;

View file

@ -37,16 +37,16 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Modal from "@/components/Modal.vue"; import Modal from "components/Modal.vue";
import { hasWon } from "@/data/mod"; import { hasWon } from "data/projEntry";
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
import player from "@/game/player"; import player from "game/player";
import { formatTime } from "@/util/bignum"; import { formatTime } from "util/bignum";
import { loadSave, newSave } from "@/util/save"; import { loadSave, newSave } from "util/save";
import { computed, toRef } from "vue"; import { computed, toRef } from "vue";
import Toggle from "./fields/Toggle.vue"; import Toggle from "./fields/Toggle.vue";
const { title, logo, discordName, discordLink, versionNumber, versionTitle } = modInfo; const { title, logo, discordName, discordLink, versionNumber, versionTitle } = projInfo;
const timePlayed = computed(() => formatTime(player.timePlayed)); const timePlayed = computed(() => formatTime(player.timePlayed));
const isOpen = computed(() => hasWon.value && !player.keepGoing); const isOpen = computed(() => hasWon.value && !player.keepGoing);

View file

@ -5,7 +5,9 @@
<img class="info-modal-logo" v-if="logo" :src="logo" :alt="title" /> <img class="info-modal-logo" v-if="logo" :src="logo" :alt="title" />
<div class="info-modal-title"> <div class="info-modal-title">
<h2>{{ title }}</h2> <h2>{{ title }}</h2>
<h4>v{{ versionNumber }}: {{ versionTitle }}</h4> <h4>
v{{ versionNumber }}<span v-if="versionTitle">: {{ versionTitle }}</span>
</h4>
</div> </div>
</div> </div>
</template> </template>
@ -48,14 +50,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Modal from "@/components/Modal.vue"; import Modal from "components/Modal.vue";
import type Changelog from "@/data/Changelog.vue"; import type Changelog from "data/Changelog.vue";
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
import player from "@/game/player"; import player from "game/player";
import { formatTime } from "@/util/bignum"; import { formatTime } from "util/bignum";
import { computed, ref, toRefs, unref } from "vue"; import { computed, ref, toRefs, unref } from "vue";
const { title, logo, author, discordName, discordLink, versionNumber, versionTitle } = modInfo; const { title, logo, author, discordName, discordLink, versionNumber, versionTitle } = projInfo;
const _props = defineProps<{ changelog: typeof Changelog | null }>(); const _props = defineProps<{ changelog: typeof Changelog | null }>();
const props = toRefs(_props); const props = toRefs(_props);

View file

@ -21,13 +21,13 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Links from "@/components/links/Links.vue"; import Links from "components/links/Links.vue";
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
import { CoercableComponent, StyleValue } from "@/features/feature"; import { CoercableComponent, StyleValue } from "features/feature";
import { Link } from "@/features/links"; import { Link } from "features/links";
import { PersistentRef } from "@/game/persistence"; import { PersistentRef } from "game/persistence";
import player from "@/game/player"; import player from "game/player";
import { computeComponent, processedPropType, wrapRef } from "@/util/vue"; import { computeComponent, processedPropType, wrapRef } from "util/vue";
import { computed, defineComponent, nextTick, PropType, toRefs, unref, watch } from "vue"; import { computed, defineComponent, nextTick, PropType, toRefs, unref, watch } from "vue";
export default defineComponent({ export default defineComponent({
@ -68,7 +68,7 @@ export default defineComponent({
const component = computeComponent(display); const component = computeComponent(display);
const showGoBack = computed( const showGoBack = computed(
() => modInfo.allowGoBack && index.value > 0 && !minimized.value () => projInfo.allowGoBack && index.value > 0 && !minimized.value
); );
function goBack() { function goBack() {

View file

@ -40,7 +40,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Link } from "@/features/links"; import { Link } from "features/links";
import { computed, ref, toRefs } from "vue"; import { computed, ref, toRefs } from "vue";
import Links from "./links/Links.vue"; import Links from "./links/Links.vue";

View file

@ -43,16 +43,16 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Modal from "@/components/Modal.vue"; import Modal from "components/Modal.vue";
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
import player from "@/game/player"; import player from "game/player";
import state from "@/game/state"; import state from "game/state";
import Decimal, { DecimalSource, format } from "@/util/bignum"; import Decimal, { DecimalSource, format } from "util/bignum";
import { ComponentPublicInstance, computed, ref, toRef } from "vue"; import { ComponentPublicInstance, computed, ref, toRef } from "vue";
import Toggle from "./fields/Toggle.vue"; import Toggle from "./fields/Toggle.vue";
import SavesManager from "./SavesManager.vue"; import SavesManager from "./SavesManager.vue";
const { discordName, discordLink } = modInfo; const { discordName, discordLink } = projInfo;
const autosave = toRef(player, "autosave"); const autosave = toRef(player, "autosave");
const hasNaN = toRef(state, "hasNaN"); const hasNaN = toRef(state, "hasNaN");
const savesManager = ref<ComponentPublicInstance<typeof SavesManager> | null>(null); const savesManager = ref<ComponentPublicInstance<typeof SavesManager> | null>(null);

View file

@ -99,8 +99,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Changelog from "@/data/Changelog.vue"; import Changelog from "data/Changelog.vue";
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
import { ComponentPublicInstance, ref } from "vue"; import { ComponentPublicInstance, ref } from "vue";
import Info from "./Info.vue"; import Info from "./Info.vue";
import Options from "./Options.vue"; import Options from "./Options.vue";
@ -114,7 +114,7 @@ const options = ref<ComponentPublicInstance<typeof Options> | null>(null);
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const changelog = ref<ComponentPublicInstance<any> | null>(null); const changelog = ref<ComponentPublicInstance<any> | null>(null);
const { useHeader, banner, title, discordName, discordLink, versionNumber } = modInfo; const { useHeader, banner, title, discordName, discordLink, versionNumber } = projInfo;
function openDiscord() { function openDiscord() {
window.open(discordLink, "mywindow"); window.open(discordLink, "mywindow");

View file

@ -19,17 +19,17 @@
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import Modal from "@/components/Modal.vue"; import Modal from "components/Modal.vue";
import rawThemes from "@/data/themes"; import rawThemes from "data/themes";
import player from "@/game/player"; import player from "game/player";
import settings, { settingFields } from "@/game/settings"; import settings, { settingFields } from "game/settings";
import { camelToTitle } from "@/util/common"; import { camelToTitle } from "util/common";
import { computed, ref, toRefs } from "vue"; import { computed, ref, toRefs } from "vue";
import Toggle from "./fields/Toggle.vue"; import Toggle from "./fields/Toggle.vue";
import Select from "./fields/Select.vue"; import Select from "./fields/Select.vue";
import Tooltip from "./Tooltip.vue"; import Tooltip from "./Tooltip.vue";
import { jsx } from "@/features/feature"; import { jsx } from "features/feature";
import { coerceComponent, render } from "@/util/vue"; import { coerceComponent, render } from "util/vue";
const isOpen = ref(false); const isOpen = ref(false);

View file

@ -58,7 +58,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import player from "@/game/player"; import player from "game/player";
import { computed, ref, toRefs, watch } from "vue"; import { computed, ref, toRefs, watch } from "vue";
import DangerButton from "./fields/DangerButton.vue"; import DangerButton from "./fields/DangerButton.vue";
import FeedbackButton from "./fields/FeedbackButton.vue"; import FeedbackButton from "./fields/FeedbackButton.vue";

View file

@ -3,11 +3,11 @@
<template v-slot:header> <template v-slot:header>
<h2>Saves Manager</h2> <h2>Saves Manager</h2>
</template> </template>
<template v-slot:body> <template #body="{ shown }">
<Draggable <Draggable
:list="settings.saves" :list="settings.saves"
handle=".handle" handle=".handle"
v-if="unref(modal?.isOpen)" v-if="shown"
:itemKey="(save: string) => save" :itemKey="(save: string) => save"
> >
<template #item="{ element }"> <template #item="{ element }">
@ -57,10 +57,10 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Modal from "@/components/Modal.vue"; import Modal from "components/Modal.vue";
import player, { PlayerData } from "@/game/player"; import player, { PlayerData } from "game/player";
import settings from "@/game/settings"; import settings from "game/settings";
import { getUniqueID, loadSave, save, newSave } from "@/util/save"; import { getUniqueID, loadSave, save, newSave } from "util/save";
import { import {
ComponentPublicInstance, ComponentPublicInstance,
computed, computed,

View file

@ -8,8 +8,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import state from "@/game/state"; import state from "game/state";
import Decimal, { DecimalSource, formatWhole } from "@/util/bignum"; import Decimal, { DecimalSource, formatWhole } from "util/bignum";
import { computed, ref, watchEffect } from "vue"; import { computed, ref, watchEffect } from "vue";
const tps = computed(() => const tps = computed(() =>

View file

@ -28,8 +28,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { CoercableComponent } from "@/features/feature"; import { CoercableComponent } from "features/feature";
import { computeOptionalComponent, processedPropType, unwrapRef } from "@/util/vue"; import { computeOptionalComponent, processedPropType, unwrapRef } from "util/vue";
import { computed, defineComponent, ref, toRefs, unref } from "vue"; import { computed, defineComponent, ref, toRefs, unref } from "vue";
export default defineComponent({ export default defineComponent({

View file

@ -14,9 +14,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import "@/components/common/fields.css"; import "components/common/fields.css";
import { CoercableComponent } from "@/features/feature"; import { CoercableComponent } from "features/feature";
import { computeOptionalComponent } from "@/util/vue"; import { computeOptionalComponent } from "util/vue";
import { ref, toRef, watch } from "vue"; import { ref, toRef, watch } from "vue";
import VueNextSelect from "vue-next-select"; import VueNextSelect from "vue-next-select";
import "vue-next-select/dist/index.css"; import "vue-next-select/dist/index.css";

View file

@ -10,7 +10,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, toRefs, unref } from "vue"; import { computed, toRefs, unref } from "vue";
import Tooltip from "../Tooltip.vue"; import Tooltip from "../Tooltip.vue";
import "@/components/common/fields.css"; import "components/common/fields.css";
const _props = defineProps<{ const _props = defineProps<{
title?: string; title?: string;

View file

@ -26,11 +26,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { CoercableComponent } from "@/features/feature"; import { CoercableComponent } from "features/feature";
import { coerceComponent } from "@/util/vue"; import { coerceComponent } from "util/vue";
import { computed, onMounted, ref, toRefs, unref } from "vue"; import { computed, onMounted, ref, toRefs, unref } from "vue";
import VueTextareaAutosize from "vue-textarea-autosize"; import VueTextareaAutosize from "vue-textarea-autosize";
import "@/components/common/fields.css"; import "components/common/fields.css";
const _props = defineProps<{ const _props = defineProps<{
title?: CoercableComponent; title?: CoercableComponent;

View file

@ -6,10 +6,10 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { CoercableComponent } from "@/features/feature"; import { CoercableComponent } from "features/feature";
import { coerceComponent } from "@/util/vue"; import { coerceComponent } from "util/vue";
import { computed, unref } from "vue"; import { computed, unref } from "vue";
import "@/components/common/fields.css"; import "components/common/fields.css";
const props = defineProps<{ const props = defineProps<{
title?: CoercableComponent; title?: CoercableComponent;

View file

@ -7,9 +7,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import "@/components/common/table.css"; import "components/common/table.css";
import themes from "@/data/themes"; import themes from "data/themes";
import settings from "@/game/settings"; import settings from "game/settings";
import { computed } from "vue"; import { computed } from "vue";
const mergeAdjacent = computed(() => themes[settings.theme].mergeAdjacent); const mergeAdjacent = computed(() => themes[settings.theme].mergeAdjacent);

View file

@ -7,9 +7,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import "@/components/common/table.css"; import "components/common/table.css";
import themes from "@/data/themes"; import themes from "data/themes";
import settings from "@/game/settings"; import settings from "game/settings";
import { computed } from "vue"; import { computed } from "vue";
const mergeAdjacent = computed(() => themes[settings.theme].mergeAdjacent); const mergeAdjacent = computed(() => themes[settings.theme].mergeAdjacent);

View file

@ -11,7 +11,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Link, LinkNode } from "@/features/links"; import { Link, LinkNode } from "features/links";
import { computed, toRefs, unref } from "vue"; import { computed, toRefs, unref } from "vue";
const _props = defineProps<{ const _props = defineProps<{

View file

@ -3,7 +3,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { RegisterLinkNodeInjectionKey, UnregisterLinkNodeInjectionKey } from "@/features/links"; import { RegisterLinkNodeInjectionKey, UnregisterLinkNodeInjectionKey } from "features/links";
import { computed, inject, onUnmounted, ref, toRefs, unref, watch } from "vue"; import { computed, inject, onUnmounted, ref, toRefs, unref, watch } from "vue";
const _props = defineProps<{ id: string }>(); const _props = defineProps<{ id: string }>();

View file

@ -18,7 +18,7 @@ import {
LinkNode, LinkNode,
RegisterLinkNodeInjectionKey, RegisterLinkNodeInjectionKey,
UnregisterLinkNodeInjectionKey UnregisterLinkNodeInjectionKey
} from "@/features/links"; } from "features/links";
import { computed, nextTick, onMounted, provide, ref, toRef } from "vue"; import { computed, nextTick, onMounted, provide, ref, toRef } from "vue";
import LinkVue from "./Link.vue"; import LinkVue from "./Link.vue";
@ -80,7 +80,7 @@ function updateNodes() {
nextTick(() => { nextTick(() => {
boundingRect = resizeListener.value?.getBoundingClientRect(); boundingRect = resizeListener.value?.getBoundingClientRect();
Object.keys(nodes.value).forEach(id => updateNode(id)); Object.keys(nodes.value).forEach(id => updateNode(id));
isDirty = true isDirty = true;
}); });
} }
} }

View file

@ -19,7 +19,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Modal from "@/components/Modal.vue"; import Modal from "components/Modal.vue";
import { ref } from "vue"; import { ref } from "vue";
const isOpen = ref(false); const isOpen = ref(false);

View file

@ -3,25 +3,26 @@ import {
ClickableOptions, ClickableOptions,
createClickable, createClickable,
GenericClickable GenericClickable
} from "@/features/clickables/clickable"; } from "features/clickables/clickable";
import { GenericConversion } from "@/features/conversion"; import { GenericConversion } from "features/conversion";
import { CoercableComponent, jsx, Replace, setDefault } from "@/features/feature"; import { CoercableComponent, jsx, Replace, setDefault } from "features/feature";
import { displayResource } from "@/features/resources/resource"; import { displayResource } from "features/resources/resource";
import { import {
createTreeNode, createTreeNode,
GenericTree, GenericTree,
GenericTreeNode, GenericTreeNode,
TreeNode, TreeNode,
TreeNodeOptions TreeNodeOptions
} from "@/features/trees/tree"; } from "features/trees/tree";
import player from "@/game/player"; import player from "game/player";
import Decimal from "@/util/bignum"; import Decimal from "util/bignum";
import { import {
Computable, Computable,
GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { computed, Ref, unref } from "vue"; import { computed, Ref, unref } from "vue";
export interface ResetButtonOptions extends ClickableOptions { export interface ResetButtonOptions extends ClickableOptions {
@ -104,6 +105,9 @@ export function createResetButton<T extends ClickableOptions & ResetButtonOption
const onClick = resetButton.onClick; const onClick = resetButton.onClick;
resetButton.onClick = function () { resetButton.onClick = function () {
if (!unref(resetButton.canClick)) {
return;
}
resetButton.conversion.convert(); resetButton.conversion.convert();
resetButton.tree.reset(resetButton.treeNode); resetButton.tree.reset(resetButton.treeNode);
onClick?.(); onClick?.();
@ -115,39 +119,48 @@ export function createResetButton<T extends ClickableOptions & ResetButtonOption
export interface LayerTreeNodeOptions extends TreeNodeOptions { export interface LayerTreeNodeOptions extends TreeNodeOptions {
layerID: string; layerID: string;
color: string; color: Computable<string>; // marking as required
append?: boolean; display?: Computable<string>;
append?: Computable<boolean>;
} }
export type LayerTreeNode<T extends LayerTreeNodeOptions> = Replace< export type LayerTreeNode<T extends LayerTreeNodeOptions> = Replace<
TreeNode<T>, TreeNode<T>,
{ {
append: ProcessedComputable<boolean>; display: GetComputableTypeWithDefault<T["display"], T["layerID"]>;
append: GetComputableType<T["append"]>;
}
>;
export type GenericLayerTreeNode = Replace<
LayerTreeNode<LayerTreeNodeOptions>,
{
display: ProcessedComputable<string>;
append?: ProcessedComputable<boolean>;
} }
>; >;
export type GenericLayerTreeNode = LayerTreeNode<LayerTreeNodeOptions>;
export function createLayerTreeNode<T extends LayerTreeNodeOptions>( export function createLayerTreeNode<T extends LayerTreeNodeOptions>(
optionsFunc: () => T optionsFunc: () => T
): LayerTreeNode<T> { ): LayerTreeNode<T> {
return createTreeNode(() => { return createTreeNode(() => {
const options = optionsFunc(); const options = optionsFunc();
processComputable(options as T, "display");
setDefault(options, "display", options.layerID);
processComputable(options as T, "append"); processComputable(options as T, "append");
return { return {
...options, ...options,
display: options.layerID, display: options.layerID,
onClick: onClick: unref((options as unknown as GenericLayerTreeNode).append)
options.append != null && options.append ? function () {
? function () { if (player.tabs.includes(options.layerID)) {
if (player.tabs.includes(options.layerID)) { const index = player.tabs.lastIndexOf(options.layerID);
const index = player.tabs.lastIndexOf(options.layerID); player.tabs.splice(index, 1);
player.tabs.splice(index, 1); } else {
} else { player.tabs.push(options.layerID);
player.tabs.push(options.layerID);
}
}
: function () {
player.tabs.splice(1, 1, options.layerID);
} }
}
: function () {
player.tabs.splice(1, 1, options.layerID);
}
}; };
}) as unknown as LayerTreeNode<T>; }) as unknown as LayerTreeNode<T>;
} }

View file

@ -1,15 +1,15 @@
import Row from "@/components/layout/Row.vue"; import Row from "components/layout/Row.vue";
import Tooltip from "@/components/Tooltip.vue"; import Tooltip from "components/Tooltip.vue";
import { main } from "@/data/mod"; import { main } from "data/projEntry";
import { createAchievement } from "@/features/achievements/achievement"; import { createAchievement } from "features/achievements/achievement";
import { jsx } from "@/features/feature"; import { jsx } from "features/feature";
import { createGrid } from "@/features/grids/grid"; import { createGrid } from "features/grids/grid";
import { createResource } from "@/features/resources/resource"; import { createResource } from "features/resources/resource";
import { createTreeNode } from "@/features/trees/tree"; import { createTreeNode } from "features/trees/tree";
import { createLayer } from "@/game/layers"; import { createLayer } from "game/layers";
import { DecimalSource } from "@/lib/break_eternity"; import { DecimalSource } from "lib/break_eternity";
import Decimal from "@/util/bignum"; import Decimal from "util/bignum";
import { render, renderRow } from "@/util/vue"; import { render, renderRow } from "util/vue";
import { computed } from "vue"; import { computed } from "vue";
import f from "./f"; import f from "./f";

View file

@ -1,42 +1,42 @@
import Slider from "@/components/fields/Slider.vue"; import Slider from "components/fields/Slider.vue";
import Text from "@/components/fields/Text.vue"; import Text from "components/fields/Text.vue";
import Toggle from "@/components/fields/Toggle.vue"; import Toggle from "components/fields/Toggle.vue";
import Column from "@/components/layout/Column.vue"; import Column from "components/layout/Column.vue";
import Row from "@/components/layout/Row.vue"; import Row from "components/layout/Row.vue";
import Spacer from "@/components/layout/Spacer.vue"; import Spacer from "components/layout/Spacer.vue";
import Sticky from "@/components/layout/Sticky.vue"; import Sticky from "components/layout/Sticky.vue";
import VerticalRule from "@/components/layout/VerticalRule.vue"; import VerticalRule from "components/layout/VerticalRule.vue";
import Modal from "@/components/Modal.vue"; import Modal from "components/Modal.vue";
import { createLayerTreeNode, createResetButton } from "@/data/common"; import { createLayerTreeNode, createResetButton } from "data/common";
import { main } from "@/data/mod"; import { main } from "data/projEntry";
import themes from "@/data/themes"; import themes from "data/themes";
import { createBar, Direction } from "@/features/bars/bar"; import { createBar, Direction } from "features/bars/bar";
import { createBuyable } from "@/features/buyable"; import { createBuyable } from "features/buyable";
import { createChallenge } from "@/features/challenges/challenge"; import { createChallenge } from "features/challenges/challenge";
import { createClickable } from "@/features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { import {
addSoftcap, addSoftcap,
createCumulativeConversion, createCumulativeConversion,
createExponentialScaling createPolynomialScaling
} from "@/features/conversion"; } from "features/conversion";
import { jsx, showIf, Visibility } from "@/features/feature"; import { jsx, showIf, Visibility } from "features/feature";
import { createHotkey } from "@/features/hotkey"; import { createHotkey } from "features/hotkey";
import { createInfobox } from "@/features/infoboxes/infobox"; import { createInfobox } from "features/infoboxes/infobox";
import { createMilestone } from "@/features/milestones/milestone"; import { createMilestone } from "features/milestones/milestone";
import { createReset } from "@/features/reset"; import { createReset } from "features/reset";
import MainDisplay from "@/features/resources/MainDisplay.vue"; import MainDisplay from "features/resources/MainDisplay.vue";
import { createResource, displayResource, trackBest } from "@/features/resources/resource"; import { createResource, displayResource, trackBest } from "features/resources/resource";
import Resource from "@/features/resources/Resource.vue"; import Resource from "features/resources/Resource.vue";
import { createTab } from "@/features/tabs/tab"; import { createTab } from "features/tabs/tab";
import { createTabFamily } from "@/features/tabs/tabFamily"; import { createTabFamily } from "features/tabs/tabFamily";
import { createTree, createTreeNode, GenericTreeNode, TreeBranch } from "@/features/trees/tree"; import { createTree, createTreeNode, GenericTreeNode, TreeBranch } from "features/trees/tree";
import { createUpgrade } from "@/features/upgrades/upgrade"; import { createUpgrade } from "features/upgrades/upgrade";
import { createLayer } from "@/game/layers"; import { createLayer } from "game/layers";
import { persistent } from "@/game/persistence"; import { persistent } from "game/persistence";
import settings from "@/game/settings"; import settings from "game/settings";
import { DecimalSource } from "@/lib/break_eternity"; import { DecimalSource } from "lib/break_eternity";
import Decimal, { format, formatWhole } from "@/util/bignum"; import Decimal, { format, formatWhole } from "util/bignum";
import { render, renderCol, renderRow } from "@/util/vue"; import { render, renderCol, renderRow } from "util/vue";
import { computed, ComputedRef, ref } from "vue"; import { computed, ComputedRef, ref } from "vue";
import f from "./f"; import f from "./f";
@ -346,7 +346,7 @@ const layer = createLayer(() => {
})); }));
const conversion = createCumulativeConversion(() => ({ const conversion = createCumulativeConversion(() => ({
scaling: addSoftcap(createExponentialScaling(10, 5, 0.5), 1e100, 0.5), scaling: addSoftcap(createPolynomialScaling(10, 0.5), 1e100, 0.5),
baseResource: main.points, baseResource: main.points,
gainResource: points, gainResource: points,
roundUpCost: true roundUpCost: true

View file

@ -1,16 +1,16 @@
import { createLayerTreeNode, createResetButton } from "@/data/common"; import { createLayerTreeNode, createResetButton } from "data/common";
import { main } from "@/data/mod"; import { main } from "data/projEntry";
import { createClickable } from "@/features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { createExponentialScaling, createIndependentConversion } from "@/features/conversion"; import { createPolynomialScaling, createIndependentConversion } from "features/conversion";
import { jsx } from "@/features/feature"; import { jsx } from "features/feature";
import { createInfobox } from "@/features/infoboxes/infobox"; import { createInfobox } from "features/infoboxes/infobox";
import { createReset } from "@/features/reset"; import { createReset } from "features/reset";
import MainDisplay from "@/features/resources/MainDisplay.vue"; import MainDisplay from "features/resources/MainDisplay.vue";
import { createResource, displayResource } from "@/features/resources/resource"; import { createResource, displayResource } from "features/resources/resource";
import { createLayer } from "@/game/layers"; import { createLayer } from "game/layers";
import { persistent } from "@/game/persistence"; import { persistent } from "game/persistence";
import Decimal, { DecimalSource, formatWhole } from "@/util/bignum"; import Decimal, { DecimalSource, formatWhole } from "util/bignum";
import { render } from "@/util/vue"; import { render } from "util/vue";
import c from "./c"; import c from "./c";
const layer = createLayer(() => { const layer = createLayer(() => {
@ -94,7 +94,7 @@ const layer = createLayer(() => {
})); }));
const conversion = createIndependentConversion(() => ({ const conversion = createIndependentConversion(() => ({
scaling: createExponentialScaling(10, 3, 0.5), scaling: createPolynomialScaling(10, 0.5),
baseResource: main.points, baseResource: main.points,
gainResource: points, gainResource: points,
modifyGainAmount: gain => Decimal.times(gain, c.otherThingy.value) modifyGainAmount: gain => Decimal.times(gain, c.otherThingy.value)

View file

@ -1,12 +1,12 @@
/* eslint-disable */ /* eslint-disable */
import { layers } from "@/game/layers"; import { layers } from "game/layers";
import player from "@/game/player"; import player from "game/player";
import { Layer, RawLayer } from "@/typings/layer"; import { Layer, RawLayer } from "typings/layer";
import Decimal, { format } from "@/util/bignum"; import Decimal, { format } from "util/bignum";
import { import {
getBuyableAmount, hasChallenge, hasMilestone, hasUpgrade, setBuyableAmount getBuyableAmount, hasChallenge, hasMilestone, hasUpgrade, setBuyableAmount
} from "@/util/features"; } from "util/features";
import { resetLayer } from "@/util/layers"; import { resetLayer } from "util/layers";
export default { export default {
id: "i", id: "i",

View file

@ -1,12 +1,12 @@
/* eslint-disable */ /* eslint-disable */
import { layers } from "@/game/layers"; import { layers } from "game/layers";
import player from "@/game/player"; import player from "game/player";
import { RawLayer } from "@/typings/layer"; import { RawLayer } from "typings/layer";
import Decimal, { format } from "@/util/bignum"; import Decimal, { format } from "util/bignum";
import { import {
getBuyableAmount, hasChallenge, hasMilestone, hasUpgrade, setBuyableAmount getBuyableAmount, hasChallenge, hasMilestone, hasUpgrade, setBuyableAmount
} from "@/util/features"; } from "util/features";
import { resetLayer } from "@/util/layers"; import { resetLayer } from "util/layers";
export default { export default {
id: "p", id: "p",

View file

@ -0,0 +1,56 @@
import { main } from "data/projEntry";
import { createCumulativeConversion, createPolynomialScaling } from "features/conversion";
import { jsx } from "features/feature";
import { createReset } from "features/reset";
import MainDisplay from "features/resources/MainDisplay.vue";
import { createResource } from "features/resources/resource";
import { createLayer } from "game/layers";
import { DecimalSource } from "lib/break_eternity";
import { render } from "util/vue";
import { createLayerTreeNode, createResetButton } from "../common";
const layer = createLayer(() => {
const id = "p";
const name = "Prestige";
const color = "#4BDC13";
const points = createResource<DecimalSource>(0, "prestige points");
const conversion = createCumulativeConversion(() => ({
scaling: createPolynomialScaling(10, 0.5),
baseResource: main.points,
gainResource: points,
roundUpCost: true
}));
const reset = createReset(() => ({
thingsToReset: (): Record<string, unknown>[] => [layer]
}));
const treeNode = createLayerTreeNode(() => ({
layerID: id,
color,
reset
}));
const resetButton = createResetButton(() => ({
conversion,
tree: main.tree,
treeNode
}));
return {
id,
name,
color,
points,
display: jsx(() => (
<>
<MainDisplay resource={points} color={color} />
{render(resetButton)}
</>
)),
treeNode
};
});
export default layer;

View file

@ -1,14 +1,14 @@
import Profectus from "@/components/Profectus.vue"; import Profectus from "components/Profectus.vue";
import Spacer from "@/components/layout/Spacer.vue"; import Spacer from "components/layout/Spacer.vue";
import { jsx } from "@/features/feature"; import { jsx } from "features/feature";
import { createResource, trackBest, trackOOMPS, trackTotal } from "@/features/resources/resource"; import { createResource, trackBest, trackOOMPS, trackTotal } from "features/resources/resource";
import { branchedResetPropagation, createTree, GenericTree } from "@/features/trees/tree"; import { branchedResetPropagation, createTree, GenericTree } from "features/trees/tree";
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import { createLayer, GenericLayer, setupLayerModal } from "@/game/layers"; import { createLayer, GenericLayer, setupLayerModal } from "game/layers";
import player, { PlayerData } from "@/game/player"; import player, { PlayerData } from "game/player";
import { DecimalSource } from "@/lib/break_eternity"; import { DecimalSource } from "lib/break_eternity";
import Decimal, { format, formatTime } from "@/util/bignum"; import Decimal, { format, formatTime } from "util/bignum";
import { render } from "@/util/vue"; import { render } from "util/vue";
import { computed, toRaw } from "vue"; import { computed, toRaw } from "vue";
import a from "./layers/aca/a"; import a from "./layers/aca/a";
import c from "./layers/aca/c"; import c from "./layers/aca/c";

View file

@ -9,7 +9,7 @@
"versionTitle": "Initial Commit", "versionTitle": "Initial Commit",
"allowGoBack": true, "allowGoBack": true,
"allowSmall": false, "defaultShowSmall": false,
"defaultDecimalsShown": 2, "defaultDecimalsShown": 2,
"useHeader": true, "useHeader": true,
"banner": null, "banner": null,

View file

@ -21,9 +21,7 @@ interface ThemeVars {
export interface Theme { export interface Theme {
variables: ThemeVars; variables: ThemeVars;
stackedInfoboxes: boolean;
floatingTabs: boolean; floatingTabs: boolean;
showSingleTab: boolean;
mergeAdjacent: boolean; mergeAdjacent: boolean;
} }
@ -54,9 +52,7 @@ const defaultTheme: Theme = {
"--modal-border": "solid 2px var(--color)", "--modal-border": "solid 2px var(--color)",
"--feature-margin": "0px" "--feature-margin": "0px"
}, },
stackedInfoboxes: false,
floatingTabs: true, floatingTabs: true,
showSingleTab: false,
mergeAdjacent: true mergeAdjacent: true
}; };
@ -83,7 +79,6 @@ export default {
"--modal-border": "", "--modal-border": "",
"--feature-margin": "5px" "--feature-margin": "5px"
}, },
stackedInfoboxes: true,
floatingTabs: false floatingTabs: false
} as Theme, } as Theme,
// Based on https://www.nordtheme.com // Based on https://www.nordtheme.com
@ -109,7 +104,6 @@ export default {
"--modal-border": "solid 2px #3B4252", "--modal-border": "solid 2px #3B4252",
"--feature-margin": "5px" "--feature-margin": "5px"
}, },
stackedInfoboxes: true,
floatingTabs: false floatingTabs: false
} as Theme, } as Theme,
aqua: { aqua: {

View file

@ -23,13 +23,13 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { CoercableComponent, Visibility } from "@/features/feature"; import { CoercableComponent, Visibility } from "features/feature";
import { computeOptionalComponent, processedPropType } from "@/util/vue"; import { computeOptionalComponent, processedPropType } from "util/vue";
import { defineComponent, StyleValue, toRefs, unref } from "vue"; import { defineComponent, StyleValue, toRefs, unref } from "vue";
import Tooltip from "@/components/Tooltip.vue"; import Tooltip from "components/Tooltip.vue";
import LinkNode from "@/components/links/LinkNode.vue"; import LinkNode from "components/links/LinkNode.vue";
import MarkNode from "@/components/MarkNode.vue"; import MarkNode from "components/MarkNode.vue";
import "@/components/common/features.css"; import "components/common/features.css";
export default defineComponent({ export default defineComponent({
props: { props: {

View file

@ -1,4 +1,4 @@
import AchievementComponent from "@/features/achievements/Achievement.vue"; import AchievementComponent from "features/achievements/Achievement.vue";
import { import {
CoercableComponent, CoercableComponent,
Component, Component,
@ -9,19 +9,19 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import "@/game/notifications"; import "game/notifications";
import { Persistent, makePersistent, PersistentState } from "@/game/persistence"; import { Persistent, makePersistent, PersistentState } from "game/persistence";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { coerceComponent } from "@/util/vue"; import { coerceComponent } from "util/vue";
import { Unsubscribe } from "nanoevents"; import { Unsubscribe } from "nanoevents";
import { Ref, unref } from "vue"; import { Ref, unref } from "vue";
import { useToast } from "vue-toastification"; import { useToast } from "vue-toastification";

View file

@ -46,12 +46,12 @@
<script lang="ts"> <script lang="ts">
import { Direction } from "./bar"; import { Direction } from "./bar";
import { CoercableComponent, Visibility } from "@/features/feature"; import { CoercableComponent, Visibility } from "features/feature";
import Decimal, { DecimalSource } from "@/util/bignum"; import Decimal, { DecimalSource } from "util/bignum";
import { computeOptionalComponent, processedPropType, unwrapRef } from "@/util/vue"; import { computeOptionalComponent, processedPropType, unwrapRef } from "util/vue";
import { computed, CSSProperties, defineComponent, StyleValue, toRefs, unref } from "vue"; import { computed, CSSProperties, defineComponent, StyleValue, toRefs, unref } from "vue";
import LinkNode from "@/components/links/LinkNode.vue"; import LinkNode from "components/links/LinkNode.vue";
import MarkNode from "@/components/MarkNode.vue"; import MarkNode from "components/MarkNode.vue";
export default defineComponent({ export default defineComponent({
props: { props: {

View file

@ -1,4 +1,4 @@
import BarComponent from "@/features/bars/Bar.vue"; import BarComponent from "features/bars/Bar.vue";
import { import {
CoercableComponent, CoercableComponent,
Component, Component,
@ -8,16 +8,16 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import { DecimalSource } from "@/lib/break_eternity"; import { DecimalSource } from "lib/break_eternity";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
export const BarType = Symbol("Bar"); export const BarType = Symbol("Bar");

View file

@ -51,9 +51,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { BoardNode, GenericBoard, getNodeProperty } from "@/features/boards/board"; import { BoardNode, GenericBoard, getNodeProperty } from "features/boards/board";
import { FeatureComponent, Visibility } from "@/features/feature"; import { FeatureComponent, Visibility } from "features/feature";
import { PersistentState } from "@/game/persistence"; import { PersistentState } from "game/persistence";
import { computed, ref, toRefs } from "vue"; import { computed, ref, toRefs } from "vue";
import panZoom from "vue-panzoom"; import panZoom from "vue-panzoom";
import BoardLinkVue from "./BoardLink.vue"; import BoardLinkVue from "./BoardLink.vue";

View file

@ -11,7 +11,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { BoardNodeLink } from "@/features/boards/board"; import { BoardNodeLink } from "features/boards/board";
import { computed, toRefs, unref } from "vue"; import { computed, toRefs, unref } from "vue";
const _props = defineProps<{ const _props = defineProps<{

View file

@ -167,7 +167,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import themes from "@/data/themes"; import themes from "data/themes";
import { import {
BoardNode, BoardNode,
GenericBoardNodeAction, GenericBoardNodeAction,
@ -175,9 +175,9 @@ import {
getNodeProperty, getNodeProperty,
ProgressDisplay, ProgressDisplay,
Shape Shape
} from "@/features/boards/board"; } from "features/boards/board";
import { Visibility } from "@/features/feature"; import { Visibility } from "features/feature";
import settings from "@/game/settings"; import settings from "game/settings";
import { computed, ref, toRefs, unref, watch } from "vue"; import { computed, ref, toRefs, unref, watch } from "vue";
const sqrtTwo = Math.sqrt(2); const sqrtTwo = Math.sqrt(2);

View file

@ -1,4 +1,4 @@
import BoardComponent from "@/features/boards/Board.vue"; import BoardComponent from "features/boards/Board.vue";
import { import {
Component, Component,
findFeatures, findFeatures,
@ -8,19 +8,19 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import { State, Persistent, makePersistent, PersistentState } from "@/game/persistence"; import { State, Persistent, makePersistent, PersistentState } from "game/persistence";
import Decimal, { DecimalSource } from "@/lib/break_eternity"; import Decimal, { DecimalSource } from "lib/break_eternity";
import { isFunction } from "@/util/common"; import { isFunction } from "util/common";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { Unsubscribe } from "nanoevents"; import { Unsubscribe } from "nanoevents";
import { computed, Ref, unref } from "vue"; import { computed, Ref, unref } from "vue";
import { Link } from "../links"; import { Link } from "../links";

View file

@ -1,16 +1,16 @@
import ClickableComponent from "@/features/clickables/Clickable.vue"; import ClickableComponent from "features/clickables/Clickable.vue";
import { Resource } from "@/features/resources/resource"; import { Resource } from "features/resources/resource";
import { Persistent, makePersistent, PersistentState } from "@/game/persistence"; import { Persistent, makePersistent, PersistentState } from "game/persistence";
import Decimal, { DecimalSource, format, formatWhole } from "@/util/bignum"; import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { coerceComponent, isCoercableComponent } from "@/util/vue"; import { coerceComponent, isCoercableComponent } from "util/vue";
import { computed, Ref, unref } from "vue"; import { computed, Ref, unref } from "vue";
import { import {
CoercableComponent, CoercableComponent,

View file

@ -27,11 +27,11 @@
</template> </template>
<script lang="tsx"> <script lang="tsx">
import "@/components/common/features.css"; import "components/common/features.css";
import { GenericChallenge } from "@/features/challenges/challenge"; import { GenericChallenge } from "features/challenges/challenge";
import { jsx, StyleValue, Visibility } from "@/features/feature"; import { jsx, StyleValue, Visibility } from "features/feature";
import { getHighNotifyStyle, getNotifyStyle } from "@/game/notifications"; import { getHighNotifyStyle, getNotifyStyle } from "game/notifications";
import { coerceComponent, isCoercableComponent, processedPropType, unwrapRef } from "@/util/vue"; import { coerceComponent, isCoercableComponent, processedPropType, unwrapRef } from "util/vue";
import { import {
Component, Component,
computed, computed,
@ -43,8 +43,8 @@ import {
UnwrapRef, UnwrapRef,
watchEffect watchEffect
} from "vue"; } from "vue";
import LinkNode from "@/components/links/LinkNode.vue"; import LinkNode from "components/links/LinkNode.vue";
import MarkNode from "@/components/MarkNode.vue"; import MarkNode from "components/MarkNode.vue";
export default defineComponent({ export default defineComponent({
props: { props: {

View file

@ -1,5 +1,5 @@
import Toggle from "@/components/fields/Toggle.vue"; import Toggle from "components/fields/Toggle.vue";
import ChallengeComponent from "@/features/challenges/Challenge.vue"; import ChallengeComponent from "features/challenges/Challenge.vue";
import { import {
CoercableComponent, CoercableComponent,
Component, Component,
@ -10,21 +10,21 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import { GenericReset } from "@/features/reset"; import { GenericReset } from "features/reset";
import { Resource } from "@/features/resources/resource"; import { Resource } from "features/resources/resource";
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import { persistent, PersistentRef } from "@/game/persistence"; import { persistent, PersistentRef } from "game/persistence";
import settings, { registerSettingField } from "@/game/settings"; import settings, { registerSettingField } from "game/settings";
import Decimal, { DecimalSource } from "@/util/bignum"; import Decimal, { DecimalSource } from "util/bignum";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { computed, Ref, unref } from "vue"; import { computed, Ref, unref } from "vue";
export const ChallengeType = Symbol("ChallengeType"); export const ChallengeType = Symbol("ChallengeType");
@ -251,7 +251,7 @@ export function createChallenge<T extends ChallengeOptions>(
}); });
} }
declare module "@/game/settings" { declare module "game/settings" {
interface Settings { interface Settings {
hideChallenges: boolean; hideChallenges: boolean;
} }

View file

@ -12,7 +12,6 @@
@touchstart="start" @touchstart="start"
@touchend="stop" @touchend="stop"
@touchcancel="stop" @touchcancel="stop"
:disabled="!unref(canClick)"
:class="{ :class="{
feature: true, feature: true,
clickable: true, clickable: true,
@ -30,18 +29,18 @@
</template> </template>
<script lang="tsx"> <script lang="tsx">
import "@/components/common/features.css"; import "components/common/features.css";
import LinkNode from "@/components/links/LinkNode.vue"; import LinkNode from "components/links/LinkNode.vue";
import MarkNode from "@/components/MarkNode.vue"; import MarkNode from "components/MarkNode.vue";
import { GenericClickable } from "@/features/clickables/clickable"; import { GenericClickable } from "features/clickables/clickable";
import { jsx, StyleValue, Visibility } from "@/features/feature"; import { jsx, StyleValue, Visibility } from "features/feature";
import { import {
coerceComponent, coerceComponent,
isCoercableComponent, isCoercableComponent,
processedPropType, processedPropType,
setupHoldToClick, setupHoldToClick,
unwrapRef unwrapRef
} from "@/util/vue"; } from "util/vue";
import { import {
Component, Component,
defineComponent, defineComponent,

View file

@ -1,4 +1,4 @@
import ClickableComponent from "@/features/clickables/Clickable.vue"; import ClickableComponent from "features/clickables/Clickable.vue";
import { import {
CoercableComponent, CoercableComponent,
Component, Component,
@ -8,15 +8,16 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { unref } from "vue";
export const ClickableType = Symbol("Clickable"); export const ClickableType = Symbol("Clickable");
@ -83,6 +84,23 @@ export function createClickable<T extends ClickableOptions>(
processComputable(clickable as T, "mark"); processComputable(clickable as T, "mark");
processComputable(clickable as T, "display"); processComputable(clickable as T, "display");
if (clickable.onClick) {
const onClick = clickable.onClick;
clickable.onClick = function () {
if (unref(clickable.canClick)) {
onClick();
}
};
}
if (clickable.onHold) {
const onHold = clickable.onHold;
clickable.onHold = function () {
if (unref(clickable.canClick)) {
onHold();
}
};
}
clickable[GatherProps] = function (this: GenericClickable) { clickable[GatherProps] = function (this: GenericClickable) {
const { const {
display, display,

View file

@ -1,12 +1,12 @@
import { GenericLayer } from "@/game/layers"; import { GenericLayer } from "game/layers";
import Decimal, { DecimalSource } from "@/util/bignum"; import Decimal, { DecimalSource } from "util/bignum";
import { import {
Computable, Computable,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { computed, isRef, Ref, unref } from "vue"; import { computed, isRef, Ref, unref } from "vue";
import { Replace, setDefault } from "./feature"; import { Replace, setDefault } from "./feature";
import { Resource } from "./resources/resource"; import { Resource } from "./resources/resource";
@ -132,9 +132,8 @@ export function createLinearScaling(
// Gain formula is (baseResource / base) ^ exponent // Gain formula is (baseResource / base) ^ exponent
// e.g. if exponent is 0.5 and base is 10, then having 10 points makes gain 1, and 40 points is 2 // e.g. if exponent is 0.5 and base is 10, then having 10 points makes gain 1, and 40 points is 2
export function createExponentialScaling( export function createPolynomialScaling(
base: DecimalSource | Ref<DecimalSource>, base: DecimalSource | Ref<DecimalSource>,
coefficient: DecimalSource | Ref<DecimalSource>,
exponent: DecimalSource | Ref<DecimalSource> exponent: DecimalSource | Ref<DecimalSource>
): ScalingFunction { ): ScalingFunction {
return { return {

View file

@ -1,6 +1,6 @@
import { DefaultValue } from "@/game/persistence"; import { DefaultValue } from "game/persistence";
import Decimal from "@/util/bignum"; import Decimal from "util/bignum";
import { DoNotCache, ProcessedComputable } from "@/util/computed"; import { DoNotCache, ProcessedComputable } from "util/computed";
import { CSSProperties, DefineComponent, isRef } from "vue"; import { CSSProperties, DefineComponent, isRef } from "vue";
export const Component = Symbol("Component"); export const Component = Symbol("Component");

View file

@ -17,12 +17,12 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import "@/components/common/table.css"; import "components/common/table.css";
import themes from "@/data/themes"; import themes from "data/themes";
import { Visibility } from "@/features/feature"; import { Visibility } from "features/feature";
import { GridCell } from "@/features/grids/grid"; import { GridCell } from "features/grids/grid";
import settings from "@/game/settings"; import settings from "game/settings";
import { processedPropType } from "@/util/vue"; import { processedPropType } from "util/vue";
import { computed, defineComponent, unref } from "vue"; import { computed, defineComponent, unref } from "vue";
import GridCellVue from "./GridCell.vue"; import GridCellVue from "./GridCell.vue";

View file

@ -15,7 +15,6 @@
@touchstart="start" @touchstart="start"
@touchend="stop" @touchend="stop"
@touchcancel="stop" @touchcancel="stop"
:disabled="!unref(canClick)"
> >
<div v-if="title"><component :is="titleComponent" /></div> <div v-if="title"><component :is="titleComponent" /></div>
<component :is="component" style="white-space: pre-line" /> <component :is="component" style="white-space: pre-line" />
@ -24,15 +23,15 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import "@/components/common/features.css"; import "components/common/features.css";
import LinkNode from "@/components/links/LinkNode.vue"; import LinkNode from "components/links/LinkNode.vue";
import { CoercableComponent, StyleValue, Visibility } from "@/features/feature"; import { CoercableComponent, StyleValue, Visibility } from "features/feature";
import { import {
computeComponent, computeComponent,
computeOptionalComponent, computeOptionalComponent,
processedPropType, processedPropType,
setupHoldToClick setupHoldToClick
} from "@/util/vue"; } from "util/vue";
import { defineComponent, PropType, toRefs, unref } from "vue"; import { defineComponent, PropType, toRefs, unref } from "vue";
export default defineComponent({ export default defineComponent({

View file

@ -1,4 +1,4 @@
import GridComponent from "@/features/grids/Grid.vue"; import GridComponent from "features/grids/Grid.vue";
import { import {
CoercableComponent, CoercableComponent,
Component, Component,
@ -8,18 +8,18 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import { isFunction } from "@/util/common"; import { isFunction } from "util/common";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { computed, Ref, unref } from "vue"; import { computed, Ref, unref } from "vue";
import { State, Persistent, makePersistent, PersistentState } from "@/game/persistence"; import { State, Persistent, makePersistent, PersistentState } from "game/persistence";
export const GridType = Symbol("Grid"); export const GridType = Symbol("Grid");
@ -278,6 +278,23 @@ export function createGrid<T extends GridOptions>(
processComputable(grid as T, "getTitle"); processComputable(grid as T, "getTitle");
processComputable(grid as T, "getDisplay"); processComputable(grid as T, "getDisplay");
if (grid.onClick) {
const onClick = grid.onClick;
grid.onClick = function (id, state) {
if (unref((grid as GenericGrid).cells[id].canClick)) {
onClick(id, state);
}
};
}
if (grid.onHold) {
const onHold = grid.onHold;
grid.onHold = function (id, state) {
if (unref((grid as GenericGrid).cells[id].canClick)) {
onHold(id, state);
}
};
}
grid[GatherProps] = function (this: GenericGrid) { grid[GatherProps] = function (this: GenericGrid) {
const { visibility, rows, cols, cells, id } = this; const { visibility, rows, cols, cells, id } = this;
return { visibility, rows, cols, cells, id }; return { visibility, rows, cols, cells, id };

View file

@ -1,14 +1,14 @@
import { hasWon } from "@/data/mod"; import { hasWon } from "data/projEntry";
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import player from "@/game/player"; import player from "game/player";
import { import {
Computable, Computable,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
GetComputableType, GetComputableType,
ProcessedComputable, ProcessedComputable,
processComputable processComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { unref } from "vue"; import { unref } from "vue";
import { findFeatures, Replace, setDefault } from "./feature"; import { findFeatures, Replace, setDefault } from "./feature";

View file

@ -29,11 +29,11 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import LinkNode from "@/components/links/LinkNode.vue"; import LinkNode from "components/links/LinkNode.vue";
import themes from "@/data/themes"; import themes from "data/themes";
import { CoercableComponent, Visibility } from "@/features/feature"; import { CoercableComponent, Visibility } from "features/feature";
import settings from "@/game/settings"; import settings from "game/settings";
import { computeComponent, processedPropType } from "@/util/vue"; import { computeComponent, processedPropType } from "util/vue";
import CollapseTransition from "@ivanv/vue-collapse-transition/src/CollapseTransition.vue"; import CollapseTransition from "@ivanv/vue-collapse-transition/src/CollapseTransition.vue";
import { computed, defineComponent, PropType, Ref, StyleValue, toRefs, unref } from "vue"; import { computed, defineComponent, PropType, Ref, StyleValue, toRefs, unref } from "vue";
@ -74,7 +74,7 @@ export default defineComponent({
const titleComponent = computeComponent(title); const titleComponent = computeComponent(title);
const bodyComponent = computeComponent(display); const bodyComponent = computeComponent(display);
const stacked = computed(() => themes[settings.theme].stackedInfoboxes); const stacked = computed(() => themes[settings.theme].mergeAdjacent);
return { return {
titleComponent, titleComponent,

View file

@ -1,4 +1,4 @@
import InfoboxComponent from "@/features/infoboxes/Infobox.vue"; import InfoboxComponent from "features/infoboxes/Infobox.vue";
import { import {
CoercableComponent, CoercableComponent,
Component, Component,
@ -8,17 +8,17 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { Ref } from "vue"; import { Ref } from "vue";
import { Persistent, makePersistent, PersistentState } from "@/game/persistence"; import { Persistent, makePersistent, PersistentState } from "game/persistence";
export const InfoboxType = Symbol("Infobox"); export const InfoboxType = Symbol("Infobox");

View file

@ -1,4 +1,4 @@
import { Position } from "@/game/layers"; import { Position } from "game/layers";
import { InjectionKey, SVGAttributes } from "vue"; import { InjectionKey, SVGAttributes } from "vue";
export interface LinkNode { export interface LinkNode {

View file

@ -15,10 +15,10 @@
</template> </template>
<script lang="tsx"> <script lang="tsx">
import "@/components/common/features.css"; import "components/common/features.css";
import { jsx, StyleValue, Visibility } from "@/features/feature"; import { jsx, StyleValue, Visibility } from "features/feature";
import { GenericMilestone } from "@/features/milestones/milestone"; import { GenericMilestone } from "features/milestones/milestone";
import { coerceComponent, isCoercableComponent, processedPropType, unwrapRef } from "@/util/vue"; import { coerceComponent, isCoercableComponent, processedPropType, unwrapRef } from "util/vue";
import { Component, defineComponent, shallowRef, toRefs, unref, UnwrapRef, watchEffect } from "vue"; import { Component, defineComponent, shallowRef, toRefs, unref, UnwrapRef, watchEffect } from "vue";
import LinkNode from "../../components/links/LinkNode.vue"; import LinkNode from "../../components/links/LinkNode.vue";

View file

@ -1,4 +1,4 @@
import Select from "@/components/fields/Select.vue"; import Select from "components/fields/Select.vue";
import { import {
CoercableComponent, CoercableComponent,
Component, Component,
@ -10,22 +10,22 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import MilestoneComponent from "@/features/milestones/Milestone.vue"; import MilestoneComponent from "features/milestones/Milestone.vue";
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import "@/game/notifications"; import "game/notifications";
import { makePersistent, Persistent, PersistentState } from "@/game/persistence"; import { makePersistent, Persistent, PersistentState } from "game/persistence";
import settings, { registerSettingField } from "@/game/settings"; import settings, { registerSettingField } from "game/settings";
import { camelToTitle } from "@/util/common"; import { camelToTitle } from "util/common";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { coerceComponent, isCoercableComponent } from "@/util/vue"; import { coerceComponent, isCoercableComponent } from "util/vue";
import { Unsubscribe } from "nanoevents"; import { Unsubscribe } from "nanoevents";
import { computed, Ref, unref } from "vue"; import { computed, Ref, unref } from "vue";
import { useToast } from "vue-toastification"; import { useToast } from "vue-toastification";
@ -180,7 +180,7 @@ globalBus.on("removeLayer", layer => {
listeners[layer.id] = undefined; listeners[layer.id] = undefined;
}); });
declare module "@/game/settings" { declare module "game/settings" {
interface Settings { interface Settings {
msDisplay: MilestoneDisplay; msDisplay: MilestoneDisplay;
} }

View file

@ -1,16 +1,16 @@
import { getUniqueID, Replace } from "@/features/feature"; import { getUniqueID, Replace } from "features/feature";
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import { GenericLayer } from "@/game/layers"; import { GenericLayer } from "game/layers";
import { import {
DefaultValue, DefaultValue,
Persistent, Persistent,
persistent, persistent,
PersistentRef, PersistentRef,
PersistentState PersistentState
} from "@/game/persistence"; } from "game/persistence";
import Decimal from "@/lib/break_eternity"; import Decimal from "lib/break_eternity";
import { Computable, GetComputableType, processComputable } from "@/util/computed"; import { Computable, GetComputableType, processComputable } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { Unsubscribe } from "nanoevents"; import { Unsubscribe } from "nanoevents";
import { computed, isRef, unref } from "vue"; import { computed, isRef, unref } from "vue";
@ -101,7 +101,7 @@ globalBus.on("removeLayer", layer => {
listeners[layer.id] = undefined; listeners[layer.id] = undefined;
}); });
declare module "@/game/events" { declare module "game/events" {
interface GlobalEvents { interface GlobalEvents {
reset: (reset: GenericReset) => void; reset: (reset: GenericReset) => void;
} }

View file

@ -10,12 +10,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { CoercableComponent } from "@/features/feature"; import { CoercableComponent } from "features/feature";
import { Resource } from "@/features/resources/resource"; import { Resource } from "features/resources/resource";
import Decimal from "@/util/bignum"; import Decimal from "util/bignum";
import { computeOptionalComponent } from "@/util/vue"; import { computeOptionalComponent } from "util/vue";
import { computed, Ref, StyleValue, toRefs } from "vue"; import { computed, Ref, StyleValue, toRefs } from "vue";
import ResourceVue from "@/features/resources/Resource.vue"; import ResourceVue from "features/resources/Resource.vue";
const _props = defineProps<{ const _props = defineProps<{
resource: Resource; resource: Resource;

View file

@ -5,7 +5,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { displayResource, Resource } from "@/features/resources/resource"; import { displayResource, Resource } from "features/resources/resource";
import { computed } from "vue"; import { computed } from "vue";
const props = defineProps<{ const props = defineProps<{

View file

@ -1,19 +1,19 @@
import Decimal, { DecimalSource, format, formatWhole } from "@/util/bignum"; import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
import { computed, ComputedRef, ref, Ref, watch } from "vue"; import { computed, ComputedRef, ref, Ref, watch } from "vue";
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import { State, persistent } from "@/game/persistence"; import { State, persistent } from "game/persistence";
export interface Resource<T = DecimalSource> extends Ref<T> { export interface Resource<T = DecimalSource> extends Ref<T> {
displayName: string; displayName: string;
precision: number; precision: number;
small: boolean; small?: boolean;
} }
export function createResource<T extends State>( export function createResource<T extends State>(
defaultValue: T | Ref<T>, defaultValue: T | Ref<T>,
displayName = "points", displayName = "points",
precision = 0, precision = 0,
small = false small = undefined
): Resource<T> { ): Resource<T> {
const resource: Partial<Resource<T>> = persistent(defaultValue); const resource: Partial<Resource<T>> = persistent(defaultValue);
resource.displayName = displayName; resource.displayName = displayName;

View file

@ -3,8 +3,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { CoercableComponent } from "@/features/feature"; import { CoercableComponent } from "features/feature";
import { computeComponent } from "@/util/vue"; import { computeComponent } from "util/vue";
import { toRefs } from "vue"; import { toRefs } from "vue";
const _props = defineProps<{ display: CoercableComponent }>(); const _props = defineProps<{ display: CoercableComponent }>();

View file

@ -20,9 +20,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { CoercableComponent, StyleValue, Visibility } from "@/features/feature"; import { CoercableComponent, StyleValue, Visibility } from "features/feature";
import { getNotifyStyle } from "@/game/notifications"; import { getNotifyStyle } from "game/notifications";
import { computeComponent, processedPropType, unwrapRef } from "@/util/vue"; import { computeComponent, processedPropType, unwrapRef } from "util/vue";
import { computed, defineComponent, toRefs, unref } from "vue"; import { computed, defineComponent, toRefs, unref } from "vue";
export default defineComponent({ export default defineComponent({

View file

@ -30,14 +30,14 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Sticky from "@/components/layout/Sticky.vue"; import Sticky from "components/layout/Sticky.vue";
import themes from "@/data/themes"; import themes from "data/themes";
import { CoercableComponent, StyleValue, Visibility } from "@/features/feature"; import { CoercableComponent, StyleValue, Visibility } from "features/feature";
import { GenericTab } from "@/features/tabs/tab"; import { GenericTab } from "features/tabs/tab";
import TabButton from "@/features/tabs/TabButton.vue"; import TabButton from "features/tabs/TabButton.vue";
import { GenericTabButton } from "@/features/tabs/tabFamily"; import { GenericTabButton } from "features/tabs/tabFamily";
import settings from "@/game/settings"; import settings from "game/settings";
import { coerceComponent, isCoercableComponent, processedPropType, unwrapRef } from "@/util/vue"; import { coerceComponent, isCoercableComponent, processedPropType, unwrapRef } from "util/vue";
import { import {
Component, Component,
computed, computed,

View file

@ -5,10 +5,10 @@ import {
getUniqueID, getUniqueID,
Replace, Replace,
StyleValue StyleValue
} from "@/features/feature"; } from "features/feature";
import TabComponent from "@/features/tabs/Tab.vue"; import TabComponent from "features/tabs/Tab.vue";
import { Computable, GetComputableType } from "@/util/computed"; import { Computable, GetComputableType } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
export const TabType = Symbol("Tab"); export const TabType = Symbol("Tab");

View file

@ -7,18 +7,18 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import TabButtonComponent from "@/features/tabs/TabButton.vue"; import TabButtonComponent from "features/tabs/TabButton.vue";
import TabFamilyComponent from "@/features/tabs/TabFamily.vue"; import TabFamilyComponent from "features/tabs/TabFamily.vue";
import { Persistent, makePersistent, PersistentState } from "@/game/persistence"; import { Persistent, makePersistent, PersistentState } from "game/persistence";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { computed, Ref, unref } from "vue"; import { computed, Ref, unref } from "vue";
import { GenericTab } from "./tab"; import { GenericTab } from "./tab";

View file

@ -1,5 +1,5 @@
import { CoercableComponent } from "@/features/feature"; import { CoercableComponent } from "features/feature";
import { ProcessedComputable } from "@/util/computed"; import { ProcessedComputable } from "util/computed";
declare module "@vue/runtime-dom" { declare module "@vue/runtime-dom" {
interface CSSProperties { interface CSSProperties {

View file

@ -28,9 +28,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import "@/components/common/table.css"; import "components/common/table.css";
import { GenericTreeNode } from "@/features/trees/tree"; import { GenericTreeNode } from "features/trees/tree";
import { processedPropType } from "@/util/vue"; import { processedPropType } from "util/vue";
import { defineComponent, unref } from "vue"; import { defineComponent, unref } from "vue";
import TreeNode from "./TreeNode.vue"; import TreeNode from "./TreeNode.vue";

View file

@ -29,7 +29,6 @@
}, },
unref(style) ?? [] unref(style) ?? []
]" ]"
:disabled="!unref(canClick)"
> >
<component :is="unref(comp)" /> <component :is="unref(comp)" />
</button> </button>
@ -39,19 +38,19 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import LinkNode from "@/components/links/LinkNode.vue"; import LinkNode from "components/links/LinkNode.vue";
import MarkNode from "@/components/MarkNode.vue"; import MarkNode from "components/MarkNode.vue";
import TooltipVue from "@/components/Tooltip.vue"; import TooltipVue from "components/Tooltip.vue";
import { CoercableComponent, StyleValue, Visibility } from "@/features/feature"; import { CoercableComponent, StyleValue, Visibility } from "features/feature";
import { gatherTooltipProps, Tooltip } from "@/features/tooltip"; import { gatherTooltipProps, Tooltip } from "features/tooltip";
import { ProcessedComputable } from "@/util/computed"; import { ProcessedComputable } from "util/computed";
import { import {
computeOptionalComponent, computeOptionalComponent,
isCoercableComponent, isCoercableComponent,
processedPropType, processedPropType,
setupHoldToClick, setupHoldToClick,
unwrapRef unwrapRef
} from "@/util/vue"; } from "util/vue";
import { import {
computed, computed,
defineComponent, defineComponent,

View file

@ -7,15 +7,15 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import { Link } from "@/features/links"; import { Link } from "features/links";
import { GenericReset } from "@/features/reset"; import { GenericReset } from "features/reset";
import { displayResource, Resource } from "@/features/resources/resource"; import { displayResource, Resource } from "features/resources/resource";
import { Tooltip } from "@/features/tooltip"; import { Tooltip } from "features/tooltip";
import TreeComponent from "@/features/trees/Tree.vue"; import TreeComponent from "features/trees/Tree.vue";
import { persistent } from "@/game/persistence"; import { persistent } from "game/persistence";
import { DecimalSource, format } from "@/util/bignum"; import { DecimalSource, format } from "util/bignum";
import Decimal, { formatWhole } from "@/util/break_eternity"; import Decimal, { formatWhole } from "util/break_eternity";
import { import {
Computable, Computable,
convertComputable, convertComputable,
@ -23,8 +23,8 @@ import {
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { computed, ref, Ref, unref } from "vue"; import { computed, ref, Ref, unref } from "vue";
export const TreeNodeType = Symbol("TreeNode"); export const TreeNodeType = Symbol("TreeNode");
@ -101,6 +101,23 @@ export function createTreeNode<T extends TreeNodeOptions>(
processComputable(treeNode as T, "style"); processComputable(treeNode as T, "style");
processComputable(treeNode as T, "mark"); processComputable(treeNode as T, "mark");
if (treeNode.onClick) {
const onClick = treeNode.onClick;
treeNode.onClick = function () {
if (unref(treeNode.canClick)) {
onClick();
}
};
}
if (treeNode.onHold) {
const onHold = treeNode.onHold;
treeNode.onHold = function () {
if (unref(treeNode.canClick)) {
onHold();
}
};
}
return treeNode as unknown as TreeNode<T>; return treeNode as unknown as TreeNode<T>;
}); });
} }

View file

@ -25,14 +25,14 @@
</template> </template>
<script lang="tsx"> <script lang="tsx">
import "@/components/common/features.css"; import "components/common/features.css";
import LinkNode from "@/components/links/LinkNode.vue"; import LinkNode from "components/links/LinkNode.vue";
import MarkNode from "@/components/MarkNode.vue"; import MarkNode from "components/MarkNode.vue";
import { jsx, StyleValue, Visibility } from "@/features/feature"; import { jsx, StyleValue, Visibility } from "features/feature";
import { displayResource, Resource } from "@/features/resources/resource"; import { displayResource, Resource } from "features/resources/resource";
import { GenericUpgrade } from "@/features/upgrades/upgrade"; import { GenericUpgrade } from "features/upgrades/upgrade";
import { DecimalSource } from "@/lib/break_eternity"; import { DecimalSource } from "lib/break_eternity";
import { coerceComponent, isCoercableComponent, processedPropType, unwrapRef } from "@/util/vue"; import { coerceComponent, isCoercableComponent, processedPropType, unwrapRef } from "util/vue";
import { import {
Component, Component,
defineComponent, defineComponent,

View file

@ -1,4 +1,4 @@
import UpgradeComponent from "@/features/upgrades/Upgrade.vue"; import UpgradeComponent from "features/upgrades/Upgrade.vue";
import { import {
CoercableComponent, CoercableComponent,
Component, Component,
@ -9,21 +9,21 @@ import {
setDefault, setDefault,
StyleValue, StyleValue,
Visibility Visibility
} from "@/features/feature"; } from "features/feature";
import { Resource } from "@/features/resources/resource"; import { Resource } from "features/resources/resource";
import { GenericLayer } from "@/game/layers"; import { GenericLayer } from "game/layers";
import Decimal, { DecimalSource } from "@/util/bignum"; import Decimal, { DecimalSource } from "util/bignum";
import { isFunction } from "@/util/common"; import { isFunction } from "util/common";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { computed, Ref, unref } from "vue"; import { computed, Ref, unref } from "vue";
import { Persistent, makePersistent, PersistentState } from "@/game/persistence"; import { Persistent, makePersistent, PersistentState } from "game/persistence";
export const UpgradeType = Symbol("Upgrade"); export const UpgradeType = Symbol("Upgrade");

View file

@ -1,5 +1,5 @@
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
import Decimal, { DecimalSource } from "@/util/bignum"; import Decimal, { DecimalSource } from "util/bignum";
import { createNanoEvents } from "nanoevents"; import { createNanoEvents } from "nanoevents";
import { App, Ref } from "vue"; import { App, Ref } from "vue";
import { GenericLayer } from "./layers"; import { GenericLayer } from "./layers";
@ -51,8 +51,8 @@ function update() {
// Add offline time if any // Add offline time if any
if (player.offlineTime != undefined) { if (player.offlineTime != undefined) {
if (Decimal.gt(player.offlineTime, modInfo.offlineLimit * 3600)) { if (Decimal.gt(player.offlineTime, projInfo.offlineLimit * 3600)) {
player.offlineTime = new Decimal(modInfo.offlineLimit * 3600); player.offlineTime = new Decimal(projInfo.offlineLimit * 3600);
} }
if (Decimal.gt(player.offlineTime, 0) && player.devSpeed !== 0) { if (Decimal.gt(player.offlineTime, 0) && player.devSpeed !== 0) {
const offlineDiff = Decimal.div(player.offlineTime, 10).max(diff); const offlineDiff = Decimal.div(player.offlineTime, 10).max(diff);
@ -67,7 +67,7 @@ function update() {
} }
// Cap at max tick length // Cap at max tick length
diff = Decimal.min(diff, modInfo.maxTickLength); diff = Decimal.min(diff, projInfo.maxTickLength);
// Apply dev speed // Apply dev speed
if (player.devSpeed != undefined) { if (player.devSpeed != undefined) {
@ -93,7 +93,7 @@ function update() {
} }
export async function startGameLoop() { export async function startGameLoop() {
hasWon = (await import("@/data/mod")).hasWon; hasWon = (await import("data/projEntry")).hasWon;
if (settings.unthrottled) { if (settings.unthrottled) {
requestAnimationFrame(update); requestAnimationFrame(update);
} else { } else {

View file

@ -1,4 +1,4 @@
import Modal from "@/components/Modal.vue"; import Modal from "components/Modal.vue";
import { import {
CoercableComponent, CoercableComponent,
jsx, jsx,
@ -6,17 +6,17 @@ import {
Replace, Replace,
setDefault, setDefault,
StyleValue StyleValue
} from "@/features/feature"; } from "features/feature";
import { Link } from "@/features/links"; import { Link } from "features/links";
import Decimal from "@/util/bignum"; import Decimal from "util/bignum";
import { import {
Computable, Computable,
GetComputableType, GetComputableType,
GetComputableTypeWithDefault, GetComputableTypeWithDefault,
processComputable, processComputable,
ProcessedComputable ProcessedComputable
} from "@/util/computed"; } from "util/computed";
import { createLazyProxy } from "@/util/proxies"; import { createLazyProxy } from "util/proxies";
import { createNanoEvents, Emitter } from "nanoevents"; import { createNanoEvents, Emitter } from "nanoevents";
import { ref, unref } from "vue"; import { ref, unref } from "vue";
import { globalBus } from "./events"; import { globalBus } from "./events";

View file

@ -1,4 +1,4 @@
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import Toast from "vue-toastification"; import Toast from "vue-toastification";
import "vue-toastification/dist/index.css"; import "vue-toastification/dist/index.css";

View file

@ -1,6 +1,6 @@
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import Decimal, { DecimalSource } from "@/util/bignum"; import Decimal, { DecimalSource } from "util/bignum";
import { ProxyState } from "@/util/proxies"; import { ProxyState } from "util/proxies";
import { isArray } from "@vue/shared"; import { isArray } from "@vue/shared";
import { isRef, Ref, ref } from "vue"; import { isRef, Ref, ref } from "vue";
import { GenericLayer } from "./layers"; import { GenericLayer } from "./layers";

View file

@ -1,6 +1,6 @@
import Decimal, { DecimalSource } from "@/util/bignum"; import Decimal, { DecimalSource } from "util/bignum";
import { isPlainObject } from "@/util/common"; import { isPlainObject } from "util/common";
import { ProxiedWithState, ProxyPath, ProxyState } from "@/util/proxies"; import { ProxiedWithState, ProxyPath, ProxyState } from "util/proxies";
import { reactive, unref } from "vue"; import { reactive, unref } from "vue";
import transientState from "./state"; import transientState from "./state";

View file

@ -1,8 +1,8 @@
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
import { Themes } from "@/data/themes"; import { Themes } from "data/themes";
import { CoercableComponent } from "@/features/feature"; import { CoercableComponent } from "features/feature";
import { globalBus } from "@/game/events"; import { globalBus } from "game/events";
import { hardReset } from "@/util/save"; import { hardReset } from "util/save";
import { reactive, watch } from "vue"; import { reactive, watch } from "vue";
export interface Settings { export interface Settings {
@ -24,14 +24,17 @@ const state = reactive<Partial<Settings>>({
watch( watch(
state, state,
state => state =>
localStorage.setItem(modInfo.id, btoa(unescape(encodeURIComponent(JSON.stringify(state))))), localStorage.setItem(
projInfo.id,
btoa(unescape(encodeURIComponent(JSON.stringify(state))))
),
{ deep: true } { deep: true }
); );
export default window.settings = state as Settings; export default window.settings = state as Settings;
export function loadSettings(): void { export function loadSettings(): void {
try { try {
const item: string | null = localStorage.getItem(modInfo.id); const item: string | null = localStorage.getItem(projInfo.id);
if (item != null && item !== "") { if (item != null && item !== "") {
const settings = JSON.parse(decodeURIComponent(escape(atob(item)))); const settings = JSON.parse(decodeURIComponent(escape(atob(item))));
if (typeof settings === "object") { if (typeof settings === "object") {

View file

@ -1,6 +1,6 @@
import { App as VueApp, createApp } from "vue"; import { App as VueApp, createApp } from "vue";
import App from "./App.vue"; import App from "./App.vue";
import modInfo from "./data/modInfo.json"; import projInfo from "./data/projInfo.json";
import { GenericLayer } from "./game/layers"; import { GenericLayer } from "./game/layers";
import { PlayerData } from "./game/player"; import { PlayerData } from "./game/player";
import { Settings } from "./game/settings"; import { Settings } from "./game/settings";
@ -8,6 +8,11 @@ import { Transient } from "./game/state";
import Decimal, { DecimalSource } from "./lib/break_eternity"; import Decimal, { DecimalSource } from "./lib/break_eternity";
import { load } from "./util/save"; import { load } from "./util/save";
document.title = projInfo.title;
if (projInfo.id === "") {
throw "Project ID is empty! Please select a unique ID for this project in /src/data/projInfo.json";
}
declare global { declare global {
interface Window { interface Window {
vue: VueApp; vue: VueApp;
@ -28,7 +33,7 @@ declare global {
toPlaces: (x: DecimalSource, precision: number, maxAccepted: DecimalSource) => string; toPlaces: (x: DecimalSource, precision: number, maxAccepted: DecimalSource) => string;
formatSmall: (x: DecimalSource, precision?: number) => string; formatSmall: (x: DecimalSource, precision?: number) => string;
invertOOM: (x: DecimalSource) => Decimal; invertOOM: (x: DecimalSource) => Decimal;
modInfo: typeof modInfo; projInfo: typeof projInfo;
} }
} }
@ -42,14 +47,11 @@ requestAnimationFrame(async () => {
const { globalBus, startGameLoop } = await require("./game/events"); const { globalBus, startGameLoop } = await require("./game/events");
// Create Vue // Create Vue
const vue = (window.vue = createApp({ const vue = (window.vue = createApp(App));
...App
}));
globalBus.emit("setupVue", vue); globalBus.emit("setupVue", vue);
vue.mount("#app"); vue.mount("#app");
document.title = modInfo.title;
startGameLoop(); startGameLoop();
}); });
window.modInfo = modInfo; window.projInfo = projInfo;

View file

@ -1,7 +1,7 @@
// Import Decimal and numberUtils from a different file to globally change which big num library gets used // Import Decimal and numberUtils from a different file to globally change which big num library gets used
// This way switching out big number libraries just needs to happen here, not every file that needs big numbers // This way switching out big number libraries just needs to happen here, not every file that needs big numbers
import { DecimalSource as RawDecimalSource } from "@/lib/break_eternity"; import { DecimalSource as RawDecimalSource } from "lib/break_eternity";
import Decimal, * as numberUtils from "@/util/break_eternity"; import Decimal, * as numberUtils from "util/break_eternity";
export const { export const {
exponentialFormat, exponentialFormat,

View file

@ -1,5 +1,5 @@
import Decimal, { DecimalSource } from "@/lib/break_eternity"; import Decimal, { DecimalSource } from "lib/break_eternity";
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
export default Decimal; export default Decimal;
@ -13,7 +13,7 @@ export function exponentialFormat(num: DecimalSource, precision: number, mantiss
e = e.add(1); e = e.add(1);
} }
const eString = e.gte(1e9) const eString = e.gte(1e9)
? format(e, Math.max(Math.max(precision, 3), modInfo.defaultDecimalsShown)) ? format(e, Math.max(Math.max(precision, 3), projInfo.defaultDecimalsShown))
: e.gte(10000) : e.gte(10000)
? commaFormat(e, 0) ? commaFormat(e, 0)
: e.toStringWithDecimalPlaces(0); : e.toStringWithDecimalPlaces(0);
@ -48,7 +48,7 @@ export function regularFormat(num: DecimalSource, precision: number): string {
return (0).toFixed(precision); return (0).toFixed(precision);
} }
if (num.mag < 0.1 && precision !== 0) { if (num.mag < 0.1 && precision !== 0) {
precision = Math.max(Math.max(precision, 4), modInfo.defaultDecimalsShown); precision = Math.max(Math.max(precision, 4), projInfo.defaultDecimalsShown);
} }
return num.toStringWithDecimalPlaces(precision); return num.toStringWithDecimalPlaces(precision);
} }
@ -63,8 +63,8 @@ const nearOne = new Decimal(0.98);
const thousandth = new Decimal(0.001); const thousandth = new Decimal(0.001);
const zero = new Decimal(0); const zero = new Decimal(0);
export function format(num: DecimalSource, precision?: number, small?: boolean): string { export function format(num: DecimalSource, precision?: number, small?: boolean): string {
if (precision == null) precision = modInfo.defaultDecimalsShown; if (precision == null) precision = projInfo.defaultDecimalsShown;
small = small || modInfo.allowSmall; small = small ?? projInfo.defaultShowSmall;
num = new Decimal(num); num = new Decimal(num);
if (isNaN(num.sign) || isNaN(num.layer) || isNaN(num.mag)) { if (isNaN(num.sign) || isNaN(num.layer) || isNaN(num.mag)) {
return "NaN"; return "NaN";

View file

@ -1,23 +1,23 @@
import modInfo from "@/data/modInfo.json"; import projInfo from "data/projInfo.json";
import player, { Player, PlayerData, stringifySave } from "@/game/player"; import player, { Player, PlayerData, stringifySave } from "game/player";
import settings, { loadSettings } from "@/game/settings"; import settings, { loadSettings } from "game/settings";
import Decimal from "./bignum"; import Decimal from "./bignum";
import { ProxyState } from "./proxies"; import { ProxyState } from "./proxies";
export function setupInitialStore(player: Partial<PlayerData> = {}): Player { export function setupInitialStore(player: Partial<PlayerData> = {}): Player {
return Object.assign( return Object.assign(
{ {
id: `${modInfo.id}-0`, id: `${projInfo.id}-0`,
name: "Default Save", name: "Default Save",
tabs: modInfo.initialTabs.slice(), tabs: projInfo.initialTabs.slice(),
time: Date.now(), time: Date.now(),
autosave: true, autosave: true,
offlineProd: true, offlineProd: true,
offlineTime: new Decimal(0), offlineTime: new Decimal(0),
timePlayed: new Decimal(0), timePlayed: new Decimal(0),
keepGoing: false, keepGoing: false,
modID: modInfo.id, modID: projInfo.id,
modVersion: modInfo.versionNumber, modVersion: projInfo.versionNumber,
layers: {} layers: {}
}, },
player player
@ -41,7 +41,7 @@ export async function load(): Promise<void> {
return; return;
} }
const player = JSON.parse(decodeURIComponent(escape(atob(save)))); const player = JSON.parse(decodeURIComponent(escape(atob(save))));
if (player.modID !== modInfo.id) { if (player.modID !== projInfo.id) {
await loadSave(newSave()); await loadSave(newSave());
return; return;
} }
@ -67,15 +67,15 @@ export function getUniqueID(): string {
let id, let id,
i = 0; i = 0;
do { do {
id = `${modInfo.id}-${i++}`; id = `${projInfo.id}-${i++}`;
} while (localStorage.getItem(id)); } while (localStorage.getItem(id));
return id; return id;
} }
export async function loadSave(playerObj: Partial<PlayerData>): Promise<void> { export async function loadSave(playerObj: Partial<PlayerData>): Promise<void> {
console.info("Loading save", playerObj); console.info("Loading save", playerObj);
const { layers, removeLayer, addLayer } = await import("@/game/layers"); const { layers, removeLayer, addLayer } = await import("game/layers");
const { fixOldSave, getInitialLayers } = await import("@/data/mod"); const { fixOldSave, getInitialLayers } = await import("data/projEntry");
for (const layer in layers) { for (const layer in layers) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@ -92,7 +92,7 @@ export async function loadSave(playerObj: Partial<PlayerData>): Promise<void> {
); );
} }
playerObj.time = Date.now(); playerObj.time = Date.now();
if (playerObj.modVersion !== modInfo.versionNumber) { if (playerObj.modVersion !== projInfo.versionNumber) {
fixOldSave(playerObj.modVersion, playerObj); fixOldSave(playerObj.modVersion, playerObj);
} }

View file

@ -1,12 +1,12 @@
import Col from "@/components/layout/Column.vue"; import Col from "components/layout/Column.vue";
import Row from "@/components/layout/Row.vue"; import Row from "components/layout/Row.vue";
import { import {
CoercableComponent, CoercableComponent,
Component as ComponentKey, Component as ComponentKey,
GatherProps, GatherProps,
GenericComponent, GenericComponent,
JSXFunction JSXFunction
} from "@/features/feature"; } from "features/feature";
import { import {
Component, Component,
computed, computed,

View file

@ -15,15 +15,10 @@
"esModuleInterop": true, "esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"sourceMap": true, "sourceMap": true,
"baseUrl": ".", "baseUrl": "src",
"types": [ "types": [
"webpack-env" "webpack-env"
], ],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [ "lib": [
"esnext", "esnext",
"dom", "dom",