mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Handle different types of servers
This commit is contained in:
parent
6643d6ece1
commit
b6eadd5ed6
@ -1,3 +1,4 @@
|
||||
module.exports = {
|
||||
path: 'path-to-arma3-directory'
|
||||
path: 'path-to-arma3-directory',
|
||||
type: 'linux', // Can be either linux, windows or wine
|
||||
};
|
||||
|
29
manager.js
29
manager.js
@ -12,7 +12,11 @@ function Server(id, title, port, mods) {
|
||||
}
|
||||
|
||||
Server.prototype.armaServerPath = function() {
|
||||
return config.path + '/arma3server';
|
||||
if (config.type === "linux") {
|
||||
return config.path + '/arma3server';
|
||||
}
|
||||
|
||||
return config.path + '/arma3server.exe';
|
||||
}
|
||||
|
||||
Server.prototype.makeModsParameter = function() {
|
||||
@ -24,10 +28,27 @@ Server.prototype.makePortParameter = function() {
|
||||
}
|
||||
|
||||
Server.prototype.start = function() {
|
||||
var mods = this.makeModsParameter();
|
||||
var port = this.makePortParameter();
|
||||
var startParams = [];
|
||||
var gamePath = this.armaServerPath();
|
||||
|
||||
var process = spawn(this.armaServerPath(), [mods, port, '-config=server.cfg', '-noSound', '-world=empty']);
|
||||
if (config.type === "wine") {
|
||||
gamePath = "wine";
|
||||
startParams.push(this.armaServerPath());
|
||||
}
|
||||
|
||||
startParams.push(this.makePortParameter());
|
||||
startParams.push('-config=server.cfg');
|
||||
startParams.push('-noSound');
|
||||
startParams.push('-world=empty');
|
||||
|
||||
if (this.mods.length) {
|
||||
startParams.push(this.makeModsParameter());
|
||||
}
|
||||
|
||||
console.log(gamePath);
|
||||
console.log(startParams);
|
||||
|
||||
var process = spawn(gamePath, startParams);
|
||||
var self = this;
|
||||
|
||||
process.stdout.on('data', function (data) {
|
||||
|
Loading…
Reference in New Issue
Block a user