Cult_of_the_Shock/Plugin.cs

53 lines
1.4 KiB
C#

using UnityEngine;
using System.Reflection;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Unity.VideoHelper;
namespace Cult_of_the_Shock
{
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
internal static new ManualLogSource Logger;
internal static new ShockConfig Config;
internal readonly static Harmony Harmony = new Harmony(MyPluginInfo.PLUGIN_GUID);
public void Awake()
{
Logger = base.Logger;
Config = new ShockConfig(base.Config);
Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded! Prepare for a shocking experiance...");
PatchMethods();
}
private void PatchMethods()
{
MethodInfo method = null;
foreach (var m in typeof(PlayerController).GetRuntimeMethods())
{
if (m.Name == "OnEnable")
{
method = m;
break;
}
}
Logger.LogDebug("A possible method: " + method);
Harmony.Patch(
method,
postfix: new HarmonyMethod(typeof(Hooks).GetMethod("OnEnable"))
);
}
}
}
// TODO: https://github.com/InfernoDragon0/CotLMods/blob/4a157380362dccb1d8564368367ac3588eb5fa06/Patches/KnucklebonesPatch.cs#L54