mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Allow different hookup settings during estrus
This commit is contained in:
		
							parent
							
								
									191e4ab5d9
								
							
						
					
					
						commit
						3f02fde439
					
				
					 8 changed files with 127 additions and 3 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -133,6 +133,23 @@
 | 
			
		|||
		</stages>
 | 
			
		||||
	</ThoughtDef>
 | 
			
		||||
 | 
			
		||||
	<ThoughtDef>
 | 
			
		||||
		<defName>HaterCameInsideFEstrus</defName>
 | 
			
		||||
		<thoughtClass>Thought_MemorySocial</thoughtClass>
 | 
			
		||||
		<durationDays>7.0</durationDays>
 | 
			
		||||
		<stackLimit>5</stackLimit>
 | 
			
		||||
		<stackedEffectMultiplier>0.1</stackedEffectMultiplier>
 | 
			
		||||
		<stackLimitForSameOtherPawn>1</stackLimitForSameOtherPawn>
 | 
			
		||||
		<stages>
 | 
			
		||||
			<li>
 | 
			
		||||
				<label>{0} came inside</label>
 | 
			
		||||
				<description>What was I thinking, letting him do that?</description>
 | 
			
		||||
				<baseMoodEffect>-2</baseMoodEffect>
 | 
			
		||||
				<baseOpinionOffset>-5</baseOpinionOffset>
 | 
			
		||||
			</li>
 | 
			
		||||
		</stages>
 | 
			
		||||
	</ThoughtDef>
 | 
			
		||||
	
 | 
			
		||||
	<ThoughtDef>
 | 
			
		||||
		<defName>HaterCameInsideM</defName>
 | 
			
		||||
		<thoughtClass>Thought_MemorySocial</thoughtClass>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,6 +102,11 @@
 | 
			
		|||
  <Option32_Label>Morph power</Option32_Label>
 | 
			
		||||
  <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.
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>
 | 
			
		||||
  <EstimatedCumLifespan>Estimated sperm lifespan</EstimatedCumLifespan>
 | 
			
		||||
  <EstimatedEggLifespan>Estimated egg lifespan</EstimatedEggLifespan>
 | 
			
		||||
  <FertilityDesc>Chance of fertilization within an hour: {0}%
The chance of pregnancy of fertilized egg.
The white overlay is indicates fertilization chance of sperms in womb.</FertilityDesc>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
using System;
 | 
			
		||||
using rjw;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using Verse;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,6 +47,10 @@ namespace RJW_Menstruation
 | 
			
		|||
        public static bool Debug = false;
 | 
			
		||||
        public static bool EnableMenopause = true;
 | 
			
		||||
        public static DetailLevel InfoDetail { get => Debug ? DetailLevel.All : infoDetail; }
 | 
			
		||||
        public static bool EstrusOverridesHookupSettings = false;
 | 
			
		||||
        public static float EstrusFuckabilityToHookup = RJWHookupSettings.MinimumFuckabilityToHookup;
 | 
			
		||||
        public static float EstrusAttractivenessToHookup = RJWHookupSettings.MinimumAttractivenessToHookup;
 | 
			
		||||
        public static float EstrusRelationshipToHookup = RJWHookupSettings.MinimumRelationshipToHookup;
 | 
			
		||||
        public static bool UseMultiplePregnancy = true;
 | 
			
		||||
        public static bool EnableHeteroOvularTwins = true;
 | 
			
		||||
        public static bool EnableEnzygoticTwins = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -85,6 +90,10 @@ namespace RJW_Menstruation
 | 
			
		|||
            EnableGatherCumGizmo = true;
 | 
			
		||||
            EnableAnimalCycle = false;
 | 
			
		||||
            CycleAcceleration = CycleAccelerationDefault;
 | 
			
		||||
            EstrusOverridesHookupSettings = false;
 | 
			
		||||
            EstrusFuckabilityToHookup = RJWHookupSettings.MinimumFuckabilityToHookup;
 | 
			
		||||
            EstrusAttractivenessToHookup = RJWHookupSettings.MinimumAttractivenessToHookup;
 | 
			
		||||
            EstrusRelationshipToHookup = RJWHookupSettings.MinimumRelationshipToHookup;
 | 
			
		||||
            EnzygoticTwinsChanceAdjust = EnzygoticTwinsChanceAdjustDefault;
 | 
			
		||||
            EnableEnzygoticTwins = true;
 | 
			
		||||
            EnableHeteroOvularTwins = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -189,6 +198,10 @@ namespace RJW_Menstruation
 | 
			
		|||
            Scribe_Values.Look(ref Debug, "Debug", Debug, true);
 | 
			
		||||
            Scribe_Values.Look(ref infoDetail, "InfoDetail", infoDetail, true);
 | 
			
		||||
            Scribe_Values.Look(ref EnableMenopause, "EnableMenopause", EnableMenopause, true);
 | 
			
		||||
            Scribe_Values.Look(ref EstrusOverridesHookupSettings, "EstrusOverridesHookupSettings", EstrusOverridesHookupSettings, true);
 | 
			
		||||
            Scribe_Values.Look(ref EstrusFuckabilityToHookup, "EstrusFuckabilityToHookup", EstrusFuckabilityToHookup, true);
 | 
			
		||||
            Scribe_Values.Look(ref EstrusAttractivenessToHookup, "EstrusAttractivenessToHookup", EstrusAttractivenessToHookup, true);
 | 
			
		||||
            Scribe_Values.Look(ref EstrusRelationshipToHookup, "EstrusRelationshipToHookup", EstrusRelationshipToHookup, true);
 | 
			
		||||
            Scribe_Values.Look(ref UseMultiplePregnancy, "UseMultiplePregnancy", UseMultiplePregnancy, true);
 | 
			
		||||
            Scribe_Values.Look(ref EnableHeteroOvularTwins, "EnableHeteroOvularTwins", EnableHeteroOvularTwins, true);
 | 
			
		||||
            Scribe_Values.Look(ref EnableEnzygoticTwins, "EnableEnzygoticTwins", EnableEnzygoticTwins, true);
 | 
			
		||||
