diff --git a/core/postinit.js b/core/postinit.js index 0a067c0..703f44e 100644 --- a/core/postinit.js +++ b/core/postinit.js @@ -27,6 +27,7 @@ const modapi_postinit = "(" + (() => { ModAPI.meta._developerMap = {}; ModAPI.meta._iconMap = {}; ModAPI.meta._versionMap = {}; + ModAPI.isServer = false; const credits = {}; ModAPI.addCredit = function (category, name, contents) { if (!credits[category]) { @@ -980,7 +981,7 @@ const modapi_postinit = "(" + (() => { inlineIntegratedServerStartup = ModAPI.hooks._rippedMethodKeys.filter(key => { return key.startsWith(inlineIntegratedServerStartup); })[0]; const inlineIntegratedServerStartupMethod = ModAPI.hooks.methods[inlineIntegratedServerStartup]; ModAPI.hooks.methods[inlineIntegratedServerStartup] = function (worker, bootstrap) { - var x = inlineIntegratedServerStartupMethod.apply(this, [worker, bootstrap + ";" + globalThis.modapi_postinit + ";" + ModAPI.dedicatedServer._data.join(";")]); + var x = inlineIntegratedServerStartupMethod.apply(this, [worker, bootstrap + ";" + globalThis.modapi_postinit + ";ModAPI.isServer=true;" + ModAPI.dedicatedServer._data.join(";")]); ModAPI.dedicatedServer._data = []; ModAPI.dedicatedServer._wasUsed = true; console.log("[ModAPI] Hooked into inline integrated server."); diff --git a/docs/apidoc/index.md b/docs/apidoc/index.md index fea8e7d..32fbdb2 100644 --- a/docs/apidoc/index.md +++ b/docs/apidoc/index.md @@ -83,6 +83,8 @@ The global object has the following properties: - The version of ModAPI. - `ModAPI.is_1_12: Boolean` - Property defining wether or not ModAPI thinks the current version is 1.12-based. + - `ModAPI.isServer: Boolean` + - Property defining wether or not ModAPI thinks it is running on the dedicated server. - `ModAPI.flavour: String` - The flavour of ModAPI. Hardcoded to be `"injector"`.