Compare commits

..

No commits in common. "d1d4398aa4f0489646dc524ee88d4d12aac62fba" and "b70b4a6c903bf7e9a1b9f1c6404d85f243d948fb" have entirely different histories.

6 changed files with 43 additions and 23 deletions

View file

@ -133,7 +133,7 @@
<Option_PregnancyFromBaseRJW_Label>Use basic RJW pregnancy</Option_PregnancyFromBaseRJW_Label> <Option_PregnancyFromBaseRJW_Label>Use basic RJW pregnancy</Option_PregnancyFromBaseRJW_Label>
<Option_PregnancyFromMultiplePregnancy_Label>Use menstruation multiple pregnancy</Option_PregnancyFromMultiplePregnancy_Label> <Option_PregnancyFromMultiplePregnancy_Label>Use menstruation multiple pregnancy</Option_PregnancyFromMultiplePregnancy_Label>
<Option_PregnancyFromBiotech_Label>Use Biotech pregnancy</Option_PregnancyFromBiotech_Label> <Option_PregnancyFromBiotech_Label>Use Biotech pregnancy</Option_PregnancyFromBiotech_Label>
<Option_EnableBiotechTwins_Label>Enable multiple babies/twins in a single Biotech pregnancy.</Option_EnableBiotechTwins_Label> <Option_EnableBiotechTwins_Label>(EXPERIMENTAL) Enable multiple babies/twins in a single Biotech pregnancy.</Option_EnableBiotechTwins_Label>
<Option_EnableBiotechTwins_Desc>Enabling this option will allow identical and hetero ovular twins with Biotech.&#10;Also allows the hybrid system, but two humanlikes cannot produce an animal.</Option_EnableBiotechTwins_Desc> <Option_EnableBiotechTwins_Desc>Enabling this option will allow identical and hetero ovular twins with Biotech.&#10;Also allows the hybrid system, but two humanlikes cannot produce an animal.</Option_EnableBiotechTwins_Desc>
<Option_EnableDraftedIcon_Label>Show womb status when drafted</Option_EnableDraftedIcon_Label> <Option_EnableDraftedIcon_Label>Show womb status when drafted</Option_EnableDraftedIcon_Label>
<Option_EnableDraftedIcon_Desc>Draw womb icon for drafted pawns</Option_EnableDraftedIcon_Desc> <Option_EnableDraftedIcon_Desc>Draw womb icon for drafted pawns</Option_EnableDraftedIcon_Desc>

View file

