mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 16:23:12 +09:00
Remove hard coded versions
This commit is contained in:
3 files changed
+13
-10
No files matched your search
@@ -659,10 +659,8 @@ export default class Host extends lib.Link {
|
|||||||
return await this.downloadMod(mod);
|
return await this.downloadMod(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchMods(mods: Iterable<lib.ModRecord>) {
|
async fetchMods(mods: Iterable<lib.ModRecord>, factorioVersion: lib.PartialVersion) {
|
||||||
// This is better than the previous hard coded names
|
const builtinModNames = lib.ModPack.getBuiltinModNames(factorioVersion);
|
||||||
// But it really shouldn't be a hard coded version either
|
|
||||||
const builtinModNames = lib.ModPack.getBuiltinModNames("2.1");
|
|
||||||
const modInfos: Promise<lib.ModInfo>[] = [];
|
const modInfos: Promise<lib.ModInfo>[] = [];
|
||||||
for (const mod of mods) {
|
for (const mod of mods) {
|
||||||
if (builtinModNames.includes(mod.name)) {
|
if (builtinModNames.includes(mod.name)) {
|
||||||
|
|||||||
@@ -797,9 +797,7 @@ end`.replace(/\r?\n/g, " ");
|
|||||||
}
|
}
|
||||||
this.activeModPack = modPack;
|
this.activeModPack = modPack;
|
||||||
|
|
||||||
// TODO validate factorioVersion
|
const mods = await this._host.fetchMods(modPack.mods.values(), modPack.factorioVersion);
|
||||||
|
|
||||||
const mods = await this._host.fetchMods(modPack.mods.values());
|
|
||||||
|
|
||||||
await fs.mkdir(this.path("mods"), { recursive: true });
|
await fs.mkdir(this.path("mods"), { recursive: true });
|
||||||
|
|
||||||
|
|||||||
@@ -363,7 +363,11 @@ before(async function() {
|
|||||||
|
|
||||||
controllerProcess = await spawnNode("controller:", "../../packages/controller run", /Started controller/);
|
controllerProcess = await spawnNode("controller:", "../../packages/controller run", /Started controller/);
|
||||||
|
|
||||||
haveFactorioInstall = (await _listFactorioVersions(factorioDir)).versions.size > 0;
|
const factorioVersions = (await _listFactorioVersions(factorioDir)).versions;
|
||||||
|
const latestFactorioVersion = [...factorioVersions.values()]
|
||||||
|
.sort((a, b) => lib.integerFullVersion(b) - lib.integerFullVersion(a))[0];
|
||||||
|
haveFactorioInstall = factorioVersions.size > 0;
|
||||||
|
|
||||||
const relativeFactorioDir = path.isAbsolute(factorioDir) ? factorioDir : path.join("..", "..", factorioDir);
|
const relativeFactorioDir = path.isAbsolute(factorioDir) ? factorioDir : path.join("..", "..", factorioDir);
|
||||||
await execCtlProcess("host create-config --id 4 --name host --generate-token");
|
await execCtlProcess("host create-config --id 4 --name host --generate-token");
|
||||||
await execHost(`config set host.factorio_directory ${relativeFactorioDir}`);
|
await execHost(`config set host.factorio_directory ${relativeFactorioDir}`);
|
||||||
@@ -382,8 +386,11 @@ before(async function() {
|
|||||||
const testPack = lib.ModPack.fromJSON({});
|
const testPack = lib.ModPack.fromJSON({});
|
||||||
testPack.id = 12;
|
testPack.id = 12;
|
||||||
testPack.name = "subspace_storage-pack";
|
testPack.name = "subspace_storage-pack";
|
||||||
testPack.factorioVersion = "2.1";
|
testPack.factorioVersion = latestFactorioVersion;
|
||||||
testPack.mods.set("clusterio_lib", { name: "clusterio_lib", enabled: true, version: "2.0.21" });
|
|
||||||
|
const [major, minor] = lib.normaliseMajorMinorVersion(latestFactorioVersion).split(".");
|
||||||
|
testPack.mods.set("clusterio_lib", { name: "clusterio_lib", enabled: true, version: `2.0.${major}${minor}` });
|
||||||
|
|
||||||
await control.sendTo("controller", new lib.ModPackCreateRequest(testPack));
|
await control.sendTo("controller", new lib.ModPackCreateRequest(testPack));
|
||||||
await control.sendTo(
|
await control.sendTo(
|
||||||
"controller",
|
"controller",
|
||||||
|
|||||||
Reference in new issue
Block a user