-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathrequire.js
More file actions
52 lines (35 loc) · 1.17 KB
/
require.js
File metadata and controls
52 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const path = require("path");
global.CONFIG = require("./config");
// Create some useful global functions
global.getDataFile = function() {
/*
* Function global.getDataFile
* Returns a file from the base data directory
*/
return path.join(__dirname, "data", CONFIG.SERVER.CLIENT_VERSION, ...arguments);
}
global.requireData = function() {
/*
* Function global.requireData
* Requires a module from the base data directory
*/
return require(getDataFile(...arguments))
}
global.requireModule = function() {
/*
* Function global.requireModule
* Requires a module from the base source directory
*/
return require(path.join(__dirname, "src", ...arguments));
}
// Requires the prototype modifications
requireModule("__proto__");
// Load constants
global.CONST = require("./" + path.join("client", "data", CONFIG.SERVER.CLIENT_VERSION, "constants.json"))
// Check the NodeJS version
let [ major, minor, patch ] = process.versions.node.split(".");
// Confirm major NodeJS version
if(major < 16) {
console.log("Could not launch gameserver: required version > 16.0.0 and current version: %s.".format(process.versions.node));
return process.exit(1);
}