mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 15:04:52 +09:00
Merge branch 'master' into dev
This commit is contained in:
commit
6449fef1e1
3 files changed
+29
-8
No files matched your search
@@ -246,10 +246,11 @@ write-data=__PATH__executable__/../../../instances/" + instance + "\r\n\
|
||||
client.connect();
|
||||
}
|
||||
});
|
||||
/*
|
||||
serverprocess.stdout.on('data', (chunk) => {
|
||||
console.log('OUT: ' + chunk);
|
||||
})*/
|
||||
if(process.platform == "linux"){
|
||||
console.log('Factorio: ' + chunk);
|
||||
}
|
||||
})
|
||||
|
||||
serverprocess.stderr.on('data', (chunk) => {
|
||||
console.log('ERR: ' + chunk);
|
||||
@@ -542,17 +543,24 @@ function instanceManagement() {
|
||||
items[i][0] = items[i][0].replace("\u0000", "");
|
||||
items[i][0] = items[i][0].replace(",", "");
|
||||
if (preparedPackage[items[i][0]]) {
|
||||
// if we have buffered some already, sum the new items
|
||||
if (typeof Number(preparedPackage[items[i][0]].count) == "number" && typeof Number(items[i][1]) == "number") {
|
||||
preparedPackage[items[i][0]] = {
|
||||
"name": items[i][0],
|
||||
"count": Number(preparedPackage[items[i][0]].count) + Number(items[i][1])
|
||||
"count": Number(preparedPackage[items[i][0]].count) + Number(items[i][1]),
|
||||
"instanceName":instance,
|
||||
"instanceID":instanceconfig.unique,
|
||||
};
|
||||
// else just add em in without summing
|
||||
} else if (typeof Number(items[i][1]) == "number") {
|
||||
preparedPackage[items[i][0]] = {
|
||||
"name": items[i][0],
|
||||
"count": Number(items[i][1])
|
||||
"count": Number(items[i][1]),
|
||||
"instanceName":instance,
|
||||
"instanceID":instanceconfig.unique,
|
||||
};
|
||||
}
|
||||
// this condition will NEVER be triggered but we know how that goes
|
||||
} else if (typeof Number(items[i][1]) == "number") {
|
||||
preparedPackage[items[i][0]] = {
|
||||
"name": items[i][0],
|
||||
|
||||
@@ -142,15 +142,21 @@ app.post("/api/remove", function(req, res) {
|
||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
||||
// save items we get
|
||||
var object = req.body;
|
||||
if(!object.instanceName) {
|
||||
object.instanceName = "unknown"
|
||||
}
|
||||
if(!object.instanceID) {
|
||||
object.instanceID = "unknown"
|
||||
}
|
||||
db.items.findOne({name:object.name}, function (err, doc) {
|
||||
// console.dir(doc);
|
||||
if (err) {
|
||||
console.log('failure');
|
||||
console.log('failure count not find ' + object.name);
|
||||
} else {
|
||||
if (doc) {
|
||||
// Update existing items if item name already exists
|
||||
if(Number(doc.count) > Number(object.count)) {
|
||||
console.log("removed: " + object.name + " " + object.count + " . " + doc.count);
|
||||
console.log("removed: " + object.name + " " + object.count + " . " + doc.count + " and sent to " + object.instanceID + " | " + object.instanceName);
|
||||
objectUpdate = {
|
||||
"name": object.name,
|
||||
"count": Number(doc.count) - Number(object.count),
|
||||
@@ -160,7 +166,7 @@ app.post("/api/remove", function(req, res) {
|
||||
// res.send("successier");
|
||||
res.send(object);
|
||||
} else {
|
||||
console.log('failure');
|
||||
console.log('failure out of ' + object.name + " | " + object.count + " from " + object.instanceID + " ("+object.instanceName+")");
|
||||
}
|
||||
} else {
|
||||
console.log('failure ' + object.name);
|
||||
|
||||
@@ -99,6 +99,13 @@ var imagedata = {
|
||||
["piercing-shotgun-shells"]: "Piercing-shotgun-shell",
|
||||
["accumulator"]: "Basic-accumulator",
|
||||
["beacon"]: "Basic-beacon",
|
||||
["rail"]: "Straight-rail",
|
||||
["piercing-rounds-magazine"]: "Piercing-bullet-magazine",
|
||||
["grenade"]: "Basic-grenade",
|
||||
["raw-fish"]: "Fish",
|
||||
["water-barrel"]: "Barrel-empty",
|
||||
["smart-train-stop"]: "Train-stop",
|
||||
["put-combinator"]: "Decider-combinator",
|
||||
}
|
||||
|
||||
// value:link pairs where you can add modded item icons that are missing
|
||||
|
||||
Reference in new issue
Block a user