Tie data exports to mod packs

Store the export manifest in ModPack to allow mulitple mod packs to have
different data exported. This is necessary as the export contains the
settings prototypes needed to create a proper UI for mod settings.

For now the useLocale and useItemMetadata interfaces uses the manifest
for a default mod pack set in the master config.
This commit is contained in:
Hornwitser committed 2023-02-02 00:28:58 +01:00
1 parent 7c6aaeb05d
commit 13e12f7335
16 files changed
+146 -34

No files matched your search

+7 -6
View File
@@ -307,17 +307,18 @@ describe("Integration of Clusterio", function() {
let exportPath = path.join("temp", "test", "static");
await fs.remove(exportPath);
await execCtl("instance export-data test");
let response = await get("/api/export-manifest");
let manifest = JSON.parse(response.body);
assert(Object.keys(manifest).length > 1, "Export manifest is empty");
let result = await libLink.messages.getDefaultModPack.send(getControl());
let modPack = new libData.ModPack(result.mod_pack);
let assets = modPack.exportManifest.assets;
assert(Object.keys(assets).length > 1, "Export assets is empty");
for (let key of ["settings", "prototypes", "item-metadata", "item-spritesheet", "locale"]) {
assert(manifest[key], `Missing ${key} from manifest`);
assert(assets[key], `Missing ${key} from assets`);
assert(
await fs.exists(path.join(exportPath, "..", manifest[key])),
await fs.exists(path.join(exportPath, assets[key])),
`Manifest entry for ${key} was not written to filesystem`
);
}
let prototypes = JSON.parse(await fs.readFile(path.join(exportPath, "..", manifest["prototypes"])));
let prototypes = JSON.parse(await fs.readFile(path.join(exportPath, assets["prototypes"])));
assert(Object.keys(prototypes).length > 50, "Expected there to be more than 50 prototype types");
await checkInstanceStatus(44, "stopped");
});
+2 -1
View File
@@ -228,7 +228,8 @@ before(async function() {
testPack.factorioVersion = "1.1.0";
testPack.mods.set("subspace_storage", { name: "clusterio_lib", enabled: true, version: "0.1.2" });
testPack.mods.set("subspace_storage", { name: "subspace_storage", enabled: true, version: "1.99.8" });
libLink.messages.createModPack.send(control, { mod_pack: testPack.toJSON() });
await libLink.messages.createModPack.send(control, { mod_pack: testPack.toJSON() });
await libLink.messages.setMasterConfigField.send(control, { field: "master.default_mod_pack_id", value: "12" });
});
after(async function() {