diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index ec97165..4179a95 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/MilkModule/Assemblies/MilkModule.dll b/1.4/MilkModule/Assemblies/MilkModule.dll index aaf7777..7c22131 100644 Binary files a/1.4/MilkModule/Assemblies/MilkModule.dll and b/1.4/MilkModule/Assemblies/MilkModule.dll differ 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 8abaf18..1142ff4 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -439,6 +439,20 @@ namespace RJW_Menstruation firstbaby = baby; request.FixedGender = baby.gender; request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); + if (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype) + { + baby.genes.xenotypeName = mother.genes.xenotypeName; + baby.genes.iconDef = mother.genes.iconDef; + } + if (baby.genes != null) + { + baby.genes.SetXenotypeDirect(BabyXenoTypeDecider(mother, father, out bool hybridBaby)); + if(hybridBaby) + { + baby.genes.hybrid = true; + baby.genes.xenotypeName = "Hybrid".Translate(); + } + } } else { @@ -451,6 +465,14 @@ namespace RJW_Menstruation baby.story.bodyType = firstbaby.story.bodyType; } + if (baby.genes != null) + { + baby.genes.SetXenotypeDirect(firstbaby.genes.Xenotype); + baby.genes.xenotypeName = firstbaby.genes.xenotypeName; + baby.genes.iconDef = firstbaby.genes.iconDef; + baby.genes.hybrid = firstbaby.genes.hybrid; + } + if (baby.IsHAR()) HARCompatibility.CopyHARProperties(baby, firstbaby); //if (Configurations.AnimalGeneticsActivated) @@ -621,6 +643,39 @@ 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) motherInheritableXenotype = null; + if (!fatherInheritableXenotype.inheritable) 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 3f3fadd..0b61fda 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,5 +1,6 @@ Version 1.0.8.1 - Added the option for humans to start Biotech pregnancies if the DLC is enabled. If set, non-humans will use the old multiple pregnancy instead. + - Babies conceived through the multiple pregnancy option will now properly inherit xenotypes. - Properly track biotech pregnancy through labor. - A biotech pregnancy will pause before going into labor if another womb already is in labor.