mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Merge branch 'dev'
This commit is contained in:
		
						commit
						304724f8d8
					
				
					 16 changed files with 157 additions and 50 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -124,6 +124,8 @@
 | 
				
			||||||
  <Option_PregnancyFromBaseRJW_Label>Use basic RJW pregnancy</Option_PregnancyFromBaseRJW_Label>
 | 
					  <Option_PregnancyFromBaseRJW_Label>Use basic RJW pregnancy</Option_PregnancyFromBaseRJW_Label>
 | 
				
			||||||
  <Option_PregnancyFromMultiplePregnancy_Label>Use menstruation multiple pregnancy</Option_PregnancyFromMultiplePregnancy_Label>
 | 
					  <Option_PregnancyFromMultiplePregnancy_Label>Use menstruation multiple pregnancy</Option_PregnancyFromMultiplePregnancy_Label>
 | 
				
			||||||
  <Option_PregnancyFromBiotech_Label>Use Biotech pregnancy</Option_PregnancyFromBiotech_Label>
 | 
					  <Option_PregnancyFromBiotech_Label>Use Biotech pregnancy</Option_PregnancyFromBiotech_Label>
 | 
				
			||||||
 | 
					  <Option_EnableDraftedIcon_Label>Show womb status when drafted</Option_EnableDraftedIcon_Label>
 | 
				
			||||||
 | 
					  <Option_EnableDraftedIcon_Desc>Draw womb icon for drafted pawns</Option_EnableDraftedIcon_Desc>
 | 
				
			||||||
  <Button_ResetToDefault>Reset to default</Button_ResetToDefault>
 | 
					  <Button_ResetToDefault>Reset to default</Button_ResetToDefault>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <Gizmo_GatherCum>Gather cum</Gizmo_GatherCum>
 | 
					  <Gizmo_GatherCum>Gather cum</Gizmo_GatherCum>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -19,23 +19,16 @@ namespace RJW_Menstruation
 | 
				
			||||||
            AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp<AlienPartGenerator.AlienComp>();
 | 
					            AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp<AlienPartGenerator.AlienComp>();
 | 
				
			||||||
            AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
 | 
					            AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
 | 
				
			||||||
            if (babyHARComp == null || originalHARComp == null) return;
 | 
					            if (babyHARComp == null || originalHARComp == null) return;
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
            foreach(KeyValuePair<string, AlienPartGenerator.ExposableValueTuple<Color, Color>> channel in originalHARComp.ColorChannels)
 | 
					            babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
 | 
				
			||||||
 | 
					            foreach (KeyValuePair<string, AlienPartGenerator.ExposableValueTuple<Color, Color>> channel in originalHARComp.ColorChannels)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                babyHARComp.OverwriteColorChannel(channel.Key, channel.Value.first, channel.Value.second);
 | 
					                babyHARComp.OverwriteColorChannel(channel.Key, channel.Value.first, channel.Value.second);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            babyHARComp.headVariant = originalHARComp.headVariant;
 | 
				
			||||||
 | 
					            babyHARComp.bodyVariant = originalHARComp.bodyVariant;
 | 
				
			||||||
            babyHARComp.headMaskVariant = originalHARComp.headMaskVariant;
 | 
					            babyHARComp.headMaskVariant = originalHARComp.headMaskVariant;
 | 
				
			||||||
            babyHARComp.bodyMaskVariant = originalHARComp.bodyMaskVariant;
 | 
					            babyHARComp.bodyMaskVariant = originalHARComp.bodyMaskVariant;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        // HAR doesn't populate variants until the graphics are called for, so this has to happen late
 | 
					 | 
				
			||||||
        public static void CopyHARPropertiesPostBirth(Pawn baby, Pawn original)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp<AlienPartGenerator.AlienComp>();
 | 
					 | 
				
			||||||
            AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
 | 
					 | 
				
			||||||
            if (babyHARComp == null || originalHARComp == null) return;
 | 
					 | 
				
			||||||
            if (originalHARComp.addonVariants != null)  // Testing has shown that the addons are valid by this point, but it's better to be safe
 | 
					 | 
				
			||||||
                babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,6 +42,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        public static int CumFertilityDecayRatioAdjust = CumFertilityDecayRatioAdjustDefault;
 | 
					        public static int CumFertilityDecayRatioAdjust = CumFertilityDecayRatioAdjustDefault;
 | 
				
			||||||
        public static int CycleAcceleration = CycleAccelerationDefault;
 | 
					        public static int CycleAcceleration = CycleAccelerationDefault;
 | 
				
			||||||
        public static bool EnableWombIcon = true;
 | 
					        public static bool EnableWombIcon = true;
 | 
				
			||||||
 | 
					        public static bool EnableDraftedIcon = true;
 | 
				
			||||||
        public static bool EnableAnimalCycle = false;
 | 
					        public static bool EnableAnimalCycle = false;
 | 
				
			||||||
        public static bool DrawWombStatus = true;
 | 
					        public static bool DrawWombStatus = true;
 | 
				
			||||||
        public static bool DrawVaginaStatus = true;
 | 
					        public static bool DrawVaginaStatus = true;
 | 
				
			||||||