| 
						 | 
				
			
			@ -404,6 +417,17 @@ namespace RJW_Menstruation
 | 
			
		|||
            listmain.LabelDouble(Translations.Option19_Label_1, Translations.Option19_Label_2 + ": " + var1 + "ml, " + var2 + "ml/h", Translations.Option19_Desc);
 | 
			
		||||
            Configurations.BleedingAmount = (int)listmain.Slider(Configurations.BleedingAmount, 0, 200);
 | 
			
		||||
 | 
			
		||||
            listmain.CheckboxLabeled(Translations.Option_EstrusOverride_Label, ref Configurations.EstrusOverridesHookupSettings, Translations.Option_EstrusOverride_Desc);
 | 
			
		||||
            if (Configurations.EstrusOverridesHookupSettings)
 | 
			
		||||
            {
 | 
			
		||||
                listmain.Label(Translations.Option_EstrusFuckability_Label + ": " + (int)(Configurations.EstrusFuckabilityToHookup * 100) + "%");
 | 
			
		||||
                Configurations.EstrusFuckabilityToHookup = listmain.Slider(Configurations.EstrusFuckabilityToHookup, 0.1f, 1.0f);
 | 
			
		||||
                listmain.Label(Translations.Option_EstrusAttractability_Label + ": " + (int)(Configurations.EstrusAttractivenessToHookup * 100) + "%");
 | 
			
		||||
                Configurations.EstrusAttractivenessToHookup = listmain.Slider(Configurations.EstrusAttractivenessToHookup, 0.0f, 1.0f);
 | 
			
		||||
                listmain.Label(Translations.Option_EstrusRelationship_Label + ": " + Configurations.EstrusRelationshipToHookup);
 | 
			
		||||
                Configurations.EstrusRelationshipToHookup = listmain.Slider((int)Configurations.EstrusRelationshipToHookup, -100f, 100f);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            listmain.CheckboxLabeled(Translations.Option13_Label, ref Configurations.UseMultiplePregnancy, Translations.Option13_Desc);
 | 
			
		||||
            if (Configurations.UseMultiplePregnancy)
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1022,9 +1022,8 @@ namespace RJW_Menstruation
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool IsInEstrus(bool includeConcealed = false)
 | 
			
		||||
        public static bool IsInEstrus(Pawn pawn, bool includeConcealed = false)
 | 
			
		||||
        {
 | 
			
		||||
            Pawn pawn = parent.pawn;
 | 
			
		||||
            if (pawn.Dead) return false;
 | 
			
		||||
            if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Estrus)) return true;
 | 
			
		||||
            else return includeConcealed && pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Estrus_Concealed);
 | 
			
		||||
| 
						 | 
				
			
			@ -1482,6 +1481,10 @@ namespace RJW_Menstruation
 | 
			
		|||
                    {
 | 
			
		||||
                        parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideF, cummer);
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (IsInEstrus(parent.pawn) && parent.pawn.relations.OpinionOf(cummer) < RJWHookupSettings.MinimumRelationshipToHookup)
 | 
			
		||||
                    {
 | 
			
		||||
                        parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideFEstrus, cummer);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,10 @@ using rjw.Modules.Interactions.Enums;
 | 
			
		|||
using rjw.Modules.Interactions.Objects;
 | 
			
		||||
