diff --git a/Source/IdeologyAddon/Harmony.cs b/Source/IdeologyAddon/Harmony.cs index 08a78d0..d756855 100644 --- a/Source/IdeologyAddon/Harmony.cs +++ b/Source/IdeologyAddon/Harmony.cs @@ -1,25 +1,14 @@ -using HarmonyLib; -using RJWSexperience.Ideology.Patches; -using System.Reflection; +using System.Reflection; using Verse; namespace RJWSexperience.Ideology { [StaticConstructorOnStartup] - internal static class First + internal static class Harmony { - static First() + static Harmony() { - var harmony = new Harmony("RJW_Sexperience.Ideology"); - harmony.PatchAll(Assembly.GetExecutingAssembly()); - - if (ModLister.HasActiveModWithName("RJW Sexperience")) - { - harmony.Patch(AccessTools.Method("RJWSexperience.RJWUtility:ThrowVirginHistoryEvent"), - prefix: null, - postfix: new HarmonyMethod(typeof(Sexperience_Patch_ThrowVirginHistoryEvent), nameof(Sexperience_Patch_ThrowVirginHistoryEvent.Postfix)) - ); - } + new HarmonyLib.Harmony("RJW_Sexperience.Ideology").PatchAll(Assembly.GetExecutingAssembly()); } } } diff --git a/Source/IdeologyAddon/Patches/Sexperience_Patch.cs b/Source/IdeologyAddon/Patches/Sexperience_Patch.cs index 6951eea..1be61cd 100644 --- a/Source/IdeologyAddon/Patches/Sexperience_Patch.cs +++ b/Source/IdeologyAddon/Patches/Sexperience_Patch.cs @@ -1,11 +1,15 @@ -using rjw; +using HarmonyLib; +using rjw; using RJWSexperience.Ideology.HistoryEvents; using Verse; namespace RJWSexperience.Ideology.Patches { + [HarmonyPatch("RJWSexperience.RJWUtility", "ThrowVirginHistoryEvent")] public static class Sexperience_Patch_ThrowVirginHistoryEvent { + public static bool Prepare() => ModsConfig.IsActive("rjw.sexperience"); + public static void Postfix(Pawn exVirgin, Pawn partner, SexProps props, int degree) { const int femaleAfterSurgery = 1;