mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 15:33:12 +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
@@ -181,9 +181,11 @@ async function downloadAndExtractTar(url: string, targetDir: string) {
|
||||
* Version to look for, supports the special value "latest" for the
|
||||
* latest version available.
|
||||
* @returns Array with path to data dir and version found.
|
||||
* @internal
|
||||
*/
|
||||
async function findVersion(factorioDir: string, targetVersion: lib.TargetVersion): Promise<[string, lib.FullVersion]> {
|
||||
export async function findVersion(
|
||||
factorioDir: string,
|
||||
targetVersion: lib.TargetVersion,
|
||||
): Promise<[string, lib.FullVersion]> {
|
||||
// Check if this is a direct installation dir
|
||||
const directVersion = await getFactorioVersion(factorioDir);
|
||||
if (directVersion !== null) {
|
||||
@@ -1580,7 +1582,6 @@ export class FactorioServer extends events.EventEmitter<FactorioServerEvents> {
|
||||
// For testing only
|
||||
export const _getFactorioVersion = getFactorioVersion;
|
||||
export const _versionOrder = versionOrder;
|
||||
export const _findVersion = findVersion;
|
||||
export const _listFactorioVersions = listFactorioVersions;
|
||||
export const _downloadAndExtractZip = downloadAndExtractZip;
|
||||
export const _downloadAndExtractTar = downloadAndExtractTar;
|
||||
|
||||
Reference in new issue
Block a user