diff --git a/1.5/Languages/English/Keyed/RJW_Menstruation.xml b/1.5/Languages/English/Keyed/RJW_Menstruation.xml
index 7aa650e..08b7327 100644
--- a/1.5/Languages/English/Keyed/RJW_Menstruation.xml
+++ b/1.5/Languages/English/Keyed/RJW_Menstruation.xml
@@ -133,7 +133,7 @@
Use basic RJW pregnancy
Use menstruation multiple pregnancy
Use Biotech pregnancy
- (EXPERIMENTAL) Enable multiple babies/twins in a single Biotech pregnancy.
+ Enable multiple babies/twins in a single Biotech pregnancy.
Enabling this option will allow identical and hetero ovular twins with Biotech.
Also allows the hybrid system, but two humanlikes cannot produce an animal.
Show womb status when drafted
Draw womb icon for drafted pawns
diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs
index ae03413..cdf9afd 100644
--- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs
+++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs
@@ -125,7 +125,7 @@ namespace RJW_Menstruation
protected bool estrusflag = false;
protected float? ovulationChanceCache = null; // Dirtied every simulation
protected float? implantationChanceCache = null;
- protected int opcache = -1;
+ protected int? opcache = null;
protected float antisperm = 0.0f;
// RJW pregnancy, or Biotech pregnancy/labor/laborpushing
protected Hediff pregnancy = null;
@@ -197,14 +197,14 @@ namespace RJW_Menstruation
{
get
{
- if (opcache > 0) return opcache;
+ if (opcache.HasValue) return opcache.Value;
const float yearsBeforeMenopause = 6.0f;
opcache = (int)(RaceCyclesPerYear() *
AverageLitterSize() *
yearsBeforeMenopause *
(Pawn.RaceProps.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy));
- if (opcache == 0) opcache = 1;
- return opcache;
+ if (opcache <= 0) opcache = 1;
+ return opcache.Value;
}
}
@@ -655,7 +655,7 @@ namespace RJW_Menstruation
estrusLevel = Props.concealedEstrus ? EstrusLevel.Concealed : EstrusLevel.Visible;
ovulationFactor = 1f;
noBleeding = false;
- opcache = -1;
+ opcache = null;
if (Pawn.genes == null || !ModsConfig.BiotechActive) return;
foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Where(gene => gene.Active).Select(gene => gene.def.GetModExtension()).Where(ext => ext != null))
@@ -971,7 +971,7 @@ namespace RJW_Menstruation
if (Pawn.HasIUD()) antisperm = 0.70f + asafactor;
else antisperm = 0.0f + asafactor;
- absorber = (Absorber)Pawn.apparel?.WornApparel.Find(x => x is Absorber);
+ absorber = Pawn.apparel?.WornApparel.OfType().FirstOrDefault();
if (absorber != null)
{
absorber.WearEffect(TickInterval);
@@ -1390,6 +1390,12 @@ namespace RJW_Menstruation
deadeggs.Add(egg);
continue;
}
+ else if (ModsConfig.BiotechActive && !Find.Storyteller.difficulty.ChildrenAllowed)
+ {
+ if (Configurations.Debug) Log.Message($"Could not implant {Pawn}'s egg due to children being disabled");
+ deadeggs.Add(egg);
+ continue;
+ }
else if (Rand.Chance(Configurations.ImplantationChance * ImplantChance * InterspeciesImplantFactor(egg.fertilizer)))
{
try
diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs
index 2f6cea5..505d9be 100644
--- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs
+++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs
@@ -43,14 +43,14 @@ namespace RJW_Menstruation
switch (parent)
{
case Hediff_Pregnant hediff_Pregnant:
- Hediff_Labor labor = (Hediff_Labor)Pawn.health.hediffSet.hediffs.Where(hediff => hediff is Hediff_Labor).MaxByWithFallback(hediff => hediff.loadID);
+ Hediff_Labor labor = Pawn.health.hediffSet.hediffs.OfType().MaxByWithFallback(hediff => hediff.loadID);
HediffComp_PregeneratedBabies laborcomp = labor?.TryGetComp();
if (laborcomp == null) return;
laborcomp.babies = this.babies;
laborcomp.enzygoticSiblings = this.enzygoticSiblings;
break;
case Hediff_Labor hediff_Labor:
- Hediff_LaborPushing pushing = (Hediff_LaborPushing)Pawn.health.hediffSet.hediffs.Where(hediff => hediff is Hediff_LaborPushing).MaxByWithFallback(hediff => hediff.loadID);
+ Hediff_LaborPushing pushing = Pawn.health.hediffSet.hediffs.OfType().MaxByWithFallback(hediff => hediff.loadID);
HediffComp_PregeneratedBabies pushingcomp = pushing?.TryGetComp();
if (pushingcomp == null) return;
pushingcomp.babies = this.babies;
@@ -103,7 +103,6 @@ namespace RJW_Menstruation
{
firstbaby = baby;
request.FixedGender = baby.gender;
- request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
}
else
{
diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs
index 7a42bae..a8e873f 100644
--- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs
+++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs
@@ -395,23 +395,10 @@ namespace RJW_Menstruation
public static HediffComp_Menstruation.EstrusLevel HighestEstrus(this Pawn pawn)
{
- HediffComp_Menstruation.EstrusLevel res = HediffComp_Menstruation.EstrusLevel.None;
-
- foreach(HediffComp_Menstruation comp in pawn.GetMenstruationComps())
- {
- switch (comp.GetEstrusLevel())
- {
- case HediffComp_Menstruation.EstrusLevel.None:
- break;
- case HediffComp_Menstruation.EstrusLevel.Concealed:
- res = HediffComp_Menstruation.EstrusLevel.Concealed;
- break;
- case HediffComp_Menstruation.EstrusLevel.Visible:
- return HediffComp_Menstruation.EstrusLevel.Visible;
- }
- }
-
- return res;
+ return pawn.GetMenstruationComps().
+ Select(comp => comp.GetEstrusLevel()).
+ DefaultIfEmpty(HediffComp_Menstruation.EstrusLevel.None).
+ Max();
}
public static bool HasIUD(this Pawn pawn)
@@ -441,21 +428,10 @@ namespace RJW_Menstruation
public static float DamagePants(this Pawn pawn, float fluidAmount)
{
if (pawn.apparel == null) return 0;
- Apparel pants = null;
- foreach(Apparel apparel in pawn.apparel.WornApparel.Where(app => app.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)))
- {
- if (apparel.def.apparel.LastLayer == ApparelLayerDefOf.OnSkin)
- {
- pants = apparel;
- break;
- }
- else if (pants == null || apparel.def.apparel.LastLayer == ApparelLayerDefOf.Middle)
- // Either grab whatever's available or reassign the pants from shell to a middle
- pants = apparel;
- // Pants are middle and this is a shell
- else continue;
- }
- if (pants == null) return 0;
+ if (!pawn.apparel.WornApparel.
+ Where(apparel => apparel.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)).
+ TryMinBy(apparel => apparel.def.apparel.LastLayer.drawOrder, out Apparel pants))
+ return 0;
const float HPPerMl = 0.5f;
diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs
index f8f4d3e..31e2027 100644
--- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs
+++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs
@@ -343,7 +343,6 @@ namespace RJW_Menstruation
firstbaby = baby;
request.FixedGender = baby.gender;
- request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
}
else
{
diff --git a/About/ModIcon.png b/About/ModIcon.png
new file mode 100644
index 0000000..f12d8f5
Binary files /dev/null and b/About/ModIcon.png differ