mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 07:24:52 +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);
|
||||
}
|
||||
|
||||
async fetchMods(mods: Iterable<lib.ModRecord>) {
|
||||
// This is better than the previous hard coded names
|
||||
// But it really shouldn't be a hard coded version either
|
||||
const builtinModNames = lib.ModPack.getBuiltinModNames("2.1");
|
||||
async fetchMods(mods: Iterable<lib.ModRecord>, factorioVersion: lib.PartialVersion) {
|
||||
const builtinModNames = lib.ModPack.getBuiltinModNames(factorioVersion);
|
||||
const modInfos: Promise<lib.ModInfo>[] = [];
|
||||
for (const mod of mods) {
|
||||
if (builtinModNames.includes(mod.name)) {
|
||||
|
||||
@@ -797,9 +797,7 @@ end`.replace(/\r?\n/g, " ");
|
||||
}
|
||||
this.activeModPack = modPack;
|
||||
|
||||
// TODO validate factorioVersion
|
||||
|
||||
const mods = await this._host.fetchMods(modPack.mods.values());
|
||||
const mods = await this._host.fetchMods(modPack.mods.values(), modPack.factorioVersion);
|
||||
|
||||
await fs.mkdir(this.path("mods"), { recursive: true });
|
||||
|
||||
|
||||
@@ -363,7 +363,11 @@ before(async function() {
|
||||
|
||||
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);
|
||||
await execCtlProcess("host create-config --id 4 --name host --generate-token");
|
||||
await execHost(`config set host.factorio_directory ${relativeFactorioDir}`);
|
||||
@@ -382,8 +386,11 @@ before(async function() {
|
||||
const testPack = lib.ModPack.fromJSON({});
|
||||
testPack.id = 12;
|
||||
testPack.name = "subspace_storage-pack";
|
||||
testPack.factorioVersion = "2.1";
|
||||
testPack.mods.set("clusterio_lib", { name: "clusterio_lib", enabled: true, version: "2.0.21" });
|
||||
testPack.factorioVersion = latestFactorioVersion;
|
||||
|
||||
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",
|
||||
|
||||
Reference in new issue
Block a user