SMSMod-PermaDay/Plugin.cs
2024-05-02 19:21:09 +02:00

50 lines
1.6 KiB
C#

using BepInEx;
using HarmonyLib;
namespace PermaDay
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded! Applying patch...");
Harmony harmony = new Harmony(PluginInfo.PLUGIN_GUID);
harmony.PatchAll();
}
}
public static class PermaDayPatch
{
[HarmonyPatch(typeof(DayCycleManager), "UpdateLighting")]
public static class DayCycleManager_UpdateLighting_Patch
{
static float dptmp;
public static void Prefix(DayCycleManager __instance)
{
dptmp = __instance.m_DayPercentage;
__instance.m_DayPercentage = 0;
__instance.m_DisablingLensFlarePercentage = -1;
}
public static void Postfix(DayCycleManager __instance)
{
__instance.m_DayPercentage = dptmp;
}
}
[HarmonyPatch(typeof(DayCycleManager), "DayCycle")]
public static class DayCycleManager_DayCycle_Patch
{
public static void Prefix(DayCycleManager __instance)
{
__instance.m_DisablingLensFlarePercentage = -1;
}
}
[HarmonyPatch(typeof(DayCycleManager), "StartNextDay")]
public static class DayCycleManager_StartNextDay_Patch
{
public static void Prefix(DayCycleManager __instance)
{
__instance.m_DisablingLensFlarePercentage = -1;
}
}
}
}