Compare commits

...

24 commits

Author SHA1 Message Date
lutepickle
c2e9983c4d Merge branch 'dev' 2022-11-08 18:09:21 -08:00
lutepickle
3811b6cf0f Remove 'you need to restart' messages from the configs as that doesn't apply anymore 2022-11-08 18:08:51 -08:00
lutepickle
487257cf64 Update changelog 2022-11-06 17:46:32 -08:00
lutepickle
f08a13c86e Check for Asmo's race support for 1.4 2022-11-06 17:45:32 -08:00
lutepickle
41034ec872 Update changelog 2022-11-05 08:00:46 -07:00
lutepickle
225e1fe143 Add a sterile genes check in the infertile and recovery actions 2022-11-05 07:59:44 -07:00
lutepickle
b9494a9acc Min is not max. Again 2022-11-05 07:57:44 -07:00
lutepickle
2a7feede8b Null check Biotech fathers in womb window 2022-11-04 17:25:03 -07:00
lutepickle
06fbc0e188 Remove redundant assignments 2022-11-04 12:07:44 -07:00
lutepickle
6fe38eb46e Respect Biotech IUDs 2022-11-04 12:06:03 -07:00
lutepickle
742381dd54 Don't run the cycle for pawns that are genetically sterile 2022-11-04 10:52:25 -07:00
lutepickle
ba6f1886d1 Males with sterile genes cum 0 fertility sperm 2022-11-04 10:44:33 -07:00
lutepickle
0647d25fa2 Don't need the null check in enzygoticSiblings anymore in 1.4 2022-11-04 09:18:27 -07:00
lutepickle
db5813d768 Move the xenotype inheritance fully into the gene null check, since it is possible with the hybrid system for two humans to make an animal 2022-11-04 09:01:36 -07:00
lutepickle
040ea6e672 Test for Biotech and only set xenotype if it's not null 2022-11-04 08:59:39 -07:00
lutepickle
ea1c5794f9 Handle inheritable xenotypes and hybrids 2022-11-04 08:43:58 -07:00
lutepickle
8c213c4fe6 Don't let a biotech pregnancy go into labor if another womb already is 2022-11-04 07:09:33 -07:00
lutepickle
2846117881 Track the changing hediff through pregnancy and labor 2022-11-03 19:01:50 -07:00
lutepickle
483ab2f7c0 Somehow OvaryPowerThreshold can end up as 0 and cause errors, so be sure to make it minimum 1 2022-10-31 20:53:57 -07:00
lutepickle
03f511fa02 Remove commented-out MultiplePregnancy options 2022-10-30 19:18:28 -07:00
lutepickle
a9d227153f Rebuild 2022-10-30 10:37:08 -07:00
lutepickle
d8ce861448 Add the option to start new biotech pregnancies 2022-10-30 10:36:38 -07:00
lutepickle
2f10a9cc3d Use ModsConfig.IsActive to detect HAR and AG 2022-10-30 10:05:58 -07:00
lutepickle
e64bd53318 Finally fix the scroll bug in the mod options 2022-10-30 09:29:28 -07:00
16 changed files with 223 additions and 55 deletions

Binary file not shown.

View file

