From b7267e614c19825d64ad0b4f774a8aa701465738 Mon Sep 17 00:00:00 2001 From: amevarashi Date: Sun, 20 Mar 2022 14:21:00 +0500 Subject: [PATCH] Fix futanari impregnation --- .../RJW_Menstruation/Patch/RJW_Patch.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs index 133673d..dafa7a5 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs @@ -1,5 +1,7 @@ using HarmonyLib; using rjw; +using rjw.Modules.Interactions.Enums; +using rjw.Modules.Interactions.Objects; using Verse; using UnityEngine; @@ -19,6 +21,8 @@ namespace RJW_Menstruation if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true; + if (!InteractionCanCausePregnancy(props)) return false; + var pawnparts = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)); HediffComp_Menstruation comp = partner.GetMenstruationComp(); @@ -39,6 +43,36 @@ namespace RJW_Menstruation } + + /// + /// Checks if pregnancy can happen based on the interaction def + /// This is needed for futanari sex, but should work for everyone + /// + /// + /// Interaction can result in pregnancy + private static bool InteractionCanCausePregnancy(SexProps props) + { + InteractionWithExtension interaction = rjw.Modules.Interactions.Helpers.InteractionHelper.GetWithExtension(props.dictionaryKey); + + if (!interaction.HasInteractionTag(InteractionTag.Fertilization)) + return false; + + bool usesPawnsPenis; + bool usesPartnersVagina; + + if (!props.isReceiver) + { + usesPawnsPenis = interaction.DominantHasTag(GenitalTag.CanPenetrate); + usesPartnersVagina = interaction.SubmissiveHasFamily(GenitalFamily.Vagina); + } + else + { + usesPawnsPenis = interaction.SubmissiveHasTag(GenitalTag.CanPenetrate); + usesPartnersVagina = interaction.DominantHasFamily(GenitalFamily.Vagina); + } + + return usesPawnsPenis && usesPartnersVagina; + } } [HarmonyPatch(typeof(PregnancyHelper), "Doimpregnate")]