2021-07-25 01:44:11 +00:00
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 )
{
2021-07-26 04:21:05 +00:00
if ( __instance is JobDriver_Masturbate | | __instance . Partner = = null ) return ;
2021-07-25 01:44:11 +00:00
HistoryEventDef def = __instance . pawn . relations . DirectRelationExists ( PawnRelationDefOf . Spouse , __instance . Partner ) ? HistoryEventDefOf . GotLovin_Spouse : HistoryEventDefOf . GotLovin_NonSpouse ;
2021-07-26 04:06:00 +00:00
if ( ! ( IdeoUtility . DoerWillingToDo ( HistoryEventDefOf . SharedBed_NonSpouse , __instance . Partner ) & & ( __instance . Partner . IsSlaveOfColony | | __instance . Partner . IsPrisonerOfColony ) ) ) //ensure raped pawns don't enjoy
2021-07-25 01:44:11 +00:00
{
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 ) ;
}
2021-07-26 04:06:00 +00:00
if ( IdeoUtility . DoerWillingToDo ( HistoryEventDefOf . SharedBed_NonSpouse , __instance . pawn ) | | ! ( __instance . Partner . IsSlaveOfColony | | __instance . Partner . IsPrisonerOfColony ) ) //ensure slaves are free game, but not otherwise
2021-07-25 01:54:23 +00:00
{
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 ) ;
}
2021-07-25 01:44:11 +00:00
}
}
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
public static class HarmonyPatch_JobDriver_SexBaseInitiator_Start
{
public static void Prefix ( JobDriver_SexBaseInitiator __instance )
{
2021-07-25 01:54:23 +00:00
2021-07-26 04:06:00 +00:00
if ( __instance is JobDriver_Masturbate | | __instance . Partner = = null ) return ;
2021-07-25 01:54:23 +00:00
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 ) ;
}
2021-07-25 01:44:11 +00:00
}
}
}