Skip to content

Commit

Permalink
Fix save / reset config not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Banane9 committed Aug 24, 2024
1 parent c0e9c9e commit f3868bb
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MonkeyLoader" Version="0.22.7-beta" />
<PackageReference Include="MonkeyLoader" Version="0.22.8-beta" />
<PackageReference Include="PolySharp" Version="1.14.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ public override IAsyncEnumerable<DataFeedItem> Apply(IAsyncEnumerable<DataFeedIt
return current;

// Format: MonkeyLoader / modId / [page]
if (!Mod.Loader.TryGet<Mod>().ById(path[1], out var mod) && path[1] is not SettingsHelpers.MonkeyLoader)
if (!((INestedIdentifiableCollection<Config>)Mod.Loader).TryGet().ByFullId($"{path[1]}.Config", out var config))
{
Logger.Error(() => $"Tried to access non-existant mod's settings: {path[1]}");
Logger.Error(() => $"Tried to access non-existant config: {path[1]}.Config");
return current;
}

parameters.IncludeOriginalResult = false;
var config = mod?.Config ?? Mod.Loader.Config;

return current.Concat(EnumerateConfigAsync(parameters, config));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FrooxEngine;
using MonkeyLoader.Configuration;
using MonkeyLoader.Meta;
using MonkeyLoader.Patching;
using System;
Expand All @@ -21,18 +22,16 @@ public override IAsyncEnumerable<DataFeedItem> Apply(IAsyncEnumerable<DataFeedIt
if (path.Count is < 2 or > 4 || path[0] is not SettingsHelpers.MonkeyLoader)
return current;

if (path.Count >= 3 && path[2] is not SettingsHelpers.ConfigSections)
if (path.Count == 4 && path[2] is not SettingsHelpers.ConfigSections)
return current;

// Format: MonkeyLoader / modId / [page]
if (!Mod.Loader.TryGet<Mod>().ById(path[1], out var mod) && path[1] is not SettingsHelpers.MonkeyLoader)
if (!((INestedIdentifiableCollection<Config>)Mod.Loader).TryGet().ByFullId($"{path[1]}.Config", out var config))
{
Logger.Error(() => $"Tried to access non-existant mod's settings: {path[1]}");
Logger.Error(() => $"Tried to access non-existant config: {path[1]}.Config");
return current;
}

var config = mod?.Config ?? Mod.Loader.Config;

if (path.Count >= 3)
{
switch (path[^1])
Expand Down
2 changes: 2 additions & 0 deletions MonkeyLoader.Resonite.Integration/Locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"messages": {
"Settings.Category.MonkeyLoader": "MonkeyLoader",
"Settings.MonkeyLoader.Breadcrumb": "Settings",
"Settings.SaveConfig.Breadcrumb": "Saving Config",
"Settings.ResetConfig.Breadcrumb": "Resetting Config",

"MonkeyLoader.GamePacks.Resonite.MonkeyLoader.Name": "MonkeyLoader",
"MonkeyLoader.GamePacks.Resonite.MonkeyLoader.MonkeyCount.Name": "Monkeys",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MonkeyLoader" Version="0.22.7-beta" />
<PackageReference Include="MonkeyLoader" Version="0.22.8-beta" />
<PackageReference Include="PolySharp" Version="1.14.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MonkeyLoader" Version="0.22.7-beta" />
<PackageReference Include="MonkeyLoader" Version="0.22.8-beta" />
<PackageReference Include="MonkeyLoader.GamePacks.Resonite" Version="0.19.0-beta-enumerabletoolkit" />
<PackageReference Include="MonkeyLoader.GamePacks.Unity" Version="0.6.0-beta" />
<PackageReference Include="PolySharp" Version="1.14.1">
Expand Down

0 comments on commit f3868bb

Please sign in to comment.