Merge branch 'dev'

This commit is contained in:
lutepickle 2022-11-08 18:09:21 -08:00
commit c2e9983c4d
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_1>Enable womb icon</Option1_Label_1>
<Option1_Label_2>Enable button in health tab</Option1_Label_2> <Option1_Label_2>Enable button in health tab</Option1_Label_2>
<Option2_Label>Enable animal cycle</Option2_Label> <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_Label>Implantation chance</Option3_Label>
<Option3_Desc>Base implantation chance of fertilized egg&#10;This value affects the chance of impregnation.</Option3_Desc> <Option3_Desc>Base implantation chance of fertilized egg&#10;This value affects the chance of impregnation.</Option3_Desc>
<Option4_Label>Fertilization chance</Option4_Label> <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_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> <Option11_Desc_4>Do not show any information about a fetus.</Option11_Desc_4>
<Option12_Label>Enable menopause</Option12_Label> <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_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> <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> <Option14_Label>Enable hetero ovular twins</Option14_Label>
@ -121,6 +121,9 @@
<EstimatedCumLifespan>Estimated sperm lifespan</EstimatedCumLifespan> <EstimatedCumLifespan>Estimated sperm lifespan</EstimatedCumLifespan>
<EstimatedEggLifespan>Estimated egg lifespan</EstimatedEggLifespan> <EstimatedEggLifespan>Estimated egg lifespan</EstimatedEggLifespan>
<FertilityDesc>Implantation chance of fertilized eggs.&#10;Chance of fertilization this hour: {0}%</FertilityDesc> <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> <Button_ResetToDefault>Reset to default</Button_ResetToDefault>
<Gizmo_GatherCum>Gather cum</Gizmo_GatherCum> <Gizmo_GatherCum>Gather cum</Gizmo_GatherCum>

View file

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

View file

