diff --git a/Source/Scripts/Utilities/SexInteractionUtility.cs b/Source/Scripts/Utilities/SexInteractionUtility.cs index 53ce3ce..0ddb4ae 100644 --- a/Source/Scripts/Utilities/SexInteractionUtility.cs +++ b/Source/Scripts/Utilities/SexInteractionUtility.cs @@ -146,24 +146,46 @@ namespace Privacy_Please return BasicSettings.worryAboutBeastiality && jobDriver.Partner != null && jobDriver.Partner.RaceProps.Animal; } + /** whether the act is bestiality to begin with, and if so, first the humanoid and then the animal */ + static (bool IsBestiality, Pawn Humanoid, Pawn Animal) getBestialityRoles(JobDriver_Sex jobDriver) + { + (bool, Pawn, Pawn) nope = (false, null, null); + if (!BasicSettings.worryAboutBeastiality) return nope; + + /* can be animal, if... + * - RJW option "animal on animal" is enabled + * - RJW option "bestiality" is enabled and an animal has the "breeder" designator + */ + var actor = jobDriver.GetActor(); + /* can be animal, if... + * - RJW option "animal on animal" is enabled + * - RJW option "bestiality" is enabled + */ + var target = jobDriver.Partner; + + if (actor.IsAnimal() && target.RaceProps.Humanlike) return (true, target, actor); + else if (actor.RaceProps.Humanlike && target.IsAnimal()) return (true, actor, target); + return nope; + } + public static bool SexActIsBestialityWithOrdinaryAnimal(JobDriver_Sex jobDriver, Pawn witness = null) { - if (BasicSettings.worryAboutBeastiality == false) return false; + var (IsBestiality, Humanoid, Animal) = getBestialityRoles(jobDriver); + if (!IsBestiality) return false; + + if (Humanoid.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_BondOnly") && Animal.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond) != Humanoid) return true; + if (Humanoid.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_OnlyVenerated") && !Humanoid.Ideo.IsVeneratedAnimal(Animal)) return true; - if (jobDriver.Partner == null || jobDriver.Partner.RaceProps.Animal == false) return false; - if (jobDriver.pawn.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_BondOnly") && jobDriver.Partner.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond) != jobDriver.pawn) return true; - if (jobDriver.pawn.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_OnlyVenerated") && jobDriver.pawn.Ideo.IsVeneratedAnimal(jobDriver.Partner) == false) return true; - return false; } public static bool SexActIsBestialityWithSpecialAnimal(JobDriver_Sex jobDriver, Pawn witness = null) { - if (BasicSettings.worryAboutBeastiality == false) return false; - - if (jobDriver.Partner == null || jobDriver.Partner.RaceProps.Animal == false) return false; - if (jobDriver.pawn.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_BondOnly") && jobDriver.Partner.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond) == jobDriver.pawn) return true; - if (jobDriver.pawn.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_OnlyVenerated") && jobDriver.pawn.Ideo.IsVeneratedAnimal(jobDriver.Partner) == true) return true; + var (IsBestiality, Humanoid, Animal) = getBestialityRoles(jobDriver); + if (!IsBestiality) return false; + + if (Humanoid.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_BondOnly") && Animal.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond) == Humanoid) return true; + if (Humanoid.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_OnlyVenerated") && Humanoid.Ideo.IsVeneratedAnimal(Animal)) return true; return false; }