Compare commits

..

6 commits

Author SHA1 Message Date
lutepickle
e4583fe9d7 Add placeholder graphic for genes 2023-03-02 18:55:29 -08:00
lutepickle
5abdf52dbe Use GoNextStage more to properly reset curStageHrs 2023-03-02 14:42:49 -08:00
lutepickle
69934d06f5 Add patch to darken nipples during Biotech lactation, but commented out 2023-03-01 17:00:58 -08:00
lutepickle
09f9438bcc Reset the baby name deadline at birth 2023-03-01 16:29:58 -08:00
lutepickle
91142d640f Copy hair color for identical twins 2023-03-01 10:21:59 -08:00
lutepickle
b28beb8eaa Add some debug logging around the pregnancy to labor transition 2023-03-01 09:55:54 -08:00
9 changed files with 47 additions and 5 deletions

Binary file not shown.

View file

@ -18,6 +18,7 @@
<defName>Menstruation_ShortEggLifetime</defName>
<label>short egg lifetime</label>
<description>Unfertilized eggs with this gene last three-quarters as long.</description>
<iconPath>UI/Genes/Placeholder</iconPath>
<biostatMet>1</biostatMet>
<displayOrderInCategory>10</displayOrderInCategory>
</GeneDef>
@ -26,6 +27,7 @@
<defName>Menstruation_DoubleEggLifetime</defName>
<label>double egg lifetime</label>
<description>Unfertilized eggs with this gene last twice as long.</description>
<iconPath>UI/Genes/Placeholder</iconPath>
<biostatMet>-1</biostatMet>
<displayOrderInCategory>12</displayOrderInCategory>
</GeneDef>
@ -34,6 +36,7 @@
<defName>Menstruation_QuadEggLifetime</defName>
<label>quadrule egg lifetime</label>
<description>Eggs with this gene last four times as long.</description>
<iconPath>UI/Genes/Placeholder</iconPath>
<biostatMet>-2</biostatMet>
<biostatCpx>1</biostatCpx>
<displayOrderInCategory>16</displayOrderInCategory>
@ -50,6 +53,7 @@
<defName>Menstruation_NeverEstrus</defName>
<label>never estrus</label>
<description>Carriers of this gene will never go into estrus.</description>
<iconPath>UI/Genes/Placeholder</iconPath>
<biostatMet>1</biostatMet>
<displayOrderInCategory>20</displayOrderInCategory>
</GeneDef>
@ -58,6 +62,7 @@
<defName>Menstruation_FullEstrus</defName>
<label>full estrus</label>
<description>Carriers of this gene will enter full estrus every menstrual cycle, regardless of vagina type.</description>
<iconPath>UI/Genes/Placeholder</iconPath>
<biostatMet>-1</biostatMet>
<biostatCpx>1</biostatCpx>
<displayOrderInCategory>25</displayOrderInCategory>
@ -74,6 +79,7 @@
<defName>Menstruation_DoubleOvulation</defName>
<label>double ovulation</label>
<description>Carriers of this gene will ovulate twice as many eggs.</description>
<iconPath>UI/Genes/Placeholder</iconPath>
<biostatMet>-1</biostatMet>
<displayOrderInCategory>30</displayOrderInCategory>
</GeneDef>
@ -82,6 +88,7 @@
<defName>Menstruation_QuadOvulation</defName>
<label>quadruple ovulation</label>
<description>Carriers of this gene will ovulate four times as many eggs.</description>
<iconPath>UI/Genes/Placeholder</iconPath>
<biostatMet>-1</biostatMet>
<displayOrderInCategory>35</displayOrderInCategory>
</GeneDef>
@ -91,6 +98,7 @@
<label>no bleeding</label>
<displayCategory>Menstruation</displayCategory>
<description>Carriers of this gene will not bleed at the end of their cycle.</description>
<iconPath>UI/Genes/Placeholder</iconPath>
<biostatMet>1</biostatMet>
<displayOrderInCategory>40</displayOrderInCategory>
</GeneDef>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

@ -673,12 +673,12 @@ namespace RJW_Menstruation
if (Pregnancy != null && curStage != Stage.Pregnant)
{
Log.Warning($"{Pawn}'s womb has a pregnancy, but was not in the pregnant stage");
curStage = Stage.Pregnant;
GoNextStage(Stage.Pregnant);
}
BeforeSimulator();
if (pregnancy == null && (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0 || EggHealth <= 0 || Pawn.SterileGenes())) curStage = Stage.Infertile;
if (pregnancy == null && (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0 || EggHealth <= 0 || Pawn.SterileGenes())) GoNextStage(Stage.Infertile);
switch (curStage)
{
case Stage.Follicular:
@ -1799,7 +1799,7 @@ namespace RJW_Menstruation
return (int)(Props.recoveryIntervalDays * 24 * Rand.Range(0.95f, 1.05f));
case Stage.Pregnant:
return (int)MenstruationUtility.GestationHours(pregnancy);
default: // Often unused
default:
return 1;
}
}

View file