| 
						 | 
					@ -72,13 +73,14 @@ namespace RJW_Menstruation
 | 
				
			||||||
        public static float MaxBreastIncrementFactor = MaxBreastIncrementFactorDefault;
 | 
					        public static float MaxBreastIncrementFactor = MaxBreastIncrementFactorDefault;
 | 
				
			||||||
        public static float MaxNippleIncrementFactor = MaxNippleIncrementFactorDefault;
 | 
					        public static float MaxNippleIncrementFactor = MaxNippleIncrementFactorDefault;
 | 
				
			||||||
        public static float PermanentNippleChange = PermanentNippleChangeDefault;
 | 
					        public static float PermanentNippleChange = PermanentNippleChangeDefault;
 | 
				
			||||||
        public static void SettoDefault()
 | 
					        public static void SetToDefault()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ImplantationChanceAdjust = ImplantationChanceAdjustDefault;
 | 
					            ImplantationChanceAdjust = ImplantationChanceAdjustDefault;
 | 
				
			||||||
            FertilizeChanceAdjust = FertilizeChanceAdjustDefault;
 | 
					            FertilizeChanceAdjust = FertilizeChanceAdjustDefault;
 | 
				
			||||||
            CumDecayRatioAdjust = CumDecayRatioAdjustDefault;
 | 
					            CumDecayRatioAdjust = CumDecayRatioAdjustDefault;
 | 
				
			||||||
            CumFertilityDecayRatioAdjust = CumFertilityDecayRatioAdjustDefault;
 | 
					            CumFertilityDecayRatioAdjust = CumFertilityDecayRatioAdjustDefault;
 | 
				
			||||||
            EnableWombIcon = true;
 | 
					            EnableWombIcon = true;
 | 
				
			||||||
 | 
					            EnableDraftedIcon = true;
 | 
				
			||||||
            EnableGatherCumGizmo = true;
 | 
					            EnableGatherCumGizmo = true;
 | 
				
			||||||
            EnableAnimalCycle = false;
 | 
					            EnableAnimalCycle = false;
 | 
				
			||||||
            CycleAcceleration = CycleAccelerationDefault;
 | 
					            CycleAcceleration = CycleAccelerationDefault;
 | 
				
			||||||
| 
						 | 
					@ -185,6 +187,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
            Scribe_Values.Look(ref CumFertilityDecayRatio, "CumFertilityDecayRatio", CumFertilityDecayRatio, true);
 | 
					            Scribe_Values.Look(ref CumFertilityDecayRatio, "CumFertilityDecayRatio", CumFertilityDecayRatio, true);
 | 
				
			||||||
            Scribe_Values.Look(ref CycleAcceleration, "CycleAcceleration", CycleAcceleration, true);
 | 
					            Scribe_Values.Look(ref CycleAcceleration, "CycleAcceleration", CycleAcceleration, true);
 | 
				
			||||||
            Scribe_Values.Look(ref EnableWombIcon, "EnableWombIcon", EnableWombIcon, true);
 | 
					            Scribe_Values.Look(ref EnableWombIcon, "EnableWombIcon", EnableWombIcon, true);
 | 
				
			||||||
 | 
					            Scribe_Values.Look(ref EnableDraftedIcon, "EnableDraftedIcon", EnableDraftedIcon, true);
 | 
				
			||||||
            Scribe_Values.Look(ref EnableAnimalCycle, "EnableAnimalCycle", EnableAnimalCycle, true);
 | 
					            Scribe_Values.Look(ref EnableAnimalCycle, "EnableAnimalCycle", EnableAnimalCycle, true);
 | 
				
			||||||
            Scribe_Values.Look(ref DrawWombStatus, "DrawWombStatus", DrawWombStatus, true);
 | 
					            Scribe_Values.Look(ref DrawWombStatus, "DrawWombStatus", DrawWombStatus, true);
 | 
				
			||||||
            Scribe_Values.Look(ref DrawVaginaStatus, "DrawVaginaStatus", DrawVaginaStatus, true);
 | 
					            Scribe_Values.Look(ref DrawVaginaStatus, "DrawVaginaStatus", DrawVaginaStatus, true);
 | 
				
			||||||
