diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/kill.js | 10 | ||||
-rw-r--r-- | src/modules/launch.js | 5 | ||||
-rw-r--r-- | src/modules/mods.js | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/modules/kill.js b/src/modules/kill.js index 5d03218..b0c4f97 100644 --- a/src/modules/kill.js +++ b/src/modules/kill.js @@ -1,12 +1,10 @@ const exec = require("child_process").exec; const ipcMain = require("electron").ipcMain; -ipcMain.on("kill-game", () => { - kill.game(); -}) - -ipcMain.on("kill-origin", () => { - kill.origin(); +ipcMain.on("kill", (function_name) => { + if (typeof kill[function_name] == "function") { + kill[function_name](); + } }) // a simple function to kill processes with a certain name diff --git a/src/modules/launch.js b/src/modules/launch.js index 544e155..fab80c7 100644 --- a/src/modules/launch.js +++ b/src/modules/launch.js @@ -10,9 +10,8 @@ const settings = require("./settings"); console = require("./console"); -ipcMain.on("launch-ns", () => {launch()}); -ipcMain.on("launch-vanilla", () => { - launch("vanilla"); +ipcMain.on("launch", (_, game_version) => { + launch(game_version) }) // launches the game diff --git a/src/modules/mods.js b/src/modules/mods.js index 169e7b1..6214098 100644 --- a/src/modules/mods.js +++ b/src/modules/mods.js @@ -350,6 +350,10 @@ mods.modfile.get = (mod) => { // read enabledmods.json let data = json(mods.modfile.file); + if (! data || typeof data !== "object") { + return true; + } + if (data[mod]) { // enabled return true; } else if (data[mod] === false) { // disabled |