@ -45,7 +45,7 @@
<Option1_Label_1>Enable womb icon</Option1_Label_1>
<Option1_Label_2>Enable button in health tab</Option1_Label_2>
<Option2_Label>Enable animal cycle</Option2_Label>
<Option2_Desc>Simulate animal cycles.&#10;This option will apply after next load&#10;Not recommended.</Option2_Desc>
<Option2_Desc>Simulate animal cycles.&#10;Not recommended.</Option2_Desc>
<Option3_Label>Implantation chance</Option3_Label>
<Option3_Desc>Base implantation chance of fertilized egg&#10;This value affects the chance of impregnation.</Option3_Desc>
<Option4_Label>Fertilization chance</Option4_Label>
@ -68,7 +68,7 @@
<Option11_Desc_3>Show only image of a fetus after discovered pregnancy.</Option11_Desc_3>
<Option11_Desc_4>Do not show any information about a fetus.</Option11_Desc_4>
<Option12_Label>Enable menopause</Option12_Label>
<Option12_Desc>Enable menopause effect that makes pawn infertile in time progress&#10;If you have problems with long life races, turn off this option.&#10;This option will apply after save loaded.</Option12_Desc>
<Option12_Desc>Enable menopause effect that makes pawn infertile in time progress&#10;If you have problems with long life races, turn off this option.</Option12_Desc>
<Option13_Label>Use multiple pregnancy</Option13_Label>
<Option13_Desc>Use multiple pregnancy instead RJW's default pregnancy&#10;Disable this option if you are in trouble with impregnation&#10;RJW pregnancy should be turned on.</Option13_Desc>
<Option14_Label>Enable hetero ovular twins</Option14_Label>
@ -121,6 +121,9 @@
<EstimatedCumLifespan>Estimated sperm lifespan</EstimatedCumLifespan>
<EstimatedEggLifespan>Estimated egg lifespan</EstimatedEggLifespan>
<FertilityDesc>Implantation chance of fertilized eggs.&#10;Chance of fertilization this hour: {0}%</FertilityDesc>
<Option_PregnancyFromBaseRJW_Label>Use basic RJW pregnancy</Option_PregnancyFromBaseRJW_Label>
<Option_PregnancyFromMultiplePregnancy_Label>Use menstruation multiple pregnancy</Option_PregnancyFromMultiplePregnancy_Label>
<Option_PregnancyFromBiotech_Label>Use Biotech pregnancy</Option_PregnancyFromBiotech_Label>
<Button_ResetToDefault>Reset to default</Button_ResetToDefault>
<Gizmo_GatherCum>Gather cum</Gizmo_GatherCum>

View file

