mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Don't assume playercount is 0 just because a command fails
This commit is contained in:
1 parent
ce24a40d8c
commit
6dd25cb1e8
1 file changed
+13
-14
@@ -594,19 +594,7 @@ function instanceManagement() {
|
|||||||
// delete when we are done
|
// delete when we are done
|
||||||
fs.unlink(instancedirectory + "/script-output/tempfile.txt", function(){});
|
fs.unlink(instancedirectory + "/script-output/tempfile.txt", function(){});
|
||||||
}
|
}
|
||||||
// if we actually got anything from the file, proceed to categorize it
|
|
||||||
if (data && data[0]) {
|
|
||||||
while (data[0]) {
|
|
||||||
let q = data[0].split(" ");
|
|
||||||
// delete array element
|
|
||||||
data.splice(0,1);
|
|
||||||
if(q[0] == "connected_players" && Number(q[1]) != NaN) {
|
|
||||||
instanceInfo.playerCount = q[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
instanceInfo.playerCount = 0;
|
|
||||||
}
|
|
||||||
var payload = {
|
var payload = {
|
||||||
time: Date.now(),
|
time: Date.now(),
|
||||||
rconPort: instanceconfig.clientPort,
|
rconPort: instanceconfig.clientPort,
|
||||||
@@ -615,10 +603,21 @@ function instanceManagement() {
|
|||||||
unique: instanceconfig.unique,
|
unique: instanceconfig.unique,
|
||||||
publicIP: config.publicIP, // IP of the server should be global for all instances, so we pull that straight from the config
|
publicIP: config.publicIP, // IP of the server should be global for all instances, so we pull that straight from the config
|
||||||
mods:modHashes,
|
mods:modHashes,
|
||||||
playerCount: instanceInfo.playerCount || 0,
|
|
||||||
instanceName: instance,
|
instanceName: instance,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we actually got anything from the file, proceed to categorize it
|
||||||
|
if (data && data[0]) {
|
||||||
|
while (data[0]) {
|
||||||
|
let q = data[0].split(" ");
|
||||||
|
// delete array element
|
||||||
|
data.splice(0,1);
|
||||||
|
if(q[0] == "connected_players" && Number(q[1]) != NaN) {
|
||||||
|
payload.playerCount = q[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function callback(err, mac) {
|
function callback(err, mac) {
|
||||||
if (err) {
|
if (err) {
|
||||||
mac = "unknown";
|
mac = "unknown";
|
||||||
|
|||||||
Reference in new issue
Block a user