From da5b9389db3547bf1220dcf5e0f55bec32643cea Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Fri, 20 Feb 2026 20:20:15 -0300 Subject: [PATCH] Fix missing HookMethod APIs in the interface --- .../SharedSource/LuaCs/_Services/_Lua/ILuaPatcher.cs | 9 ++++++++- .../LuaCs/_Services/_Lua/LuaPatcherCompat.cs | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/_Lua/ILuaPatcher.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/_Lua/ILuaPatcher.cs index 4de514875..3d385a9d3 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/_Lua/ILuaPatcher.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/_Lua/ILuaPatcher.cs @@ -1,4 +1,6 @@ -using System.Reflection; +using Barotrauma.LuaCs.Compatibility; +using System; +using System.Reflection; using static Barotrauma.LuaCs.Compatibility.ILuaCsHook; using LuaCsCompatPatchFunc = Barotrauma.LuaCsPatch; @@ -12,5 +14,10 @@ public interface ILuaPatcher : IReusableService string Patch(string className, string methodName, LuaCsPatchFunc patch, HookMethodType hookType = HookMethodType.Before); bool RemovePatch(string identifier, string className, string methodName, string[] parameterTypes, HookMethodType hookType); bool RemovePatch(string identifier, string className, string methodName, HookMethodType hookType); + void HookMethod(string identifier, MethodBase method, LuaCsCompatPatchFunc patch, HookMethodType hookType = HookMethodType.Before, IAssemblyPlugin owner = null); + public void HookMethod(string identifier, string className, string methodName, string[] parameterNames, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before); + public void HookMethod(string identifier, string className, string methodName, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before); + public void HookMethod(string className, string methodName, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before); + public void HookMethod(string className, string methodName, string[] parameterNames, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before); } diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/_Lua/LuaPatcherCompat.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/_Lua/LuaPatcherCompat.cs index 4acf68f33..c3f56a272 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/_Lua/LuaPatcherCompat.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/_Lua/LuaPatcherCompat.cs @@ -197,7 +197,7 @@ namespace Barotrauma.LuaCs } } } - protected void HookMethod(string identifier, string className, string methodName, string[] parameterNames, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before) + public void HookMethod(string identifier, string className, string methodName, string[] parameterNames, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before) { var method = ResolveMethod(className, methodName, parameterNames); if (method == null) return; @@ -207,11 +207,11 @@ namespace Barotrauma.LuaCs } HookMethod(identifier, method, patch, hookMethodType); } - protected void HookMethod(string identifier, string className, string methodName, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before) => + public void HookMethod(string identifier, string className, string methodName, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before) => HookMethod(identifier, className, methodName, null, patch, hookMethodType); - protected void HookMethod(string className, string methodName, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before) => + public void HookMethod(string className, string methodName, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before) => HookMethod("", className, methodName, null, patch, hookMethodType); - protected void HookMethod(string className, string methodName, string[] parameterNames, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before) => + public void HookMethod(string className, string methodName, string[] parameterNames, LuaCsCompatPatchFunc patch, ILuaCsHook.HookMethodType hookMethodType = ILuaCsHook.HookMethodType.Before) => HookMethod("", className, methodName, parameterNames, patch, hookMethodType);