mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
Fixed database corruption problems
This commit is contained in:
1 parent
2a07591173
commit
08143b7b84
1 file changed
+16
-2
@@ -76,10 +76,24 @@ db.flows.ensureIndex({ fieldName: "slaveID", expireAfterSeconds: 2592000}); // e
|
||||
})()
|
||||
|
||||
db.items.addItem = function(object) {
|
||||
db.items[object.name] += object.count;
|
||||
if(object.name == "addItem") {
|
||||
console.log("Fuck you, that would screw everything up if you named your item that.");
|
||||
}
|
||||
if(this[object.name] && typeof this[object.name] == "number"){
|
||||
this[object.name] += object.count;
|
||||
} else {
|
||||
this[object.name] = object.count;
|
||||
}
|
||||
}
|
||||
db.items.removeItem = function(object) {
|
||||
db.items[object.name] -= object.count;
|
||||
if(object.name == "addItem") {
|
||||
console.log("Fuck you, that would screw everything up if you named your item that.");
|
||||
}
|
||||
if(this[object.name] && typeof this[object.name] == "number"){
|
||||
this[object.name] -= object.count;
|
||||
} else {
|
||||
this[object.name] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// store slaves and inventory in a .json full of JSON data
|
||||
|
||||
Reference in new issue
Block a user