@ -33,7 +33,7 @@ namespace RJW_Menstruation
// Make the cutoff halfway into cycle, just to be sure there isn't a double-cycle the first time
if ((curStage == Stage.Follicular || curStage == Stage.Luteal || curStage == Stage.Bleeding)
&& (averageCycleIntervalHours - hoursToNextCycle) / 2 >= 24 * (Props.follicularIntervalDays + Props.lutealIntervalDays) / cycleSpeed)
curStage = Stage.Anestrus;
GoNextStage(Stage.Anestrus);
}
}

View file

@ -111,6 +111,7 @@ namespace RJW_Menstruation
{
baby.story.headType = firstbaby.story.headType;
baby.story.hairDef = firstbaby.story.hairDef;
baby.story.HairColor = firstbaby.story.HairColor;
baby.story.bodyType = firstbaby.story.bodyType;
baby.story.furDef = firstbaby.story.furDef;
baby.story.skinColorOverride = firstbaby.story.skinColorOverride;
@ -165,6 +166,7 @@ namespace RJW_Menstruation
if (baby == null) return PawnGenerator.GeneratePawn(request); // Shouldn't happen
baby.ageTracker.AgeBiologicalTicks = 0;
baby.ageTracker.AgeChronologicalTicks = 0;
baby.babyNamingDeadline = Find.TickManager.TicksGame + GenDate.TicksPerDay;
if (request.ForceDead) baby.Kill(null, null);
return baby;
}

View file

@ -127,6 +127,7 @@ namespace RJW_Menstruation
string label = bestOutcome.label;
string description = bestOutcome.description.Formatted(mother.Named("MOTHER"));
baby.babyNamingDeadline = Find.TickManager.TicksGame + GenDate.TicksPerDay;
ChoiceLetter_BabyBirth choiceLetter_BabyBirth = (ChoiceLetter_BabyBirth)LetterMaker.MakeLetter(
label, description, LetterDefOf.BabyBirth, baby
);
@ -351,6 +352,7 @@ namespace RJW_Menstruation
{
baby.story.headType = firstbaby.story.headType;
baby.story.hairDef = firstbaby.story.hairDef;
baby.story.HairColor = firstbaby.story.HairColor;
baby.story.bodyType = firstbaby.story.bodyType;
baby.story.furDef = firstbaby.story.furDef;
baby.story.skinColorOverride = firstbaby.story.skinColorOverride;

View file

@ -26,8 +26,10 @@ namespace RJW_Menstruation
public static void Postfix(Hediff_Pregnant __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (Configurations.Debug) Log.Message($"{comp.Pawn}'s labor starting, menstruation comp is {comp}");
if (comp == null) return;
comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLabor);
if (Configurations.Debug) Log.Message($"New pregnancy Hediff is {comp.Pregnancy}");
}
}
@ -37,8 +39,10 @@ namespace RJW_Menstruation
public static void PostFix(Hediff_Labor __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (Configurations.Debug) Log.Message($"{comp.Pawn}'s initial labor ending, menstruation comp is {comp}");
if (comp == null) return;
comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLaborPushing);
if (Configurations.Debug) Log.Message($"New pregnancy Hediff is {comp.Pregnancy}");
}
}
@ -48,6 +52,7 @@ namespace RJW_Menstruation
public static void PostFix(Hediff_LaborPushing __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (Configurations.Debug) Log.Message($"{comp.Pawn}'s labor pushing ending, menstruation comp is {comp}");
if (comp == null) return;
comp.Pregnancy = null;
}
@ -215,4 +220,28 @@ namespace RJW_Menstruation
comp.Notify_UpdatedGenes();
}
}
//[HarmonyPatch(typeof(ChildcareUtility), nameof(ChildcareUtility.SuckleFromLactatingPawn))]
//public class GreedyConsume_Patch
//{
// private static float ConsumeAndAdjustNipples(HediffComp_Chargeable instance, float desiredCharge)
// {
// // Pulling breast comp every tick might be too much for performance.
// const float averageNippleChangePerTick = 0.0025f / 50000f;
// instance.Pawn.GetBreastComp()?.AdjustNippleProgress(Rand.Range(0.0f, averageNippleChangePerTick * 2) * Configurations.MaxBreastIncrementFactor);
// return instance.GreedyConsume(desiredCharge);
// }
// private static readonly MethodInfo GreedyConsume = AccessTools.Method(typeof(HediffComp_Chargeable), nameof(HediffComp_Chargeable.GreedyConsume), new Type[] { typeof(HediffComp_Chargeable), typeof(float) });
// public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
// {
// if(GreedyConsume == null) throw new InvalidOperationException("GreedyConsume not found");
// foreach (var instruction in instructions)
// {
// if (instruction.Calls(GreedyConsume))
// yield return CodeInstruction.Call(typeof(GreedyConsume_Patch), nameof(GreedyConsume_Patch.ConsumeAndAdjustNipples));
// yield return instruction;
// }
// }
//}
}

View file

@ -1,7 +1,8 @@
Version 1.0.8.6
- Updated Traditional Chinese translation by Hydrogen.
- Fix error when trying to terminate a non-Biotech pregnancy.
- Added several menstruation-related genes.
- Properly give the opportunity to name a newborn with Biotech and multiple pregnancy.
- Added several menstruation-related genes, with a placeholder graphic for now.
- Added experimental support for twins and hybrids with Biotech pregnancies, disabled by default.
Version 1.0.8.5