diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index f8d1b95..0621e5c 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 32219a6..5064dc2 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -1528,7 +1528,7 @@ namespace RJW_Menstruation if (curStageHrs >= currentIntervalHours) { Hediff hediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_MenstrualCramp); - if (hediff != null) Pawn.health.RemoveHediff(hediff); + if (hediff != null && !Pawn.GetMenstruationComps().Any(comp => comp != this && comp.curStage == Stage.Bleeding)) Pawn.health.RemoveHediff(hediff); int totalFollicularHours = PeriodRandomizer(Stage.Follicular); // The total amount of time for both bleeding and follicular if (totalFollicularHours <= currentIntervalHours) // We've bled for so long that we completely missed the follicular phase GoOvulatoryStage(); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs index 0026e89..11509de 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs @@ -1,4 +1,5 @@ using RimWorld; +using System.Linq; using Verse; namespace RJW_Menstruation @@ -61,17 +62,12 @@ namespace RJW_Menstruation if (curStageHrs >= currentIntervalHours) { Hediff hediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_MenstrualCramp); - if (hediff != null) Pawn.health.RemoveHediff(hediff); + if (hediff != null && !Pawn.GetMenstruationComps().Any(comp => comp != this && comp.curStage == Stage.Bleeding)) Pawn.health.RemoveHediff(hediff); estrusflag = false; GoNextStage(Stage.Anestrus); return; } - else - { - if (curStageHrs < currentIntervalHours / 4) for (int i = 0; i < Configurations.CycleAcceleration; i++) BleedOut(); - curStageHrs += Configurations.CycleAcceleration; - StayCurrentStage(); - } + else base.BleedingAction(); } protected override void PregnantAction() diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index c4fa06f..c1d995a 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -1,9 +1,10 @@ using RimWorld; using rjw; +using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; -using UnityEngine; using Verse; namespace RJW_Menstruation @@ -12,6 +13,9 @@ namespace RJW_Menstruation { protected Dictionary enzygoticSiblings = new Dictionary(); // Each pawn and who they split from + protected readonly MethodInfo TryGetInheritedXenotype = typeof(PregnancyUtility).GetMethod("TryGetInheritedXenotype", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(Pawn), typeof(Pawn), typeof(XenotypeDef).MakeByRefType() }, null ); + protected readonly MethodInfo ShouldByHybrid = typeof(PregnancyUtility).GetMethod("ShouldByHybrid", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(Pawn), typeof(Pawn) }, null); + public override void DiscoverPregnancy() { PregnancyThought(); @@ -431,9 +435,13 @@ namespace RJW_Menstruation baby.genes.xenotypeName = mother.genes.xenotypeName; baby.genes.iconDef = mother.genes.iconDef; } - XenotypeDef xenoTypeDef = BabyXenoTypeDecider(mother, father, out bool hybridBaby); - if (xenoTypeDef != null) baby.genes.SetXenotypeDirect(xenoTypeDef); - if (hybridBaby) + + object[] args = new object[] { mother, father, null }; + if ((bool)TryGetInheritedXenotype.Invoke(null, args)) + { + baby.genes.SetXenotypeDirect((XenotypeDef)args[2]); + } + else if((bool)ShouldByHybrid.Invoke(null, new object[] { mother, father })) { baby.genes.hybrid = true; baby.genes.xenotypeName = "Hybrid".Translate(); @@ -638,39 +646,6 @@ namespace RJW_Menstruation } - public XenotypeDef BabyXenoTypeDecider(Pawn mother, Pawn father, out bool hybrid) - { - hybrid = false; - bool hybridMother = mother?.genes?.hybrid ?? false; - bool hybridFather = father?.genes?.hybrid ?? false; - if (hybridMother && hybridFather) - { - hybrid = true; - return null; - } - XenotypeDef motherInheritableXenotype = mother?.genes?.Xenotype; - XenotypeDef fatherInheritableXenotype = father?.genes?.Xenotype; - if (!(motherInheritableXenotype?.inheritable ?? false)) motherInheritableXenotype = null; - if (!(fatherInheritableXenotype?.inheritable ?? false)) fatherInheritableXenotype = null; - - // If they're the same (or both null) - if (motherInheritableXenotype == fatherInheritableXenotype) - { - // Both null, but one's a hybrid - if (motherInheritableXenotype == null && (hybridMother || hybridFather)) - hybrid = true; - - return motherInheritableXenotype; - } - - // If one is null and the other isn't - if ((motherInheritableXenotype == null) != (fatherInheritableXenotype == null)) return motherInheritableXenotype ?? fatherInheritableXenotype; - - // So two different inheritable ones - hybrid = true; - return null; - } - public PawnKindDef GetHybrid(Pawn first, Pawn second) { PawnKindDef res = null; diff --git a/changelogs.txt b/changelogs.txt index 146583c..237beb1 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -4,6 +4,7 @@ Version 1.0.8.5 - Impregnation fetishists are significantly less likely to pull out. - Some males will release small amounts of semen into a womb during vaginal sex before their actual ejaculation. - Babies born from multiple pregnancy will properly produce the prompt to name them. + - Hopefully improve compatibility with xenotype inhertiance-altering mods for multiple pregnancy. - Experimental "periodic ovulator" cycle type, currently not used. See Patches/Hediffs_Private_Parts_Animal.xml. Version 1.0.8.4