mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Make the estrus hookup override only apply to pawns that can get them pregnant
This commit is contained in:
		
							parent
							
								
									c5622a10f8
								
							
						
					
					
						commit
						3009a3c6ef
					
				
					 3 changed files with 13 additions and 7 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -103,7 +103,7 @@
 | 
				
			||||||
  <Option32_Desc>Set morph power.</Option32_Desc>
 | 
					  <Option32_Desc>Set morph power.</Option32_Desc>
 | 
				
			||||||
  <Option_EnableGatherCumGizmo_Label>Enable Gather Cum Gizmo</Option_EnableGatherCumGizmo_Label>
 | 
					  <Option_EnableGatherCumGizmo_Label>Enable Gather Cum Gizmo</Option_EnableGatherCumGizmo_Label>
 | 
				
			||||||
  <Option_EstrusOverride_Label>Estrus overrides RJW hookup settings</Option_EstrusOverride_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.
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.
All settings default to their RJW counterparts.</Option_EstrusOverride_Desc>
 | 
				
			||||||
  <Option_EstrusFuckability_Label>Hookup minimum fuckability in estrus</Option_EstrusFuckability_Label>
 | 
					  <Option_EstrusFuckability_Label>Hookup minimum fuckability in estrus</Option_EstrusFuckability_Label>
 | 
				
			||||||
  <Option_EstrusAttractability_Label>Hookup minimum attractability in estrus</Option_EstrusAttractability_Label>
 | 
					  <Option_EstrusAttractability_Label>Hookup minimum attractability in estrus</Option_EstrusAttractability_Label>
 | 
				
			||||||
  <Option_EstrusRelationship_Label>Hookup minimum opinion in estrus</Option_EstrusRelationship_Label>
 | 
					  <Option_EstrusRelationship_Label>Hookup minimum opinion in estrus</Option_EstrusRelationship_Label>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -173,9 +173,10 @@ namespace RJW_Menstruation
 | 
				
			||||||
    [HarmonyPatch(typeof(CasualSex_Helper), "roll_to_skip")]
 | 
					    [HarmonyPatch(typeof(CasualSex_Helper), "roll_to_skip")]
 | 
				
			||||||
    public static class Roll_To_Skip_Patch
 | 
					    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));
 | 
					        private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
 | 
				
			||||||
| 
						 | 
					@ -189,6 +190,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    found_fuckability = true;
 | 
					                    found_fuckability = true;
 | 
				
			||||||
                    yield return new CodeInstruction(OpCodes.Ldarg_0);
 | 
					                    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)));
 | 
					                    yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Roll_To_Skip_Patch), nameof(FuckabilityThreshold)));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
| 
						 | 
					@ -200,13 +202,15 @@ namespace RJW_Menstruation
 | 
				
			||||||
    [HarmonyPatch(typeof(CasualSex_Helper), "FindBestPartner")]
 | 
					    [HarmonyPatch(typeof(CasualSex_Helper), "FindBestPartner")]
 | 
				
			||||||
    public static class FindBestPartner_Patch
 | 
					    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));
 | 
					        private static readonly FieldInfo MinimumAttractivenessToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumAttractivenessToHookup));
 | 
				
			||||||
| 
						 | 
					@ -222,12 +226,14 @@ namespace RJW_Menstruation
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    found_first_attractiveness = true;
 | 
					                    found_first_attractiveness = true;
 | 
				
			||||||
                    yield return new CodeInstruction(OpCodes.Ldarg_0);
 | 
					                    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)));
 | 
					                    yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(FindBestPartner_Patch), nameof(AttractivenessThreshold)));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else if (!found_first_relationship && instruction.LoadsField(MinimumRelationshipToHookup))
 | 
					                else if (!found_first_relationship && instruction.LoadsField(MinimumRelationshipToHookup))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    found_first_relationship = true;
 | 
					                    found_first_relationship = true;
 | 
				
			||||||
                    yield return new CodeInstruction(OpCodes.Ldarg_0);
 | 
					                    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)));
 | 
					                    yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(FindBestPartner_Patch), nameof(RelationshipThreshold)));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else yield return instruction;
 | 
					                else yield return instruction;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue