Skip to content

Commit 0565def

Browse files
authored
Merge pull request #70 from StarMapLoader/dev
Feature/external/pr 65 fix local mods folder dev (#69)
2 parents 2f4e545 + b2e7d64 commit 0565def

5 files changed

Lines changed: 14 additions & 9 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ It makes use of Assembly Load Contexts to ensure mod dependencies are managed se
1515

1616
## Mod location
1717

18-
Mods should be installed in the contents folder in the KSA installation, StarMap makes use of the
18+
Mods can be placed in either of these two locations:
19+
20+
- `Documents/My Games/Kitten Space Agency/mods/<ModName>/` (recommended, persists across game updates)
21+
- `<KSA Installation>/Content/<ModName>/`
22+
23+
StarMap uses the game's manifest system to discover mods from both locations.
1924

2025
## Mod creation
2126

StarMap.API/StarMap.API.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</ItemGroup>
1919

2020
<ItemGroup Condition="'$(Configuration)' != 'Debug'">
21-
<PackageReference Include="StarMap.KSA.Dummy" Version="1.0.13">
21+
<PackageReference Include="StarMap.KSA.Dummy" Version="1.0.22">
2222
<IncludeAssets>compile; build; analyzers</IncludeAssets>
2323
<PrivateAssets>all</PrivateAssets>
2424
</PackageReference>

StarMap.Core/ModRepository/ModLoader.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ private void PrepareMods()
5656
var mods = ModLibrary.Manifest.Mods;
5757
if (mods is null) return;
5858

59-
string rootPath = "Content";
60-
string path = Path.Combine(new ReadOnlySpan<string>(in rootPath));
61-
6259
foreach (var mod in mods)
6360
{
6461
if (!mod.Enabled)
@@ -67,8 +64,6 @@ private void PrepareMods()
6764
continue;
6865
}
6966

70-
var modPath = Path.Combine(path, mod.Id);
71-
7267
if (!RuntimeMod.TryCreateMod(mod, _coreAssemblyLoadContext, out var runtimeMod))
7368
continue;
7469

StarMap.Core/ModRepository/RuntimeMod.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ public static bool TryCreateMod(ModEntry manifestEntry, AssemblyLoadContext core
3838

3939
var modPath = Path.Combine(_rootContentPath, manifestEntry.Id);
4040
var modTomlPath = Path.Combine(modPath, "mod.toml");
41-
if (!File.Exists(modTomlPath)) return false;
41+
if (!File.Exists(modTomlPath))
42+
{
43+
modPath = Path.Combine(ModLibrary.LocalModsFolderPath, manifestEntry.Id);
44+
modTomlPath = Path.Combine(modPath, "mod.toml");
45+
if (!File.Exists(modTomlPath)) return false;
46+
}
4247
var tomlConfig = TomletMain.To<RootConfig>(File.ReadAllText(modTomlPath));
4348
if (tomlConfig?.StarMap is not StarMapConfig starMapConfig)
4449
{

StarMap.Core/StarMap.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</ItemGroup>
2424

2525
<ItemGroup Condition="'$(Configuration)' != 'Debug'">
26-
<PackageReference Include="StarMap.KSA.Dummy" Version="1.0.13">
26+
<PackageReference Include="StarMap.KSA.Dummy" Version="1.0.22">
2727
<ExcludeAssets>runtime</ExcludeAssets>
2828
</PackageReference>
2929
</ItemGroup>

0 commit comments

Comments
 (0)