| 
						 | 
					@ -290,7 +293,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
            Widgets.CheckboxLabeled(middleAndRightCells.RightHalf(), Translations.Option_EnableGatherCumGizmo_Label, ref Configurations.EnableGatherCumGizmo, false, null, null, true);
 | 
					            Widgets.CheckboxLabeled(middleAndRightCells.RightHalf(), Translations.Option_EnableGatherCumGizmo_Label, ref Configurations.EnableGatherCumGizmo, false, null, null, true);
 | 
				
			||||||
            if (Configurations.EnableWombIcon || Configurations.EnableButtonInHT)
 | 
					            if (Configurations.EnableWombIcon || Configurations.EnableButtonInHT)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Listing_Standard wombsection = listmain.BeginSection(350);
 | 
					                Listing_Standard wombsection = listmain.BeginSection(380);
 | 
				
			||||||
                wombsection.CheckboxLabeled(Translations.Option9_Label, ref Configurations.DrawWombStatus, Translations.Option9_Desc);
 | 
					                wombsection.CheckboxLabeled(Translations.Option9_Label, ref Configurations.DrawWombStatus, Translations.Option9_Desc);
 | 
				
			||||||
                if (Configurations.DrawWombStatus)
 | 
					                if (Configurations.DrawWombStatus)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					@ -299,6 +302,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                wombsection.CheckboxLabeled(Translations.Option10_Label, ref Configurations.DrawVaginaStatus, Translations.Option10_Desc);
 | 
					                wombsection.CheckboxLabeled(Translations.Option10_Label, ref Configurations.DrawVaginaStatus, Translations.Option10_Desc);
 | 
				
			||||||
                wombsection.CheckboxLabeled(Translations.Option29_Label, ref Configurations.AllowShrinkIcon, Translations.Option29_Desc);
 | 
					                wombsection.CheckboxLabeled(Translations.Option29_Label, ref Configurations.AllowShrinkIcon, Translations.Option29_Desc);
 | 
				
			||||||
 | 
					                wombsection.CheckboxLabeled(Translations.Option_EnableDraftedIcon_Label, ref Configurations.EnableDraftedIcon, Translations.Option_EnableDraftedIcon_Desc);
 | 
				
			||||||
                if (wombsection.ButtonText(Translations.Option11_Label + ": " + Configurations.LevelString(Configurations.infoDetail)))
 | 
					                if (wombsection.ButtonText(Translations.Option11_Label + ": " + Configurations.LevelString(Configurations.infoDetail)))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (Configurations.infoDetail == Configurations.DetailLevel.Hide) Configurations.infoDetail = Configurations.DetailLevel.All;
 | 
					                    if (Configurations.infoDetail == Configurations.DetailLevel.Hide) Configurations.infoDetail = Configurations.DetailLevel.All;
 | 
				
			||||||
| 
						 | 
					@ -478,7 +482,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
            listmain.CheckboxLabeled(Translations.Option8_Label, ref Configurations.Debug, Translations.Option8_Desc);
 | 
					            listmain.CheckboxLabeled(Translations.Option8_Label, ref Configurations.Debug, Translations.Option8_Desc);
 | 
				
			||||||
            if (listmain.ButtonText(Translations.Button_ResetToDefault))
 | 
					            if (listmain.ButtonText(Translations.Button_ResetToDefault))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Configurations.SettoDefault();
 | 
					                Configurations.SetToDefault();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            listmain.End();
 | 
					            listmain.End();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -257,7 +257,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // Scenario B: Pregnant, grow in the second half of first trimester
 | 
					            // Scenario B: Pregnant, grow in the second half of first trimester
 | 
				
			||||||
            else if (Pawn.IsRJWPregnant())
 | 
					            else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                float pregnancySize = Mathf.InverseLerp(breastGrowthStart, breastGrowthEnd, Pawn.GetFarthestPregnancyProgress()) * MaxBreastIncrement;
 | 
					                float pregnancySize = Mathf.InverseLerp(breastGrowthStart, breastGrowthEnd, Pawn.GetFarthestPregnancyProgress()) * MaxBreastIncrement;
 | 
				
			||||||
                if (breastSizeIncreased > pregnancySize)
 | 
					                if (breastSizeIncreased > pregnancySize)
 | 
				
			||||||
