mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 23:04:52 +09:00
Resolves #30
This commit is contained in:
1 parent
52b3e48eb8
commit
67fef2e543
1 file changed
+16
@@ -107,6 +107,22 @@ setInterval(function() {
|
||||
}
|
||||
}, 3000)
|
||||
// COMBINATOR SIGNALS ---------------------------------------------------------
|
||||
// get inventory from Master and RCON it to our slave
|
||||
setInterval(function() {
|
||||
needle.get(config.masterIP + ":" + config.masterPort + '/inventory', function(err, response, body){
|
||||
if(response && response.body) {
|
||||
// Take the inventory we (hopefully) got and turn it into the format LUA accepts
|
||||
// console.log(response.body)
|
||||
var inventory = response.body;
|
||||
var inventoryFrame = {};
|
||||
for(i = 0;i<inventory.length;i++) {
|
||||
inventoryFrame[inventory[i].name] = Number(inventory[i].count);
|
||||
}
|
||||
console.log("RCONing inventory! " + JSON.stringify(inventoryFrame));
|
||||
client.exec("/silent-command remote.call('clusterio', 'receiveInventory', '" + JSON.stringify(inventoryFrame) + "')");
|
||||
}
|
||||
});
|
||||
}, 1000)
|
||||
// send any signals the slave has been told to send
|
||||
setInterval(function() {
|
||||
// Fetch combinator signals from the server
|
||||
|
||||
Reference in new issue
Block a user