Browse Source

set isMapThread and run init, map init, and main init if they exist on the correct threads

tags/v0.3.1
notme 5 years ago
committed by Big Bad Waffle
parent
commit
c43375ef7a
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/server/misc/mods.js

+ 9
- 1
src/server/misc/mods.js View File

@@ -17,6 +17,8 @@ module.exports = {
},

onGetMod: function (name, mod) {
let isMapThread = !!process.send;
mod.isMapThread = isMapThread;
mod.events = events;
mod.folderName = 'server/mods/' + name;
mod.relativeFolderName = 'mods/' + name;
@@ -29,7 +31,13 @@ module.exports = {
this.onGetExtra(name, mod, extra);
}

mod.init();
if (isMapThread && typeof mod.initMap === 'function')
mod.initMap();
else if (typeof mod.initMain === 'function')
mod.initMain();

if (typeof mod.init === 'function')
mod.init();
},

onGetExtra: function (name, mod, extra) {


Loading…
Cancel
Save