fix(package): the Thunderstore package keeps the mod under plugins/

Mod managers (r2modman, the Thunderstore Mod Manager, Gale) copy what is
inside a top-level plugins/ folder into BepInEx/plugins/<Author-Mod>/
with its structure, and flatten folders they do not recognise. 1.5.1's
Translations/English/items.json landed as a loose items.json beside the
DLL, the Italian copy of each file overwrote the English one, and Jotunn
found no translations. Reproduced in a clean r2modman profile; with the
DLL and Translations under plugins/ the import keeps both language
folders and the texts show.
This commit is contained in:
kanym 2026-09-30 22:42:59 +02:00
commit d866f137fb

View file

@ -50,13 +50,20 @@ $readmeText = [regex]::Replace($readmeText, '\[([^\]]+)\]\(#[^)]*\)', '$1')
$packagedReadme = Join-Path ([System.IO.Path]::GetTempPath()) ("RacesOfValheim_README_" + [guid]::NewGuid().ToString('N') + ".md")
[System.IO.File]::WriteAllText($packagedReadme, $readmeText, (New-Object System.Text.UTF8Encoding($false)))
# Thunderstore gives every package a folder of its own, so the texts sit at the zip root.
# The mod itself goes under plugins/, and that folder name is the whole fix for 1.5.1's missing
# texts. Mod managers (r2modman, the Thunderstore Mod Manager, Gale) copy what sits inside a
# top-level plugins/ folder into BepInEx/plugins/<Author-Mod>/ keeping its structure, but they
# flatten any folder they do not recognise: 1.5.1's Translations/English/items.json landed as a
# loose items.json beside the DLL, the Italian copy of each file overwrote the English one, and
# Jotunn - which only reads JSON whose grandparent folder is called Translations - found none.
# Reproduced in a clean r2modman profile. manifest.json, README.md and icon.png stay at the root,
# where Thunderstore requires them.
$thunderstore = @(
[pscustomobject]@{ Source = $Dll; Name = 'RacesOfValheim.dll' }
[pscustomobject]@{ Source = $Dll; Name = 'plugins/RacesOfValheim.dll' }
[pscustomobject]@{ Source = $Manifest; Name = 'manifest.json' }
[pscustomobject]@{ Source = $packagedReadme; Name = 'README.md' }
[pscustomobject]@{ Source = $Icon; Name = 'icon.png' }
) + ($texts | ForEach-Object { [pscustomobject]@{ Source = $_.Source; Name = "Translations/$($_.Rel)" } })
) + ($texts | ForEach-Object { [pscustomobject]@{ Source = $_.Source; Name = "plugins/Translations/$($_.Rel)" } })
# Nexus users unzip straight into plugins, so the texts travel inside a RacesOfValheim folder.
$nexus = @(