Allow plugins to look up harmony types in other plugins/themselves
All checks were successful
Build / Compute Version (push) Successful in 5s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 1m37s
Build / Build Nuget package (NuGet) (push) Successful in 2m17s
Build / Build Nuget package (CringePlugins) (push) Successful in 2m53s
Build / Build Nuget package (SharedCringe) (push) Successful in 1m59s
Build / Build Launcher (push) Successful in 3m10s

This commit is contained in:
2024-11-03 16:45:09 -05:00
parent ed4fd11de0
commit b3ef089a70
3 changed files with 14 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ using VRage.ModAPI;
using VRage.ObjectBuilders;
using VRage.ObjectBuilders.Private;
using VRage.Plugins;
using CringePlugins.Loader;
namespace CringeLauncher.Patches;
@@ -80,7 +81,8 @@ public static class IntrospectionPatches
[HarmonyPrefix, HarmonyPatch(typeof(AccessTools), nameof(AccessTools.AllAssemblies))]
private static bool AllAssembliesHarmonyPrefix(ref IEnumerable<Assembly> __result)
{
__result = AssemblyLoadContext.GetLoadContext(typeof(IntrospectionPatches).Assembly)?.Assemblies ?? [];
__result = AssemblyLoadContext.GetLoadContext(typeof(IntrospectionPatches).Assembly)?.Assemblies
.Concat(PluginsLifetime.Contexts.SelectMany(x => x.Assemblies)) ?? [];
return false;
}