From 9f4ac93bf9151536a6cac3617de40274e9913ea3 Mon Sep 17 00:00:00 2001 From: c0ffee12 Date: Sat, 24 Jul 2021 18:44:11 -0700 Subject: [PATCH] RJW ideology stuff --- .../C0ffee's RJW Ideology Addons.dll | Bin 4608 -> 10240 bytes C0ffee's RJW Ideology Addons.csproj | 4 ++ Source/CRIAUtility.cs | 47 ++++++++++++++++ ...HarmonyPatch_JobDriver_SexBaseInitiator.cs | 49 +++++++++++++++++ .../HarmonyPatch_CasualSex_Helper.cs | 49 +++++++++++++++++ .../LovinPrecepts/HarmonyPatch_RMB_Menu.cs | 51 ++++++++++++++++++ 6 files changed, 200 insertions(+) create mode 100644 Source/CRIAUtility.cs create mode 100644 Source/Patches/RJW/LovinEventDefs/HarmonyPatch_JobDriver_SexBaseInitiator.cs create mode 100644 Source/Patches/RJW/LovinPrecepts/HarmonyPatch_CasualSex_Helper.cs create mode 100644 Source/Patches/RJW/LovinPrecepts/HarmonyPatch_RMB_Menu.cs diff --git a/1.3/Assemblies/C0ffee's RJW Ideology Addons.dll b/1.3/Assemblies/C0ffee's RJW Ideology Addons.dll index f8b273ddb51b4ad3dc53ff72e61bee6917b980f8..7a4b2ffe31a1086dadbda18367b3e495faa1ffa7 100644 GIT binary patch literal 10240 zcmeHMe{dZ2b${Qzy}i>}K1*jI8F0)R+dY4qUZ4BYnOz}g9UU) zullPfJzIBf{c~dfx%CsrELSf$_OxT<^t6%B+nzpY>P|7QTX}t8WL(eL88fkRWn^PX z^ynbbei5Jz-+$r#vbHzrYJG+1Bw7bb*rz^nBc3|$UAT!FWLxp=W`f3muLazo^A(_@ zcQGsfSDz)6Nw`KKcZ3_eh}N(ZmR?7R>Ot!P-`b^p%i(&(bjcM4K2*b>@XQ$x_@8|Y z0DW?l2QdwZX`?(ox(j>*KgIYgGaxwGvhb8-u=#PKs|n313!u z8Ck@uHEKSu+Oi@}p*GA53ismF29ig?fv3M;t11@czJRjeX=lw&4DyYZA) zHMX3~5M`}BV0PezLQ_-gR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{TlG-@FMTQI%b=}C|mBU z)6k$}m(Ad>w0C1{C+cHW$02Y#kWlqO7fuG9m76fL_26eO@`=E~(}47<4i63>6=N+oMYwx8pmt(o9oxa11M~Oc*?aSP&rJH!9vblyJ<2eh&dvLmFr zM19wrX*q0ObwdmYpV|>o(XO70p3Xc6>X=}YXu@|6aK{3K`aL|N(lQWi2Yf!O z&t@uh5aG)|qO#u(DXu(~UN9L(Gwx3@%V}5=6#lQe(_ZtcL~b z&x)liYaP5@j0YuJba5bt@Bt0VK)ugsE{--f?Xzv*5C!l^Xalg|6L+sJm07pG zxZsYiQa<3|v(y4rP2XKQNGCXaVH2yiUAh|ES9IrtW~P+awEm2-G!o?s}@QtYBPAUHI}QE%82E3 zQg4oA+Q!`M>f$0lW$wwX=xL5wQ`xV0i~6=RJjbsxi8vN`xxA*4Lc%=7C-J%9`n{de zpMN=c+VjuuElEZfM`* y;W??naM*vL@q_9W%2D-YxJ%}vYCZguic4q9@BH7?;?)27A4az9-v2}`ZoLI5gSwLd diff --git a/C0ffee's RJW Ideology Addons.csproj b/C0ffee's RJW Ideology Addons.csproj index f91ed42..79779f7 100644 --- a/C0ffee's RJW Ideology Addons.csproj +++ b/C0ffee's RJW Ideology Addons.csproj @@ -66,8 +66,12 @@ + + + + diff --git a/Source/CRIAUtility.cs b/Source/CRIAUtility.cs new file mode 100644 index 0000000..16c5dcd --- /dev/null +++ b/Source/CRIAUtility.cs @@ -0,0 +1,47 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using RimWorld; +using rjw; + + +namespace C0ffee_s_RJW_Ideology_Addons +{ + public static class CRIAUtility + { + + public static bool TwoPawnsWillingToHaveSex(Pawn fucker, Pawn fucked) + { + + if (fucker == fucked) return true; //pawns are always allowed to masturbate + + if (DesignatorsData.rjwComfort.Contains(fucker) || DesignatorsData.rjwComfort.Contains(fucked)) return true; //designated comfort pawns allowed to have sex with + + if (!IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucker) || !IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucked)) + { + return false; + } + + if (fucker.relations.GetDirectRelation(PawnRelationDefOf.Spouse, fucked) != null) + { + + if (!IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_Spouse, fucker) || !IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_Spouse, fucked)) + { + return false; + } + + } + else if (!IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, fucker) || !IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, fucked)) + { + return false; + } + + return true; + } + + } +} diff --git a/Source/Patches/RJW/LovinEventDefs/HarmonyPatch_JobDriver_SexBaseInitiator.cs b/Source/Patches/RJW/LovinEventDefs/HarmonyPatch_JobDriver_SexBaseInitiator.cs new file mode 100644 index 0000000..9bbd4dc --- /dev/null +++ b/Source/Patches/RJW/LovinEventDefs/HarmonyPatch_JobDriver_SexBaseInitiator.cs @@ -0,0 +1,49 @@ +using HarmonyLib; +using RimWorld; +using rjw; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Verse; + + +namespace C0ffee_s_RJW_Ideology_Addons +{ + [HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "End")] + public static class HarmonyPatch_JobDriver_SexBaseInitiator_End + { + + public static void Prefix(JobDriver_SexBaseInitiator __instance) + { + + HistoryEventDef def = __instance.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, __instance.Partner) ? HistoryEventDefOf.GotLovin_Spouse : HistoryEventDefOf.GotLovin_NonSpouse; + + if (!(__instance is JobDriver_Rape && IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner))) //ensure raped pawns don't enjoy + { + Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.GotLovin, __instance.Partner.Named(HistoryEventArgsNames.Doer)), true); + Find.HistoryEventsManager.RecordEvent(new HistoryEvent(def, __instance.Partner.Named(HistoryEventArgsNames.Doer)), true); + } + + Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.GotLovin, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true); + Find.HistoryEventsManager.RecordEvent(new HistoryEvent(def, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true); + + } + } + + + [HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")] + public static class HarmonyPatch_JobDriver_SexBaseInitiator_Start + { + + public static void Prefix(JobDriver_SexBaseInitiator __instance) + { + Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.InitiatedLovin, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true); + + } + + } + +} diff --git a/Source/Patches/RJW/LovinPrecepts/HarmonyPatch_CasualSex_Helper.cs b/Source/Patches/RJW/LovinPrecepts/HarmonyPatch_CasualSex_Helper.cs new file mode 100644 index 0000000..9eefa06 --- /dev/null +++ b/Source/Patches/RJW/LovinPrecepts/HarmonyPatch_CasualSex_Helper.cs @@ -0,0 +1,49 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using RimWorld; +using rjw; +using System.Reflection.Emit; + +namespace C0ffee_s_RJW_Ideology_Addons +{ + [HarmonyPatch(typeof(CasualSex_Helper), "FindBestPartner")] + public static class HarmonyPatch_CasualSex_Helper + { + + public static IEnumerable Transpiler(IEnumerable codeInstructions) + { + + var ins = codeInstructions.ToList(); + for(int i = 0; i < ins.Count; i++) + { + + if(ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(CasualSex_Helper), "HookupAllowedViaSettings"))) + { + + yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(HarmonyPatch_CasualSex_Helper), "HookupAllowed")); + + } + else + { + yield return ins[i]; + } + } + + } + + public static bool HookupAllowed(Pawn pawn1, Pawn pawn2) + { + if(CRIAUtility.TwoPawnsWillingToHaveSex(pawn1, pawn2)) + { + return CasualSex_Helper.HookupAllowedViaSettings(pawn1, pawn2); + } + return false; + } + + } +} diff --git a/Source/Patches/RJW/LovinPrecepts/HarmonyPatch_RMB_Menu.cs b/Source/Patches/RJW/LovinPrecepts/HarmonyPatch_RMB_Menu.cs new file mode 100644 index 0000000..ff3a8d7 --- /dev/null +++ b/Source/Patches/RJW/LovinPrecepts/HarmonyPatch_RMB_Menu.cs @@ -0,0 +1,51 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using RimWorld; +using rjw; +using System.Reflection.Emit; + +namespace C0ffee_s_RJW_Ideology_Addons +{ + [StaticConstructorOnStartup] + public static class HarmonyPatch_RMB_Menu + { + static HarmonyPatch_RMB_Menu() + { + (new Harmony("C0ffeeRIA")).Patch(AccessTools.Method(AccessTools.TypeByName("rjw.RMB_Menu"), "GenerateSexOptions"), + postfix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_RMB_Menu), "Postfix"))); + + + } + + public static void Postfix(ref List __result, Pawn pawn, LocalTargetInfo target) + { + + if (target.Pawn != null) + { + + if (!CRIAUtility.TwoPawnsWillingToHaveSex(pawn, target.Pawn)) + { + for(int i = 0; i < __result.Count; i++) + { + + if(__result[i].Label.StartsWith("RJW_RMB_Sex".Translate())) + { + __result[i].Label += " (sinful)"; + } + + } + + return; + } + } + + return; + + } + } +}