mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Remove broken combinator signaling
Remove the buggy and unstable combinator signaling implementation.
This commit is contained in:
1 parent
a9a3fb3fce
commit
e70cfe7abd
5 files changed
+8
-62
No files matched your search
@@ -1,6 +1,12 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
Version 1.2.4
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- Removed broken remote combinator signaling.
|
||||||
|
|
||||||
|
|
||||||
Version 1.2.3
|
Version 1.2.3
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|||||||
@@ -299,7 +299,6 @@ if (!command || command == "help" || command == "--help") {
|
|||||||
fs.mkdirSync(instancedirectory + "/saves/");
|
fs.mkdirSync(instancedirectory + "/saves/");
|
||||||
fs.writeFileSync(instancedirectory + "/script-output/output.txt", "");
|
fs.writeFileSync(instancedirectory + "/script-output/output.txt", "");
|
||||||
fs.writeFileSync(instancedirectory + "/script-output/orders.txt", "");
|
fs.writeFileSync(instancedirectory + "/script-output/orders.txt", "");
|
||||||
fs.writeFileSync(instancedirectory + "/script-output/txbuffer.txt", "");
|
|
||||||
fs.mkdirSync(instancedirectory + "/mods/");
|
fs.mkdirSync(instancedirectory + "/mods/");
|
||||||
fs.mkdirSync(instancedirectory + "/instanceMods/");
|
fs.mkdirSync(instancedirectory + "/instanceMods/");
|
||||||
fs.mkdirSync(instancedirectory + "/scenarios/");
|
fs.mkdirSync(instancedirectory + "/scenarios/");
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Clusterio master server. Facilitates communication between slaves through
|
Clusterio master server. Facilitates communication between slaves through
|
||||||
a webserver, storing data related to slaves like production graphs and
|
a webserver, storing data related to slaves like production graphs.
|
||||||
combinator signals.
|
|
||||||
|
|
||||||
@module clusterioMaster
|
@module clusterioMaster
|
||||||
@author Danielv123
|
@author Danielv123
|
||||||
@@ -876,14 +875,6 @@ class wsSlave {
|
|||||||
prometheusWsUsageCounter.labels('heartbeat', this.instanceID).inc();
|
prometheusWsUsageCounter.labels('heartbeat', this.instanceID).inc();
|
||||||
this.lastBeat = Date.now();
|
this.lastBeat = Date.now();
|
||||||
});
|
});
|
||||||
this.socket.on("combinatorSignal", circuitFrameWithMeta => {
|
|
||||||
prometheusWsUsageCounter.labels('combinatorSignal', this.instanceID).inc();
|
|
||||||
if(circuitFrameWithMeta && typeof circuitFrameWithMeta == "object"){
|
|
||||||
Object.keys(wsSlaves).forEach(instanceID => {
|
|
||||||
wsSlaves[instanceID].socket.emit("processCombinatorSignal", circuitFrameWithMeta);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// handle command return values
|
// handle command return values
|
||||||
this.commandsWaitingForReturn = {};
|
this.commandsWaitingForReturn = {};
|
||||||
this.socket.on("runCommandReturnValue", resp => {
|
this.socket.on("runCommandReturnValue", resp => {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "clusterio",
|
"name": "clusterio",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4-alpha",
|
||||||
"description": "Interserver communication for factorio",
|
"description": "Interserver communication for factorio",
|
||||||
"repository": "https://github.com/Danielv123/factorioClusterio",
|
"repository": "https://github.com/Danielv123/factorioClusterio",
|
||||||
"main": "master.js",
|
"main": "master.js",
|
||||||
|
|||||||
@@ -232,56 +232,6 @@ module.exports = class remoteCommands {
|
|||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
messageInterface("/silent-command remote.call('clusterio','setWorldID',"+that.config.unique+")")
|
messageInterface("/silent-command remote.call('clusterio','setWorldID',"+that.config.unique+")")
|
||||||
}, 20000);
|
}, 20000);
|
||||||
/* REMOTE SIGNALLING
|
|
||||||
* send any signals the slave has been told to send
|
|
||||||
* Fetch combinator signals from the server
|
|
||||||
*/
|
|
||||||
this.socket.on("processCombinatorSignal", circuitFrameWithMeta => {
|
|
||||||
if(circuitFrameWithMeta && typeof circuitFrameWithMeta == "object" && circuitFrameWithMeta.frame && Array.isArray(circuitFrameWithMeta.frame)){
|
|
||||||
messageInterface("/silent-command remote.call('clusterio', 'receiveFrame', '"+JSON.stringify(circuitFrameWithMeta.frame)+"')");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// get outbound frames from file and send to master
|
|
||||||
// get array of lines in file, each line should correspond to a JSON encoded frame
|
|
||||||
let signals = fs.readFileSync(instancedirectory + "/script-output/txbuffer.txt", "utf8").split("\n");
|
|
||||||
// if we actually got anything from the file, proceed and reset file
|
|
||||||
let readingTxBufferSoon = false;
|
|
||||||
let txBufferClearCounter = 0;
|
|
||||||
fs.watch(instancedirectory + "/script-output/txbuffer.txt", "utf-8", (eventType, filename) => {
|
|
||||||
if(!readingTxBufferSoon){ // use a 100ms delay to avoid messing with rapid sequential writes from factorio (I think that might be a problem maybe?)
|
|
||||||
readingTxBufferSoon = true;
|
|
||||||
setTimeout(()=>{
|
|
||||||
txBufferClearCounter++;
|
|
||||||
fs.readFile(instancedirectory + "/script-output/txbuffer.txt", "utf-8", (err, signals) => {
|
|
||||||
signals = signals.split("\n");
|
|
||||||
if (signals[0]) {
|
|
||||||
//if(txBufferClearCounter > 500){
|
|
||||||
fs.writeFileSync(instancedirectory + "/script-output/txbuffer.txt", "");
|
|
||||||
// txBufferClearCounter = 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// loop through all our frames
|
|
||||||
for (let i = 0; i < signals.length; i++) {
|
|
||||||
if (signals[i] && objectOps.isJSON(signals[i])) {
|
|
||||||
// signals[i] is a JSON array called a "frame" of signals. We timestamp it for storage on master
|
|
||||||
// then we unpack and RCON in this.frame to the game later.
|
|
||||||
let framepart = JSON.parse(signals[i]);
|
|
||||||
let doneframe = {
|
|
||||||
time: Date.now(),
|
|
||||||
frame: framepart, // thats our array of objects(single signals);
|
|
||||||
}
|
|
||||||
// send to master using socket.io, opened at the top of instanceManagement()
|
|
||||||
this.socket.emit("combinatorSignal", doneframe);
|
|
||||||
} else {
|
|
||||||
// console.log("Invalid jsony: "+typeof signals[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
readingTxBufferSoon = false;
|
|
||||||
},100);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
async getCommand(file){
|
async getCommand(file){
|
||||||
this.commandCache = this.commandCache || {};
|
this.commandCache = this.commandCache || {};
|
||||||
|
|||||||
Reference in new issue
Block a user