orgy ritual

This commit is contained in:
c0ffee12 2021-07-27 23:14:27 -07:00
parent edc619a950
commit 379c9a4d7d
13 changed files with 264 additions and 6 deletions

View file

@ -0,0 +1,63 @@
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)
{
if (__instance is JobDriver_Masturbate || __instance.Partner == null) return;
HistoryEventDef def = __instance.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, __instance.Partner) ? HistoryEventDefOf.GotLovin_Spouse : HistoryEventDefOf.GotLovin_NonSpouse;
if (!(IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner) && (__instance.Partner.IsSlaveOfColony || __instance.Partner.IsPrisonerOfColony))) //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);
}
if (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.pawn) || !(__instance.Partner.IsSlaveOfColony || __instance.Partner.IsPrisonerOfColony)) //ensure slaves are free game, but not otherwise
{
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)
{
if (__instance is JobDriver_Masturbate || __instance.Partner == null) return;
if (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner) || !(__instance is JobDriver_Rape)) //ensure raped pawns don't enjoy
{
Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.InitiatedLovin, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true);
}
}
}
}

View file

@ -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<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> 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;
}
}
}

View file

@ -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<FloatMenuOption> __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;
}
}
}