From adf9303a7e26cd4f1467d7353ccf06133c8b207f Mon Sep 17 00:00:00 2001 From: Maplewheels Date: Sun, 25 Jan 2026 17:15:54 -0500 Subject: [PATCH] - The GetType lag situation is less crazy. --- .../LuaCs/Services/PluginManagementService.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/PluginManagementService.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/PluginManagementService.cs index 83aa9d1d0..05b174642 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/PluginManagementService.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/PluginManagementService.cs @@ -130,16 +130,14 @@ public class PluginManagementService : IPluginManagementService, IAssemblyManage } } - //TODO: the lag situation here is craazy - var t = AssemblyLoadContext.All - .SelectMany(alc => alc.Assemblies) - .SelectMany(ass => ass.GetSafeTypes()) - .FirstOrDefault(tp => tp.FullName?.Equals(typeName) ?? tp.Name.Equals(typeName), null); - - return t; - - //TODO: implement ALC resolutions. - throw new NotImplementedException(); + foreach (var ass in AssemblyLoadContext.All.SelectMany(alc => alc.Assemblies)) + { + if (ass.GetType(typeName, false) is not { } type) + { + continue; + } + return isByRefType ? type.MakeByRefType() : type; + } } public FluentResults.Result LoadAssemblyResources(ImmutableArray resource)