diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index 4179a95..7aadb4a 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_InducedOvulator.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs index a1ab09a..55b7ecf 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs @@ -67,7 +67,7 @@ namespace RJW_Menstruation { get { - if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; + if (Pawn.HasIUD()) return false; switch (curStage) { 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 b3b1e84..88cb3f8 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 @@ -472,7 +472,7 @@ namespace RJW_Menstruation { get { - if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; + if (Pawn.HasIUD()) return false; switch (curStage) { @@ -639,7 +639,7 @@ namespace RJW_Menstruation CumOut(); - if (pregnancy == null && (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) || EggHealth <= 0) curStage = Stage.Infertile; + if (pregnancy == null && (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0 || EggHealth <= 0 || Pawn.SterileGenes())) curStage = Stage.Infertile; switch (curStage) { case Stage.Follicular: @@ -739,7 +739,7 @@ namespace RJW_Menstruation public void CumIn(Pawn pawn, float volume, float fertility = 1.0f, ThingDef filthdef = null) { if (volume <= 0) return; - if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) fertility /= 100f; + if (Pawn.HasIUD()) fertility /= 100f; float cumd = TotalCumPercent; float tmp = TotalCum + volume; if (tmp > CumCapacity) @@ -852,7 +852,7 @@ namespace RJW_Menstruation Hediff asa = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_ASA); float asafactor = asa?.Severity ?? 0f; - if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) antisperm = 0.70f + asafactor; + if (Pawn.HasIUD()) antisperm = 0.70f + asafactor; else antisperm = 0.0f + asafactor; absorber = (Absorber)Pawn.apparel?.WornApparel?.Find(x => x is Absorber); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs index a243f52..7d3ffa3 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -92,10 +92,7 @@ namespace RJW_Menstruation if (hediff is Hediff_MechanoidPregnancy) return ContentFinder.Get(("Womb/Mechanoid_Fluid"), true); - string icon = "Fetus/Slime_Abomi02"; - string fetustex = "Fetus/Fetus_Default"; ThingDef babydef = comp.Pawn.def; // TODO: Pregenerated babies - float gestationProgress = comp.StageProgress; int babycount = hediff is Hediff_BasePregnancy preg ? preg.babies.Count : 1; @@ -103,8 +100,9 @@ namespace RJW_Menstruation { babydef = h.babies?.FirstOrDefault()?.def ?? ThingDefOf.Human; } - - fetustex = babydef.GetModExtension()?.fetusTexPath ?? "Fetus/Fetus_Default"; + + string fetustex = babydef.GetModExtension()?.fetusTexPath ?? "Fetus/Fetus_Default"; + string icon; if (gestationProgress < 0.2f) icon = comp.WombTex + "_Implanted"; else if (gestationProgress < 0.3f) { @@ -357,5 +355,12 @@ namespace RJW_Menstruation return res; } + + public static bool HasIUD(this Pawn pawn) + { + if (pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return true; + if (ModsConfig.BiotechActive && pawn.health.hediffSet.HasHediff(HediffDefOf.ImplantedIUD)) return true; + return false; + } } } 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 1142ff4..e7c91dc 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -439,14 +439,15 @@ 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) + if (baby.genes != null && ModsConfig.BiotechActive) { - 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 (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype) + { + 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) { baby.genes.hybrid = true; @@ -456,7 +457,7 @@ namespace RJW_Menstruation } else { - enzygoticSiblings?.Add(baby, firstbaby); + enzygoticSiblings.Add(baby, firstbaby); if (baby.story != null) { @@ -465,7 +466,7 @@ namespace RJW_Menstruation baby.story.bodyType = firstbaby.story.bodyType; } - if (baby.genes != null) + if (baby.genes != null && ModsConfig.BiotechActive) { baby.genes.SetXenotypeDirect(firstbaby.genes.Xenotype); baby.genes.xenotypeName = firstbaby.genes.xenotypeName; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs index 18931b3..5062aee 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using RimWorld; using rjw; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; @@ -42,7 +43,7 @@ namespace RJW_Menstruation } else if (Genital_Helper.has_ovipositorM(pawn, pawnparts)) { - comp.CumIn(pawn, Rand.Range(0.75f, 4.5f) * pawn.BodySize, 1.0f); + comp.CumIn(pawn, Rand.Range(0.75f, 4.5f) * pawn.BodySize, partner.SterileGenes() ? 0.0f : 1.0f); } else comp.CumIn(pawn, pawn.GetCumVolume(pawnparts), 0); @@ -114,7 +115,7 @@ namespace RJW_Menstruation comp.CumIn(pawn, pawn.GetCumVolume(), 0); return false; } - else comp.CumIn(pawn, pawn.GetCumVolume(), pawn.health.capacities.GetLevel(xxx.reproduction)); + else comp.CumIn(pawn, pawn.GetCumVolume(), pawn.SterileGenes() ? 0.0f : pawn.health.capacities.GetLevel(xxx.reproduction)); return false; } } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs index e90643b..8a8e380 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs @@ -230,7 +230,7 @@ namespace RJW_Menstruation fontstyleright.alignment = TextAnchor.MiddleRight; buttonstyle.alignment = TextAnchor.MiddleLeft; - string father = p.Father.LabelShort; + string father = p.Father?.LabelShort ?? Translations.Dialog_FatherUnknown; GUI.Box(preginfo, "1 " + p.Mother.def.label + " " + Translations.Dialog_WombInfo02, buttonstyle); GUI.Label(preginfo, Translations.Dialog_WombInfo03 + ": " + father + " ", fontstyleright); diff --git a/changelogs.txt b/changelogs.txt index 0b61fda..5242c1d 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -2,7 +2,10 @@ 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. + - Pawns that are genetically sterile will no longer produce fertile cum, nor have a menstrual cycle. + - Biotech IUDs will now reduce pregnancy chances the same as an RJW IUD. Using both will not stack. - A biotech pregnancy will pause before going into labor if another womb already is in labor. + - Fix errors in womb dialog for Biotech pregnancies with null father. Version 1.0.8.0 - Support for RimWorld 1.4. All future changes to Menstruation will only be for Rimworld 1.4.