| 
						 | 
					@ -293,7 +293,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
            float newNippleProgress;
 | 
					            float newNippleProgress;
 | 
				
			||||||
            if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks)
 | 
					            if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks)
 | 
				
			||||||
                newNippleProgress = 1f;
 | 
					                newNippleProgress = 1f;
 | 
				
			||||||
            else if (Pawn.IsRJWPregnant())
 | 
					            else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant())
 | 
				
			||||||
                newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress());
 | 
					                newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress());
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
                newNippleProgress = 0f;
 | 
					                newNippleProgress = 0f;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -362,5 +362,34 @@ namespace RJW_Menstruation
 | 
				
			||||||
            if (ModsConfig.BiotechActive && pawn.health.hediffSet.HasHediff(HediffDefOf.ImplantedIUD)) return true;
 | 
					            if (ModsConfig.BiotechActive && pawn.health.hediffSet.HasHediff(HediffDefOf.ImplantedIUD)) return true;
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static float DamagePants(this Pawn pawn, float fluidAmount)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (pawn.apparel == null) return 0;
 | 
				
			||||||
 | 
					            Apparel pants = null;
 | 
				
			||||||
 | 
					            foreach(Apparel apparel in pawn.apparel.WornApparel.Where(app => app.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if (apparel.def.apparel.LastLayer == ApparelLayerDefOf.OnSkin)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    pants = apparel;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (pants == null || apparel.def.apparel.LastLayer == ApparelLayerDefOf.Middle)
 | 
				
			||||||
 | 
					                    // Either grab whatever's available or reassign the pants from shell to a middle
 | 
				
			||||||
 | 
					                    pants = apparel;
 | 
				
			||||||
 | 
					                // Pants are middle and this is a shell
 | 
				
			||||||
 | 
					                else continue;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (pants == null) return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            const float HPPerMl = 0.5f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            DamageWorker.DamageResult damage = pants.TakeDamage(new DamageInfo(DamageDefOf.Deterioration, fluidAmount * HPPerMl, spawnFilth: false));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (pants.Destroyed && PawnUtility.ShouldSendNotificationAbout(pawn) && !pawn.Dead)
 | 
				
			||||||
 | 
					                Messages.Message("MessageWornApparelDeterioratedAway".Translate(GenLabel.ThingLabel(pants.def, pants.Stuff), pawn).CapitalizeFirst(), pawn, MessageTypeDefOf.NegativeEvent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return damage.totalDamageDealt;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -244,8 +244,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
            CopyBodyPartRecord(baby, original, Genital_Helper.get_breastsBPR(baby), Genital_Helper.get_breastsBPR(original));
 | 
					            CopyBodyPartRecord(baby, original, Genital_Helper.get_breastsBPR(baby), Genital_Helper.get_breastsBPR(original));
 | 
				
			||||||
            CopyBodyPartRecord(baby, original, Genital_Helper.get_uddersBPR(baby), Genital_Helper.get_uddersBPR(original));
 | 
					            CopyBodyPartRecord(baby, original, Genital_Helper.get_uddersBPR(baby), Genital_Helper.get_uddersBPR(original));
 | 
				
			||||||
            CopyBodyPartRecord(baby, original, Genital_Helper.get_anusBPR(baby), Genital_Helper.get_anusBPR(original));
 | 
					            CopyBodyPartRecord(baby, original, Genital_Helper.get_anusBPR(baby), Genital_Helper.get_anusBPR(original));
 | 
				
			||||||
            if (baby.IsHAR())
 | 
					 | 
				
			||||||
                HARCompatibility.CopyHARPropertiesPostBirth(baby, original);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void PostBirth(Pawn mother, Pawn father, Pawn baby)
 | 
					        public override void PostBirth(Pawn mother, Pawn father, Pawn baby)
 | 
				
			||||||
| 
						 | 
					@ -398,7 +396,8 @@ namespace RJW_Menstruation
 | 
				
			||||||
                //fixedIdeo: mother.Ideo,
 | 
					                //fixedIdeo: mother.Ideo,
 | 
				
			||||||
                forbidAnyTitle: true,
 | 
					                forbidAnyTitle: true,
 | 
				
			||||||
                forceNoBackstory: true,
 | 
					                forceNoBackstory: true,
 | 
				
			||||||
                forcedEndogenes: PregnancyUtility.GetInheritedGenes(father, mother)
 | 
					                forcedEndogenes: PregnancyUtility.GetInheritedGenes(father, mother),
 | 
				
			||||||
 | 
					                forcedXenotype: ModsConfig.BiotechActive ? XenotypeDefOf.Baseliner : null
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            int division = 1;
 | 
					            int division = 1;
 | 
				
			||||||
| 
						 | 
					@ -410,28 +409,30 @@ namespace RJW_Menstruation
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Pawn baby = GenerateBaby(request, mother, father, parentTraits, traitSeed);
 | 
					                Pawn baby = GenerateBaby(request, mother, father, parentTraits, traitSeed);
 | 
				
			||||||
                if (baby == null) break;
 | 
					                if (baby == null) break;
 | 
				
			||||||
 | 
					                if (baby.genes != null && ModsConfig.BiotechActive)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        baby.genes.xenotypeName = mother.genes.xenotypeName;
 | 
				
			||||||
 | 
					                        baby.genes.iconDef = mother.genes.iconDef;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    XenotypeDef xenoTypeDef = BabyXenoTypeDecider(mother, father, out bool hybridBaby);
 | 
				
			||||||
 | 
					                    if (xenoTypeDef != null) baby.genes.SetXenotypeDirect(xenoTypeDef);
 | 
				
			||||||
 | 
					                    if (hybridBaby)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        baby.genes.hybrid = true;
 | 
				
			||||||
 | 
					                        baby.genes.xenotypeName = "Hybrid".Translate();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                if (division > 1)
 | 
					                if (division > 1)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (i == 0)
 | 
					                    if (i == 0)
 | 
				
			||||||
                    {
 | 
					                    {                    
 | 
				
			||||||
 | 
					                        if (baby.IsHAR())   // Have HAR determine the first baby's properties
 | 
				
			||||||
 | 
					                            baby.Drawer.renderer.graphics.ResolveAllGraphics();
 | 
				
			||||||
                        firstbaby = baby;
 | 
					                        firstbaby = baby;
 | 
				
			||||||
                        request.FixedGender = baby.gender;
 | 
					                        request.FixedGender = baby.gender;
 | 
				
			||||||
                        request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
 | 
					                        request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();                        
 | 
				
			||||||
                        if (baby.genes != null && ModsConfig.BiotechActive)
 | 
					 | 
				
			||||||
                        {
 | 
					 | 
				
			||||||
                            if (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype)
 | 
					 | 
				
			||||||
                            {
 | 
					 | 
				
			||||||
                                baby.genes.xenotypeName = mother.genes.xenotypeName;
 | 
					 | 
				
			||||||
                                baby.genes.iconDef = mother.genes.iconDef;
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                            XenotypeDef xenoTypeDef = BabyXenoTypeDecider(mother, father, out bool hybridBaby);
 | 
					 | 
				
			||||||
                            if (xenoTypeDef != null) baby.genes.SetXenotypeDirect(xenoTypeDef);
 | 
					 | 
				
			||||||
                            if(hybridBaby)
 | 
					 | 
				
			||||||
                            {
 | 
					 | 
				
			||||||
                                baby.genes.hybrid = true;
 | 
					 | 
				
			||||||
                                baby.genes.xenotypeName = "Hybrid".Translate();
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else
 | 
					                    else
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
| 
						 | 
					@ -634,8 +635,8 @@ namespace RJW_Menstruation
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            XenotypeDef motherInheritableXenotype = mother?.genes?.Xenotype;
 | 
					            XenotypeDef motherInheritableXenotype = mother?.genes?.Xenotype;
 | 
				
			||||||
            XenotypeDef fatherInheritableXenotype = father?.genes?.Xenotype;
 | 
					            XenotypeDef fatherInheritableXenotype = father?.genes?.Xenotype;
 | 
				
			||||||
            if (!motherInheritableXenotype.inheritable) motherInheritableXenotype = null;
 | 
					            if (!(motherInheritableXenotype?.inheritable ?? false)) motherInheritableXenotype = null;
 | 
				
			||||||
            if (!fatherInheritableXenotype.inheritable) fatherInheritableXenotype = null;
 | 
					            if (!(fatherInheritableXenotype?.inheritable ?? false)) fatherInheritableXenotype = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // If they're the same (or both null)
 | 
					            // If they're the same (or both null)
 | 
				
			||||||
            if (motherInheritableXenotype == fatherInheritableXenotype)
 | 
					            if (motherInheritableXenotype == fatherInheritableXenotype)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,11 +9,9 @@ namespace RJW_Menstruation
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Hediff hediff = HediffMaker.MakeHediff(hediffDef, pawn);
 | 
					            Hediff hediff = HediffMaker.MakeHediff(hediffDef, pawn);
 | 
				
			||||||
            float effect = ((!(severity > 0f)) ? hediffDef.initialSeverity : severity) * ingested.stackCount;
 | 
					            float effect = ((!(severity > 0f)) ? hediffDef.initialSeverity : severity) * ingested.stackCount;
 | 
				
			||||||
            AddictionUtility.ModifyChemicalEffectForToleranceAndBodySize(pawn, toleranceChemical, ref effect);
 | 
					            AddictionUtility.ModifyChemicalEffectForToleranceAndBodySize_NewTemp(pawn, toleranceChemical, ref effect, multiplyByGeneToleranceFactors);
 | 
				
			||||||
            hediff.Severity = effect;
 | 
					            hediff.Severity = effect;
 | 
				
			||||||
            pawn.health.AddHediff(hediff);
 | 
					            pawn.health.AddHediff(hediff);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,7 @@ using System.Linq;
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Reflection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJW_Menstruation
 | 
					namespace RJW_Menstruation
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -108,4 +109,71 @@ namespace RJW_Menstruation
 | 
				
			||||||
                comp.TakeLoosePregnancy();
 | 
					                comp.TakeLoosePregnancy();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.ApplyBirthOutcome))]
 | 
				
			||||||
 | 
					    public class ApplyBirthOutcome_Patch
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public static void PostFix(Thing birtherThing)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (birtherThing is Pawn pawn && !pawn.health.Dead)
 | 
				
			||||||
 | 
					                pawn.GetBreastComp()?.GaveBirth();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.TryTerminatePregnancy))]
 | 
				
			||||||
 | 
					    public class TryTerminatePregnancy_Patch
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        private static Hediff GetEarliestPregnancy(Pawn pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Hediff Earliest_Pregnancy = PregnancyUtility.GetPregnancyHediff(pawn);
 | 
				
			||||||
 | 
					            foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Hediff pregnancy = comp.Pregnancy;
 | 
				
			||||||
 | 
					                if (pregnancy == null) continue;
 | 
				
			||||||
 | 
					                if (Earliest_Pregnancy == null || Earliest_Pregnancy.Severity > pregnancy.Severity) Earliest_Pregnancy = pregnancy;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					            return Earliest_Pregnancy;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private static readonly MethodInfo GetPregnancyHediff = AccessTools.Method(typeof(PregnancyUtility), nameof(PregnancyUtility.GetPregnancyHediff), new System.Type[] { typeof(Pawn) });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Also called for Recipe_TerminatePregnancy.ApplyOnPawn
 | 
				
			||||||
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (GetPregnancyHediff == null || GetPregnancyHediff.ReturnType != typeof(Hediff)) throw new System.InvalidOperationException("GetPregnancyHediff not found");
 | 
				
			||||||
 | 
					            foreach (CodeInstruction instruction in instructions)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if (instruction.Calls(GetPregnancyHediff))
 | 
				
			||||||
 | 
					                    yield return CodeInstruction.Call(typeof(TryTerminatePregnancy_Patch), nameof(TryTerminatePregnancy_Patch.GetEarliestPregnancy));
 | 
				
			||||||
 | 
					                else yield return instruction;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void Postfix(bool __result, Pawn pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (__result)
 | 
				
			||||||
 | 
					                foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
 | 
				
			||||||
 | 
					                    _ = comp.Pregnancy; // get_Pregnancy will remove the hediff attached to the comp that doesn't have it anymore
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [HarmonyPatch(typeof(Recipe_TerminatePregnancy), nameof(Recipe_TerminatePregnancy.AvailableOnNow))]
 | 
				
			||||||
 | 
					    public class TerminatePregnancy_AvailableOnNow_Patch
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public static void Postfix(ref bool __result, Thing thing)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (!ModsConfig.BiotechActive || !(thing is Pawn pawn)) return;
 | 
				
			||||||
 | 
					            __result |= pawn.GetMenstruationComps().Any(comp => comp.Pregnancy != null);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [HarmonyPatch(typeof(Recipe_TerminatePregnancy), nameof(Recipe_TerminatePregnancy.ApplyOnPawn))]
 | 
				
			||||||
 | 
					    public class TerminatePregnancy_ApplyOnPawn_Patch
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return TryTerminatePregnancy_Patch.Transpiler(instructions);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [HarmonyPatch(typeof(PregnancyHelper), nameof(PregnancyHelper.DoImpregnate))]
 | 
					    [HarmonyPatch(typeof(PregnancyHelper), nameof(PregnancyHelper.DoImpregnate))]
 | 
				
			||||||
    public static class Doimpregnate_Patch
 | 
					    public static class DoImpregnate_Patch
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public static bool Prefix(Pawn pawn, Pawn partner) // partner has vagina
 | 
					        public static bool Prefix(Pawn pawn, Pawn partner) // partner has vagina
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        private static readonly MethodInfo IsPregnant = AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsPregnant), new System.Type[] {typeof(Pawn), typeof(bool)});
 | 
					        private static readonly MethodInfo IsPregnant = AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsPregnant), new System.Type[] {typeof(Pawn), typeof(bool)});
 | 
				
			||||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (IsPregnant == null) throw new System.InvalidOperationException("IsPregnant not found");
 | 
					            if (IsPregnant == null || IsPregnant.ReturnType != typeof(bool)) throw new System.InvalidOperationException("IsPregnant not found");
 | 
				
			||||||
            foreach(CodeInstruction instruction in instructions)
 | 
					            foreach(CodeInstruction instruction in instructions)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (instruction.Calls(IsPregnant))
 | 
					                if (instruction.Calls(IsPregnant))
 | 
				
			||||||
