mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 07:24:52 +09:00
Add create-scenario command to clusteriohost
Creates a scenario directory with the Clusterio modules patched into it so the modules can be used outside of Clusterio. The command reuses the save patching by zipping the scenario, running patch() on it and extracting the result. Defaults to the freeplay scenario from the Factorio install in the host config and all plugins enabled there. Module loading in Instance.prepareSave is moved to patch.loadModules so the command and the instance share it, and findVersion is exported from server.ts so the command can find the freeplay scenario. Zipped scenarios were tried as an output form but Factorio does not pick them up from the scenarios folder, so only directories are written. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
7987a5d925
commit
c419f3e9b2
10 files changed
+349
-41
No files matched your search
@@ -226,6 +226,22 @@ describe("host/patch", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("loadModules()", function() {
|
||||
it("should load the bundled clusterio module", async function() {
|
||||
const modules = await patch.loadModules([]);
|
||||
assert.deepEqual([...modules.keys()], ["clusterio"]);
|
||||
assert(modules.get("clusterio").files.has("modules/clusterio/api.lua"));
|
||||
});
|
||||
it("should load modules from plugins", async function() {
|
||||
const pluginInfos = await lib.loadPluginInfos(
|
||||
new Map([["research_sync", path.resolve("plugins/research_sync")]])
|
||||
);
|
||||
const modules = await patch.loadModules(pluginInfos);
|
||||
assert.deepEqual([...modules.keys()], ["research_sync", "clusterio"]);
|
||||
assert(modules.get("research_sync").files.has("modules/research_sync/sync.lua"));
|
||||
});
|
||||
});
|
||||
|
||||
describe("patch()", function() {
|
||||
it("should throw on unknown scenario", async function() {
|
||||
let zip = new JSZip();
|
||||
|
||||
Reference in new issue
Block a user