Don't let pawns without a cycle wear absorbers

This commit is contained in:
lutepickle 2024-01-01 07:28:30 -08:00
parent a9879b0b1b
commit f410f6bc0f
3 changed files with 26 additions and 1 deletions

Binary file not shown.

View file

@ -85,4 +85,28 @@ namespace RJW_Menstruation
__result = Translations.CannotNoWomb;
}
}
// Doesn't cover everything, but at least it'll get the auto equip
[HarmonyPatch(typeof(Apparel), nameof(Apparel.PawnCanWear))]
public class PawnCanWear_Patch
{
public static void Postfix(ref bool __result, Apparel __instance, Pawn pawn)
{
if (__result && __instance is Absorber)
{
__result = pawn.ShouldCycle() && pawn.GetMenstruationComps().Any();
}
}
}
// Might cause issues when it comes to caravans
//[HarmonyPatch(typeof(JobGiver_OptimizeApparel), nameof(JobGiver_OptimizeApparel.ApparelScoreRaw))]
//public class ApparelScoreRaw_Patch
//{
// public static void Postfix(ref float __result, Pawn pawn, Apparel ap)
// {
// if (__result > 0f && ap is Absorber && !pawn.GetMenstruationComps().Any(comp => comp.TotalCum > 0))
// __result = -10f;
// }
//}
}

View file

@ -8,7 +8,8 @@ Version 1.0.9.2
- An equipped tampon or pad will now show how much fluid it has absorbed in its tooltip.
- Passive absorption will now make a tampon or pad dirty after enough time, even if no fluid was added.
- It will take a cloth tampon about 2 days to become dirty passively. A cloth pad will take about 10 days.
- An absorber that was force worn will no longer be force worn once it becomes dirty.
- An absorber that was force worn will no longer be forced once it becomes dirty.
- Pawns without a menstrual cycle will no longer equip absorbers.
- Egglaying races no longer have a menstrual cycle, regardless of vagina type.
- Pawns with the egglaying genes from Alpha Genes, VE Saurids, or Phytokin 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.