Fix futanari impregnation

This commit is contained in:
amevarashi 2022-03-20 14:21:00 +05:00
parent d5d5dbd77c
commit b7267e614c

View file

@ -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
}
/// <summary>
/// Checks if pregnancy can happen based on the interaction def
/// This is needed for futanari sex, but should work for everyone
/// </summary>
/// <param name="props"></param>
/// <returns>Interaction can result in pregnancy</returns>
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")]