diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index 26ec0a6..92628f4 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 3518b5c..0208c9c 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 @@ -123,8 +123,8 @@ namespace RJW_Menstruation protected string customwombtex = null; protected string customvagtex = null; protected bool estrusflag = false; - protected float? ovulationChanceCache = null; // Dirtied every simulation - protected float? implantationChanceCache = null; + protected float ovulationChanceCache = -1.0f; // Dirtied every simulation + protected float implantationChanceCache = -1.0f; protected int opcache = -1; protected float antisperm = 0.0f; // RJW pregnancy, or Biotech pregnancy/labor/laborpushing @@ -259,7 +259,7 @@ namespace RJW_Menstruation } public float TotalFertCum { - get => cums?.Where(cum => CumCanFertilize(cum)).Sum(cum => cum.FertVolume) ?? 0; + get => cums?.Sum(cum => cum.FertVolume) ?? 0; } public float TotalCumPercent { @@ -289,7 +289,7 @@ namespace RJW_Menstruation private bool calculatingOvulationChance = false; public bool CalculatingOvulationChance { get => calculatingOvulationChance; } - private float CalculatedOvulationChance() + protected float CalculatedOvulationChance() { float ovulationChance = 1.0f; if (EggHealth <= 0.0f) return 0.0f; @@ -315,7 +315,7 @@ namespace RJW_Menstruation return ovulationChance; } - private float CalculatedImplantChance() + protected float CalculatedImplantChance() { if (ModsConfig.BiotechActive && xxx.is_human(Pawn)) { @@ -336,8 +336,8 @@ namespace RJW_Menstruation { get { - if (ovulationChanceCache == null) ovulationChanceCache = CalculatedOvulationChance(); - return ovulationChanceCache.Value; + if (ovulationChanceCache < 0.0f) ovulationChanceCache = CalculatedOvulationChance(); + return ovulationChanceCache; } } @@ -346,8 +346,8 @@ namespace RJW_Menstruation { get { - if (implantationChanceCache == null) implantationChanceCache = CalculatedImplantChance(); - return implantationChanceCache.Value; + if (implantationChanceCache < 0.0f) implantationChanceCache = CalculatedImplantChance(); + return implantationChanceCache; } } @@ -1266,8 +1266,8 @@ namespace RJW_Menstruation protected virtual void BeforeSimulator() { - ovulationChanceCache = null; - implantationChanceCache = null; + ovulationChanceCache = -1.0f; + implantationChanceCache = -1.0f; CumOut(); } @@ -1335,18 +1335,10 @@ namespace RJW_Menstruation } } - public bool CumCanFertilize(Cum cum) - { - return !cum.notcum && - cum.FertVolume > 0 && - !(cum.pawn?.Destroyed ?? true) && - (RJWPregnancySettings.bestial_pregnancy_enabled || xxx.is_animal(Pawn) == xxx.is_animal(cum.pawn)); - } - protected Pawn Fertilize() { if (cums.NullOrEmpty()) return null; - List eligibleCum = cums.FindAll(cum => CumCanFertilize(cum)); + List eligibleCum = cums.FindAll(cum => !cum.notcum && cum.FertVolume > 0 && !(cum.pawn?.Destroyed ?? true) && (RJWPregnancySettings.bestial_pregnancy_enabled || xxx.is_animal(Pawn) == xxx.is_animal(cum.pawn))); if (eligibleCum.Count == 0) return null; float totalFertPower = eligibleCum.Sum(cum => cum.FertVolume); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs index 130edcc..42b2aac 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs @@ -1,7 +1,6 @@  using RimWorld; -using RimWorld.Planet; using rjw; using System; using System.Collections.Generic; @@ -47,8 +46,6 @@ namespace RJW_Menstruation protected IEnumerable AffectedPawns() { - if(Pawn.GetCaravan() is Caravan caravan) - foreach (Pawn p in caravan.PawnsListForReading.Where(p => p != Pawn)) yield return p; Map mapHeld = Pawn.MapHeld; if (mapHeld == null) yield break; foreach (Pawn pawn in mapHeld.mapPawns.AllPawnsSpawned) diff --git a/changelogs.txt b/changelogs.txt index 4c92c4f..cd8aaa3 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,6 +1,5 @@ Version 1.0.9.4 - Added graphics for the menstruation genes with thanks to Alpenglow. - - Pawns in estrus now give their pheromones to their caravan-mates. - Pawns with the egglaying genes from Erin's Corvyia and Outland - Genetics no longer have a menstrual cycle. Version 1.0.9.3