You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
734 B

  1. var requirejs = require('requirejs');
  2. requirejs.config({
  3. baseUrl: '',
  4. nodeRequire: require
  5. });
  6. global.io = true;
  7. var instancer = null;
  8. requirejs([
  9. 'extend', 'misc/helpers', 'components/components', 'world/instancer', 'security/io', 'misc/mods'
  10. ], function(
  11. extend, helpers, components, _instancer, io, mods
  12. ) {
  13. var onDbReady = function() {
  14. global.extend = extend;
  15. global._ = helpers;
  16. require('../misc/random');
  17. instancer = _instancer;
  18. components.init(function() {
  19. process.send({
  20. method: 'onReady'
  21. });
  22. });
  23. mods.init();
  24. setInterval(function() {
  25. global.gc();
  26. }, 60000);
  27. };
  28. io.init(onDbReady);
  29. });
  30. process.on('message', (m) => {
  31. if (m.method) {
  32. instancer[m.method](m.args);
  33. }
  34. });