@@ -5,8 +5,6 @@ var slugify = require('slugify')
5
5
6
6
var ArmaServer = require ( 'arma-server' )
7
7
8
- var config = require ( '../config.js' )
9
-
10
8
var queryInterval = 5000
11
9
var queryTypes = {
12
10
arma1 : 'arma' ,
@@ -19,18 +17,6 @@ var queryTypes = {
19
17
ofpresistance : 'operationflashpoint'
20
18
}
21
19
22
- var createServerTitle = function ( title ) {
23
- if ( config . prefix ) {
24
- title = config . prefix + title
25
- }
26
-
27
- if ( config . suffix ) {
28
- title = title + config . suffix
29
- }
30
-
31
- return title
32
- }
33
-
34
20
var Server = function ( config , logs , options ) {
35
21
this . config = config
36
22
this . logs = logs
@@ -39,6 +25,18 @@ var Server = function (config, logs, options) {
39
25
40
26
Server . prototype = new events . EventEmitter ( )
41
27
28
+ Server . prototype . createServerTitle = function ( title ) {
29
+ if ( this . config . prefix ) {
30
+ title = this . config . prefix + title
31
+ }
32
+
33
+ if ( this . config . suffix ) {
34
+ title = title + this . config . suffix
35
+ }
36
+
37
+ return title
38
+ }
39
+
42
40
Server . prototype . generateId = function ( ) {
43
41
return slugify ( this . title ) . replace ( / \. / g, '-' )
44
42
}
@@ -76,7 +74,7 @@ Server.prototype.queryStatus = function () {
76
74
var self = this
77
75
Gamedig . query (
78
76
{
79
- type : queryTypes [ config . game ] ,
77
+ type : queryTypes [ this . config . game ] ,
80
78
host : '127.0.0.1' ,
81
79
port : self . port
82
80
} ,
@@ -100,8 +98,8 @@ Server.prototype.queryStatus = function () {
100
98
Server . prototype . getParameters = function ( ) {
101
99
var parameters = [ ]
102
100
103
- if ( config . parameters && Array . isArray ( config . parameters ) ) {
104
- parameters = parameters . concat ( config . parameters )
101
+ if ( this . config . parameters && Array . isArray ( this . config . parameters ) ) {
102
+ parameters = parameters . concat ( this . config . parameters )
105
103
}
106
104
107
105
if ( this . parameters && Array . isArray ( this . parameters ) ) {
@@ -114,8 +112,8 @@ Server.prototype.getParameters = function () {
114
112
Server . prototype . getAdditionalConfigurationOptions = function ( ) {
115
113
var additionalConfigurationOptions = ''
116
114
117
- if ( config . additionalConfigurationOptions ) {
118
- additionalConfigurationOptions += config . additionalConfigurationOptions
115
+ if ( this . config . additionalConfigurationOptions ) {
116
+ additionalConfigurationOptions += this . config . additionalConfigurationOptions
119
117
}
120
118
121
119
if ( this . additionalConfigurationOptions ) {
@@ -137,16 +135,16 @@ Server.prototype.start = function () {
137
135
var parameters = this . getParameters ( )
138
136
var server = new ArmaServer . Server ( {
139
137
additionalConfigurationOptions : this . getAdditionalConfigurationOptions ( ) ,
140
- admins : config . admins ,
138
+ admins : this . config . admins ,
141
139
allowedFilePatching : this . allowed_file_patching || 1 ,
142
140
battleEye : this . battle_eye ? 1 : 0 ,
143
141
config : this . id ,
144
142
disableVoN : this . von ? 0 : 1 ,
145
- game : config . game ,
143
+ game : this . config . game ,
146
144
filePatching : this . file_patching || false ,
147
145
forcedDifficulty : this . forcedDifficulty || null ,
148
146
headlessClients : this . number_of_headless_clients > 0 ? [ '127.0.0.1' ] : null ,
149
- hostname : createServerTitle ( this . title ) ,
147
+ hostname : this . createServerTitle ( this . title ) ,
150
148
localClient : this . number_of_headless_clients > 0 ? [ '127.0.0.1' ] : null ,
151
149
missions : this . missions ,
152
150
mods : this . mods ,
@@ -159,7 +157,7 @@ Server.prototype.start = function () {
159
157
platform : this . config . type ,
160
158
players : this . max_players ,
161
159
port : this . port ,
162
- serverMods : config . serverMods ,
160
+ serverMods : this . config . serverMods ,
163
161
verifySignatures : this . verify_signatures ? 2 : 0
164
162
} )
165
163
server . writeServerConfig ( )
@@ -204,7 +202,7 @@ Server.prototype.startHeadlessClients = function () {
204
202
var headlessClientInstances = _ . times ( this . number_of_headless_clients , function ( i ) {
205
203
var headless = new ArmaServer . Headless ( {
206
204
filePatching : self . file_patching ,
207
- game : config . game ,
205
+ game : self . config . game ,
208
206
host : '127.0.0.1' ,
209
207
mods : self . mods ,
210
208
parameters : parameters ,
0 commit comments