mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 00:13:12 +09:00
Use detected Factorio version
Remove Factorio_version from the config file and use the detected version of Factorio instead.
This commit is contained in:
1 parent
27fc68da0f
commit
fcae3ef0c1
5 files changed
+19
-6
No files matched your search
@@ -47,6 +47,8 @@ Version 2.0.0
|
|||||||
- Removed redundant call to /api/slaves in globalChat plugin.
|
- Removed redundant call to /api/slaves in globalChat plugin.
|
||||||
- Removed broken serverManager plugin.
|
- Removed broken serverManager plugin.
|
||||||
- Removed broken remote combinator signaling.
|
- Removed broken remote combinator signaling.
|
||||||
|
- Removed factorio_version from config. The version installed is auto
|
||||||
|
detected and used instead.
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
"username": "",
|
"username": "",
|
||||||
"__comment4": "Token from your factorio.com profile page. Required for MP and mod manager services.",
|
"__comment4": "Token from your factorio.com profile page. Required for MP and mod manager services.",
|
||||||
"token": "",
|
"token": "",
|
||||||
"__comment7": "Used for communication with the mod portal, not needed if you manage mods by hand",
|
|
||||||
"factorio_version": "0.16.41",
|
|
||||||
|
|
||||||
"__comment5": "General user settings",
|
"__comment5": "General user settings",
|
||||||
"verify_user_identity": true,
|
"verify_user_identity": true,
|
||||||
|
|||||||
@@ -443,6 +443,13 @@ class FactorioServer extends events.EventEmitter {
|
|||||||
this._state = "init";
|
this._state = "init";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of Factorio that was detected
|
||||||
|
*/
|
||||||
|
get version() {
|
||||||
|
return this._version;
|
||||||
|
}
|
||||||
|
|
||||||
_attachStdio() {
|
_attachStdio() {
|
||||||
this._server.stdout.on('data', chunk => { this._stdout.data(chunk); });
|
this._server.stdout.on('data', chunk => { this._stdout.data(chunk); });
|
||||||
this._server.stdout.on('close', () => { this._stdout.end(); });
|
this._server.stdout.on('close', () => { this._stdout.end(); });
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ async function listMods(config, instance) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const instances = require("./../getInstances")(config).sync();
|
const instances = require("./../getInstances")(config).sync();
|
||||||
if (instances.includes(instance.name)) {
|
if (instances.includes(instance.name)) {
|
||||||
factorioAPI.init(false, instance.path("instanceMods"), instance.path("saves"), config.factorio_version);
|
factorioAPI.init(false, instance.path("instanceMods"), instance.path("saves"), instance.server.version);
|
||||||
factorioAPI.authenticate({
|
factorioAPI.authenticate({
|
||||||
username: config.username,
|
username: config.username,
|
||||||
token: config.token,
|
token: config.token,
|
||||||
@@ -68,7 +68,7 @@ async function listMods(config, instance) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// list shared mods in /sharedMods/
|
// list shared mods in /sharedMods/
|
||||||
factorioAPI.init(false, 'sharedMods/', '', config.factorio_version);
|
factorioAPI.init(false, 'sharedMods/', '', instance.server.version);
|
||||||
factorioAPI.authenticate({
|
factorioAPI.authenticate({
|
||||||
username: config.username,
|
username: config.username,
|
||||||
token: config.token,
|
token: config.token,
|
||||||
@@ -140,7 +140,7 @@ async function addMod(config, term, instance) {
|
|||||||
if (term && term.length > 0) {
|
if (term && term.length > 0) {
|
||||||
if (term.includes("mods.factorio.com/mods/")) { // https://mods.factorio.com/mods/Danielv123/ChooChoo
|
if (term.includes("mods.factorio.com/mods/")) { // https://mods.factorio.com/mods/Danielv123/ChooChoo
|
||||||
// treat it as a link download
|
// treat it as a link download
|
||||||
factorioAPI.init(false, modDirectory, "", config.factorio_version);
|
factorioAPI.init(false, modDirectory, "", instance.server.version);
|
||||||
factorioAPI.authenticate({
|
factorioAPI.authenticate({
|
||||||
username: config.username,
|
username: config.username,
|
||||||
token: config.token,
|
token: config.token,
|
||||||
@@ -185,7 +185,7 @@ async function addMod(config, term, instance) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// treat it as a search and download the top result
|
// treat it as a search and download the top result
|
||||||
factorioAPI.init(false, modDirectory, "", config.factorio_version);
|
factorioAPI.init(false, modDirectory, "", instance.server.version);
|
||||||
factorioAPI.authenticate({
|
factorioAPI.authenticate({
|
||||||
username: config.username,
|
username: config.username,
|
||||||
token: config.token,
|
token: config.token,
|
||||||
|
|||||||
@@ -204,5 +204,11 @@ describe("lib/factorio/server", function() {
|
|||||||
await assert.rejects(server.init(), new Error("Expected state new but state is init"));
|
await assert.rejects(server.init(), new Error("Expected state new but state is init"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe(".version", function() {
|
||||||
|
it("should return the version detected", function() {
|
||||||
|
assert.equal(server.version, "0.1.1");
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user