Have the womb status button patched into the health tab instead of the hediff row. Modified version of code contributed by Fern.

This commit is contained in:
lutepickle 2023-12-01 19:39:20 -08:00
parent c12f9dbc87
commit 0e708c6c89
4 changed files with 9 additions and 41 deletions

Binary file not shown.

View file

@ -54,61 +54,28 @@ namespace RJW_Menstruation
}
}
//[HarmonyPatch(typeof(HealthCardUtility), "DrawHediffListing")]
//public class DrawHediffListing_Patch
//{
// public const float buttonWidth = 80f;
// public const float buttonHeight = 20f;
//
// public static void Postfix(Rect rect, Pawn pawn, bool showBloodLoss)
// {
// if (Configurations.EnableButtonInHT && pawn.HasMenstruationComp())
// {
// Rect buttonrect = new Rect(rect.xMax - buttonWidth, rect.yMax - buttonHeight, buttonWidth, buttonHeight);
// if (Widgets.ButtonText(buttonrect, "Status"))
// {
// Dialog_WombStatus.ToggleWindow(pawn,pawn.GetMenstruationComp());
// }
// }
//
//
// }
//}
[HarmonyPatch(typeof(HealthCardUtility), "DrawHediffRow")]
public class DrawHediffRow_Patch
[HarmonyPatch(typeof(HealthCardUtility), "DrawOverviewTab")]
public class DrawOverviewTab_Patch
{
public const float buttonWidth = 50f;
public const float buttonHeight = 20f;
private static HediffComp_Menstruation GetFirstMenstruation(IEnumerable<Hediff> diffs)
public static void Prefix(Rect leftRect, Pawn pawn, float curY)
{
foreach (Hediff diff in diffs)
if (Configurations.EnableButtonInHT && pawn.ShowStatus() && pawn.ShouldCycle())
{
if (diff.Part != Genital_Helper.get_genitalsBPR(diff.pawn)) continue;
HediffComp_Menstruation comp = diff.GetMenstruationCompFromVagina();
if (comp != null) return comp;
}
return null;
}
public static void Prefix(Rect rect, Pawn pawn, IEnumerable<Hediff> diffs, ref float curY)
{
if (Configurations.EnableButtonInHT && pawn.ShowStatus())
{
HediffComp_Menstruation comp = GetFirstMenstruation(diffs);
HediffComp_Menstruation comp = pawn.GetFirstMenstruationComp();
if (comp != null)
{
Rect buttonrect = new Rect((rect.xMax) / 2 - 5f, curY + 2f, buttonWidth, buttonHeight);
if (Widgets.ButtonText(buttonrect, Translations.Button_HealthTab))
Text.Font = GameFont.Tiny;
Rect buttonRect = new Rect(leftRect.xMax - buttonWidth - 8f, curY + 4f, buttonWidth, buttonHeight);
if (Widgets.ButtonText(buttonRect, Translations.Button_HealthTab))
{
Dialog_WombStatus.ToggleWindow(pawn, comp);
}
}
}
}
}
[HarmonyPatch(typeof(CompBiosculpterPod), nameof(CompBiosculpterPod.CannotUseNowPawnCycleReason), new Type[] { typeof(Pawn), typeof(Pawn), typeof(CompBiosculpterPod_Cycle), typeof(bool) })]

View file

@ -6,6 +6,7 @@ Version 1.0.9.2
- Fix implanting multiple eggs in an animal when configured to use Biotech pregnancies.
- Egglaying races no longer have a menstrual cycle, regardless of vagina type.
- Pawns with the egglaying genes from Alpha Genes or VE Saurids no longer have a menstrual cycle.
- The womb status button will now appear in a pawn's health tab when using Compact Hediffs, with thanks to Fern.
- Tampons and pads are now allowed by default in the worker, soldier, and slave starting outfits.
Version 1.0.9.1