mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 15:24:52 +09:00
Set default values for mod settings on export
Add missing mod settings set to their default values to a mod pack when performing a data export based on the settings prototypes that were extracted from the game. This mirrors the behaviour of Factorio when new setting prototypes are added by a mod.
This commit is contained in:
1 parent
39ed098a64
commit
ddc548f590
3 files changed
+133
No files matched your search
@@ -220,12 +220,17 @@ async function uploadExport(req, res) {
|
||||
];
|
||||
|
||||
let assets = {};
|
||||
let settingPrototypes = {};
|
||||
for (let filePath of exportFiles) {
|
||||
let file = zip.file(filePath);
|
||||
if (!file) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (filePath === "export/settings.json") {
|
||||
settingPrototypes = JSON.parse(await file.async("text"));
|
||||
}
|
||||
|
||||
let { name, ext } = path.posix.parse(filePath);
|
||||
let hash = await libHash.hashStream(file.nodeStream());
|
||||
assets[name] = `${name}.${hash}${ext}`;
|
||||
@@ -233,6 +238,7 @@ async function uploadExport(req, res) {
|
||||
}
|
||||
|
||||
modPack.exportManifest = new libData.ExportManifest({ assets });
|
||||
modPack.fillDefaultSettings(settingPrototypes, logger);
|
||||
res.app.locals.master.modPackUpdated(modPack);
|
||||
|
||||
res.sendStatus(200);
|
||||
|
||||
Reference in new issue
Block a user