| 
						 | 
					@ -239,7 +239,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
 | 
					        private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
 | 
				
			||||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (MinimumFuckabilityToHookup == null) throw new System.InvalidOperationException("MinimumFuckabilityToHookup not found");
 | 
					            if (MinimumFuckabilityToHookup == null || MinimumFuckabilityToHookup.FieldType != typeof(float)) throw new System.InvalidOperationException("MinimumFuckabilityToHookup not found");
 | 
				
			||||||
            bool first_fuckability = true;
 | 
					            bool first_fuckability = true;
 | 
				
			||||||
            foreach (CodeInstruction instruction in instructions)
 | 
					            foreach (CodeInstruction instruction in instructions)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -275,8 +275,8 @@ namespace RJW_Menstruation
 | 
				
			||||||
        private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
 | 
					        private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
 | 
				
			||||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (MinimumAttractivenessToHookup == null) throw new System.InvalidOperationException("MinimumAttractivenessToHookup not found");
 | 
					            if (MinimumAttractivenessToHookup == null || MinimumAttractivenessToHookup.FieldType != typeof(float)) throw new System.InvalidOperationException("MinimumAttractivenessToHookup not found");
 | 
				
			||||||
            if (MinimumRelationshipToHookup == null) throw new System.InvalidOperationException("MinimumRelationshipToHookup not found");
 | 
					            if (MinimumRelationshipToHookup == null || MinimumRelationshipToHookup.FieldType != typeof(float)) throw new System.InvalidOperationException("MinimumRelationshipToHookup not found");
 | 
				
			||||||
            LocalBuilder pawn_index = null;
 | 
					            LocalBuilder pawn_index = null;
 | 
				
			||||||
            // Like in the last one, we switch the arguments around for the second load
 | 
					            // Like in the last one, we switch the arguments around for the second load
 | 
				
			||||||
            bool first_attractiveness = true;
 | 
					            bool first_attractiveness = true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,6 +125,8 @@ namespace RJW_Menstruation
 | 
				
			||||||
        public static readonly string Option_PregnancyFromBaseRJW_Label = "Option_PregnancyFromBaseRJW_Label".Translate();
 | 
					        public static readonly string Option_PregnancyFromBaseRJW_Label = "Option_PregnancyFromBaseRJW_Label".Translate();
 | 
				
			||||||
        public static readonly string Option_PregnancyFromMultiplePregnancy_Label = "Option_PregnancyFromMultiplePregnancy_Label".Translate();
 | 
					        public static readonly string Option_PregnancyFromMultiplePregnancy_Label = "Option_PregnancyFromMultiplePregnancy_Label".Translate();
 | 
				
			||||||
        public static readonly string Option_PregnancyFromBiotech_Label = "Option_PregnancyFromBiotech_Label".Translate();
 | 
					        public static readonly string Option_PregnancyFromBiotech_Label = "Option_PregnancyFromBiotech_Label".Translate();
 | 
				
			||||||
 | 
					        public static readonly string Option_EnableDraftedIcon_Label = "Option_EnableDraftedIcon_Label".Translate();
 | 
				
			||||||
 | 
					        public static readonly string Option_EnableDraftedIcon_Desc = "Option_EnableDraftedIcon_Desc".Translate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static readonly string Button_ResetToDefault = "Button_ResetToDefault".Translate();
 | 
					        public static readonly string Button_ResetToDefault = "Button_ResetToDefault".Translate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -449,7 +449,10 @@ namespace RJW_Menstruation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static bool ShouldShowWombGizmo(this Pawn pawn)
 | 
					        public static bool ShouldShowWombGizmo(this Pawn pawn)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return Configurations.EnableWombIcon && (!pawn.IsAnimal() || Configurations.EnableAnimalCycle);
 | 
					            if (!Configurations.EnableWombIcon) return false;
 | 
				
			||||||
 | 
					            if (pawn.Drafted && !Configurations.EnableDraftedIcon) return false;
 | 
				
			||||||
 | 
					            if (pawn.IsAnimal() && !Configurations.EnableAnimalCycle) return false;
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
				
			||||||
