LTS.Integrated_Implants-Forked/1.5/Assemblies/Implants/PatchBootStrap.cs

51 lines
1.8 KiB
C#

using System.Reflection;
using HarmonyLib;
using Verse;
namespace LTS_Implants
{
[StaticConstructorOnStartup]
public static class HarmonyPatches
{
public static bool IsCombatExtended = false;
static HarmonyPatches()
{
Harmony harmony = new Harmony("rimworld.LTS.implants");
Harmony.DEBUG = false;
//Check if we are in a CE enabled env
if(ModLister.GetModWithIdentifier("ceteam.combatextended")!=null)
IsCombatExtended = true;
if (ModLister.BiotechInstalled)
{
Verse.Log.Message("[LTS Intrgated Implants Forked]Biotech found, harmony patch running");
harmony.PatchCategory("Biotech");
}
harmony.PatchAllUncategorized(Assembly.GetExecutingAssembly());
#if DEBUG
foreach (var method in harmony.GetPatchedMethods())
{
Verse.Log.Message($"[LTS Implants]Patched Method {method.Name}");
var patchinfo = Harmony.GetPatchInfo(method);
foreach (var VARIABLE in patchinfo.Owners)
{
Verse.Log.Message("The Method has been patched by:" + VARIABLE);
}
foreach (var VARIABLE in patchinfo.Prefixes)
{
Verse.Log.Message("has Prefix:" + VARIABLE.PatchMethod);
}
foreach (var VARIABLE in patchinfo.Postfixes)
{
Verse.Log.Message("has Postfix:" + VARIABLE.PatchMethod);
}
foreach (var VARIABLE in patchinfo.Transpilers)
{
Verse.Log.Message("has Transpiler:" + VARIABLE.PatchMethod);
}
Verse.Log.Message("Displaying next method");
}
#endif
}
}
}