using Verse;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using System.Reflection.Emit;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Menstruation
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -166,6 +170,71 @@ namespace RJW_Menstruation
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [HarmonyPatch(typeof(CasualSex_Helper), "roll_to_skip")]
 | 
			
		||||
    public static class Roll_To_Skip_Patch
 | 
			
		||||
    {
 | 
			
		||||
        private static float FuckabilityThreshold(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            return (Configurations.EstrusOverridesHookupSettings && HediffComp_Menstruation.IsInEstrus(pawn)) ? Configurations.EstrusFuckabilityToHookup : RJWHookupSettings.MinimumFuckabilityToHookup;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
 | 
			
		||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
			
		||||
        {
 | 
			
		||||
            // We only want the first fuckability check, i.e. the estrus-haver towards a partner
 | 
			
		||||
            bool found_fuckability = false;
 | 
			
		||||
            foreach(CodeInstruction instruction in instructions)
 | 
			
		||||
            {
 | 
			
		||||
                if(!found_fuckability && instruction.LoadsField(MinimumFuckabilityToHookup))
 | 
			
		||||
                {
 | 
			
		||||
                    found_fuckability = true;
 | 
			
		||||
                    yield return new CodeInstruction(OpCodes.Ldarg_0);
 | 
			
		||||
                    yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Roll_To_Skip_Patch), nameof(FuckabilityThreshold)));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                    yield return instruction;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [HarmonyPatch(typeof(CasualSex_Helper), "FindBestPartner")]
 | 
			
		||||
    public static class FindBestPartner_Patch
 | 
			
		||||
    {
 | 
			
		||||
        private static float AttractivenessThreshold(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            return (Configurations.EstrusOverridesHookupSettings && HediffComp_Menstruation.IsInEstrus(pawn)) ? Configurations.EstrusAttractivenessToHookup : RJWHookupSettings.MinimumAttractivenessToHookup;
 | 
			
		||||
        }
 | 
			
		||||
        private static float RelationshipThreshold(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            return (Configurations.EstrusOverridesHookupSettings && HediffComp_Menstruation.IsInEstrus(pawn)) ? Configurations.EstrusRelationshipToHookup : RJWHookupSettings.MinimumRelationshipToHookup;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static readonly FieldInfo MinimumAttractivenessToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumAttractivenessToHookup));
 | 
			
		||||
        private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
 | 
			
		||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
			
		||||
        {
 | 
			
		||||
            // Like in the last one, we're only interested in the first of each
 | 
			
		||||
            bool found_first_attractiveness = false;
 | 
			
		||||
            bool found_first_relationship = false;
 | 
			
		||||
            foreach(CodeInstruction instruction in instructions)
 | 
			
		||||
            {
 | 
			
		||||
                if (!found_first_attractiveness && instruction.LoadsField(MinimumAttractivenessToHookup))
 | 
			
		||||
                {
 | 
			
		||||
                    found_first_attractiveness = true;
 | 
			
		||||
                    yield return new CodeInstruction(OpCodes.Ldarg_0);
 | 
			
		||||
                    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.Call, AccessTools.Method(typeof(FindBestPartner_Patch), nameof(RelationshipThreshold)));
 | 
			
		||||
                }
 | 
			
		||||
                else yield return instruction;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [HarmonyPatch(typeof(CompHediffBodyPart), "updatesize")]
 | 
			
		||||
    public static class Updatesize_Patch
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,6 +108,11 @@ namespace RJW_Menstruation
 | 
			
		|||
        public static readonly string Option32_Label = "Option32_Label".Translate();
 | 
			
		||||
        public static readonly string Option32_Desc  = "Option32_Desc".Translate();
 | 
			
		||||
        public static readonly string Option_EnableGatherCumGizmo_Label = "Option_EnableGatherCumGizmo_Label".Translate();
 | 
			
		||||
        public static readonly string Option_EstrusOverride_Label = "Option_EstrusOverride_Label".Translate();
 | 
			
		||||
        public static readonly string Option_EstrusOverride_Desc = "Option_EstrusOverride_Desc".Translate();
 | 
			
		||||
        public static readonly string Option_EstrusFuckability_Label = "Option_EstrusFuckability_Label".Translate();
 | 
			
		||||
        public static readonly string Option_EstrusAttractability_Label = "Option_EstrusAttractability_Label".Translate();
 | 
			
		||||
        public static readonly string Option_EstrusRelationship_Label = "Option_EstrusRelationship_Label".Translate();
 | 
			
		||||
 | 
			
		||||
        public static readonly string Button_ResetToDefault = "Button_ResetToDefault".Translate();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,6 +34,7 @@ namespace RJW_Menstruation
 | 
			
		|||
        public static readonly ThoughtDef CameInsideFFetishSafe = DefDatabase<ThoughtDef>.GetNamed("CameInsideFFetishSafe");
 | 
			
		||||
        public static readonly ThoughtDef HaterCameInsideFSafe = DefDatabase<ThoughtDef>.GetNamed("HaterCameInsideFSafe");
 | 
			
		||||
        public static readonly ThoughtDef HaterCameInsideF = DefDatabase<ThoughtDef>.GetNamed("HaterCameInsideF");
 | 
			
		||||
        public static readonly ThoughtDef HaterCameInsideFEstrus = DefDatabase<ThoughtDef>.GetNamed("HaterCameInsideFEstrus");
 | 
			
		||||
        public static readonly ThoughtDef CameInsideM = DefDatabase<ThoughtDef>.GetNamed("CameInsideM");
 | 
			
		||||
        public static readonly ThoughtDef HaterCameInsideM = DefDatabase<ThoughtDef>.GetNamed("HaterCameInsideM");
 | 
			
		||||
        public static readonly ThoughtDef UnwantedPregnancy = DefDatabase<ThoughtDef>.GetNamed("UnwantedPregnancy");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue