Make the estrus hookup override only apply to pawns that can get them pregnant

This commit is contained in:
lutepickle 2022-04-27 07:12:17 -07:00
parent c5622a10f8
commit 3009a3c6ef
3 changed files with 13 additions and 7 deletions

Binary file not shown.

View File

@ -103,7 +103,7 @@
<Option32_Desc>Set morph power.</Option32_Desc>
<Option_EnableGatherCumGizmo_Label>Enable Gather Cum Gizmo</Option_EnableGatherCumGizmo_Label>
<Option_EstrusOverride_Label>Estrus overrides RJW hookup settings</Option_EstrusOverride_Label>
<Option_EstrusOverride_Desc>If enabled, a pawn in visible estrus will use these settings for hookups instead of the RJW settings.&#10;All settings default to their RJW counterparts.</Option_EstrusOverride_Desc>
<Option_EstrusOverride_Desc>If enabled, a pawn in visible estrus will use these settings for potential impregnation hookups instead of the RJW settings.&#10;All settings default to their RJW counterparts.</Option_EstrusOverride_Desc>
<Option_EstrusFuckability_Label>Hookup minimum fuckability in estrus</Option_EstrusFuckability_Label>
<Option_EstrusAttractability_Label>Hookup minimum attractability in estrus</Option_EstrusAttractability_Label>
<Option_EstrusRelationship_Label>Hookup minimum opinion in estrus</Option_EstrusRelationship_Label>

View File

@ -173,9 +173,10 @@ namespace RJW_Menstruation
[HarmonyPatch(typeof(CasualSex_Helper), "roll_to_skip")]
public static class Roll_To_Skip_Patch
{
private static float FuckabilityThreshold(Pawn pawn)
private static float FuckabilityThreshold(Pawn pawn, Pawn partner)
{
return (Configurations.EstrusOverridesHookupSettings && HediffComp_Menstruation.IsInEstrus(pawn)) ? Configurations.EstrusFuckabilityToHookup : RJWHookupSettings.MinimumFuckabilityToHookup;
return (Configurations.EstrusOverridesHookupSettings && HediffComp_Menstruation.IsInEstrus(pawn) && PregnancyHelper.CanImpregnate(partner, pawn))
? Configurations.EstrusFuckabilityToHookup : RJWHookupSettings.MinimumFuckabilityToHookup;
}
private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
@ -189,6 +190,7 @@ namespace RJW_Menstruation
{
found_fuckability = true;
yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Ldarg_1);
yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Roll_To_Skip_Patch), nameof(FuckabilityThreshold)));
}
else
@ -200,13 +202,15 @@ namespace RJW_Menstruation
[HarmonyPatch(typeof(CasualSex_Helper), "FindBestPartner")]
public static class FindBestPartner_Patch
{
private static float AttractivenessThreshold(Pawn pawn)
private static float AttractivenessThreshold(Pawn pawn, Pawn partner)
{
return (Configurations.EstrusOverridesHookupSettings && HediffComp_Menstruation.IsInEstrus(pawn)) ? Configurations.EstrusAttractivenessToHookup : RJWHookupSettings.MinimumAttractivenessToHookup;
return (Configurations.EstrusOverridesHookupSettings && HediffComp_Menstruation.IsInEstrus(pawn) && PregnancyHelper.CanImpregnate(partner, pawn))
? Configurations.EstrusAttractivenessToHookup : RJWHookupSettings.MinimumAttractivenessToHookup;
}
private static float RelationshipThreshold(Pawn pawn)
private static float RelationshipThreshold(Pawn pawn, Pawn partner)
{
return (Configurations.EstrusOverridesHookupSettings && HediffComp_Menstruation.IsInEstrus(pawn)) ? Configurations.EstrusRelationshipToHookup : RJWHookupSettings.MinimumRelationshipToHookup;
return (Configurations.EstrusOverridesHookupSettings && HediffComp_Menstruation.IsInEstrus(pawn) && PregnancyHelper.CanImpregnate(partner, pawn))
? Configurations.EstrusRelationshipToHookup : RJWHookupSettings.MinimumRelationshipToHookup;
}
private static readonly FieldInfo MinimumAttractivenessToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumAttractivenessToHookup));
@ -222,12 +226,14 @@ namespace RJW_Menstruation
{
found_first_attractiveness = true;
yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Ldarg_1);
yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(FindBestPartner_Patch), nameof(AttractivenessThreshold)));
}
else if (!found_first_relationship && instruction.LoadsField(MinimumRelationshipToHookup))
{
found_first_relationship = true;
yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Ldarg_1);
yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(FindBestPartner_Patch), nameof(RelationshipThreshold)));
}
else yield return instruction;