@ -125,7 +125,7 @@ namespace RJW_Menstruation
protected bool estrusflag = false; protected bool estrusflag = false;
protected float? ovulationChanceCache = null; // Dirtied every simulation protected float? ovulationChanceCache = null; // Dirtied every simulation
protected float? implantationChanceCache = null; protected float? implantationChanceCache = null;
protected int? opcache = null; protected int opcache = -1;
protected float antisperm = 0.0f; protected float antisperm = 0.0f;
// RJW pregnancy, or Biotech pregnancy/labor/laborpushing // RJW pregnancy, or Biotech pregnancy/labor/laborpushing
protected Hediff pregnancy = null; protected Hediff pregnancy = null;
@ -197,14 +197,14 @@ namespace RJW_Menstruation
{ {
get get
{ {
if (opcache.HasValue) return opcache.Value; if (opcache > 0) return opcache;
const float yearsBeforeMenopause = 6.0f; const float yearsBeforeMenopause = 6.0f;
opcache = (int)(RaceCyclesPerYear() * opcache = (int)(RaceCyclesPerYear() *
AverageLitterSize() * AverageLitterSize() *
yearsBeforeMenopause * yearsBeforeMenopause *
(Pawn.RaceProps.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)); (Pawn.RaceProps.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy));
if (opcache <= 0) opcache = 1; if (opcache == 0) opcache = 1;
return opcache.Value; return opcache;
} }
} }
@ -655,7 +655,7 @@ namespace RJW_Menstruation
estrusLevel = Props.concealedEstrus ? EstrusLevel.Concealed : EstrusLevel.Visible; estrusLevel = Props.concealedEstrus ? EstrusLevel.Concealed : EstrusLevel.Visible;
ovulationFactor = 1f; ovulationFactor = 1f;
noBleeding = false; noBleeding = false;
opcache = null; opcache = -1;
if (Pawn.genes == null || !ModsConfig.BiotechActive) return; if (Pawn.genes == null || !ModsConfig.BiotechActive) return;
foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Where(gene => gene.Active).Select(gene => gene.def.GetModExtension<MenstruationModExtension>()).Where(ext => ext != null)) foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Where(gene => gene.Active).Select(gene => gene.def.GetModExtension<MenstruationModExtension>()).Where(ext => ext != null))
@ -971,7 +971,7 @@ namespace RJW_Menstruation
if (Pawn.HasIUD()) antisperm = 0.70f + asafactor; if (Pawn.HasIUD()) antisperm = 0.70f + asafactor;
else antisperm = 0.0f + asafactor; else antisperm = 0.0f + asafactor;
absorber = Pawn.apparel?.WornApparel.OfType<Absorber>().FirstOrDefault(); absorber = (Absorber)Pawn.apparel?.WornApparel.Find(x => x is Absorber);
if (absorber != null) if (absorber != null)
{ {
absorber.WearEffect(TickInterval); absorber.WearEffect(TickInterval);
@ -1390,12 +1390,6 @@ namespace RJW_Menstruation
deadeggs.Add(egg); deadeggs.Add(egg);
continue; 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))) else if (Rand.Chance(Configurations.ImplantationChance * ImplantChance * InterspeciesImplantFactor(egg.fertilizer)))
{ {
try try

View file

@ -43,14 +43,14 @@ namespace RJW_Menstruation
switch (parent) switch (parent)
{ {
case Hediff_Pregnant hediff_Pregnant: case Hediff_Pregnant hediff_Pregnant:
Hediff_Labor labor = Pawn.health.hediffSet.hediffs.OfType<Hediff_Labor>().MaxByWithFallback(hediff => hediff.loadID); Hediff_Labor labor = (Hediff_Labor)Pawn.health.hediffSet.hediffs.Where(hediff => hediff is Hediff_Labor).MaxByWithFallback(hediff => hediff.loadID);
HediffComp_PregeneratedBabies laborcomp = labor?.TryGetComp<HediffComp_PregeneratedBabies>(); HediffComp_PregeneratedBabies laborcomp = labor?.TryGetComp<HediffComp_PregeneratedBabies>();
if (laborcomp == null) return; if (laborcomp == null) return;
laborcomp.babies = this.babies; laborcomp.babies = this.babies;
laborcomp.enzygoticSiblings = this.enzygoticSiblings; laborcomp.enzygoticSiblings = this.enzygoticSiblings;
break; break;
case Hediff_Labor hediff_Labor: case Hediff_Labor hediff_Labor:
Hediff_LaborPushing pushing = Pawn.health.hediffSet.hediffs.OfType<Hediff_LaborPushing>().MaxByWithFallback(hediff => hediff.loadID); Hediff_LaborPushing pushing = (Hediff_LaborPushing)Pawn.health.hediffSet.hediffs.Where(hediff => hediff is Hediff_LaborPushing).MaxByWithFallback(hediff => hediff.loadID);
HediffComp_PregeneratedBabies pushingcomp = pushing?.TryGetComp<HediffComp_PregeneratedBabies>(); HediffComp_PregeneratedBabies pushingcomp = pushing?.TryGetComp<HediffComp_PregeneratedBabies>();
if (pushingcomp == null) return; if (pushingcomp == null) return;
pushingcomp.babies = this.babies; pushingcomp.babies = this.babies;
@ -103,6 +103,7 @@ namespace RJW_Menstruation
{ {
firstbaby = baby; firstbaby = baby;
request.FixedGender = baby.gender; request.FixedGender = baby.gender;
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
} }
else else
{ {

View file

@ -395,10 +395,23 @@ namespace RJW_Menstruation
public static HediffComp_Menstruation.EstrusLevel HighestEstrus(this Pawn pawn) public static HediffComp_Menstruation.EstrusLevel HighestEstrus(this Pawn pawn)
{ {
return pawn.GetMenstruationComps(). HediffComp_Menstruation.EstrusLevel res = HediffComp_Menstruation.EstrusLevel.None;
Select(comp => comp.GetEstrusLevel()).
DefaultIfEmpty(HediffComp_Menstruation.EstrusLevel.None). foreach(HediffComp_Menstruation comp in pawn.GetMenstruationComps())
Max(); {
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;
} }
public static bool HasIUD(this Pawn pawn) public static bool HasIUD(this Pawn pawn)
@ -428,10 +441,21 @@ namespace RJW_Menstruation
public static float DamagePants(this Pawn pawn, float fluidAmount) public static float DamagePants(this Pawn pawn, float fluidAmount)
{ {
if (pawn.apparel == null) return 0; if (pawn.apparel == null) return 0;
if (!pawn.apparel.WornApparel. Apparel pants = null;
Where(apparel => apparel.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)). foreach(Apparel apparel in pawn.apparel.WornApparel.Where(app => app.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)))
TryMinBy(apparel => apparel.def.apparel.LastLayer.drawOrder, out Apparel pants)) {
return 0; 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;
const float HPPerMl = 0.5f; const float HPPerMl = 0.5f;

View file

@ -343,6 +343,7 @@ namespace RJW_Menstruation
firstbaby = baby; firstbaby = baby;
request.FixedGender = baby.gender; request.FixedGender = baby.gender;
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
} }
else else
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB