working host game begin and host game exit

This commit is contained in:
Oiltanker
2022-04-13 01:52:45 +03:00
parent 5d06df437e
commit 891efb4c4f
3 changed files with 4 additions and 20 deletions
@@ -12,24 +12,6 @@ namespace Barotrauma
{ {
public CsHook(LuaCsHook hook) : base(hook) { } public CsHook(LuaCsHook hook) : base(hook) { }
//public enum class HookMethodTypeProxy
//{
// Before = Barotrauma.HookMethodType.Before;
// After = Barotrauma.HookMethodType.After;
// public Barotrauma.HookMethodType type;
// public HookMethodTypeProxy(int i) => type = (Barotrauma.HookMethodType)i;
// public HookMethodTypeProxy(Barotrauma.HookMethodType t) => type = t;
// public static implicit operator Barotrauma.HookMethodType(HookMethodTypeProxy t) => t.type;
// public static implicit operator int(HookMethodTypeProxy t) => (int)t.type;
// public static implicit operator HookMethodTypeProxy(Barotrauma.HookMethodType t) => new HookMethodTypeProxy(t);
// public static implicit operator HookMethodTypeProxy(int i) => new HookMethodTypeProxy(i);
//}
//public readonly HookMethodTypeProxy HookMethodType = new HookMethodTypeProxy(Barotrauma.HookMethodType.Before);
public void HookMethod(string identifier, MethodInfo method, CsPatchDelegate hook, HookMethodType hookType = HookMethodType.Before, ACsMod owner = null) => public void HookMethod(string identifier, MethodInfo method, CsPatchDelegate hook, HookMethodType hookType = HookMethodType.Before, ACsMod owner = null) =>
_hook.HookCsMethod(identifier, method, hook, hookType, owner); _hook.HookCsMethod(identifier, method, hook, hookType, owner);
@@ -489,6 +489,8 @@ namespace Barotrauma
csHookPostfixMethods.Clear(); csHookPostfixMethods.Clear();
queuedFunctionCalls.Clear(); queuedFunctionCalls.Clear();
GameMain.LuaCs.harmony?.UnpatchAll();
} }
@@ -271,12 +271,12 @@ namespace Barotrauma
public void Stop() public void Stop()
{ {
ACsMod.LoadedMods.ForEach(m => m.Dispose()); foreach (var mod in ACsMod.LoadedMods.ToArray()) mod.Dispose();
ACsMod.LoadedMods.Clear(); ACsMod.LoadedMods.Clear();
HookBase?.Call("stop"); HookBase?.Call("stop");
game?.Stop(); game?.Stop();
harmony?.UnpatchAll(); //harmony?.UnpatchAll();
//HookBase = new LuaCsHook(); //HookBase = new LuaCsHook();
HookBase.Clear(); HookBase.Clear();