diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index 5f73187..0215954 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/Defs/GeneDefs/GeneDefs_Menstruation.xml b/1.4/Defs/GeneDefs/GeneDefs_Menstruation.xml index bc136a5..d430d3f 100644 --- a/1.4/Defs/GeneDefs/GeneDefs_Menstruation.xml +++ b/1.4/Defs/GeneDefs/GeneDefs_Menstruation.xml @@ -18,6 +18,7 @@ Menstruation_ShortEggLifetime Unfertilized eggs with this gene last three-quarters as long. + UI/Genes/Placeholder 1 10 @@ -26,6 +27,7 @@ Menstruation_DoubleEggLifetime Unfertilized eggs with this gene last twice as long. + UI/Genes/Placeholder -1 12 @@ -34,6 +36,7 @@ Menstruation_QuadEggLifetime Eggs with this gene last four times as long. + UI/Genes/Placeholder -2 1 16 @@ -50,6 +53,7 @@ Menstruation_NeverEstrus Carriers of this gene will never go into estrus. + UI/Genes/Placeholder 1 20 @@ -58,6 +62,7 @@ Menstruation_FullEstrus Carriers of this gene will enter full estrus every menstrual cycle, regardless of vagina type. + UI/Genes/Placeholder -1 1 25 @@ -74,6 +79,7 @@ Menstruation_DoubleOvulation Carriers of this gene will ovulate twice as many eggs. + UI/Genes/Placeholder -1 30 @@ -82,6 +88,7 @@ Menstruation_QuadOvulation Carriers of this gene will ovulate four times as many eggs. + UI/Genes/Placeholder -1 35 @@ -91,6 +98,7 @@ Menstruation Carriers of this gene will not bleed at the end of their cycle. + UI/Genes/Placeholder 1 40 diff --git a/1.4/Textures/UI/Genes/Placeholder.png b/1.4/Textures/UI/Genes/Placeholder.png new file mode 100644 index 0000000..deaa2c0 Binary files /dev/null and b/1.4/Textures/UI/Genes/Placeholder.png differ diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index cf59be0..070c6ef 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -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; } } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs index 2daf3a5..b3fa2ac 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs @@ -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); } } 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 f830211..51b497a 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 @@ -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; } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index 2a6d7b8..cab288a 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -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; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs index 8e3f4e9..2ffe8b3 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs @@ -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 Transpiler(IEnumerable 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; + // } + // } + //} } \ No newline at end of file diff --git a/changelogs.txt b/changelogs.txt index fc1e583..78e5725 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -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