@ -53,7 +53,7 @@ namespace RJW_Menstruation
public static float EstrusFuckabilityToHookup = RJWHookupSettings.MinimumFuckabilityToHookup;
public static float EstrusAttractivenessToHookup = RJWHookupSettings.MinimumAttractivenessToHookup;
public static float EstrusRelationshipToHookup = RJWHookupSettings.MinimumRelationshipToHookup;
public static bool UseMultiplePregnancy = true;
public static PregnancyType PregnancySource = PregnancyType.MultiplePregnancy;
public static bool EnableHeteroOvularTwins = true;
public static bool EnableEnzygoticTwins = true;
public static float EnzygoticTwinsChance = EnzygoticTwinsChanceDefault;
@ -89,7 +89,7 @@ namespace RJW_Menstruation
EnzygoticTwinsChanceAdjust = EnzygoticTwinsChanceAdjustDefault;
EnableEnzygoticTwins = true;
EnableHeteroOvularTwins = true;
UseMultiplePregnancy = true;
PregnancySource = PregnancyType.MultiplePregnancy;
MaxEnzygoticTwins = MaxEnzygoticTwinsDefault;
BleedingAmount = BleedingAmountDefault;
MotherFirst = false;
@ -166,6 +166,13 @@ namespace RJW_Menstruation
Hostile = 16
}
public enum PregnancyType
{
BaseRJW,
MultiplePregnancy,
Biotech
}
public override void ExposeData()
{
Scribe_Values.Look(ref ImplantationChanceAdjust, "ImplantationChanceAdjust", ImplantationChanceAdjust, true);
@ -189,7 +196,7 @@ namespace RJW_Menstruation
Scribe_Values.Look(ref EstrusFuckabilityToHookup, "EstrusFuckabilityToHookup", EstrusFuckabilityToHookup, true);
Scribe_Values.Look(ref EstrusAttractivenessToHookup, "EstrusAttractivenessToHookup", EstrusAttractivenessToHookup, true);
Scribe_Values.Look(ref EstrusRelationshipToHookup, "EstrusRelationshipToHookup", EstrusRelationshipToHookup, true);
Scribe_Values.Look(ref UseMultiplePregnancy, "UseMultiplePregnancy", UseMultiplePregnancy, true);
Scribe_Values.Look(ref PregnancySource, "PregnancySource", PregnancySource, true);
Scribe_Values.Look(ref EnableHeteroOvularTwins, "EnableHeteroOvularTwins", EnableHeteroOvularTwins, true);
Scribe_Values.Look(ref EnableEnzygoticTwins, "EnableEnzygoticTwins", EnableEnzygoticTwins, true);
Scribe_Values.Look(ref EnzygoticTwinsChance, "EnzygoticTwinsChance", EnzygoticTwinsChance, true);
@ -245,8 +252,10 @@ namespace RJW_Menstruation
public RJW_Menstruation(ModContentPack content) : base(content)
{
GetSettings<Configurations>();
Configurations.HARActivated = ModLister.GetActiveModWithIdentifier("erdelf.HumanoidAlienRaces") != null;
Configurations.AnimalGeneticsActivated = ModLister.GetActiveModWithIdentifier("Mlie.AnimalGenetics") != null;
if (!ModsConfig.BiotechActive && Configurations.PregnancySource == Configurations.PregnancyType.Biotech)
Configurations.PregnancySource = Configurations.PregnancyType.MultiplePregnancy;
Configurations.HARActivated = ModsConfig.IsActive("erdelf.HumanoidAlienRaces");
Configurations.AnimalGeneticsActivated = ModsConfig.IsActive("Mlie.AnimalGenetics");
}
@ -262,7 +271,8 @@ namespace RJW_Menstruation
float mainRectHeight = -3f +
(Configurations.EnableWombIcon || Configurations.EnableButtonInHT ? 400f : 0f) +
(Configurations.EstrusOverridesHookupSettings ? 144f : 0f) +
(Configurations.UseMultiplePregnancy ? (Configurations.EnableEnzygoticTwins ? 175f : 75f) : 0f) +
// TODO: Also for modified Biotech pregnancies
(Configurations.PregnancySource == Configurations.PregnancyType.MultiplePregnancy ? (Configurations.EnableEnzygoticTwins ? 175f : 75f) : 0f) +
(Configurations.EnableBirthVaginaMorph ? 48f : 0f);
Rect mainRect = new Rect(0f, 0f, inRect.width - 30f, Math.Max(inRect.height + mainRectHeight, 1f));
int Adjust;
@ -415,8 +425,14 @@ namespace RJW_Menstruation
Configurations.EstrusRelationshipToHookup = listmain.Slider((int)Configurations.EstrusRelationshipToHookup, -100f, 100f);
}
listmain.CheckboxLabeled(Translations.Option13_Label, ref Configurations.UseMultiplePregnancy, Translations.Option13_Desc);
if (Configurations.UseMultiplePregnancy)
if (listmain.RadioButton(Translations.Option_PregnancyFromBaseRJW_Label, Configurations.PregnancySource == Configurations.PregnancyType.BaseRJW))
Configurations.PregnancySource = Configurations.PregnancyType.BaseRJW;
if (listmain.RadioButton(Translations.Option_PregnancyFromMultiplePregnancy_Label, Configurations.PregnancySource == Configurations.PregnancyType.MultiplePregnancy))
Configurations.PregnancySource = Configurations.PregnancyType.MultiplePregnancy;
if (ModsConfig.BiotechActive && listmain.RadioButton(Translations.Option_PregnancyFromBiotech_Label, Configurations.PregnancySource == Configurations.PregnancyType.Biotech))
Configurations.PregnancySource = Configurations.PregnancyType.Biotech;
// TODO: Also for modified Biotech pregnancy
if (Configurations.PregnancySource == Configurations.PregnancyType.MultiplePregnancy)
{
float sectionheight = 75f;
if (Configurations.EnableEnzygoticTwins) sectionheight += 100;
@ -459,19 +475,14 @@ namespace RJW_Menstruation
listmain.EndSection(vmsection);
}
Widgets.EndScrollView();
listmain.CheckboxLabeled(Translations.Option8_Label, ref Configurations.Debug, Translations.Option8_Desc);
if (listmain.ButtonText(Translations.Button_ResetToDefault))
{
Configurations.SettoDefault();
}
listmain.End();
Widgets.EndScrollView();
}

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

