Merge pull request #268 from Hornwitser/port-1.2.4

Port 1.2.4 fixes
This commit is contained in:
Hornwitser authored and GitHub committed 2019-12-13 21:37:17 +01:00
commit b59fd80a7b
4 files changed
+17 -63

No files matched your search

+11 -1
View File
@@ -50,7 +50,6 @@ Version 2.0.0
handling in client.
- Removed redundant call to /api/slaves in globalChat plugin.
- Removed broken serverManager plugin.
- Removed broken remote combinator signaling.
- Removed factorio_version from config. The version installed is auto
detected and used instead.
- Removed the playerManager specific command CLI tools/delete_player.js.
@@ -98,6 +97,17 @@ Version 2.0.0
- Changed the format of database/slaves.json.
Version 1.2.4
-------------
- Removed broken remote combinator signaling.
- Fixed research sync endlessly updating already researched technologies
- Removed obsolete item/fluid statistics from clusterioMod
- Removed per mod upload logging when config.uploadModsToMaster disabled
- Fixed bcrypt failing to install on windows due to the new version not
having Windows binaries.
Version 1.2.3
-------------
+1 -1
View File
@@ -32,7 +32,7 @@
"as-table": "^1.0.31",
"averaged-timeseries": "^1.4.0",
"base64url": "^3.0.0",
"bcrypt": "^3.0.6",
"bcrypt": "=3.0.6",
"bcrypt-promise": "^2.0.0",
"body-parser": "^1.18.2",
"cli-interact": "^0.1.9",
-61
View File
@@ -34,67 +34,6 @@ module.exports = class remoteCommands {
ensureFileSync(instancedirectory + "/script-output/output.txt");
ensureFileSync(instancedirectory + "/script-output/orders.txt");
// flow/production statistics ------------------------------------------------------------
var oldFlowStats = false;
var oldTimestamp;
var oldFlowStats;
setInterval(function(){
fs.readFile(instancedirectory + "/script-output/flows.txt", {encoding: "utf8"}, function(err, data) {
if(!err && data) {
let timestamp = Date.now();
data = data.split("\n");
let flowStats = [];
for(let i = 0; i < data.length; i++) {
// try catch to remove any invalid json
try{
flowStats[flowStats.length] = JSON.parse(data[i]);
} catch (e) {
// console.log(" invalid json: " + i);
// some lines of JSON are invalid but don't worry, we just filter em out
}
}
// fluids
let flowStat1 = flowStats[flowStats.length-1].flows.player.input_counts
// items
let flowStat2 = flowStats[flowStats.length-2].flows.player.input_counts
// merge fluid and item flows
let totalFlows = {};
for(let key in flowStat1) totalFlows[key] = flowStat1[key];
for(let key in flowStat2) totalFlows[key] = flowStat2[key];
if(oldFlowStats && totalFlows && oldTimestamp) {
let payload = objectOps.deepclone(totalFlows);
// change from total reported to per time unit
for(let key in oldFlowStats) {
// get production per minute
payload[key] = Math.floor((payload[key] - oldFlowStats[key])/(timestamp - oldTimestamp)*60000);
if(payload[key] < 0) {
payload[key] = 0;
}
}
for(let key in payload) {
if(payload[key] == '0') {
delete payload[key];
}
}
console.log("Recorded flows, copper plate since last time: " + payload["copper-plate"]);
needle.post(
that.config.masterURL + '/api/logStats',
{timestamp: timestamp, instanceID: that.config.unique, data: payload},
needleOptionsWithTokenAuthHeader,
function (err, response, body) {
// we did it, keep going
}
);
}
oldTimestamp = timestamp;
oldFlowStats = totalFlows;
fs.writeFileSync(instancedirectory + "/script-output/flows.txt", "");
}
});
// we don't need to update stats quickly as that could be expensive
}, 60000*5);
// provide items --------------------------------------------------------------
// trigger when something happens to output.txt
fs.watch(instancedirectory + "/script-output/output.txt", function (eventType, filename) {
+5
View File
@@ -259,6 +259,11 @@ class ResearchSync {
if (isNaN(cluster_techs[name].progress))
continue
// Ignore researched techs
if (!tech.infinite && tech.researched) {
continue;
}
// Do not update progress for infinite techs with a local level that's higher.
if (tech.infinite && tech.level > cluster_techs[name].level) {
continue;