forked from profectus/Profectus
Renamed modInfo -> projInfo, mod -> projEntry
This commit is contained in:
parent
f352c7d316
commit
52a9f51510
15 changed files with 42 additions and 42 deletions
|
@ -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>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</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";
|
||||||
|
@ -26,7 +26,7 @@ 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;
|
||||||
|
|
|
@ -38,15 +38,15 @@
|
||||||
|
|
||||||
<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);
|
||||||
|
|
|
@ -50,12 +50,12 @@
|
||||||
<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);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
<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";
|
||||||
|
@ -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() {
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
<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";
|
||||||
|
@ -52,7 +52,7 @@ 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);
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
|
|
||||||
<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");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { main } from "@/data/mod";
|
import { main } from "@/data/projEntry";
|
||||||
import { createCumulativeConversion, createExponentialScaling } from "@/features/conversion";
|
import { createCumulativeConversion, createExponentialScaling } from "@/features/conversion";
|
||||||
import { jsx } from "@/features/feature";
|
import { jsx } from "@/features/feature";
|
||||||
import { createReset } from "@/features/reset";
|
import { createReset } from "@/features/reset";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
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";
|
||||||
|
@ -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 {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
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";
|
||||||
|
@ -24,14 +24,14 @@ 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") {
|
||||||
|
|
|
@ -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";
|
||||||
|
@ -28,7 +28,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,9 +47,9 @@ requestAnimationFrame(async () => {
|
||||||
}));
|
}));
|
||||||
globalBus.emit("setupVue", vue);
|
globalBus.emit("setupVue", vue);
|
||||||
vue.mount("#app");
|
vue.mount("#app");
|
||||||
document.title = modInfo.title;
|
document.title = projInfo.title;
|
||||||
|
|
||||||
startGameLoop();
|
startGameLoop();
|
||||||
});
|
});
|
||||||
|
|
||||||
window.modInfo = modInfo;
|
window.projInfo = projInfo;
|
||||||
|
|
|
@ -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.allowSmall;
|
||||||
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";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
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";
|
||||||
|
@ -7,17 +7,17 @@ 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,7 +67,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ export function getUniqueID(): string {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue