mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Fix loading order
This commit is contained in:
parent
b87b642627
commit
7261bddf4c
@ -160,6 +160,7 @@ export async function initMods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const url of external_mods) {
|
for (const url of external_mods) {
|
||||||
|
try {
|
||||||
let temp = await fetch(url);
|
let temp = await fetch(url);
|
||||||
const text = await temp.text();
|
const text = await temp.text();
|
||||||
const mod = /** @type {Mod} */ (eval(text));
|
const mod = /** @type {Mod} */ (eval(text));
|
||||||
@ -167,6 +168,9 @@ export async function initMods() {
|
|||||||
if (mod.name) {
|
if (mod.name) {
|
||||||
Mods.push(mod);
|
Mods.push(mod);
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
|
logger.log(`🛑 Failed to load mod at : ${url}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const external_mods_count = Mods.length - local_mods_count;
|
const external_mods_count = Mods.length - local_mods_count;
|
||||||
|
@ -55,13 +55,4 @@ function bootApp() {
|
|||||||
app.boot();
|
app.boot();
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
|
||||||
await initMods();
|
|
||||||
initDrawUtils();
|
|
||||||
initComponentRegistry();
|
|
||||||
initItemRegistry();
|
|
||||||
initMetaBuildingRegistry();
|
|
||||||
initGameSpeedRegistry();
|
|
||||||
})();
|
|
||||||
|
|
||||||
window.addEventListener("load", bootApp);
|
window.addEventListener("load", bootApp);
|
@ -8,6 +8,12 @@ import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
|
|||||||
import { CHANGELOG } from "../changelog";
|
import { CHANGELOG } from "../changelog";
|
||||||
import { globalConfig } from "../core/config";
|
import { globalConfig } from "../core/config";
|
||||||
|
|
||||||
|
import { initComponentRegistry } from "../game/component_registry";
|
||||||
|
import { initDrawUtils } from "../core/draw_utils";
|
||||||
|
import { initItemRegistry } from "../game/item_registry";
|
||||||
|
import { initMetaBuildingRegistry } from "../game/meta_building_registry";
|
||||||
|
import { initGameSpeedRegistry } from "../game/game_speed_registry";
|
||||||
|
|
||||||
const logger = createLogger("state/preload");
|
const logger = createLogger("state/preload");
|
||||||
|
|
||||||
export class PreloadState extends GameState {
|
export class PreloadState extends GameState {
|
||||||
@ -108,6 +114,18 @@ export class PreloadState extends GameState {
|
|||||||
return this.app.settings.initialize();
|
return this.app.settings.initialize();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
.then(() => this.setStatus("Loading GeoZ mods"))
|
||||||
|
.then(() => require("../GeoZ/main").initMods())
|
||||||
|
|
||||||
|
.then(() => this.setStatus("Initializing registeries"))
|
||||||
|
.then(() => {
|
||||||
|
initDrawUtils();
|
||||||
|
initComponentRegistry();
|
||||||
|
initItemRegistry();
|
||||||
|
initMetaBuildingRegistry();
|
||||||
|
initGameSpeedRegistry();
|
||||||
|
})
|
||||||
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Initialize fullscreen
|
// Initialize fullscreen
|
||||||
if (this.app.platformWrapper.getSupportsFullscreen()) {
|
if (this.app.platformWrapper.getSupportsFullscreen()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user