@ -166,7 +166,7 @@ namespace RJW_Menstruation
{
get
{
if (opcache >= 0) return opcache;
if (opcache > 0) return opcache;
float avglittersize;
try
{
@ -182,6 +182,7 @@ namespace RJW_Menstruation
avglittersize *
yearsBeforeMenopause *
(Pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy));
if (opcache == 0) opcache = 1;
return opcache;
}
}
@ -193,7 +194,7 @@ namespace RJW_Menstruation
{
get
{
if (!Configurations.EnableMenopause || Props.infertile) return Mathf.Min(1.0f, ovarypower / OvaryPowerThreshold);
if (!Configurations.EnableMenopause || Props.infertile) return Mathf.Max(1.0f, ovarypower / OvaryPowerThreshold);
else return ovarypower / OvaryPowerThreshold;
}
}
@ -471,7 +472,7 @@ namespace RJW_Menstruation
{
get
{
if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false;
if (Pawn.HasIUD()) return false;
switch (curStage)
{
@ -638,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:
@ -738,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)
@ -851,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);
@ -1234,7 +1235,8 @@ namespace RJW_Menstruation
if (Configurations.Debug) Log.Message($"Implanting fertilized egg of {Pawn} into {parent}, father {egg.fertilizer}");
if (pregnancy != null)
{
if (Configurations.UseMultiplePregnancy && Configurations.EnableHeteroOvularTwins)
// TODO: Modified Biotech pregnancy
if (Configurations.PregnancySource == Configurations.PregnancyType.MultiplePregnancy && Configurations.EnableHeteroOvularTwins)
{
if (pregnancy is Hediff_MultiplePregnancy h)
{
@ -1252,30 +1254,41 @@ namespace RJW_Menstruation
}
else
{
if (!Configurations.UseMultiplePregnancy)
Configurations.PregnancyType usePregnancy = xxx.is_human(Pawn) ? Configurations.PregnancySource : Configurations.PregnancyType.MultiplePregnancy;
switch (usePregnancy)
{
if (Configurations.Debug) Log.Message($"Creating new base RJW pregnancy");
PregnancyHelper.PregnancyDecider(Pawn, egg.fertilizer);
// I hate having to do this, but it gets the newest pregnancy
List<Hediff_BasePregnancy> pregnancies = new List<Hediff_BasePregnancy>();
Pawn.health.hediffSet.GetHediffs(ref pregnancies);
pregnancy = pregnancies.MaxBy(hediff => hediff.loadID);
pregnant = true;
break;
}
else
{
if (Configurations.Debug) Log.Message($"Creating new menstruation pregnancy");
pregnancy = Hediff_BasePregnancy.Create<Hediff_MultiplePregnancy>(Pawn, egg.fertilizer);
pregnant = true;
deadeggs.Add(egg);
case Configurations.PregnancyType.BaseRJW:
if (Configurations.Debug) Log.Message($"Creating new base RJW pregnancy");
PregnancyHelper.PregnancyDecider(Pawn, egg.fertilizer);
// I hate having to do this, but it gets the newest pregnancy
List<Hediff_BasePregnancy> pregnancies = new List<Hediff_BasePregnancy>();
Pawn.health.hediffSet.GetHediffs(ref pregnancies);
pregnancy = pregnancies.MaxBy(hediff => hediff.loadID);
pregnant = true;
break;
case Configurations.PregnancyType.MultiplePregnancy:
if (Configurations.Debug) Log.Message($"Creating new menstruation pregnancy");
pregnancy = Hediff_BasePregnancy.Create<Hediff_MultiplePregnancy>(Pawn, egg.fertilizer);
pregnant = true;
deadeggs.Add(egg);
break;
case Configurations.PregnancyType.Biotech:
if (Configurations.Debug) Log.Message($"Creating new biotech pregnancy");
pregnancy = HediffMaker.MakeHediff(HediffDefOf.PregnantHuman, Pawn);
((Hediff_Pregnant)pregnancy).SetParents(Pawn, egg.fertilizer, PregnancyUtility.GetInheritedGeneSet(egg.fertilizer, Pawn));
Pawn.health.AddHediff(pregnancy);
break;
}
if (pregnancy is Hediff_BasePregnancy rjw_preg)
{
// TODO: advance biotech pregnancy
rjw_preg.p_start_tick -= egg.fertstage / Configurations.CycleAcceleration * GenDate.TicksPerHour;
rjw_preg.p_end_tick -= egg.fertstage / Configurations.CycleAcceleration * GenDate.TicksPerHour;
}
// TODO: advance biotech pregnancy
if (!(pregnancy is Hediff_MultiplePregnancy)) break;
}
}
@ -1286,7 +1299,7 @@ namespace RJW_Menstruation
}
}
if (pregnant && (!Configurations.UseMultiplePregnancy || !Configurations.EnableHeteroOvularTwins))
if (pregnant && (Configurations.PregnancySource != Configurations.PregnancyType.MultiplePregnancy || !Configurations.EnableHeteroOvularTwins))
{
eggs.Clear();
return true;
@ -1537,7 +1550,7 @@ namespace RJW_Menstruation
{
if (curStageHrs >= currentIntervalHours)
{
if (Pawn.health.capacities.GetLevel(xxx.reproduction) == 0 || EggHealth <= 0)
if (Pawn.health.capacities.GetLevel(xxx.reproduction) == 0 || EggHealth <= 0 || Pawn.SterileGenes())
{
GoNextStage(Stage.Infertile);
}
@ -1559,7 +1572,7 @@ namespace RJW_Menstruation
protected virtual void InfertileAction()
{
if (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0 || EggHealth <= 0)
if (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0 || EggHealth <= 0 || Pawn.SterileGenes())
{
StayCurrentStageConst(Stage.Infertile);
}

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,10 +439,25 @@ namespace RJW_Menstruation
firstbaby = baby;
request.FixedGender = baby.gender;
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
if (baby.genes != null && ModsConfig.BiotechActive)
{
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;
baby.genes.xenotypeName = "Hybrid".Translate();
}
}
}
else
{
enzygoticSiblings?.Add(baby, firstbaby);
enzygoticSiblings.Add(baby, firstbaby);
if (baby.story != null)
{
@ -451,6 +466,14 @@ namespace RJW_Menstruation
baby.story.bodyType = firstbaby.story.bodyType;
}
if (baby.genes != null && ModsConfig.BiotechActive)
{
baby.genes.SetXenotypeDirect(firstbaby.genes.Xenotype);
baby.genes.xenotypeName = firstbaby.genes.xenotypeName;
baby.genes.iconDef = firstbaby.genes.iconDef;
baby.genes.hybrid = firstbaby.genes.hybrid;
}
if (baby.IsHAR())
HARCompatibility.CopyHARProperties(baby, firstbaby);
//if (Configurations.AnimalGeneticsActivated)
@ -621,6 +644,39 @@ namespace RJW_Menstruation
}
public XenotypeDef BabyXenoTypeDecider(Pawn mother, Pawn father, out bool hybrid)
{
hybrid = false;
bool hybridMother = mother?.genes?.hybrid ?? false;
bool hybridFather = father?.genes?.hybrid ?? false;
if (hybridMother && hybridFather)
{
hybrid = true;
return null;
}
XenotypeDef motherInheritableXenotype = mother?.genes?.Xenotype;
XenotypeDef fatherInheritableXenotype = father?.genes?.Xenotype;
if (!motherInheritableXenotype.inheritable) motherInheritableXenotype = null;
if (!fatherInheritableXenotype.inheritable) fatherInheritableXenotype = null;
// If they're the same (or both null)
if (motherInheritableXenotype == fatherInheritableXenotype)
{
// Both null, but one's a hybrid
if (motherInheritableXenotype == null && (hybridMother || hybridFather))
hybrid = true;
return motherInheritableXenotype;
}
// If one is null and the other isn't
if ((motherInheritableXenotype == null) != (fatherInheritableXenotype == null)) return motherInheritableXenotype ?? fatherInheritableXenotype;
// So two different inheritable ones
hybrid = true;
return null;
}
public PawnKindDef GetHybrid(Pawn first, Pawn second)
{
PawnKindDef res = null;

View file

@ -0,0 +1,64 @@
using HarmonyLib;
using System.Linq;
using RimWorld;
using Verse;
namespace RJW_Menstruation
{
[HarmonyPatch(typeof(Hediff_Pregnant), "Miscarry")]
public class Miscarry_Patch
{
public static void Postfix(Hediff_Pregnant __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (comp == null) return;
comp.Pregnancy = null;
}
}
[HarmonyPatch(typeof(Hediff_Pregnant), nameof(Hediff_Pregnant.StartLabor))]
public class StartLabor_Patch
{
public static void Postfix(Hediff_Pregnant __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (comp == null) return;
comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLabor);
}
}
[HarmonyPatch(typeof(Hediff_Labor), nameof(Hediff_Labor.PreRemoved))]
public class Labor_PreRemoved_Patch
{
public static void PostFix(Hediff_Labor __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (comp == null) return;
comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLaborPushing);
}
}
[HarmonyPatch(typeof(Hediff_LaborPushing), nameof(Hediff_LaborPushing.PreRemoved))]
public class LaborPushing_PreRemoved_Patch
{
public static void PostFix(Hediff_LaborPushing __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (comp == null) return;
comp.Pregnancy = null;
}
}
// Prevents a pregnancy from going into labor if another pregnancy already is
[HarmonyPatch(typeof(Hediff_Pregnant), nameof(Hediff_Pregnant.GestationProgress), MethodType.Getter)]
public class Hediff_Pregnant_GestationProgess_Patch
{
public static void PostFix(Hediff_Pregnant __instance, ref float __result)
{
if (__result < 1f) return;
Pawn pawn = __instance.pawn;
if (pawn.health.hediffSet.hediffs.Any(hediff => hediff.def == HediffDefOf.PregnancyLabor || hediff.def == HediffDefOf.PregnancyLaborPushing))
__result = 0.999f;
}
}
}

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

@ -70,6 +70,7 @@
<Compile Include="HediffComps\MenstruationUtility.cs" />
<Compile Include="Hediff_Estrus.cs" />
<Compile Include="IngestionOutcomeDoers.cs" />
<Compile Include="Patch\Biotech_Patch.cs" />
<Compile Include="Patch\GC_Patch.cs" />
<Compile Include="Recipe_Surgery.cs" />
<Compile Include="StatParts.cs" />

View file

@ -122,6 +122,9 @@ namespace RJW_Menstruation
public static readonly string Option_EstrusFuckability_Label = "Option_EstrusFuckability_Label".Translate();
public static readonly string Option_EstrusAttractability_Label = "Option_EstrusAttractability_Label".Translate();
public static readonly string Option_EstrusRelationship_Label = "Option_EstrusRelationship_Label".Translate();
public static readonly string Option_PregnancyFromBaseRJW_Label = "Option_PregnancyFromBaseRJW_Label".Translate();
public static readonly string Option_PregnancyFromMultiplePregnancy_Label = "Option_PregnancyFromMultiplePregnancy_Label".Translate();
public static readonly string Option_PregnancyFromBiotech_Label = "Option_PregnancyFromBiotech_Label".Translate();
public static readonly string Button_ResetToDefault = "Button_ResetToDefault".Translate();

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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>RJW Menstruation</identifier>
<version>1.0.8.0</version>
<version>1.0.8.1</version>
<dependencies>
</dependencies>
<incompatibleWith />

View file

@ -13,7 +13,7 @@
</v1.3>
<v1.4>
<li>1.4</li>
<li IfModActive="Abraxas.RJW.RaceSupport">1.4/RJW Menstruation Race Support</li>
<li IfModActive="ASMR.RJW.RaceSupport">1.4/RJW Menstruation Race Support</li>
<!-- <li IfModActive="rjw.milk.humanoid">1.3/MilkModule</li> -->
</v1.4>
</loadFolders>

View file

@ -1,3 +1,14 @@
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 disabling menopause not actually disabling menopause.
- Fix errors in womb dialog for Biotech pregnancies with null father.
- Properly detect AsmodeusRex's race support.
Version 1.0.8.0
- Support for RimWorld 1.4. All future changes to Menstruation will only be for Rimworld 1.4.
- Existing Biotech pregnancies will appear in a womb, but no support yet for starting a Biotech pregnancy.