Split animal cycle check into generic ShouldCycle function, exclude egglaying races from cycling

This commit is contained in:
lutepickle 2023-10-11 08:06:31 -07:00
parent ebf0db8ae6
commit f08ff58b64
8 changed files with 16 additions and 7 deletions

Binary file not shown.

View File

@ -150,7 +150,7 @@ namespace RJW_Menstruation
public bool ShouldSimulate()
{
if (!Configurations.EnableAnimalCycle && Pawn.IsAnimal()) return false;
if (!Pawn.ShouldCycle()) return false;
if (Pawn.SpawnedOrAnyParentSpawned || Pawn.IsCaravanMember() || PawnUtility.IsTravelingInTransportPodWorldObject(Pawn)) return true;
return false;

View File

@ -714,7 +714,7 @@ namespace RJW_Menstruation
public bool ShouldSimulate()
{
if (!Configurations.EnableAnimalCycle && Pawn.IsAnimal()) return false;
if (!Pawn.ShouldCycle()) return false;
if (Pawn.SpawnedOrAnyParentSpawned || Pawn.IsCaravanMember() || PawnUtility.IsTravelingInTransportPodWorldObject(Pawn)) return true;
return false;

View File

@ -403,6 +403,14 @@ namespace RJW_Menstruation
else return variability;
}
public static bool ShouldCycle(this Pawn pawn)
{
if (!Configurations.EnableAnimalCycle && pawn.IsAnimal()) return false;
if (pawn.RaceHasOviPregnancy()) return false;
// TODO: Exclude egglaying genes
return true;
}
public static bool IsInEstrus(this Pawn pawn, bool visible = true)
{
if (pawn.Dead) return false;

View File

@ -24,7 +24,7 @@ namespace RJW_Menstruation
if (sextype != xxx.rjwSextype.Vaginal && sextype != xxx.rjwSextype.DoublePenetration) return true;
if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
if (!partner.ShouldCycle()) return true;
if (!InteractionCanCausePregnancy(props)) return false;
@ -100,7 +100,7 @@ namespace RJW_Menstruation
{
public static bool Prefix(Pawn pawn, Pawn partner) // partner has vagina
{
if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
if (!partner.ShouldCycle()) return true;
HediffComp_Menstruation comp;
if (pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.IsInEstrus())
comp = partner.GetFertileMenstruationComp();
@ -125,7 +125,7 @@ namespace RJW_Menstruation
{
private static bool PregnancyBlocksImpregnation(this Pawn pawn, bool _)
{
if (!Configurations.EnableAnimalCycle && pawn.IsAnimal()) return pawn.IsPregnant();
if (!pawn.ShouldCycle()) return pawn.IsPregnant();
else if (pawn.GetMenstruationComps().Any()) return false;
else return pawn.IsPregnant();
}
@ -347,7 +347,7 @@ namespace RJW_Menstruation
if (__instance.Sexprops.usedCondom) return;
if (AndroidsCompatibility.IsAndroid(pawn)) return;
if (!Impregnate_Patch.InteractionCanCausePregnancy(__instance.Sexprops)) return;
if (!Configurations.EnableAnimalCycle && xxx.is_animal(partner)) return;
if (!partner.ShouldCycle()) return;
// Archotech penises have more control. Or something.
CompHediffBodyPart penisComp = pawn.GetGenitalsList()?.Find(genital => (genital as Hediff_PartBaseNatural)?.def.defName.ToLower().Contains("penis") ?? false)?.TryGetComp<CompHediffBodyPart>();

View File

@ -448,7 +448,7 @@ namespace RJW_Menstruation
{
if (!Configurations.EnableWombIcon) return false;
if (pawn.Drafted && !Configurations.EnableDraftedIcon) return false;
if (pawn.IsAnimal() && !Configurations.EnableAnimalCycle) return false;
if (!pawn.ShouldCycle()) return false;
return true;
}

View File

@ -2,6 +2,7 @@ Version 1.0.9.2
- Fixed the no bleeding gene having positive metabolic efficiency instead of negative.
- Removed status button in health tab for non-genitals to avoid errors.
- Handle errors more gracefully when starting a pregnancy.
- Egglaying races no longer have a menstrual cycle, regardless of vagina type.
Version 1.0.9.1
- Japanese translation for most text by Lokuzt.