From 7f6309466ab4b2ed3bcd45e9d6f8ab6fb728db2f Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Fri, 10 May 2024 21:06:51 -0700 Subject: [PATCH 1/8] Log a message if an egg would implant but children are disabled --- .../RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs | 6 ++++++ 1 file changed, 6 insertions(+) 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 ae03413..846a19b 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 @@ -1390,6 +1390,12 @@ namespace RJW_Menstruation deadeggs.Add(egg); continue; } + else if (ModsConfig.BiotechActive && !Find.Storyteller.difficulty.ChildrenAllowed) + { + if (Configurations.Debug) Log.Message($"Could not implant {Pawn}'s egg due to children being disabled"); + deadeggs.Add(egg); + continue; + } else if (Rand.Chance(Configurations.ImplantationChance * ImplantChance * InterspeciesImplantFactor(egg.fertilizer))) { try From 3cd1220283da76eaa0d0f0a53ad68f35ea3a3d6b Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Fri, 10 May 2024 21:23:46 -0700 Subject: [PATCH 2/8] Use OfType in places where it'd be useful --- .../RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs | 2 +- .../HediffComps/HediffComp_PregeneratedBabies.cs | 4 ++-- 2 files changed, 3 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 846a19b..7e95936 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 @@ -971,7 +971,7 @@ namespace RJW_Menstruation if (Pawn.HasIUD()) antisperm = 0.70f + asafactor; else antisperm = 0.0f + asafactor; - absorber = (Absorber)Pawn.apparel?.WornApparel.Find(x => x is Absorber); + absorber = Pawn.apparel?.WornApparel.OfType().FirstOrDefault(); if (absorber != null) { absorber.WearEffect(TickInterval); diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs index 2f6cea5..a3ca0ec 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs @@ -43,14 +43,14 @@ namespace RJW_Menstruation switch (parent) { case Hediff_Pregnant hediff_Pregnant: - Hediff_Labor labor = (Hediff_Labor)Pawn.health.hediffSet.hediffs.Where(hediff => hediff is Hediff_Labor).MaxByWithFallback(hediff => hediff.loadID); + Hediff_Labor labor = Pawn.health.hediffSet.hediffs.OfType().MaxByWithFallback(hediff => hediff.loadID); HediffComp_PregeneratedBabies laborcomp = labor?.TryGetComp(); if (laborcomp == null) return; laborcomp.babies = this.babies; laborcomp.enzygoticSiblings = this.enzygoticSiblings; break; case Hediff_Labor hediff_Labor: - Hediff_LaborPushing pushing = (Hediff_LaborPushing)Pawn.health.hediffSet.hediffs.Where(hediff => hediff is Hediff_LaborPushing).MaxByWithFallback(hediff => hediff.loadID); + Hediff_LaborPushing pushing = Pawn.health.hediffSet.hediffs.OfType().MaxByWithFallback(hediff => hediff.loadID); HediffComp_PregeneratedBabies pushingcomp = pushing?.TryGetComp(); if (pushingcomp == null) return; pushingcomp.babies = this.babies; From a0d0993560d48251a8945e09d1ab4a96b08565b9 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Sun, 12 May 2024 22:27:09 -0700 Subject: [PATCH 3/8] Switch opcache to a nullable --- .../HediffComps/HediffComp_Menstruation.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 7e95936..cdf9afd 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 @@ -125,7 +125,7 @@ namespace RJW_Menstruation protected bool estrusflag = false; protected float? ovulationChanceCache = null; // Dirtied every simulation protected float? implantationChanceCache = null; - protected int opcache = -1; + protected int? opcache = null; protected float antisperm = 0.0f; // RJW pregnancy, or Biotech pregnancy/labor/laborpushing protected Hediff pregnancy = null; @@ -197,14 +197,14 @@ namespace RJW_Menstruation { get { - if (opcache > 0) return opcache; + if (opcache.HasValue) return opcache.Value; const float yearsBeforeMenopause = 6.0f; opcache = (int)(RaceCyclesPerYear() * AverageLitterSize() * yearsBeforeMenopause * (Pawn.RaceProps.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)); - if (opcache == 0) opcache = 1; - return opcache; + if (opcache <= 0) opcache = 1; + return opcache.Value; } } @@ -655,7 +655,7 @@ namespace RJW_Menstruation estrusLevel = Props.concealedEstrus ? EstrusLevel.Concealed : EstrusLevel.Visible; ovulationFactor = 1f; noBleeding = false; - opcache = -1; + opcache = null; if (Pawn.genes == null || !ModsConfig.BiotechActive) return; foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Where(gene => gene.Active).Select(gene => gene.def.GetModExtension()).Where(ext => ext != null)) From 26864e40251ab8318238046ebd46d2b313661251 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Mon, 13 May 2024 05:56:22 -0700 Subject: [PATCH 4/8] Remove experimental tag from Biotech multiple pregnancy option --- 1.5/Languages/English/Keyed/RJW_Menstruation.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1.5/Languages/English/Keyed/RJW_Menstruation.xml b/1.5/Languages/English/Keyed/RJW_Menstruation.xml index 7aa650e..08b7327 100644 --- a/1.5/Languages/English/Keyed/RJW_Menstruation.xml +++ b/1.5/Languages/English/Keyed/RJW_Menstruation.xml @@ -133,7 +133,7 @@ Use basic RJW pregnancy Use menstruation multiple pregnancy Use Biotech pregnancy - (EXPERIMENTAL) Enable multiple babies/twins in a single Biotech pregnancy. + Enable multiple babies/twins in a single Biotech pregnancy. Enabling this option will allow identical and hetero ovular twins with Biotech. Also allows the hybrid system, but two humanlikes cannot produce an animal. Show womb status when drafted Draw womb icon for drafted pawns From 9a495ad32ba7db84c9ea95584354b22fba63add5 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Mon, 13 May 2024 07:05:45 -0700 Subject: [PATCH 5/8] Remove redundant setting of ForcedEndogenes for enzygotic twins --- .../HediffComps/HediffComp_PregeneratedBabies.cs | 1 - .../RJW_Menstruation/Hediff_MultiplePregnancy.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs index a3ca0ec..505d9be 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs @@ -103,7 +103,6 @@ namespace RJW_Menstruation { firstbaby = baby; request.FixedGender = baby.gender; - request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); } else { diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index f8f4d3e..31e2027 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -343,7 +343,6 @@ namespace RJW_Menstruation firstbaby = baby; request.FixedGender = baby.gender; - request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); } else { From 2516ed1439b15d7f7ba5107ace0dedb49d4f4e0c Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Tue, 14 May 2024 20:51:18 -0700 Subject: [PATCH 6/8] Refactor DamagePants --- .../HediffComps/MenstruationUtility.cs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs index 7a42bae..5628f9d 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -441,21 +441,10 @@ namespace RJW_Menstruation public static float DamagePants(this Pawn pawn, float fluidAmount) { if (pawn.apparel == null) return 0; - Apparel pants = null; - foreach(Apparel apparel in pawn.apparel.WornApparel.Where(app => app.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs))) - { - if (apparel.def.apparel.LastLayer == ApparelLayerDefOf.OnSkin) - { - pants = apparel; - break; - } - else if (pants == null || apparel.def.apparel.LastLayer == ApparelLayerDefOf.Middle) - // Either grab whatever's available or reassign the pants from shell to a middle - pants = apparel; - // Pants are middle and this is a shell - else continue; - } - if (pants == null) return 0; + if (!pawn.apparel.WornApparel. + Where(apparel => apparel.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)). + TryMinBy(apparel => apparel.def.apparel.LastLayer.drawOrder, out Apparel pants)) + return 0; const float HPPerMl = 0.5f; From c9c5e7024642c3b9ca6b49f04795064726db431f Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Tue, 14 May 2024 21:15:49 -0700 Subject: [PATCH 7/8] Refactor HighestEstrus --- .../HediffComps/MenstruationUtility.cs | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs index 5628f9d..a8e873f 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -395,23 +395,10 @@ namespace RJW_Menstruation public static HediffComp_Menstruation.EstrusLevel HighestEstrus(this Pawn pawn) { - HediffComp_Menstruation.EstrusLevel res = HediffComp_Menstruation.EstrusLevel.None; - - foreach(HediffComp_Menstruation comp in pawn.GetMenstruationComps()) - { - switch (comp.GetEstrusLevel()) - { - case HediffComp_Menstruation.EstrusLevel.None: - break; - case HediffComp_Menstruation.EstrusLevel.Concealed: - res = HediffComp_Menstruation.EstrusLevel.Concealed; - break; - case HediffComp_Menstruation.EstrusLevel.Visible: - return HediffComp_Menstruation.EstrusLevel.Visible; - } - } - - return res; + return pawn.GetMenstruationComps(). + Select(comp => comp.GetEstrusLevel()). + DefaultIfEmpty(HediffComp_Menstruation.EstrusLevel.None). + Max(); } public static bool HasIUD(this Pawn pawn) From d1d4398aa4f0489646dc524ee88d4d12aac62fba Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Tue, 14 May 2024 21:44:39 -0700 Subject: [PATCH 8/8] Add mod icon --- About/ModIcon.png | Bin 0 -> 2902 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 About/ModIcon.png diff --git a/About/ModIcon.png b/About/ModIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..f12d8f5448db56409c20007ed7ad4baf7c664ee8 GIT binary patch literal 2902 zcmV-c3#s&pP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TXaNE8Hd7Gw4TcjDgr|M$Fo4oc6JuIjD#t#$7?d!J$N{hfXGf6$-BsqaVg zwB0u<=v-Fl?gerEx)3?<>%Vb$>j{SR@u4F2e#%DfWWoX}|6lM+{&*JS?9L4@?H~J< zp=1iaeLS)RL~Vzb!s$^fD~`rKKb9_*!Y zE#P=gK(NYex0xQa>bD1^Em;Zk+Uh^u#CtBE^He8(=fIYQZ?Ut}&O1oI@=*9RFAwz= zm68`*4K~!Iw{GDTT%dPX)v&rI%jMvAF8<>tx~(U37roR^oG|A7VclJI;Z91`WS-+t ztHpfdSoO78VHsZ@Zcg3GyDyvdOeQE&=MCs|sOZPBS*Fq{*l_6sTyZEoGjY-@fkeM^ z)!^3-?RN4cq2Z6zNUoepZ^C1o4vpDbHa2!V=~u+fSKL^-j>FrtJB?H> zT$5r=-+}ELcHv*Q$n{cjNiot#7l7 zPy~a&p3f3pS$KSQZFC~8hhNS6@g1AbT|@UMOIq1!B6();&#I ze2k4LpW{0#H&G{SX*(!OUq?=5@X2d*-{w_cq~J{%xH)ypIU*Be$0Sh3>4Y9#L@Gq| z5)+jIFE+MX_q~yHAO{!4@IA-nSjkvTR3fk4_qlvKDlzOOjnj0VWw2zmDV5$H4$-44 z(s6w5g&B)`2@B(;EAv+Hu~~a?Vdi#vliZhnywYGcU3O7x-nzbE^#r1OvxgtG&EDD< z$vTJZmJ8GV*-hY>nWlCL9lCHgjSL<;)kbf_@!)9A=ZDQw&d{-g7+K2U;I26w4#Wxy zr1kM;k=-t9H6rTUqenJO*S`AM3h8V@GW*^)oAKSH>nI~t4Yg|-xWZkuE{j1FdaO#4 z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