This repository has been archived by the owner on Nov 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 826
/
CommandList.js
771 lines (725 loc) · 30.8 KB
/
CommandList.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
// Imports
var Entity = require('../entity');
// Utils
var fillChar = function(data, char, fieldLength, rTL) {
var result = data.toString();
if (rTL === true) {
for (var i = result.length; i < fieldLength; i++)
result = char.concat(result);
} else {
for (var i = result.length; i < fieldLength; i++)
result = result.concat(char);
}
return result;
};
function getTime(t) {
t /= 1000;
if (t <= 1) return "right now";
else if (t < 120) return "in " + t + " seconds";
else {
var minutes = Math.round(t / 60),
minCeil = Math.ceil(t / 60),
minFloor = Math.floor(t / 60);
if (minutes == minCeil) return "in a little under " + minutes + " minutes";
else return "in a little over " + minutes + " minutes";
}
}
function getTicks(i, d) {
var t = d ? d : "s";
var m = isNaN(parseFloat(i)) ? 1 : parseFloat(i);
switch (t) {
case "d":
return m * 86400000;
break;
case "h":
return m * 3600000;
break;
case "m":
return m * 60000;
break;
default:
return m * 1000;
break;
}
}
function getDate(d) {
return d.toISOString().replace(/T/, ' ').replace(/\..+/, '');
}
function Commands() {
this.list = {
help: {
f: function(gameServer, split) {
console.log("[Help] ======================== HELP ======================");
console.log("[Help] <x> is a required field, [x] is an optional field.");
gameServer.pluginHandler.onHelpCommand();
console.log("[Help] ====================================================");
},
name: "help",
desc: "Shows all commands and their info",
vars: ""
},
addbot: {
f: function(gameServer, split) {
var add = parseInt(split[1]);
if (isNaN(add)) {
add = 1; // Adds 1 bot if user doesnt specify a number
}
for (var i = 0; i < add; i++) {
setTimeout(gameServer.bots.addBot.bind(gameServer.bots), i);
}
console.log("[Console] Added " + add + " player bots");
},
name: "addbot",
desc: "Adds a number of bots",
vars: "[n]"
},
kickbot: {
f: function(gameServer, split) {
var toRemove = parseInt(split[1]);
if (isNaN(toRemove)) {
toRemove = -1; // Kick all bots if user doesnt specify a number
}
var removed = 0;
var i = 0;
while (i < gameServer.clients.length && removed != toRemove) {
if (typeof gameServer.clients[i].remoteAddress == 'undefined') { // if client i is a bot kick him
var client = gameServer.clients[i].playerTracker;
var len = client.cells.length;
for (var j = 0; j < len; j++) {
gameServer.removeNode(client.cells[0]);
}
client.socket.close();
removed++;
} else
i++;
}
if (toRemove == -1)
console.log("[Console] Kicked all bots (" + removed + ")");
else if (toRemove == removed)
console.log("[Console] Kicked " + toRemove + " bots");
else
console.log("[Console] Only " + removed + " bots could be kicked");
},
name: "kickbot",
desc: "Kicks a number of bots",
vars: "[n]"
},
/*
TODO: Fix board and boardreset commands.
board: {
f: function(gameServer, split) {
var newLB = [];
for (var i = 1; i < split.length; i++) {
if (split[i]) {
newLB[i - 1] = split[i];
} else {
newLB[i - 1] = " ";
}
}
// Clears the update leaderboard function and replaces it with our own
gameServer.gameMode.packetLB = 48;
gameServer.gameMode.specByLeaderboard = false;
gameServer.gameMode.updateLB = function(gameServer) {
gameServer.leaderboard = newLB;
};
console.log("[Console] Successfully changed leaderboard values");
}
},
boardreset: {
function(gameServer) {
// Gets the current gamemode
var gm = GameMode.get(gameServer.gameMode.ID);
// Replace functions
gameServer.gameMode.packetLB = gm.packetLB;
gameServer.gameMode.updateLB = gm.updateLB;
console.log("[Console] Successfully reset leaderboard");
}
},
*/
change: {
f: function(gameServer, split) {
var key = split[1];
var value = split[2];
// Check if int/float
if (value.indexOf('.') != -1) {
value = parseFloat(value);
} else {
value = parseInt(value);
}
if (typeof gameServer.config[key] != 'undefined') {
gameServer.config[key] = value;
console.log("[Console] Set " + key + " to " + value);
} else {
console.log("[Console] Invalid config value");
}
},
name: "change",
desc: "Temporarily changes a config value",
vars: "<name> <value>"
},
clear: {
f: function() {
process.stdout.write("\u001b[2J\u001b[0;0H");
},
name: "clear",
desc: "Clears the console.",
vars: ""
},
color: {
f: function(gameServer, split) {
// Validation checks
var id = parseInt(split[1]);
if (isNaN(id)) {
console.log("[Console] Please specify a valid player ID!");
return;
}
var color = {
r: 0,
g: 0,
b: 0
};
color.r = Math.max(Math.min(parseInt(split[2]), 255), 0);
color.g = Math.max(Math.min(parseInt(split[3]), 255), 0);
color.b = Math.max(Math.min(parseInt(split[4]), 255), 0);
// Sets color to the specified amount
for (var i in gameServer.clients) {
if (gameServer.clients[i].playerTracker.pID == id) {
var client = gameServer.clients[i].playerTracker;
client.setColor(color); // Set color
for (var j in client.cells) {
client.cells[j].setColor(color);
}
break;
}
}
},
name: "color",
desc: "Changes color of a player.",
vars: "<id> <r> <g> <b>"
},
exit: {
f: function(gameServer, split) {
console.log("[Console] Closing server...");
gameServer.socketServer.close();
gameServer.shutdownHandle();
},
name: "exit",
desc: "Gracefully stops the server.",
vars: ""
},
quit: {
f: function(gameServer, split) {
gameServer.pluginHandler.executeCommand("exit", split);
},
name: "quit",
desc: "Alias for exit",
vars: ""
},
shutdown: {
f: function(gameServer, split) {
gameServer.pluginHandler.executeCommand("exit", split);
},
name: "shutdown",
desc: "Alias for exit",
vars: ""
},
restart: {
f: function(gameServer, split) {
if (split[1] == "schedule" || split[1] == "at" || split[1] == "when" || split[1] == "time" || split[1] == "set") {
if (gameServer.restartAt) {
console.log("[Restart] Restart scheduled at " + getDate(gameServer.restartScheduled));
console.log("[Restart] Restart will happen at " + getDate(gameServer.restartAt));
var remaining = (gameServer.restartAt - Date.now());
console.log("[Restart] Restart will happen " + getTime(remaining));
} else {
console.log("[Console] Restart not scheduled");
}
} else if (split[1] == "abort" || split[1] == "stop" || split[1] == "reset") {
if (!gameServer.restartId) {
console.log("[Restart] Restart not scheduled");
return;
}
clearTimeout(gameServer.restartId);
console.log("[Restart] Restart has been stopped");
} else if (split[1] == "delay" || split[1] == "increase") {
if (!gameServer.restartId) {
console.log("[Restart] Restart not scheduled");
return;
}
var newRemaining = (gameServer.restartAt - Date.now()) + getTicks(split[2], split[3]);
if (newRemaining < 1000) newRemaining = 1000;
clearTimeout(gameServer.restartId);
gameServer.restartHandle(newRemaining);
console.log("[Console] Restart delayed and will happen " + getTime(newRemaining));
} else if (split[1] == "help" || split[1] == "?") {
console.log("[Restart] Restart command is versatile and accepts many arguments.\n");
console.log(" Uses:");
console.log(" restart schedule");
console.log(" Shows if a restart is scheduled and time to restart if it is.");
console.log(" Aliases: at, when, time, set\n");
console.log(" restart abort");
console.log(" Aborts restarting, if any.");
console.log(" Aliases: stop, reset\n");
console.log(" restart delay [interval] [s/m/h/d]");
console.log(" Delays restarting for specified period, if any. Negative intervals will decrease the restart time. Unspecified interval will immediately stop the server.");
console.log(" Aliases: increase\n");
console.log(" restart <timeout> [s/m/h/d]");
console.log(" Starts a restart.");
} else if (!isNaN(parseFloat(split[1])) || split.length == 1) {
if (gameServer.restartId) {
console.log("[Restart] Restart already scheduled");
return;
}
var a = getTicks(split[1], split[2]);
gameServer.restartHandle(a);
console.log("[Restart] Restart scheduled for " + getTime(a) + "!");
} else console.log("[Restart] Couldn't parse command. Type in \"restart help\" for details.");
},
name: "restart",
desc: "Restarts the server without memory leaking.",
vars: "[timeout/help] [s/m/h/d]"
},
reset: {
f: function(gameServer, split) {
gameServer.pluginHandler.executeCommand("exit", split);
},
name: "reset",
desc: "Alias for restart",
vars: "[timeout]"
},
food: {
f: function(gameServer, split) {
var pos = {
x: parseInt(split[1]),
y: parseInt(split[2])
};
var mass = parseInt(split[3]);
// Make sure the input values are numbers
if (isNaN(pos.x) || isNaN(pos.y)) {
console.log("[Console] Invalid coordinates");
return;
}
if (isNaN(mass)) mass = gameServer.config.foodStartMass;
// Spawn
var f = new Entity.Food(gameServer.getNextNodeId(), null, pos, mass, gameServer);
f.setColor(gameServer.getRandomColor());
gameServer.addNode(f);
gameServer.currentFood++;
console.log("[Console] Spawned 1 food cell at (" + pos.x + " , " + pos.y + ")");
},
name: "food",
desc: "Spawns a food pellet in the game.",
vars: "<x> <y> [mass]"
},
gamemode: {
f: function(gameServer, split) {
try {
var n = parseInt(split[1]);
var gm = gameServer.pluginHandler.gamemodes.retrieveGamemode(n); // If there is an invalid gamemode, the function will exit
gameServer.gameMode.onChange(gameServer); // Reverts the changes of the old gamemode
gameServer.gameMode = gm; // Apply new gamemode
gameServer.gameMode.onServerInit(gameServer); // Resets the server
console.log("[Game] Changed game mode to " + gameServer.gameMode.name);
} catch (e) {
console.log("[Console] Invalid game mode selected");
}
},
name: "gamemode",
desc: "Changes the gamemode.",
vars: "<id>"
},
kick: {
f: function(gameServer, split) {
var id = parseInt(split[1]);
if (isNaN(id)) {
console.log("[Console] Please specify a valid player ID!");
return;
}
for (var i in gameServer.clients) {
if (gameServer.clients[i].playerTracker.pID == id) {
var client = gameServer.clients[i].playerTracker;
var len = client.cells.length;
for (var j = 0; j < len; j++) {
gameServer.removeNode(client.cells[0]);
}
client.socket.close();
console.log("[Console] Kicked " + client.name);
break;
}
}
},
name: "kick",
desc: "Kicks a player by player ID.",
vars: "<id>"
},
kickall: {
f: function(gameServer, split) {
for (var i in gameServer.clients) {
var client = gameServer.clients[i].playerTracker;
var len = client.cells.length;
for (var j = 0; j < len; j++) {
gameServer.removeNode(client.cells[0]);
}
client.socket.close();
console.log("[Console] Kicked " + client.name);
}
},
name: "kickall",
desc: "Kicks all players and bots in the game.",
vars: ""
},
kill: {
f: function(gameServer, split) {
var id = parseInt(split[1]);
if (isNaN(id)) {
console.log("[Console] Please specify a valid player ID!");
return;
}
var count = 0;
for (var i in gameServer.clients) {
if (gameServer.clients[i].playerTracker.pID == id) {
var client = gameServer.clients[i].playerTracker;
var len = client.cells.length;
for (var j = 0; j < len; j++) {
gameServer.removeNode(client.cells[0]);
count++;
}
console.log("[Console] Removed " + count + " cells");
break;
}
}
},
name: "kill",
desc: "Removes player's cells from a game.",
vars: "<id>"
},
killall: {
f: function(gameServer, split) {
var count = 0;
var len = gameServer.nodesPlayer.length;
for (var i = 0; i < len; i++) {
gameServer.removeNode(gameServer.nodesPlayer[0]);
count++;
}
console.log("[Console] Removed " + count + " cells");
},
name: "killall",
desc: "Removes all players from the game.",
vars: ""
},
mass: {
f: function(gameServer, split) {
// Validation checks
var id = parseInt(split[1]);
if (isNaN(id)) {
console.log("[Console] Please specify a valid player ID!");
return;
}
var amount = Math.max(parseInt(split[2]), 9);
if (isNaN(amount)) {
console.log("[Console] Please specify a valid number");
return;
}
// Sets mass to the specified amount
for (var i in gameServer.clients) {
if (gameServer.clients[i].playerTracker.pID == id) {
var client = gameServer.clients[i].playerTracker;
for (var j in client.cells) {
client.cells[j].mass = amount;
}
console.log("[Console] Set mass of " + client.name + " to " + amount);
break;
}
}
},
name: "mass",
desc: "Sets player's cells' mass to specified number.",
vars: "<id> <mass>"
},
merge: {
f: function(gameServer, split) {
// Validation checks
var id = parseInt(split[1]);
var set = split[2];
if (isNaN(id)) {
console.log("[Console] Please specify a valid player ID!");
return;
}
// Find client with same ID as player entered
var client;
for (var i = 0; i < gameServer.clients.length; i++) {
if (id == gameServer.clients[i].playerTracker.pID) {
client = gameServer.clients[i].playerTracker;
break;
}
}
if (!client) {
console.log("[Console] Client is nonexistent!");
return;
}
if (client.cells.length == 1) {
console.log("[Console] Client already has one cell!");
return;
}
// Set client's merge override
var state;
if (set == "true" || set == "yes" || set == "1") {
client.mergeOverride = true;
state = true;
} else if (set == "false" || set == "no" || set == "0") {
client.mergeOverride = false;
state = false;
} else {
if (client.mergeOverride) {
client.mergeOverride = false;
} else {
client.mergeOverride = true;
}
state = client.mergeOverride;
}
// Log
if (state) console.log("[Console] Player " + id + " is now force merging");
else console.log("[Console] Player " + id + " isn't force merging anymore");
},
name: "merge",
desc: "Toggles or sets force merging on player.",
vars: "<id> [state]"
},
name: {
f: function(gameServer, split) {
// Validation checks
var id = parseInt(split[1]);
if (isNaN(id)) {
console.log("[Console] Please specify a valid player ID!");
return;
}
var name = split.slice(2, split.length).join(' ');
if (name == undefined) {
console.log("[Console] Please type a valid name");
return;
}
// Change name
for (var i = 0; i < gameServer.clients.length; i++) {
var client = gameServer.clients[i].playerTracker;
if (client.pID == id) {
console.log("[Console] Changing " + client.name + " to " + name);
client.name = name;
return;
}
}
// Error
console.log("[Console] Player " + id + " was not found");
},
name: "name",
desc: "Changes the name of a player.",
vars: "<id> <name>"
},
playerlist: {
f: function(gameServer, split) {
console.log("[Console] Showing " + gameServer.clients.length + " players: ");
console.log(" ID | IP | " + fillChar('NICK', ' ', gameServer.config.playerMaxNickLength) + " | CELLS | SCORE | POSITION "); // Fill space
console.log(fillChar('', '-', ' ID | IP | | CELLS | SCORE | POSITION '.length + gameServer.config.playerMaxNickLength));
for (var i = 0; i < gameServer.clients.length; i++) {
var client = gameServer.clients[i].playerTracker;
// ID with 3 digits length
var id = fillChar((client.pID), ' ', 10, true);
// Get ip (15 digits length)
var ip = "Bot";
if (typeof gameServer.clients[i].remoteAddress != 'undefined') {
ip = gameServer.clients[i].remoteAddress;
}
ip = fillChar(ip, ' ', 15);
// Get name and data
var nick = '',
cells = '',
score = '',
position = '',
data = '';
if (client.spectate) {
try {
nick = gameServer.largestClient.name;
} catch (e) {
// Specating in free-roam mode
nick = "in free-roam";
}
nick = (nick == "") ? "An unnamed cell" : nick;
data = fillChar("Spectating " + nick, '-', ' | CELLS | SCORE | POSITION '.length + gameServer.config.playerMaxNickLength, true);
console.log(" " + id + " | " + ip + " | " + data);
} else if (client.cells.length > 0) {
nick = fillChar((client.name == "") ? "An unnamed cell" : client.name, ' ', gameServer.config.playerMaxNickLength);
cells = fillChar(client.cells.length, ' ', 5, true);
score = fillChar(client.getScore(true), ' ', 6, true);
position = fillChar(client.centerPos.x >> 0, ' ', 5, true) + ', ' + fillChar(client.centerPos.y >> 0, ' ', 5, true);
console.log(" " + id + " | " + ip + " | " + nick + " | " + cells + " | " + score + " | " + position);
} else {
// No cells = dead player or in-menu
data = fillChar('Dead or not playing', '-', ' | CELLS | SCORE | POSITION '.length + gameServer.config.playerMaxNickLength, true);
console.log(" " + id + " | " + ip + " | " + data);
}
}
},
name: "playerlist",
desc: "Shows info about players.",
vars: ""
},
pause: {
f: function(gameServer, split) {
gameServer.run = !gameServer.run; // Switches the pause state
var s = gameServer.run ? "Unpaused" : "Paused";
console.log("[Console] " + s + " the game.");
},
name: "pause",
desc: "Toggles pause of the game.",
vars: ""
},
reload: {
f: function(gameServer) {
gameServer.loadConfig();
console.log("[Console] Reloaded the config file successfully");
},
name: "reload",
desc: "Reloads the configuration file.",
vars: ""
},
resetantiteam: {
f: function(gameServer, split) {
// Validation checks
var id = parseInt(split[1]);
if (isNaN(id)) {
console.log("[Console] Please specify a valid player ID!");
return;
}
for (var i in gameServer.clients) {
var client = gameServer.clients[i];
if (!client) continue; // Nonexistent
if (client.playerTracker.pID == id) {
// Found client
client.playerTracker.massGainMult = 0;
client.playerTracker.massLossMult = 0;
console.log("[Console] Successfully reset client's anti-team effect");
return;
}
}
},
name: "resetantiteam",
desc: "Resets anti-teaming effect on a player.",
vars: "<id>"
},
status: {
f: function(gameServer, split) {
// Get amount of humans/bots
var humans = 0,
bots = 0;
for (var i = 0; i < gameServer.clients.length; i++) {
if ('_socket' in gameServer.clients[i]) {
humans++;
} else {
bots++;
}
}
console.log("[Console] Connected players: " + gameServer.clients.length + "/" + gameServer.config.serverMaxConnections);
console.log("[Console] Players: " + humans + " - Bots: " + bots);
console.log("[Console] Server has been running for " + Math.floor(process.uptime() / 60) + " minutes");
console.log("[Console] Current memory usage: " + Math.round(process.memoryUsage().heapUsed / 1048576 * 10) * 0.1 + "/" + Math.round(process.memoryUsage().heapTotal / 1048576 * 10) * 0.1 + " mb");
console.log("[Console] Current game mode: " + gameServer.gameMode.name);
console.log("[Console] Node amount: " + gameServer.nodes.length + ", quadtree node amount: " + gameServer.quadTree.getNodes().length + ", branch count: " + gameServer.quadTree.getBranches());
console.log("[Console] Running " + (gameServer.internalClock - gameServer.lastUpdate) + " ticks behind");
},
name: "status",
desc: "Gives status about the server.",
vars: ""
},
delay: {
f: function(gameServer, split) {
gameServer.internalClock += 2000;
},
name: "delay",
desc: "Lags the game.",
vars: ""
},
debug: {
f: function(gameServer, split) {
console.log(gameServer.updateLog);
console.log(gameServer.nodes.length + " nodes, " + gameServer.quadTree.getNodes().length + " in quad");
},
name: "debug",
desc: "Gives debug information.",
vars: ""
},
tp: {
f: function(gameServer, split) {
var id = parseInt(split[1]);
if (isNaN(id)) {
console.log("[Console] Please specify a valid player ID!");
return;
}
// Make sure the input values are numbers
var pos = {
x: parseInt(split[2]),
y: parseInt(split[3])
};
if (isNaN(pos.x) || isNaN(pos.y)) {
console.log("[Console] Invalid coordinates");
return;
}
// Spawn
for (var i in gameServer.clients) {
if (gameServer.clients[i].playerTracker.pID == id) {
var client = gameServer.clients[i].playerTracker;
for (var j in client.cells) {
client.cells[j].position.x = pos.x;
client.cells[j].position.y = pos.y;
}
console.log("[Console] Teleported " + client.name + " to (" + pos.x + " , " + pos.y + ")");
break;
}
}
},
name: "tp",
desc: "Teleports a player to specified coordinates",
vars: "<id> <x> <y>",
},
virus: {
f: function(gameServer, split) {
var pos = {
x: parseInt(split[1]),
y: parseInt(split[2])
};
var mass = parseInt(split[3]);
// Make sure the input values are numbers
if (isNaN(pos.x) || isNaN(pos.y)) {
console.log("[Console] Invalid coordinates");
return;
}
if (isNaN(mass)) {
mass = gameServer.config.virusStartMass;
}
// Spawn
var v = new Entity.Virus(gameServer.getNextNodeId(), null, pos, mass);
gameServer.addNode(v);
console.log("[Console] Spawned 1 virus at (" + pos.x + " , " + pos.y + ")");
},
name: "virus",
desc: "Spawns a virus at given coordinates.",
vars: "<x> <y> [mass]"
},
//Aliases
st: {
f: function (gameServer, split) {
gameServer.pluginHandler.executeCommand("status", split);
},
name: "st",
desc: "Alias for status.",
vars: ""
},
pl: {
f: function (gameServer, split) {
gameServer.pluginHandler.executeCommand("playerlist", split);
},
name: "pl",
desc: "Alias for playerlist.",
vars: ""
},
};
}
module.exports = Commands;