diff --git a/electron/index.js b/electron/index.js index 1b8b4b5e..3c567893 100644 --- a/electron/index.js +++ b/electron/index.js @@ -351,21 +351,10 @@ ipcMain.handle("get-mods", async () => { buttons: ["Exit Game", "Continue"], type: "warning", defaultId: 0, - - checkboxLabel: - "I understand that mods have access to my file system and can be potentially harmful", - checkboxChecked: false, cancelId: 0, }); if (response.response === 1) { - if (response.checkboxChecked) { - break; - } else { - await dialog.showMessageBox(win, { - message: - "Please confirm that you have understood the risks by checking the checkbox in the next dialog.", - }); - } + break; } if (response.response === 0) { process.exit(0); diff --git a/src/js/mods/modloader.js b/src/js/mods/modloader.js index 0aae0721..525baaa5 100644 --- a/src/js/mods/modloader.js +++ b/src/js/mods/modloader.js @@ -93,19 +93,29 @@ export class ModLoader { } mods.forEach(modCode => { - const func = new Function(modCode); - func(); + try { + const func = new Function(modCode); + const response = func(); + } catch (ex) { + console.error(ex); + alert("Failed to parse mod (launch with --dev for more info): " + ex); + } }); } catch (ex) { - alert("Failed to load mods: " + ex); + alert("Failed to load mods (launch with --dev for more info): " + ex); } } this.initialized = true; this.modLoadQueue.forEach(modClass => { - const mod = new (modClass())(this.app, this); - mod.init(); - this.mods.push(mod); + try { + const mod = new (modClass())(this.app, this); + mod.init(); + this.mods.push(mod); + } catch (ex) { + console.error(ex); + alert("Failed to initialize mods (launch with --dev for more info): " + ex); + } }); this.modLoadQueue = []; this.signals.postInit.dispatch();