diff options
Diffstat (limited to 'entrypoint.mjs')
| -rw-r--r-- | entrypoint.mjs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/entrypoint.mjs b/entrypoint.mjs index 10c90d7..c4f6cf4 100644 --- a/entrypoint.mjs +++ b/entrypoint.mjs @@ -77,5 +77,40 @@ for (const { name, type } of CONFIG_FIELDS) { writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + "\n"); +// Do we have any workshop items to download? +if (process.env.WORKSHOP_ITEMS) { + const itemIds = process.env.WORKSHOP_ITEMS.split(",").map((id) => id.trim()); + console.log(`Downloading workshop items: ${itemIds.join(", ")}`); + for (const itemId of itemIds) { + execFileSync( + "steamcmd", + [ + "+login", + STEAM_USERNAME, + STEAM_PASSWORD || "", + "+workshop_download_item", + "3930080", + itemId, + "+quit", + ], + { stdio: "inherit" }, + ); + } + + // Move downloaded workshop items to the /app/Mods directory + const steamWorkshopPath = `/home/steam/Steam/steamapps/workshop/content/3930080`; + const modsPath = `/app/Mods`; + + for (const itemId of itemIds) { + const sourcePath = `${steamWorkshopPath}/${itemId}`; + if (existsSync(sourcePath)) { + console.log(`Copying workshop item ${itemId} to ${modsPath}`); + cpSync(sourcePath, `${modsPath}/${itemId}`, { recursive: true }); + } else { + console.warn(`Workshop item ${itemId} not found at ${sourcePath}`); + } + } +} + // Run the server execFileSync("sh", ["/app/RunServer.sh"], { stdio: "inherit" }); |
