diff --git a/client.js b/client.js index 61f92931..ab42d4fd 100644 --- a/client.js +++ b/client.js @@ -8,6 +8,7 @@ var request = require("request") var ncp = require('ncp').ncp; var Rcon = require('simple-rcon'); var hashFiles = require('hash-files'); +var findRemoveSync = require('find-remove'); // require config.json var config = require('./config'); @@ -162,11 +163,12 @@ write-data=__PATH__executable__/../../../instances/" + instance + "\r\n\ } else { process.exit(1) } + console.log("Deleting .tmp.zip files"); + findRemoveSync(instancedirectory + "/saves", {extensions: ['.tmp.zip']}) console.log("Deleting logs"); // clean old log file to avoid crash // file exists, delete so we don't get in trouble - try { fs.unlinkSync(instancedirectory+'/factorio-current.log') } catch (err){ @@ -493,7 +495,7 @@ function instanceManagement() { sadas = JSON.stringify(confirmedOrders) confirmedOrders = []; // send our RCON command with whatever we got - client.exec("/silent-command remote.call('clusterio', 'importMany', '" + sadas + "')"); + messageInterface("/silent-command remote.call('clusterio', 'importMany', '" + sadas + "')"); } }, 3000) // COMBINATOR SIGNALS --------------------------------------------------------- @@ -510,7 +512,7 @@ function instanceManagement() { } inventoryFrame["signal-unixtime"] = Math.floor(Date.now()/1000); // console.log("RCONing inventory! " + JSON.stringify(inventoryFrame)); - client.exec("/silent-command remote.call('clusterio', 'receiveInventory', '" + JSON.stringify(inventoryFrame) + "')"); + messageInterface("/silent-command remote.call('clusterio', 'receiveInventory', '" + JSON.stringify(inventoryFrame) + "')"); } }); }, 1000) diff --git a/package.json b/package.json index a1917639..2db79739 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "child_process": "^1.0.2", "express": "^4.14.0", "express-fileupload": "0.0.6", + "find-remove": "^1.0.0", "follow-redirects": "^1.2.1", "fs": "0.0.2", "fs-extra": "^1.0.0",