mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
More docs
This commit is contained in:
1 parent
6ecdde8cbc
commit
dc0a722e3d
4 files changed
+44
-3
No files matched your search
@@ -1,6 +1,8 @@
|
||||
toc:
|
||||
- name: Master Server API
|
||||
- clusterioMaster
|
||||
- name: Type declarations
|
||||
- itemStack
|
||||
- name: Internal modules
|
||||
description: |
|
||||
Here are some helper functions for navigation.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
An item with a count specified
|
||||
|
||||
@typedef {object} itemStack
|
||||
@property {string} name The name of the item in the stack
|
||||
@property {(number|string)} count The amount of items in the stack
|
||||
|
||||
@example
|
||||
itemStack = {name:"iron-plate", count:"12"}
|
||||
itemStack = {name:"copper-plate", count:972}
|
||||
*/
|
||||
@@ -231,7 +231,18 @@ var recievedItemStatistics = new averagedTimeSeries({
|
||||
maxEntries: config.itemStats.maxEntries,
|
||||
entriesPerSecond: config.itemStats.entriesPerSecond,
|
||||
}, console.log);*/
|
||||
// endpoint to send items to
|
||||
//
|
||||
/**
|
||||
POST endpoint for storing items in master's inventory.
|
||||
|
||||
@memberof clusterioMaster
|
||||
@instance
|
||||
@alias api/place
|
||||
@param {itemStack} itemStack the number and type of items to store (see typedef)
|
||||
@param {string} [itemStack.instanceID="unknown"] the unique/instanceID which is a numerical value for an instance
|
||||
@param {string} [itemStack.instanceName="unknown"] the name of an instance for identification in statistics, as provided when launching it. ex node client.js start [name]
|
||||
@returns {string} status either "success" or "failure"
|
||||
*/
|
||||
app.post("/api/place", function(req, res) {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
||||
@@ -283,7 +294,17 @@ app.post("/api/place", function(req, res) {
|
||||
res.send("failure");
|
||||
}
|
||||
});
|
||||
// endpoint to remove items from DB when client orders items
|
||||
/**
|
||||
POST endpoint to remove items from DB when client orders items.
|
||||
|
||||
@memberof clusterioMaster
|
||||
@instance
|
||||
@alias api/remove
|
||||
@param {itemStack} itemStack the name of and the number of items to remove (see typedef)
|
||||
@param {string} [itemStack.instanceID="unknown"] the unique/instanceID which is a numerical value for an instance
|
||||
@param {string} [itemStack.instanceName="unknown"] the name of an instance for identification in statistics, as provided when launching it. ex node client.js start [name]
|
||||
@returns {itemStack} the number of items actually removed, may be lower than what was asked for due to shortages.
|
||||
*/
|
||||
_doleDivisionFactor = {}; //If the server regularly can't fulfill requests, this number grows until it can. Then it slowly shrinks back down.
|
||||
app.post("/api/remove", function(req, res) {
|
||||
const doleDivisionRetardation = 10; //lower rates will equal more dramatic swings
|
||||
@@ -570,7 +591,14 @@ app.post("/api/getTimelineStats", function(req,res) {
|
||||
});
|
||||
}
|
||||
});
|
||||
/**
|
||||
GET endpoint. Returns factorio's base locale as a JSON object.
|
||||
|
||||
@memberof clusterioMaster
|
||||
@instance
|
||||
@alias api/getFactorioLocale
|
||||
@returns {object{}} 2 deep nested object with base game factorio locale as key:value pairs
|
||||
*/
|
||||
app.get("/api/getFactorioLocale", function(req,res){
|
||||
getFactorioLocale.asObject(config.factorioDirectory, "en", (err, factorioLocale) => res.send(factorioLocale));
|
||||
});
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
"start": "echo Run node client.js start [instance] to start slaves && node master.js",
|
||||
"cover": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- \"./{,!(node_modules)/**/}*.spec.js\" -R spec || echo . && codecov -t f7b38085-36eb-4d72-84e6-64721910171e",
|
||||
"docs": "documentation build index.js --config documentation.yml -f html -o docs",
|
||||
"livedocs": "documentation serve --watch *.js --config documentation.yml"
|
||||
"livedocs": "documentation serve --watch *.js lib/** --config documentation.yml"
|
||||
},
|
||||
"keywords": [
|
||||
"factorio"
|
||||
|
||||
Reference in new issue
Block a user