From 2facc09926419a8d8c732bc9981b308846d5c034 Mon Sep 17 00:00:00 2001
From: lutepickle <28810-lutepickle@users.noreply.gitgud.io>
Date: Sat, 16 Mar 2024 21:59:58 -0700
Subject: [PATCH 1/4] Have the fertile end age for ovary power based off of a
constant instead of RJW setttings
---
.../RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 437478c..fdca1a9 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
@@ -1222,7 +1222,7 @@ namespace RJW_Menstruation
float avglittersize = AverageLitterSize();
float fertStartAge = Pawn.RaceProps.lifeStageAges?.Find(stage => stage.def.reproductive)?.minAge ?? 0.0f;
- float fertEndAge = Pawn.RaceProps.lifeExpectancy * (Pawn.IsAnimal() ? RJWPregnancySettings.fertility_endage_female_animal : RJWPregnancySettings.fertility_endage_female_humanlike);
+ float fertEndAge = Pawn.RaceProps.lifeExpectancy * (Pawn.IsAnimal() ? 0.96f : 0.58f); // RJW default fertility_endage for animal and humanlike
if (fertEndAge < fertStartAge) fertEndAge = fertStartAge;
float raceCyclesPerYear = RaceCyclesPerYear();
From 5fbed7073aba5a2e3387b5a9d21a7411ca790fc0 Mon Sep 17 00:00:00 2001
From: lutepickle <28810-lutepickle@users.noreply.gitgud.io>
Date: Sat, 16 Mar 2024 22:35:13 -0700
Subject: [PATCH 2/4] Do the infertile check after the simulation instead of
before
---
.../HediffComps/HediffComp_Menstruation.cs | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
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 fdca1a9..b66aef7 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
@@ -716,7 +716,6 @@ namespace RJW_Menstruation
BeforeSimulator();
- if (ShouldBeInfertile()) GoNextStage(Stage.Infertile);
switch (curStage)
{
case Stage.Follicular:
@@ -749,6 +748,7 @@ namespace RJW_Menstruation
GoNextStage(Stage.Follicular);
break;
}
+
AfterSimulator();
}
catch (Exception ex)
@@ -1263,6 +1263,11 @@ namespace RJW_Menstruation
protected virtual void AfterSimulator()
{
+ if (ShouldBeInfertile())
+ {
+ eggs.Clear();
+ GoNextStage(Stage.Infertile);
+ }
if (EggHealth < 1f)
{
if (sexNeed == null) sexNeed = Pawn.needs.TryGetNeed(VariousDefOf.SexNeed);
@@ -1727,11 +1732,7 @@ namespace RJW_Menstruation
{
if (curStageTicks >= currentIntervalTicks)
{
- if (ShouldBeInfertile())
- {
- GoNextStage(Stage.Infertile);
- }
- else if (!IsBreedingSeason())
+ if (!IsBreedingSeason())
{
GoNextStage(Stage.Anestrus);
}
From 9d66be1e49361c7d9cf64cb30df99434e8632c29 Mon Sep 17 00:00:00 2001
From: lutepickle <28810-lutepickle@users.noreply.gitgud.io>
Date: Sun, 17 Mar 2024 08:28:25 -0700
Subject: [PATCH 3/4] Little refactor in PeriodRandomizer
---
.../HediffComps/HediffComp_Menstruation.cs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
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 b66aef7..fbb0115 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
@@ -1854,18 +1854,20 @@ namespace RJW_Menstruation
protected int PeriodRandomizer(Stage stage)
{
+ float CycleSkew(float factor) => 1 + (cycleSpeed - 1) * factor;
+
float variabilityFactor = (EggHealth < 1.0f) ? 6.0f : 1.0f;
// Most cycle lengthening or shortening occurs in the follicular phase, so weight towards that
switch (stage)
{
case Stage.Follicular:
- return (int)(Utility.VariationRange(Props.follicularIntervalDays * GenDate.TicksPerDay, cycleVariability * 1.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 1.5f));
+ return (int)(Utility.VariationRange(Props.follicularIntervalDays * GenDate.TicksPerDay, cycleVariability * 1.5f * variabilityFactor) / CycleSkew(1.5f));
case Stage.Ovulatory:
return Props.ovulationIntervalHours * GenDate.TicksPerHour; // No variability for now
case Stage.Luteal:
- return (int)(Utility.VariationRange(Props.lutealIntervalDays * GenDate.TicksPerDay, cycleVariability * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f));
+ return (int)(Utility.VariationRange(Props.lutealIntervalDays * GenDate.TicksPerDay, cycleVariability * 0.5f * variabilityFactor) / CycleSkew(0.5f));
case Stage.Bleeding:
- return (int)(Utility.VariationRange(Props.bleedingIntervalDays * GenDate.TicksPerDay, cycleVariability * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f));
+ return (int)(Utility.VariationRange(Props.bleedingIntervalDays * GenDate.TicksPerDay, cycleVariability * 0.5f * variabilityFactor) / CycleSkew(0.5f));
case Stage.Recover:
return (int)Utility.VariationRange(Props.recoveryIntervalDays * GenDate.TicksPerDay, 0.05f);
case Stage.Pregnant:
From e3647caf2ad3e206f07d29914719cf78f3b9f3f0 Mon Sep 17 00:00:00 2001
From: lutepickle <28810-lutepickle@users.noreply.gitgud.io>
Date: Sun, 17 Mar 2024 16:32:41 -0700
Subject: [PATCH 4/4] Build dll, change Rimworld reference in 1.4 to NuGet
---
1.4/Assemblies/RJW_Menstruation.dll | Bin 217088 -> 217088 bytes
.../HediffComp_PregeneratedBabies.cs | 2 +-
.../RJW_Menstruation/RJW_Menstruation.csproj | 7 +++----
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll
index 26ec0a6fe1462d8f9a237ef14632228c9ea65e28..8897ef02016e9ea63468462c5c11dc6c27f83fa0 100644
GIT binary patch
delta 79
zcmV-V0I>gnpbdba4UmWg1{0aVfsBQW0kw<*#PSembfS_%^^QcXe0&l#m455DVDkdl
lQv}_|-qx2qM*}nvB8i6SeB1R(t6}S&go_0lw}3|jfC#9kB!mC}
delta 79
zcmV-V0I>gnpbdba4UmWg1G5R(fsBQW0kw<*#PSe!<|re`)lyHs6Ejp!f`J>iVDkdl
lQv{BTcc7O%M*}nv?D=PjSq)-KtMcxgEtmXgw}3|jfCyXABJ2PF
diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs
index 0a919c4..4ce241f 100644
--- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs
+++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs
@@ -202,7 +202,7 @@ namespace RJW_Menstruation
if (comp?.HasBaby ?? false)
{
OutcomeChance thisOutcome = outcome;
- Precept_Ritual precept_Ritual = (Precept_Ritual)comp.Pawn.Ideo.GetPrecept(PreceptDefOf.ChildBirth);
+ Precept_Ritual precept_Ritual = (Precept_Ritual)comp.Pawn.Ideo.GetPrecept(RimWorld.PreceptDefOf.ChildBirth);
float birthQuality = PregnancyUtility.GetBirthQualityFor(mother);
do
{
diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj b/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj
index 33cf9ec..2577bb6 100644
--- a/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj
+++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj
@@ -109,10 +109,6 @@
..\..\..\..\..\..\..\..\workshop\content\294100\2830943477\1.4\Assemblies\AnimalGenetics.dll
False
-
- ..\..\..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll
- False
-
..\..\..\..\..\rjw\1.4\Assemblies\RJW.dll
False
@@ -173,6 +169,9 @@
+
+ 1.4.3901
+
2.2.2
runtime