null partner bugfix

This commit is contained in:
c0ffee12 2021-07-25 21:06:00 -07:00
parent 0d112972ef
commit 91d05d0e1e
13 changed files with 312 additions and 3 deletions

View file

@ -19,7 +19,11 @@ namespace C0ffee_s_RJW_Ideology_Addons
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 (DesignatorsData.rjwComfort.Contains(fucked)) return true; //designated comfort pawns allowed to have sex with
if (fucked.IsSlaveOfColony || fucked.IsPrisonerOfColony) return true; //prisoners and slaves are free game
if (PawnsAreDesperate(fucker, fucked)) return true;
if (!IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucker) || !IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucked))
{
@ -43,5 +47,12 @@ namespace C0ffee_s_RJW_Ideology_Addons
return true;
}
public static bool PawnsAreDesperate(Pawn fucker, Pawn fucked)
{
if ((IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucker) || xxx.is_frustrated(fucker) && (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucked) || xxx.is_frustrated(fucked)))) return true; //frustrated pawns have to have sex
return false;
}
}
}

View file

@ -21,13 +21,13 @@ namespace C0ffee_s_RJW_Ideology_Addons
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
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.Partner) || !(__instance is JobDriver_Rape)) //ensure raped pawns don't enjoy
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);
@ -45,6 +45,9 @@ namespace C0ffee_s_RJW_Ideology_Addons
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);