From 9e6f25fb9b5f694f0f5708fd56d1d40ccb157c25 Mon Sep 17 00:00:00 2001 From: Ed86 Date: Tue, 6 Sep 2022 12:54:46 +0300 Subject: [PATCH] fix harmony --- 1.3/Source/FB/fb.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/1.3/Source/FB/fb.cs b/1.3/Source/FB/fb.cs index 159903c..6e48355 100644 --- a/1.3/Source/FB/fb.cs +++ b/1.3/Source/FB/fb.cs @@ -3,20 +3,35 @@ using RimWorld; using rjw; using Verse; using System; +using System.Reflection; -[StaticConstructorOnStartup] -public static class HarmonyPatches +namespace rjwfb { - public static readonly ThoughtDef RJW_Beautyfuck = DefDatabase.GetNamed("RJW_Beautyfuck"); + [StaticConstructorOnStartup] + internal static class InitHarmonyPatches + { + static InitHarmonyPatches() + { + var har = new Harmony("rjw.FB"); + har.PatchAll(Assembly.GetExecutingAssembly()); + } + } - [HarmonyPatch(typeof(AfterSexUtility), "think_about_sex")] + [HarmonyPatch(typeof(AfterSexUtility), "think_about_sex", new Type[] { typeof(Pawn), typeof(Pawn), typeof(bool), typeof(SexProps), typeof(bool) })] + [StaticConstructorOnStartup] static class Beautyfuck_AfterSexUtility_think_about_sex { + public static readonly ThoughtDef RJW_Beautyfuck = DefDatabase.GetNamed("RJW_Beautyfuck"); + [HarmonyPostfix] public static void think_about_sex_Patch(Pawn pawn, Pawn partner, bool isReceiving, SexProps props, bool whoring = false) { try { + if (partner == null) + { + return; + } var p1 = pawn; var p2 = partner; var p2beauty = p2.GetStatValue(StatDefOf.PawnBeauty, true);