Renamed modInfo -> projInfo, mod -> projEntry

This commit is contained in:
thepaperpilot 2022-03-02 20:12:56 -06:00
parent f352c7d316
commit 52a9f51510
15 changed files with 42 additions and 42 deletions

View file

@ -16,7 +16,7 @@ import GameOverScreen from "./components/GameOverScreen.vue";
import NaNScreen from "./components/NaNScreen.vue";
import Nav from "./components/Nav.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 settings from "./game/settings";
import "./main.css";
@ -25,7 +25,7 @@ function updateMouse(/* event */) {
// 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 showTPS = toRef(settings, "showTPS");
</script>

View file

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

View file

@ -38,15 +38,15 @@
<script setup lang="ts">
import Modal from "@/components/Modal.vue";
import { hasWon } from "@/data/mod";
import modInfo from "@/data/modInfo.json";
import { hasWon } from "@/data/projEntry";
import projInfo from "@/data/projInfo.json";
import player from "@/game/player";
import { formatTime } from "@/util/bignum";
import { loadSave, newSave } from "@/util/save";
import { computed, toRef } from "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 isOpen = computed(() => hasWon.value && !player.keepGoing);

View file

@ -50,12 +50,12 @@
<script setup lang="ts">
import Modal from "@/components/Modal.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 { formatTime } from "@/util/bignum";
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 = toRefs(_props);

View file

@ -22,7 +22,7 @@
<script lang="ts">
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 { Link } from "@/features/links";
import { PersistentRef } from "@/game/persistence";
@ -68,7 +68,7 @@ export default defineComponent({
const component = computeComponent(display);
const showGoBack = computed(
() => modInfo.allowGoBack && index.value > 0 && !minimized.value
() => projInfo.allowGoBack && index.value > 0 && !minimized.value
);
function goBack() {

View file

@ -44,7 +44,7 @@
<script setup lang="ts">
import Modal from "@/components/Modal.vue";
import modInfo from "@/data/modInfo.json";
import projInfo from "@/data/projInfo.json";
import player from "@/game/player";
import state from "@/game/state";
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 SavesManager from "./SavesManager.vue";
const { discordName, discordLink } = modInfo;
const { discordName, discordLink } = projInfo;
const autosave = toRef(player, "autosave");
const hasNaN = toRef(state, "hasNaN");
const savesManager = ref<ComponentPublicInstance<typeof SavesManager> | null>(null);

View file

@ -100,7 +100,7 @@
<script setup lang="ts">
import Changelog from "@/data/Changelog.vue";
import modInfo from "@/data/modInfo.json";
import projInfo from "@/data/projInfo.json";
import { ComponentPublicInstance, ref } from "vue";
import Info from "./Info.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
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() {
window.open(discordLink, "mywindow");

View file

@ -1,4 +1,4 @@
import { main } from "@/data/mod";
import { main } from "@/data/projEntry";
import { createCumulativeConversion, createExponentialScaling } from "@/features/conversion";
import { jsx } from "@/features/feature";
import { createReset } from "@/features/reset";

View file

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

View file

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

View file

@ -1,6 +1,6 @@
import { App as VueApp, createApp } from "vue";
import App from "./App.vue";
import modInfo from "./data/modInfo.json";
import projInfo from "./data/projInfo.json";
import { GenericLayer } from "./game/layers";
import { PlayerData } from "./game/player";
import { Settings } from "./game/settings";
@ -28,7 +28,7 @@ declare global {
toPlaces: (x: DecimalSource, precision: number, maxAccepted: DecimalSource) => string;
formatSmall: (x: DecimalSource, precision?: number) => string;
invertOOM: (x: DecimalSource) => Decimal;
modInfo: typeof modInfo;
projInfo: typeof projInfo;
}
}
@ -47,9 +47,9 @@ requestAnimationFrame(async () => {
}));
globalBus.emit("setupVue", vue);
vue.mount("#app");
document.title = modInfo.title;
document.title = projInfo.title;
startGameLoop();
});
window.modInfo = modInfo;
window.projInfo = projInfo;

View file

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

View file

@ -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 settings, { loadSettings } from "@/game/settings";
import Decimal from "./bignum";
@ -7,17 +7,17 @@ import { ProxyState } from "./proxies";
export function setupInitialStore(player: Partial<PlayerData> = {}): Player {
return Object.assign(
{
id: `${modInfo.id}-0`,
id: `${projInfo.id}-0`,
name: "Default Save",
tabs: modInfo.initialTabs.slice(),
tabs: projInfo.initialTabs.slice(),
time: Date.now(),
autosave: true,
offlineProd: true,
offlineTime: new Decimal(0),
timePlayed: new Decimal(0),
keepGoing: false,
modID: modInfo.id,
modVersion: modInfo.versionNumber,
modID: projInfo.id,
modVersion: projInfo.versionNumber,
layers: {}
},
player
@ -41,7 +41,7 @@ export async function load(): Promise<void> {
return;
}
const player = JSON.parse(decodeURIComponent(escape(atob(save))));
if (player.modID !== modInfo.id) {
if (player.modID !== projInfo.id) {
await loadSave(newSave());
return;
}
@ -67,7 +67,7 @@ export function getUniqueID(): string {
let id,
i = 0;
do {
id = `${modInfo.id}-${i++}`;
id = `${projInfo.id}-${i++}`;
} while (localStorage.getItem(id));
return id;
}
@ -75,7 +75,7 @@ export function getUniqueID(): string {
export async function loadSave(playerObj: Partial<PlayerData>): Promise<void> {
console.info("Loading save", playerObj);
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) {
// 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();
if (playerObj.modVersion !== modInfo.versionNumber) {
if (playerObj.modVersion !== projInfo.versionNumber) {
fixOldSave(playerObj.modVersion, playerObj);
}