<Manifest>
 | 
					<Manifest>
 | 
				
			||||||
	<identifier>RJW Menstruation</identifier>
 | 
						<identifier>RJW Menstruation</identifier>
 | 
				
			||||||
	<version>1.0.8.3</version>
 | 
						<version>1.0.8.4</version>
 | 
				
			||||||
	<dependencies>
 | 
						<dependencies>
 | 
				
			||||||
	</dependencies>
 | 
						</dependencies>
 | 
				
			||||||
	<incompatibleWith />
 | 
						<incompatibleWith />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,10 @@
 | 
				
			||||||
 | 
					Version 1.0.8.4
 | 
				
			||||||
 | 
					 - Fix Biotech xenotype inheritance for single-child pregnancies.
 | 
				
			||||||
 | 
					 - Fix error in Traditional Chinese translation.
 | 
				
			||||||
 | 
					 - New option in the mod settings to hide the womb icon for drafted pawns.
 | 
				
			||||||
 | 
					 - Newborns should now be baseliners if there are no xenotypes to inherit.
 | 
				
			||||||
 | 
					 - The Biotech terminate pregnancy recipe can now terminate a menstruation pregnancy, too.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 1.0.8.3
 | 
					Version 1.0.8.3
 | 
				
			||||||
 - Compatibility update for RJW 5.3.0.9
 | 
					 - Compatibility update for RJW 5.3.0.9
 | 
				
			||||||
 - Requires RJW 5.3.0.9
 | 
					 - Requires RJW 5.3.0.9
 | 
				
			||||||
