Compare commits

...

8 Commits

8 changed files with 32 additions and 22 deletions

Binary file not shown.

View File

@ -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)
{

View File

@ -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);

View File

@ -92,10 +92,7 @@ namespace RJW_Menstruation
if (hediff is Hediff_MechanoidPregnancy)
return ContentFinder<Texture2D>.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<PawnDNAModExtension>()?.fetusTexPath ?? "Fetus/Fetus_Default";
string fetustex = babydef.GetModExtension<PawnDNAModExtension>()?.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;
}
}
}

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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.