mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 23:04:52 +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
+20
-7
No files matched your search
@@ -47,6 +47,8 @@ Version 2.0.0
|
||||
- Removed redundant call to /api/slaves in globalChat plugin.
|
||||
- Removed broken serverManager plugin.
|
||||
- Removed broken remote combinator signaling.
|
||||
- Removed factorio_version from config. The version installed is auto
|
||||
detected and used instead.
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
|
||||
+1
-3
@@ -28,9 +28,7 @@
|
||||
"username": "",
|
||||
"__comment4": "Token from your factorio.com profile page. Required for MP and mod manager services.",
|
||||
"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",
|
||||
"verify_user_identity": true,
|
||||
"auto_pause": false,
|
||||
|
||||
@@ -443,6 +443,13 @@ class FactorioServer extends events.EventEmitter {
|
||||
this._state = "init";
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of Factorio that was detected
|
||||
*/
|
||||
get version() {
|
||||
return this._version;
|
||||
}
|
||||
|
||||
_attachStdio() {
|
||||
this._server.stdout.on('data', chunk => { this._stdout.data(chunk); });
|
||||
this._server.stdout.on('close', () => { this._stdout.end(); });
|
||||
|
||||
@@ -38,7 +38,7 @@ async function listMods(config, instance) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const instances = require("./../getInstances")(config).sync();
|
||||
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({
|
||||
username: config.username,
|
||||
token: config.token,
|
||||
@@ -68,7 +68,7 @@ async function listMods(config, instance) {
|
||||
});
|
||||
} else {
|
||||
// list shared mods in /sharedMods/
|
||||
factorioAPI.init(false, 'sharedMods/', '', config.factorio_version);
|
||||
factorioAPI.init(false, 'sharedMods/', '', instance.server.version);
|
||||
factorioAPI.authenticate({
|
||||
username: config.username,
|
||||
token: config.token,
|
||||
@@ -140,7 +140,7 @@ async function addMod(config, term, instance) {
|
||||
if (term && term.length > 0) {
|
||||
if (term.includes("mods.factorio.com/mods/")) { // https://mods.factorio.com/mods/Danielv123/ChooChoo
|
||||
// treat it as a link download
|
||||
factorioAPI.init(false, modDirectory, "", config.factorio_version);
|
||||
factorioAPI.init(false, modDirectory, "", instance.server.version);
|
||||
factorioAPI.authenticate({
|
||||
username: config.username,
|
||||
token: config.token,
|
||||
@@ -185,7 +185,7 @@ async function addMod(config, term, instance) {
|
||||
}
|
||||
} else {
|
||||
// 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({
|
||||
username: config.username,
|
||||
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"));
|
||||
});
|
||||
});
|
||||
|
||||
describe(".version", function() {
|
||||
it("should return the version detected", function() {
|
||||
assert.equal(server.version, "0.1.1");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user