Browse Source

You can now simply place mods in the server/mods folder (each with its own folder) for them to work

tags/v0.1.2
bigbadwaffle 7 years ago
parent
commit
1b109815f5
3 changed files with 20 additions and 13 deletions
  1. +6
    -0
      src/server/misc/fileLister.js
  2. +14
    -4
      src/server/misc/mods.js
  3. +0
    -9
      src/server/mods/modList.js

+ 6
- 0
src/server/misc/fileLister.js View File

@@ -10,6 +10,12 @@ define([
return fs.readdirSync(path).filter(function(file) {
return !fs.statSync(fsPath.join(path, file)).isDirectory();
});
},

getFolderList: function(path) {
return fs.readdirSync(path).filter(function(file) {
return fs.statSync(fsPath.join(path, file)).isDirectory();
});
}
};
});

+ 14
- 4
src/server/misc/mods.js View File

@@ -1,13 +1,23 @@
define([
'mods/modList'
'misc/fileLister'
], function(
modList
fileLister
) {
return {
init: function() {
var modList = fileLister.getFolderList('mods');
console.log(modList);


modList.forEach(function(m) {
var mod = require('mods/' + m + '/index');
mod.init();
var mod = null;
try {
mod = require('mods/' + m + '/index');
}
catch (e) {}

if (mod)
mod.init();
}, this);
}
};

+ 0
- 9
src/server/mods/modList.js View File

@@ -1,9 +0,0 @@
define([
], function(
) {
return [
];
});

Loading…
Cancel
Save