| 
						 | 
					@ -13,7 +20,7 @@ Version 1.0.8.2
 | 
				
			||||||
Version 1.0.8.1
 | 
					Version 1.0.8.1
 | 
				
			||||||
 - Added the option for humans to start Biotech pregnancies if the DLC is enabled. If set, non-humans will use the old multiple pregnancy instead.
 | 
					 - Added the option for humans to start Biotech pregnancies if the DLC is enabled. If set, non-humans will use the old multiple pregnancy instead.
 | 
				
			||||||
 - Babies conceived through the multiple pregnancy option will now properly inherit xenotypes.
 | 
					 - Babies conceived through the multiple pregnancy option will now properly inherit xenotypes.
 | 
				
			||||||
 - Properly track biotech pregnancy through labor.
 | 
					 - Properly track Biotech pregnancy through labor.
 | 
				
			||||||
 - Pawns that are genetically sterile will no longer produce fertile cum, nor have a menstrual cycle.
 | 
					 - Pawns that are genetically sterile will no longer produce fertile cum, nor have a menstrual cycle.
 | 
				
			||||||
 - Biotech IUDs will now reduce pregnancy chances the same as an RJW IUD. Using both will not stack.
 | 
					 - Biotech IUDs will now reduce pregnancy chances the same as an RJW IUD. Using both will not stack.
 | 
				
			||||||
 - A biotech pregnancy will pause before going into labor if another womb already is in labor.
 | 
					 - A biotech pregnancy will pause before going into labor if another womb already is in labor.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue