mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Don't allow ovum extraction for menopausal pawns
This commit is contained in:
parent
4f2830084c
commit
0154f89438
3 changed files with 28 additions and 1 deletions
|
@ -132,6 +132,7 @@
|
|||
<CustomHybrid_List_Title>Custom Hybrid Editor</CustomHybrid_List_Title>
|
||||
<CustomHybrid_Title>Hybrids of {0}</CustomHybrid_Title>
|
||||
<CustomHybrid_Tooltip>When {0} breed with {1}, {2} will be born at {3} chance. If both races have hybrid definitions for each other, the father's definition will be used.</CustomHybrid_Tooltip>
|
||||
|
||||
|
||||
<CannotNoEggs>No eggs</CannotNoEggs>
|
||||
|
||||
</LanguageData>
|
|
@ -2,6 +2,7 @@
|
|||
using System.Linq;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RJW_Menstruation
|
||||
{
|
||||
|
@ -61,4 +62,27 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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); }
|
||||
|
|
Loading…
Reference in a new issue