@ -67,7 +67,7 @@ namespace RJW_Menstruation
{ {
get get
{ {
if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; if (Pawn.HasIUD()) return false;
switch (curStage) switch (curStage)
{ {

View file

@ -166,7 +166,7 @@ namespace RJW_Menstruation
{ {
get get
{ {
if (opcache >= 0) return opcache; if (opcache > 0) return opcache;
float avglittersize; float avglittersize;
try try
{ {
@ -182,6 +182,7 @@ namespace RJW_Menstruation
avglittersize * avglittersize *
yearsBeforeMenopause * yearsBeforeMenopause *
(Pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)); (Pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy));
if (opcache == 0) opcache = 1;
return opcache; return opcache;
} }
} }
@ -193,7 +194,7 @@ namespace RJW_Menstruation
{ {
get 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; else return ovarypower / OvaryPowerThreshold;
} }
} }
@ -471,7 +472,7 @@ namespace RJW_Menstruation
{ {
get get
{ {
if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; if (Pawn.HasIUD()) return false;
switch (curStage) switch (curStage)
{ {
@ -638,7 +639,7 @@ namespace RJW_Menstruation
CumOut(); 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) switch (curStage)
{ {
case Stage.Follicular: case Stage.Follicular:
@ -738,7 +739,7 @@ namespace RJW_Menstruation
public void CumIn(Pawn pawn, float volume, float fertility = 1.0f, ThingDef filthdef = null) public void CumIn(Pawn pawn, float volume, float fertility = 1.0f, ThingDef filthdef = null)
{ {
if (volume <= 0) return; if (volume <= 0) return;
if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) fertility /= 100f; if (Pawn.HasIUD()) fertility /= 100f;
float cumd = TotalCumPercent; float cumd = TotalCumPercent;
float tmp = TotalCum + volume; float tmp = TotalCum + volume;
if (tmp > CumCapacity) if (tmp > CumCapacity)
@ -851,7 +852,7 @@ namespace RJW_Menstruation
Hediff asa = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_ASA); Hediff asa = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_ASA);
float asafactor = asa?.Severity ?? 0f; 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; else antisperm = 0.0f + asafactor;
absorber = (Absorber)Pawn.apparel?.WornApparel?.Find(x => x is Absorber); 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 (Configurations.Debug) Log.Message($"Implanting fertilized egg of {Pawn} into {parent}, father {egg.fertilizer}");
if (pregnancy != null) 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) if (pregnancy is Hediff_MultiplePregnancy h)
{ {
@ -1252,8 +1254,11 @@ namespace RJW_Menstruation
} }
else else
{ {
if (!Configurations.UseMultiplePregnancy) Configurations.PregnancyType usePregnancy = xxx.is_human(Pawn) ? Configurations.PregnancySource : Configurations.PregnancyType.MultiplePregnancy;
switch (usePregnancy)
{ {
case Configurations.PregnancyType.BaseRJW:
if (Configurations.Debug) Log.Message($"Creating new base RJW pregnancy"); if (Configurations.Debug) Log.Message($"Creating new base RJW pregnancy");
PregnancyHelper.PregnancyDecider(Pawn, egg.fertilizer); PregnancyHelper.PregnancyDecider(Pawn, egg.fertilizer);
// I hate having to do this, but it gets the newest pregnancy // I hate having to do this, but it gets the newest pregnancy
@ -1262,20 +1267,28 @@ namespace RJW_Menstruation
pregnancy = pregnancies.MaxBy(hediff => hediff.loadID); pregnancy = pregnancies.MaxBy(hediff => hediff.loadID);
pregnant = true; pregnant = true;
break; break;
}
else case Configurations.PregnancyType.MultiplePregnancy:
{
if (Configurations.Debug) Log.Message($"Creating new menstruation pregnancy"); if (Configurations.Debug) Log.Message($"Creating new menstruation pregnancy");
pregnancy = Hediff_BasePregnancy.Create<Hediff_MultiplePregnancy>(Pawn, egg.fertilizer); pregnancy = Hediff_BasePregnancy.Create<Hediff_MultiplePregnancy>(Pawn, egg.fertilizer);
pregnant = true; pregnant = true;
deadeggs.Add(egg); 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) 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_start_tick -= egg.fertstage / Configurations.CycleAcceleration * GenDate.TicksPerHour;
rjw_preg.p_end_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(); eggs.Clear();
return true; return true;
@ -1537,7 +1550,7 @@ namespace RJW_Menstruation
{ {
if (curStageHrs >= currentIntervalHours) 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); GoNextStage(Stage.Infertile);
} }
@ -1559,7 +1572,7 @@ namespace RJW_Menstruation
protected virtual void InfertileAction() 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); StayCurrentStageConst(Stage.Infertile);
} }

View file

@ -92,10 +92,7 @@ namespace RJW_Menstruation
if (hediff is Hediff_MechanoidPregnancy) if (hediff is Hediff_MechanoidPregnancy)
return ContentFinder<Texture2D>.Get(("Womb/Mechanoid_Fluid"), true); 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 ThingDef babydef = comp.Pawn.def; // TODO: Pregenerated babies
float gestationProgress = comp.StageProgress; float gestationProgress = comp.StageProgress;
int babycount = hediff is Hediff_BasePregnancy preg ? preg.babies.Count : 1; int babycount = hediff is Hediff_BasePregnancy preg ? preg.babies.Count : 1;
@ -104,7 +101,8 @@ namespace RJW_Menstruation
babydef = h.babies?.FirstOrDefault()?.def ?? ThingDefOf.Human; 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"; if (gestationProgress < 0.2f) icon = comp.WombTex + "_Implanted";
else if (gestationProgress < 0.3f) else if (gestationProgress < 0.3f)
{ {
@ -357,5 +355,12 @@ namespace RJW_Menstruation
return res; 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; firstbaby = baby;
request.FixedGender = baby.gender; request.FixedGender = baby.gender;
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); 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 else
{ {
enzygoticSiblings?.Add(baby, firstbaby); enzygoticSiblings.Add(baby, firstbaby);
if (baby.story != null) if (baby.story != null)
{ {
@ -451,6 +466,14 @@ namespace RJW_Menstruation
baby.story.bodyType = firstbaby.story.bodyType; 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()) if (baby.IsHAR())
HARCompatibility.CopyHARProperties(baby, firstbaby); HARCompatibility.CopyHARProperties(baby, firstbaby);
//if (Configurations.AnimalGeneticsActivated) //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) public PawnKindDef GetHybrid(Pawn first, Pawn second)
{ {
PawnKindDef res = null; 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 HarmonyLib;
using RimWorld;
using rjw; using rjw;
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Enums;
using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects;
@ -42,7 +43,7 @@ namespace RJW_Menstruation
} }
else if (Genital_Helper.has_ovipositorM(pawn, pawnparts)) 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); else comp.CumIn(pawn, pawn.GetCumVolume(pawnparts), 0);
@ -114,7 +115,7 @@ namespace RJW_Menstruation
comp.CumIn(pawn, pawn.GetCumVolume(), 0); comp.CumIn(pawn, pawn.GetCumVolume(), 0);
return false; 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; return false;
} }
} }

View file

@ -70,6 +70,7 @@
<Compile Include="HediffComps\MenstruationUtility.cs" /> <Compile Include="HediffComps\MenstruationUtility.cs" />
<Compile Include="Hediff_Estrus.cs" /> <Compile Include="Hediff_Estrus.cs" />
<Compile Include="IngestionOutcomeDoers.cs" /> <Compile Include="IngestionOutcomeDoers.cs" />
<Compile Include="Patch\Biotech_Patch.cs" />
<Compile Include="Patch\GC_Patch.cs" /> <Compile Include="Patch\GC_Patch.cs" />
<Compile Include="Recipe_Surgery.cs" /> <Compile Include="Recipe_Surgery.cs" />
<Compile Include="StatParts.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_EstrusFuckability_Label = "Option_EstrusFuckability_Label".Translate();
public static readonly string Option_EstrusAttractability_Label = "Option_EstrusAttractability_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_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(); public static readonly string Button_ResetToDefault = "Button_ResetToDefault".Translate();

View file

@ -230,7 +230,7 @@ namespace RJW_Menstruation
fontstyleright.alignment = TextAnchor.MiddleRight; fontstyleright.alignment = TextAnchor.MiddleRight;
buttonstyle.alignment = TextAnchor.MiddleLeft; 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.Box(preginfo, "1 " + p.Mother.def.label + " " + Translations.Dialog_WombInfo02, buttonstyle);
GUI.Label(preginfo, Translations.Dialog_WombInfo03 + ": " + father + " ", fontstyleright); GUI.Label(preginfo, Translations.Dialog_WombInfo03 + ": " + father + " ", fontstyleright);

View file

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

View file

@ -13,7 +13,7 @@
</v1.3> </v1.3>
<v1.4> <v1.4>
<li>1.4</li> <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> --> <!-- <li IfModActive="rjw.milk.humanoid">1.3/MilkModule</li> -->
</v1.4> </v1.4>
</loadFolders> </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 Version 1.0.8.0
- Support for RimWorld 1.4. All future changes to Menstruation will only be for Rimworld 1.4. - 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. - Existing Biotech pregnancies will appear in a womb, but no support yet for starting a Biotech pregnancy.