mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 23:30:41 +09:00
Fix missing semicolons
Ensure all statements end with a semicolon.
This commit is contained in:
1 parent
34aaeee354
commit
29f066a191
56 files changed
+242
-242
No files matched your search
@@ -20,4 +20,4 @@ module.exports = {
|
||||
},
|
||||
}),
|
||||
},
|
||||
}
|
||||
};
|
||||
@@ -57,4 +57,4 @@ module.exports = {
|
||||
|
||||
// For testing only
|
||||
_removeTags: removeTags,
|
||||
}
|
||||
};
|
||||
@@ -62,6 +62,6 @@ describe("global_chat plugin", function() {
|
||||
}
|
||||
assert(count > 0, "no lines were tested");
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -77,4 +77,4 @@ module.exports = {
|
||||
},
|
||||
}),
|
||||
},
|
||||
}
|
||||
};
|
||||
@@ -5,8 +5,8 @@ const luaTools = require("lib/luaTools");
|
||||
|
||||
|
||||
function unexpectedError(err) {
|
||||
console.log("Unexpected error in research_sync")
|
||||
console.log("---------------------------------")
|
||||
console.log("Unexpected error in research_sync");
|
||||
console.log("---------------------------------");
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
@@ -78,4 +78,4 @@ class InstancePlugin extends plugin.BaseInstancePlugin {
|
||||
|
||||
module.exports = {
|
||||
InstancePlugin,
|
||||
}
|
||||
};
|
||||
@@ -38,7 +38,7 @@ class MasterPlugin extends plugin.BaseMasterPlugin {
|
||||
}
|
||||
|
||||
broadcastProgress() {
|
||||
let techs = []
|
||||
let techs = [];
|
||||
for (let name of this.progressToBroadcast) {
|
||||
let tech = this.technologies.get(name);
|
||||
if (tech.progress) {
|
||||
@@ -58,7 +58,7 @@ class MasterPlugin extends plugin.BaseMasterPlugin {
|
||||
let tech = this.technologies.get(name);
|
||||
if (!tech) {
|
||||
tech = { level, progress: 0, researched: false };
|
||||
this.technologies.set(name, tech)
|
||||
this.technologies.set(name, tech);
|
||||
|
||||
// Ignore contribution to already researched technologies
|
||||
} else if (tech.level > level || tech.level === level && tech.researched) {
|
||||
@@ -96,7 +96,7 @@ class MasterPlugin extends plugin.BaseMasterPlugin {
|
||||
let tech = this.technologies.get(name);
|
||||
if (!tech || tech.level <= level) {
|
||||
this.progressToBroadcast.delete(name);
|
||||
this.technologies.set(name, { level, progress: null, researched: true })
|
||||
this.technologies.set(name, { level, progress: null, researched: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,10 +151,10 @@ class MasterPlugin extends plugin.BaseMasterPlugin {
|
||||
|
||||
let technologies = [];
|
||||
for (let [name, tech] of this.technologies) {
|
||||
technologies.push([ name, tech.level, tech.progress, tech.researched ])
|
||||
technologies.push([ name, tech.level, tech.progress, tech.researched ]);
|
||||
}
|
||||
|
||||
return { technologies }
|
||||
return { technologies };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,4 +184,4 @@ async function saveTechnologies(masterConfig, technologies) {
|
||||
|
||||
module.exports = {
|
||||
MasterPlugin
|
||||
}
|
||||
};
|
||||
@@ -6,4 +6,4 @@ module.exports = {
|
||||
description: "Exports statistics to Prometheus",
|
||||
version: "2.0.0-alpha",
|
||||
instanceEntrypoint: "instance",
|
||||
}
|
||||
};
|
||||
@@ -64,4 +64,4 @@ module.exports = {
|
||||
_instanceGameTicksTotal: instanceGameTicksTotal,
|
||||
_instanceForceFlowStatistics: instanceForceFlowStatistics,
|
||||
_instanceGameFlowStatistics: instanceGameFlowStatistics,
|
||||
}
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
const doleNN = require("./dole_nn_base")
|
||||
const doleNN = require("./dole_nn_base");
|
||||
|
||||
const prometheus = require("lib/prometheus");
|
||||
|
||||
@@ -32,13 +32,13 @@ class neuralDole {
|
||||
items
|
||||
}){
|
||||
// Set some storage variables for the dole divider
|
||||
this.items = items
|
||||
this.itemsLastTick = new Map(items._items)
|
||||
this.dole = {}
|
||||
this.carry = {}
|
||||
this.lastRequest = {}
|
||||
this.stats=[]
|
||||
this.debt= {}
|
||||
this.items = items;
|
||||
this.itemsLastTick = new Map(items._items);
|
||||
this.dole = {};
|
||||
this.carry = {};
|
||||
this.lastRequest = {};
|
||||
this.stats=[];
|
||||
this.debt= {};
|
||||
}
|
||||
doMagic() {
|
||||
for (let [name, count] of this.items._items) {
|
||||
@@ -47,16 +47,16 @@ class neuralDole {
|
||||
this.dole[name],
|
||||
this.itemsLastTick.get(name),
|
||||
this.getRequestStats(name,5)
|
||||
)
|
||||
this.stats[name]=this.stats[name] || []
|
||||
);
|
||||
this.stats[name]=this.stats[name] || [];
|
||||
this.stats[name].unshift({req:0,given:0});//stats[name][0] is the one we currently collect
|
||||
if (this.stats[name].length>10) this.stats[name].pop();//remove if too many samples in stats
|
||||
|
||||
this.dole[name] = magicData[0]
|
||||
this.dole[name] = magicData[0];
|
||||
// DONE handle magicData[1] for graphing for our users
|
||||
prometheusNNDoleGauge.labels(name).set(magicData[1] || 0);
|
||||
}
|
||||
this.itemsLastTick = new Map(this.items._items)
|
||||
this.itemsLastTick = new Map(this.items._items);
|
||||
}
|
||||
divider(object) {
|
||||
let magicData = doleNN.Dose(
|
||||
@@ -68,19 +68,19 @@ class neuralDole {
|
||||
this.lastRequest[object.name+"_"+object.instanceID+"_"+object.instanceName] || 0,
|
||||
this.getRequestStats(object.name,5),
|
||||
this.debt[object.name+" "+object.instanceID] || 0
|
||||
)
|
||||
);
|
||||
if ((this.stats[object.name] || []).length>0)
|
||||
{
|
||||
this.stats[object.name][0].req+=Number(object.count);
|
||||
this.stats[object.name][0].given+=Number(magicData[0]);
|
||||
}
|
||||
this.lastRequest[object.name+"_"+object.instanceID+"_"+object.instanceName] = object.count
|
||||
this.lastRequest[object.name+"_"+object.instanceID+"_"+object.instanceName] = object.count;
|
||||
//0.Number of items to give in that dose
|
||||
//1.New dole for item X
|
||||
//2.New carry for item X slave Y
|
||||
this.dole[object.name] = magicData[1]
|
||||
this.carry[object.name+" "+object.instanceID] = magicData[2]
|
||||
this.debt[object.name+" "+object.instanceID] = magicData[3]
|
||||
this.dole[object.name] = magicData[1];
|
||||
this.carry[object.name+" "+object.instanceID] = magicData[2];
|
||||
this.debt[object.name+" "+object.instanceID] = magicData[3];
|
||||
|
||||
// Remove item from DB and send it
|
||||
this.items.removeItem(object.name, magicData[0]);
|
||||
@@ -111,7 +111,7 @@ function doleDivider({
|
||||
if (itemCount > object.count) {
|
||||
//If successful, increase dole
|
||||
_doleDivisionFactor[object.name] = Math.max((_doleDivisionFactor[object.name]||0)||1, 1) - 1;
|
||||
items.removeItem(object.name, object.count)
|
||||
items.removeItem(object.name, object.count);
|
||||
|
||||
prometheusDoleFactorGauge.labels(object.name).set(_doleDivisionFactor[object.name] || 0);
|
||||
return object.count;
|
||||
@@ -127,4 +127,4 @@ function doleDivider({
|
||||
module.exports = {
|
||||
doleDivider,
|
||||
neuralDole
|
||||
}
|
||||
};
|
||||
@@ -7,17 +7,17 @@ function sigmoid0(x)
|
||||
function sigmoid1(x)
|
||||
{
|
||||
if (x>=0.0) {
|
||||
return 1.0
|
||||
return 1.0;
|
||||
} else {
|
||||
return 0.0
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
function sigmoid2(x)
|
||||
{
|
||||
if (x>=0.0){
|
||||
return x
|
||||
return x;
|
||||
} else {
|
||||
return 0.0
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
function sigmoid3(x)
|
||||
@@ -116,4 +116,4 @@ outputs[1]=sigmoid3(outputs[1]);
|
||||
return [sigmoid0(outputs[0]),avg];
|
||||
}
|
||||
|
||||
module.exports = {Dose,Tick}
|
||||
module.exports = {Dose,Tick};
|
||||
@@ -50,7 +50,7 @@ const items = {
|
||||
{ type: "integer" },
|
||||
],
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
name: "subspace_storage",
|
||||
@@ -103,4 +103,4 @@ module.exports = {
|
||||
},
|
||||
}),
|
||||
},
|
||||
}
|
||||
};
|
||||
@@ -4,8 +4,8 @@ const plugin = require("lib/plugin");
|
||||
const luaTools = require("lib/luaTools");
|
||||
|
||||
function unexpectedError(err) {
|
||||
console.log("Unexpected error in subspace_storage")
|
||||
console.log("------------------------------------")
|
||||
console.log("Unexpected error in subspace_storage");
|
||||
console.log("------------------------------------");
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class InstancePlugin extends plugin.BaseInstancePlugin {
|
||||
});
|
||||
|
||||
if (this.instance.config.get("subspace_storage.log_item_transfers")) {
|
||||
console.log("Exported the following to master:")
|
||||
console.log("Exported the following to master:");
|
||||
console.log(items);
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class InstancePlugin extends plugin.BaseInstancePlugin {
|
||||
}
|
||||
|
||||
if (this.instance.config.get("subspace_storage.log_item_transfers")) {
|
||||
console.log("Imported following from master:")
|
||||
console.log("Imported following from master:");
|
||||
console.log(response.items);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ class MasterPlugin extends plugin.BaseMasterPlugin {
|
||||
this.itemsLastUpdate = new Map(this.items._items.entries());
|
||||
this.autosaveId = setInterval(() => {
|
||||
saveDatabase(this.master.config, this.items).catch(err => {
|
||||
console.log("Unexpected error autosaving items in subspace_storage")
|
||||
console.log("-----------------------------------------------------")
|
||||
console.log("Unexpected error autosaving items in subspace_storage");
|
||||
console.log("-----------------------------------------------------");
|
||||
console.log(err);
|
||||
});
|
||||
}, this.master.config.get("subspace_storage.autosave_interval") * 1000);
|
||||
@@ -56,7 +56,7 @@ class MasterPlugin extends plugin.BaseMasterPlugin {
|
||||
this.neuralDole = new dole.neuralDole({ items: this.items });
|
||||
this.doleMagicId = setInterval(() => {
|
||||
if (this.master.config.get("subspace_storage.division_method") === "neural_dole") {
|
||||
this.neuralDole.doMagic()
|
||||
this.neuralDole.doMagic();
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -97,7 +97,7 @@ class MasterPlugin extends plugin.BaseMasterPlugin {
|
||||
this.updateStorage();
|
||||
|
||||
if (this.master.config.get("subspace_storage.log_item_transfers")) {
|
||||
console.log(`Imported the following from ${message.data.instance_id}:`)
|
||||
console.log(`Imported the following from ${message.data.instance_id}:`);
|
||||
console.log(message.data.items);
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ class MasterPlugin extends plugin.BaseMasterPlugin {
|
||||
|
||||
return {
|
||||
items: itemsRemoved,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
onMetrics() {
|
||||
|
||||
@@ -53,4 +53,4 @@ function addApiRoutes(app, items, endpointHitCounter) {
|
||||
module.exports = {
|
||||
addWebRoutes,
|
||||
addApiRoutes,
|
||||
}
|
||||
};
|
||||
@@ -11,7 +11,7 @@ function drawcontents(data) {
|
||||
const search = new RegExp(searchArgs, "i");
|
||||
data = data.filter(function(item) {
|
||||
return search.test(item.name);
|
||||
})
|
||||
});
|
||||
|
||||
sortByKey(data, "count");
|
||||
|
||||
@@ -76,7 +76,7 @@ function updateInventory() {
|
||||
let data = JSON.parse(xmlhttp.responseText);
|
||||
drawcontents(data);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", `${root}api/inventory`, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ describe("subspace_storage endpoints", function() {
|
||||
inventory.forEach(itemStack => {
|
||||
if(itemStack.name == "steel-plate" && itemStack.count >= 20) contains20SteelPlate = true;
|
||||
});
|
||||
assert(contains20SteelPlate, "Please ensure there are at least 20 steel plate in the inventory")
|
||||
assert(contains20SteelPlate, "Please ensure there are at least 20 steel plate in the inventory");
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user