Compare commits

...

4 commits

Author SHA1 Message Date
lutepickle
8b7902bc8a Pick up pregnancies on embryo implantation 2022-11-10 22:31:14 -08:00
lutepickle
a8793765c5 Deduct an egg from a pawn's ovaries upon extraction 2022-11-10 21:46:42 -08:00
lutepickle
0154f89438 Don't allow ovum extraction for menopausal pawns 2022-11-10 21:25:07 -08:00
lutepickle
4f2830084c Have pawns with sterile genes start infertile 2022-11-10 08:19:56 -08:00
7 changed files with 54 additions and 2 deletions

Binary file not shown.

View file

@ -133,5 +133,6 @@
<CustomHybrid_Title>Hybrids of {0}</CustomHybrid_Title>
<CustomHybrid_Tooltip>When {0} breed with {1}, {2} will be born at {3} chance.&#10;If both races have hybrid definitions for each other, the father's definition will be used.</CustomHybrid_Tooltip>
<CannotNoEggs>No eggs</CannotNoEggs>
</LanguageData>

View file

@ -1030,7 +1030,7 @@ namespace RJW_Menstruation
if (cycleVariability < 0f) cycleVariability = MenstruationUtility.RandomVariabilityPercent();
if (currentIntervalHours < 0)
{
if (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Infertile;
if (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0 || Pawn.SterileGenes()) curStage = Stage.Infertile;
else if (!IsBreedingSeason()) curStage = Stage.Anestrus;
else curStage = RandomStage();
if (curStage == Stage.Follicular)

View file

@ -2,6 +2,7 @@
using System.Linq;
using RimWorld;
using Verse;
using System.Collections.Generic;
namespace RJW_Menstruation
{
@ -61,4 +62,50 @@ namespace RJW_Menstruation
__result = 0.999f;
}
}
[HarmonyPatch(typeof(Recipe_ExtractOvum), nameof(Recipe_ExtractOvum.AvailableReport))]
public class ExtractOvum_AvailableReport_Patch
{
public static void PostFix(Thing thing, ref AcceptanceReport __result)
{
if (!__result.Accepted) return;
Pawn pawn = (Pawn)thing;
if (pawn.IsRJWPregnant())
{
__result = "CannotPregnant".Translate();
return;
}
List<HediffComp_Menstruation> comps = pawn.GetMenstruationComps().ToList();
if (!comps.Any()) return;
if (comps.All(comp => comp.ovarypower <= 0))
{
__result = Translations.CannotNoEggs;
return;
}
return;
}
}
[HarmonyPatch(typeof(Recipe_ExtractOvum), "OnSurgerySuccess")]
public class ExtractOvum_OnSurgerySuccess_Patch
{
public static void PostFix(Pawn pawn)
{
List<HediffComp_Menstruation> comps = pawn.GetMenstruationComps().ToList();
if (!comps.Any()) return;
HediffComp_Menstruation mostEggs = comps.MaxBy(comp => comp.ovarypower);
if (mostEggs.ovarypower <= 0) return; // Shouldn't happen
mostEggs.ovarypower--;
}
}
[HarmonyPatch(typeof(Recipe_ImplantEmbryo), nameof(Recipe_ImplantEmbryo.ApplyOnPawn))]
public class ImplantEmbryo_ApplyOnPawn_Patch
{
public static void PostFix(Pawn pawn)
{
foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
comp.TakeLoosePregnancy();
}
}
}

View file

@ -135,6 +135,8 @@ namespace RJW_Menstruation
public static readonly string Gizmo_GatherCum = "Gizmo_GatherCum".Translate();
public static readonly string FloatMenu_CleanSelf = "FloatMenu_CleanSelf".Translate();
public static readonly string CannotNoEggs = "CannotNoEggs".Translate();
public static readonly string CustomHybrid_List_Title = "CustomHybrid_List_Title".Translate();
static public string CustomHybrid_Title(string label) { return TranslatorFormattedStringExtensions.Translate("CustomHybrid_Title", label); }
static public string CustomHybrid_Tooltip(string label, string breedee, string baby, string chance) { return TranslatorFormattedStringExtensions.Translate("CustomHybrid_Tooltip", label, breedee, baby, chance); }

View file

@ -1,5 +1,7 @@
Version 1.0.8.2
- Updated race support patches for new and removed vaginas.
- The Biotech extract ovum operation will now remove an egg from a pawn's ovaries.
- A pawn's womb should now recognize an implanted embryo.
Version 1.0.8.1
- Added the option for humans to start Biotech pregnancies if the DLC is enabled. If set, non-humans will use the old multiple pregnancy instead.