From b5705ccbd9d8373dce8dab0697f43bb615dd1e89 Mon Sep 17 00:00:00 2001 From: ADHD_Coder Date: Sun, 9 Jun 2024 09:24:07 -0700 Subject: [PATCH 1/5] Add Doublex, identical twin creating drug --- 1.5/Defs/Drugs/Pills_Menstruation.xml | 42 +++++++++++++++++++ 1.5/Defs/HediffDef/Hediffs_Menstruation.xml | 26 ++++++++++++ .../Hediff_MultiplePregnancy.cs | 15 ++++++- .../RJW_Menstruation/VariousDefOf.cs | 1 + 4 files changed, 83 insertions(+), 1 deletion(-) diff --git a/1.5/Defs/Drugs/Pills_Menstruation.xml b/1.5/Defs/Drugs/Pills_Menstruation.xml index 9f65c17..e8077c0 100644 --- a/1.5/Defs/Drugs/Pills_Menstruation.xml +++ b/1.5/Defs/Drugs/Pills_Menstruation.xml @@ -91,6 +91,48 @@ + + Doublex + + Glittertech drug that causes fertilized eggs to produce enzygotic twins. + + Things/Item/SIA + Graphic_StackCount + + false + + 800 + 250 + 0.01 + + Ultra + + Medical + +
  • + Hediff_Doublex + 1.0 +
  • +
    +
    + + DrugProduction + +
  • DrugLab
  • +
    +
    + + 3 + 2 + + +
  • + 0 + 1000 +
  • +
    +
    + PainReliever diff --git a/1.5/Defs/HediffDef/Hediffs_Menstruation.xml b/1.5/Defs/HediffDef/Hediffs_Menstruation.xml index 7fe11f7..7da31c8 100644 --- a/1.5/Defs/HediffDef/Hediffs_Menstruation.xml +++ b/1.5/Defs/HediffDef/Hediffs_Menstruation.xml @@ -164,6 +164,32 @@ + + + HediffWithComps + Hediff_Doublex + + doublex + Ultratech drug that causes fertilized eggs to split resulting in identical twins. + (0.75,0.75,1.0) + false + false + false + false + 5 + 1.0 + +
  • + true +
  • +
    + +
  • + -0.5 +
  • +
    +
    + HediffWithComps 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 e8d6939..a65f73a 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -320,7 +320,20 @@ namespace RJW_Menstruation Pawn firstbaby = null; int traitSeed = Rand.Int; List parentTraits = GetInheritableTraits(mother, father); - while (Rand.Chance(Configurations.EnzygoticTwinsChance) && division < Configurations.MaxEnzygoticTwins) division++; + + //TODO: turn this into a proper function that can handle genes, fertility boosts, genital type effects etc. + float eTwinChance = Configurations.EnzygoticTwinsChance; + //Log.Message($"RJW_Menstration :: Configurations.EnzygoticTwinsChance = {Configurations.EnzygoticTwinsChance}"); + if (mother.health.hediffSet.HasHediff(VariousDefOf.Hediff_Doublex)) + { + division++; + eTwinChance = eTwinChance + (1 - eTwinChance) / 4; + } + + //Log.Message($"RJW_Menstration :: TwinChance = {eTwinChance}"); + while (Rand.Chance(eTwinChance) && division < Configurations.MaxEnzygoticTwins) division++; + //Log.Message($"RJW_Menstration :: division = {division}"); + for (int i = 0; i < division; i++) { Pawn baby = GenerateBaby(request, mother, father, parentTraits, traitSeed); diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs index 997db3c..7884cde 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs @@ -22,6 +22,7 @@ namespace RJW_Menstruation public static readonly HediffDef Hediff_Estrus_Concealed = DefDatabase.GetNamed("Hediff_Estrus_Concealed"); public static readonly HediffDef Hediff_AffectedByPheromones = DefDatabase.GetNamed("Hediff_AffectedByPheromones"); public static readonly HediffDef Hediff_ASA = DefDatabase.GetNamed("Hediff_ASA"); + public static readonly HediffDef Hediff_Doublex = DefDatabase.GetNamed("Hediff_Doublex"); public static readonly StatDef MaxAbsorbable = DefDatabase.GetNamed("MaxAbsorbable"); public static readonly NeedDef SexNeed = DefDatabase.GetNamed("Sex"); public static readonly JobDef VaginaWashing = DefDatabase.GetNamed("VaginaWashing"); From f70c2ad5850a1c6cb5b6eb7c51e74274e4b1ccec Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Wed, 31 Jul 2024 07:22:20 -0700 Subject: [PATCH 2/5] Put a warning in the log when loading a pregnancy with mother == father --- .../RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs | 6 +++++- 1 file changed, 5 insertions(+), 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 38fbb81..895685e 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 @@ -639,8 +639,12 @@ namespace RJW_Menstruation if (Scribe.mode == LoadSaveMode.PostLoadInit) { Initialize(); - if (pregnancy is HediffWithParents vanillaPreg && vanillaPreg.Mother == vanillaPreg.Father) // Fix mother == father issue + // Biotech labor errors if the mother is also the father, so don't let that happen + if (pregnancy is HediffWithParents vanillaPreg && vanillaPreg.Mother == vanillaPreg.Father && vanillaPreg.Mother != null) + { + Log.Warning($"Pregnancy of {Pawn} has same mother and father, setting father to null"); vanillaPreg.SetParents(vanillaPreg.Mother, null, vanillaPreg.geneSet); + } } } From 80611882c9d0243d56963c3d5d057534105576c6 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Wed, 31 Jul 2024 15:16:06 -0700 Subject: [PATCH 3/5] Don't show stage or time to next stage for pawns that don't cycle --- .../HediffComps/HediffComp_Menstruation.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 895685e..4c6681c 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 @@ -794,7 +794,7 @@ namespace RJW_Menstruation { get { - if (Pawn.Dead) return null; + if (Pawn.Dead || !Pawn.ShouldCycle()) return null; StringBuilder tip = new StringBuilder(); tip.Append(Translations.Dialog_WombInfo01); tip.Append(": "); @@ -816,7 +816,11 @@ namespace RJW_Menstruation public override string CompDebugString() { - if (Pawn.Dead || curStage == Stage.None || curStage == Stage.Infertile || curStage == Stage.Pregnant) return null; + if (Pawn.Dead || + !Pawn.ShouldCycle() || + curStage == Stage.None || + curStage == Stage.Infertile || + curStage == Stage.Pregnant) return null; StringBuilder debugString = new StringBuilder(); debugString.Append($"Time to next state: "); debugString.Append(GenDate.ToStringTicksToPeriod(TicksToNextStage())); From 3d9b22776e703d67a106e619ee61cf89f7ba184e Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Wed, 31 Jul 2024 15:18:21 -0700 Subject: [PATCH 4/5] Remove vaginal washing order for pawns that don't cycle --- .../RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs index 26a66eb..ef1c8b3 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs @@ -33,8 +33,12 @@ namespace RJW_Menstruation foreach (LocalTargetInfo t in selftargets) { - if (t.Pawn == pawn && pawn.HasMenstruationComp()) opts.AddDistinct(MakeSelfMenu(pawn, t)); - break; + if (t.Pawn == pawn) + { + if (pawn.HasMenstruationComp() && pawn.ShouldCycle()) + opts.AddDistinct(MakeSelfMenu(pawn, t)); + break; + } } } From 36c88d27526b6bd63ac053264379068a8039896f Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Sat, 3 Aug 2024 08:59:06 -0700 Subject: [PATCH 5/5] Null check for pawn job in GetOvaryIcon --- .../RJW_Menstruation/HediffComps/MenstruationUtility.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 db4bd06..d608249 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -242,7 +242,7 @@ namespace RJW_Menstruation bool isInduced = comp is HediffComp_InducedOvulator; if (comp.curStage == HediffComp_Menstruation.Stage.Follicular && isInduced && - comp.Pawn.jobs.curDriver is JobDriver_Sex job && + comp.Pawn.jobs?.curDriver is JobDriver_Sex job && job.Sexprops != null && !UsingCondom(comp.Pawn, job.Partner) && (job.Sexprops.sexType == xxx.rjwSextype.Vaginal || job.Sexprops.sexType == xxx.rjwSextype.DoublePenetration))