fixed bug relating to mechs and pawns with no relations defined

This commit is contained in:
c0ffee 2021-11-28 10:43:41 -08:00
parent 5d3e7d94a3
commit 25fba08b2d
2 changed files with 2 additions and 1 deletions

View file

@ -18,7 +18,8 @@ namespace C0ffee_s_RJW_Ideology_Addons
public static void Prefix(JobDriver_SexBaseInitiator __instance) public static void Prefix(JobDriver_SexBaseInitiator __instance)
{ {
if (__instance is JobDriver_Masturbate || __instance.Partner == null) return; if (__instance is JobDriver_Masturbate || __instance.Partner == null
|| __instance.pawn?.relations == null || __instance.pawn.RaceProps.IsMechanoid) return;
HistoryEventDef def = __instance.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, __instance.Partner) ? HistoryEventDefOf.GotLovin_Spouse : HistoryEventDefOf.GotLovin_NonSpouse; HistoryEventDef def = __instance.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, __instance.Partner) ? HistoryEventDefOf.GotLovin_Spouse : HistoryEventDefOf.GotLovin_NonSpouse;