bool isXenophobe = pawn.HasTrait("Xenophobia") && pawn.story.traits.DegreeOfTrait(DefDatabase.GetNamedSilentFail("Xenophobia")) > 0; bool isXenophile = pawn.HasTrait("Xenophobia") && pawn.story.traits.DegreeOfTrait(DefDatabase.GetNamedSilentFail("Xenophobia")) < 0; public static ThoughtDef GetThoughtsAboutSexAct(Pawn pawn, JobDriver_Sex jobDriver, out Precept precept) { ThoughtDef thoughtDef = null; precept = null; if (pawn == null || jobDriver == null) return null; if (BasicSettings.slavesIgnoreSex && (pawn.IsPrisoner || pawn.IsSlave)) return null; if (BasicSettings.otherFactionsIgnoreSex && pawn.Faction.IsPlayer == false) return null; if (BasicSettings.worryAboutNecro && sexIsNecro && xxx.is_necrophiliac(pawn) == false) { thoughtDef = xxx.is_necrophiliac(pawn) ? DefDatabase.GetNamedSilentFail("SawNecrophilia_Honorable") : pawn.HasPreceptForIssue("Necrophilia", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : DefDatabase.GetNamedSilentFail("SawNecrophilia_Abhorrent"); } else if (BasicSettings.worryAboutBeastiality && sexIsBeastial) { thoughtDef = xxx.is_zoophile(pawn) ? DefDatabase.GetNamedSilentFail("SawBeastility_Honorable") : pawn.HasPreceptForIssue("Beastility", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : DefDatabase.GetNamedSilentFail("SawBeastility_Abhorrent"); } else if (BasicSettings.worryAboutRape && BasicSettings.ignoreSlaveRape == false && sexIsSlaveRape) { thoughtDef = xxx.is_rapist(pawn) ? DefDatabase.GetNamedSilentFail("SawRape_Honorable") : pawn.HasPreceptForIssue("Rape", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : DefDatabase.GetNamedSilentFail("SawRape_Abhorrent"); } else if (BasicSettings.worryAboutRape && sexIsRape) { thoughtDef = xxx.is_rapist(pawn) ? DefDatabase.GetNamedSilentFail("SawRape_Honorable") : pawn.HasPreceptForIssue("Rape", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : DefDatabase.GetNamedSilentFail("SawRape_Abhorrent"); } else if (BasicSettings.worryAboutXeno && sexIsXeno) { thoughtDef = isXenophobe ? DefDatabase.GetNamedSilentFail("SawHAR_AlienDating_Prohibited") : isXenophile ? DefDatabase.GetNamedSilentFail("SawHAR_AlienDating_Honorable") : pawn.HasPreceptForIssue("HAR_AlienDating", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : DefDatabase.GetNamedSilentFail("SawHAR_AlienDating_Acceptable"); } else if (BasicSettings.worryAboutMasturbation && sexIsSolo) { thoughtDef = pawn.HasPreceptForIssue("Masturbation", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : DefDatabase.GetNamedSilentFail("SawMasturbation_Disapproved"); } DebugMode.Message("Sex job is: " + jobDriver + " Issue is: " + (precept?.def?.issue?.defName).ToStringSafe() + " Opinion is: " + (precept?.def?.defName).ToStringSafe() + " Thought is: " + (thoughtDef?.defName).ToStringSafe()); return thoughtDef; }