From d52348149a5e3a060f656d29abfc0cbcb194258e Mon Sep 17 00:00:00 2001 From: zznty <94796179+zznty@users.noreply.github.com> Date: Sun, 8 May 2022 11:44:12 +0700 Subject: [PATCH] fix scripts compilation --- Torch/Patches/ScriptCompilerPatch.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Torch/Patches/ScriptCompilerPatch.cs b/Torch/Patches/ScriptCompilerPatch.cs index 8257889..d0a21ff 100644 --- a/Torch/Patches/ScriptCompilerPatch.cs +++ b/Torch/Patches/ScriptCompilerPatch.cs @@ -44,8 +44,10 @@ namespace Torch.Patches private static void WhitelistCtorPrefix(MyScriptCompiler scriptCompiler) { + var baseDir = new FileInfo(typeof(Type).Assembly.Location).DirectoryName!; + scriptCompiler.AddReferencedAssemblies( - typeof(ValueType).Assembly.Location, + typeof(Type).Assembly.Location, typeof(LinkedList<>).Assembly.Location, typeof(Regex).Assembly.Location, typeof(Enumerable).Assembly.Location, @@ -54,7 +56,11 @@ namespace Torch.Patches typeof(PropertyChangedEventArgs).Assembly.Location, typeof(TypeConverter).Assembly.Location, typeof(System.Diagnostics.TraceSource).Assembly.Location, + typeof(System.Security.Policy.Evidence).Assembly.Location, typeof(ProtoBuf.Meta.RuntimeTypeModel).Assembly.Location, + typeof(ProtoContractAttribute).Assembly.Location, + Path.Combine(baseDir, "netstandard.dll"), + Path.Combine(baseDir, "System.Runtime.dll"), Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll"), Path.Combine(MyFileSystem.ExePath, "Sandbox.Common.dll"), Path.Combine(MyFileSystem.ExePath, "Sandbox.Graphics.dll"), @@ -73,6 +79,10 @@ namespace Torch.Patches MyModWatchdog.Init(updateThread); MyScriptCompiler.Static.AddImplicitIngameNamespacesFromTypes(referencedTypes); MyScriptCompiler.Static.AddConditionalCompilationSymbols(symbols); + + using var batch = MyScriptCompiler.Static.Whitelist.OpenBatch(); + batch.AllowTypes(MyWhitelistTarget.ModApi, typeof(ConcurrentQueue<>)); + return false; }