mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Merge branch 'dev' of https://github.com/Shabakur/RJW-Genes into dev
This commit is contained in:
		
						commit
						982339a84e
					
				
					 40 changed files with 492 additions and 214 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
using LicentiaLabs;
 | 
			
		||||
using rjw;
 | 
			
		||||
using rjw;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,12 @@ namespace RJW_Genes
 | 
			
		|||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
 | 
			
		||||
            // If the Pawn is already a Futa, do not do anything. Can Happen by Base-RJW Spawn Chance or potentially races / other mods. 
 | 
			
		||||
            if (IsAlreadyFuta(pawn))
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (GenderUtility.IsFemale(pawn) && additional_genital == null)
 | 
			
		||||
            {
 | 
			
		||||
                createAndAddPenis();
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +33,12 @@ namespace RJW_Genes
 | 
			
		|||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
 | 
			
		||||
            // If the Pawn is already a Futa, do not do anything. Can Happen by Base-RJW Spawn Chance or potentially races / other mods. 
 | 
			
		||||
            if (IsAlreadyFuta(pawn))
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (pawn.gender == Gender.Female && additional_genital == null)
 | 
			
		||||
            {
 | 
			
		||||
                createAndAddPenis();
 | 
			
		||||
| 
						 | 
				
			
			@ -79,5 +91,15 @@ namespace RJW_Genes
 | 
			
		|||
            pawn.health.AddHediff(additional_genital, partBPR);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static bool IsAlreadyFuta(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (pawn == null)
 | 
			
		||||
                return false;
 | 
			
		||||
            if (!Genital_Helper.has_genitals(pawn))
 | 
			
		||||
                return false;
 | 
			
		||||
            return 
 | 
			
		||||
                (Genital_Helper.has_penis_fertile(pawn) || Genital_Helper.has_penis_infertile(pawn)) 
 | 
			
		||||
                && Genital_Helper.has_vagina(pawn) ;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
| 
						 | 
				
			
			@ -102,7 +103,7 @@ namespace RJW_Genes
 | 
			
		|||
            return pawn.genes.HasGene(GeneDefOf.rjw_genes_youth_fountain);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        internal static bool IsAgeDrainer(Pawn pawn)
 | 
			
		||||
        public static bool IsAgeDrainer(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (pawn.genes == null)
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -173,5 +174,20 @@ namespace RJW_Genes
 | 
			
		|||
            }
 | 
			
		||||
            return pawn.genes.HasGene(GeneDefOf.rjw_genes_unbreakable);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<Gene_GenitaliaResizingGene> GetGenitaliaResizingGenes(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            var ResizingGenes = new List<Gene_GenitaliaResizingGene>();
 | 
			
		||||
 | 
			
		||||
            // Error Handling: Issue with Pawn or Genes return empty.
 | 
			
		||||
            if (pawn == null || pawn.genes == null)
 | 
			
		||||
                return ResizingGenes;
 | 
			
		||||
 | 
			
		||||
            foreach (Gene gene in pawn.genes.GenesListForReading)
 | 
			
		||||
                if (gene is Gene_GenitaliaResizingGene resizing_gene)
 | 
			
		||||
                    ResizingGenes.Add(resizing_gene);
 | 
			
		||||
 | 
			
		||||
            return ResizingGenes;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,24 +1,12 @@
 | 
			
		|||
using Verse;
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_BigBreasts : RJW_Gene
 | 
			
		||||
    public class Gene_BigBreasts : Gene_GenitaliaResizingGene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        public override void Resize()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
 | 
			
		||||
            if (pawn.gender == Gender.Female)
 | 
			
		||||
                SizeAdjuster.AdjustAllBreastSizes(pawn,0.5f,1.0f);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public override void PostAdd()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
            if (pawn.gender == Gender.Female)
 | 
			
		||||
                SizeAdjuster.AdjustAllBreastSizes(pawn, 0.5f, 1.0f);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,20 +1,10 @@
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_BigMaleGenitalia : RJW_Gene
 | 
			
		||||
    public class Gene_BigMaleGenitalia : Gene_GenitaliaResizingGene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        public override void Resize()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
 | 
			
		||||
            SizeAdjuster.AdjustAllPenisSizes(pawn,0.5f,1.0f);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public override void PostAdd()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
            SizeAdjuster.AdjustAllPenisSizes(pawn, 0.5f, 1.0f);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										49
									
								
								Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								Source/Genes/GenitaliaSize/Gene_GenitaliaResizingGene.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Parent Gene for Genitalia Resizing. All Resizing genes should inherit for this class. 
 | 
			
		||||
    /// 
 | 
			
		||||
    /// This helps with some functions (e.g. "hasGenitaliaResizingGenes(pawn)") but also to fire genitalia resizing later in life for Pawns. 
 | 
			
		||||
    /// (No Children with huge ding dongs, and I don't want kids with tight anuses I am not that degenerate)
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public abstract class Gene_GenitaliaResizingGene : RJW_Gene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public const int RESIZING_AGE = 20;
 | 
			
		||||
        public bool WasApplied { get; set; }
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
            if (pawn.ageTracker.AgeBiologicalYears >= RESIZING_AGE)
 | 
			
		||||
            {
 | 
			
		||||
                Resize();
 | 
			
		||||
                WasApplied = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public override void PostAdd()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
            if (pawn.ageTracker.AgeBiologicalYears >= RESIZING_AGE)
 | 
			
		||||
            {
 | 
			
		||||
                Resize();
 | 
			
		||||
                WasApplied = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Used to resize the pawns genitalia. 
 | 
			
		||||
        /// All Logic should be put here: 
 | 
			
		||||
        /// 1. Filters for Gender
 | 
			
		||||
        /// 2. Filters for Genitalia Existance
 | 
			
		||||
        /// 3. Selection of right Genitalia 
 | 
			
		||||
        /// 4. Adjustment of Size
 | 
			
		||||
        /// 
 | 
			
		||||
        /// I kept it intentionally broad, so that e.g. the Penis Resize can resize multiple penises and also for futas, 
 | 
			
		||||
        /// while the breast-gene is female only. 
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public abstract void Resize();
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,22 +1,12 @@
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_LooseAnus : RJW_Gene
 | 
			
		||||
    public class Gene_LooseAnus : Gene_GenitaliaResizingGene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        public override void Resize()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
 | 
			
		||||
            SizeAdjuster.AdjustAllAnusSizes(pawn, 0.5f, 1.0f);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public override void PostAdd()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
            SizeAdjuster.AdjustAllAnusSizes(pawn, 0.5f, 1.0f);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,22 +1,12 @@
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_LooseFemaleGenitalia : RJW_Gene
 | 
			
		||||
    public class Gene_LooseFemaleGenitalia : Gene_GenitaliaResizingGene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        public override void Resize()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
 | 
			
		||||
            SizeAdjuster.AdjustAllVaginaSizes(pawn, 0.5f, 1.0f);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public override void PostAdd()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
            SizeAdjuster.AdjustAllVaginaSizes(pawn, 0.5f, 1.0f);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,18 +1,11 @@
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_SmallBreasts : RJW_Gene
 | 
			
		||||
    public class Gene_SmallBreasts : Gene_GenitaliaResizingGene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        public override void Resize()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
 | 
			
		||||
            SizeAdjuster.AdjustAllBreastSizes(pawn, 0.0f, 0.5f);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public override void PostAdd()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
            SizeAdjuster.AdjustAllBreastSizes(pawn, 0.0f, 0.5f);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,20 +1,10 @@
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_SmallMaleGenitalia : RJW_Gene
 | 
			
		||||
    public class Gene_SmallMaleGenitalia : Gene_GenitaliaResizingGene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        public override void Resize()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
 | 
			
		||||
            SizeAdjuster.AdjustAllPenisSizes(pawn,0.0f,0.5f);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public override void PostAdd()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
            SizeAdjuster.AdjustAllPenisSizes(pawn, 0.0f, 0.5f);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,21 +1,10 @@
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_TightAnus : RJW_Gene
 | 
			
		||||
    public class Gene_TightAnus : Gene_GenitaliaResizingGene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        public override void Resize()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
 | 
			
		||||
            SizeAdjuster.AdjustAllAnusSizes(pawn, 0.0f, 0.5f);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public override void PostAdd()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
            SizeAdjuster.AdjustAllAnusSizes(pawn, 0.0f, 0.5f);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,20 +1,10 @@
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_TightFemaleGenitalia : RJW_Gene
 | 
			
		||||
    public class Gene_TightFemaleGenitalia : Gene_GenitaliaResizingGene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        public override void Resize()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostMake();
 | 
			
		||||
 | 
			
		||||
            SizeAdjuster.AdjustAllVaginaSizes(pawn, 0.0f, 0.5f);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public override void PostAdd()
 | 
			
		||||
        {
 | 
			
		||||
            base.PostAdd();
 | 
			
		||||
            SizeAdjuster.AdjustAllVaginaSizes(pawn, 0.0f, 0.5f);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								Source/Genes/GenitaliaSize/Patch_ResizingOnAdulthood.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Source/Genes/GenitaliaSize/Patch_ResizingOnAdulthood.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
using HarmonyLib;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// This Patch adds behavior to all resizing genes: 
 | 
			
		||||
    /// At Age RESIZING_MIN_AGE the Pawns Resizing Genes will trigger again, if not already triggered somewhere else.
 | 
			
		||||
    /// This is meant to allow kids to grow up without resized genitals, and resize later (Fixing #11). 
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [HarmonyPatch(typeof(Pawn_AgeTracker), "BirthdayBiological")]
 | 
			
		||||
    public class Patch_ResizingOnAdulthood
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        static void Postfix(Pawn ___pawn, int birthdayAge)
 | 
			
		||||
        {
 | 
			
		||||
            if (birthdayAge >= Gene_GenitaliaResizingGene.RESIZING_AGE)
 | 
			
		||||
            {
 | 
			
		||||
                foreach(Gene_GenitaliaResizingGene gene in GeneUtility.GetGenitaliaResizingGenes(___pawn))
 | 
			
		||||
                {
 | 
			
		||||
                    if (!gene.WasApplied)
 | 
			
		||||
                    {
 | 
			
		||||
                        gene.Resize();
 | 
			
		||||
                        gene.WasApplied = true;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -24,7 +24,7 @@ namespace RJW_Genes
 | 
			
		|||
				Pawn pawn = this.pawn;
 | 
			
		||||
				
 | 
			
		||||
				return ((pawn != null) ? pawn.ageTracker : null) == null || 
 | 
			
		||||
					((float)this.pawn.ageTracker.AgeBiologicalYears >= this.def.minAgeActive && this.pawn.ageTracker.AgeBiologicalYears >= (RJWSettings.AllowYouthSex ? 13f : 18f));
 | 
			
		||||
					((float)this.pawn.ageTracker.AgeBiologicalYears >= this.def.minAgeActive);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,9 +13,11 @@ namespace RJW_Genes.Genes.Special
 | 
			
		|||
    {
 | 
			
		||||
 | 
			
		||||
        const long AGE_TRANSFERED = 120000; // 120k == 2 days
 | 
			
		||||
        // 20 Years * 60 Days / Year * 60k Ticks/Day + 1 for safety
 | 
			
		||||
        const long MINIMUM_AGE = 20 * 60 * 60000 + 1;
 | 
			
		||||
 | 
			
		||||
        // Comment Below in for debugging, changes years
 | 
			
		||||
        // const long AGE_TRANSFERED = 6000000; // 6000k == 100 days
 | 
			
		||||
        // const long AGE_TRANSFERED = 12000000; 
 | 
			
		||||
        public static void Postfix(SexProps props)
 | 
			
		||||
        {
 | 
			
		||||
            if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal() )
 | 
			
		||||
| 
						 | 
				
			
			@ -25,12 +27,12 @@ namespace RJW_Genes.Genes.Special
 | 
			
		|||
            if (GeneUtility.IsAgeDrainer(props.pawn))
 | 
			
		||||
            {
 | 
			
		||||
                var pawnAge = props.pawn.ageTracker.AgeBiologicalTicks;
 | 
			
		||||
                var pawnMinAge = props.pawn.ageTracker.AdultMinAgeTicks;
 | 
			
		||||
                //ModLog.Error($"Firing Age Drain \nMinimum Age is \t{MINIMUM_AGE} \nPawn Age is \t{pawnAge} \nTransferred \t{AGE_TRANSFERED}\nResulting in \t{pawnAge - AGE_TRANSFERED}");
 | 
			
		||||
 | 
			
		||||
                // Make Partner older
 | 
			
		||||
                props.partner.ageTracker.AgeBiologicalTicks += AGE_TRANSFERED;
 | 
			
		||||
                // Make Pawn younger
 | 
			
		||||
                props.pawn.ageTracker.AgeBiologicalTicks = Math.Max(pawnMinAge, pawnAge - AGE_TRANSFERED);
 | 
			
		||||
                props.pawn.ageTracker.AgeBiologicalTicks = Math.Max(MINIMUM_AGE, (pawnAge - AGE_TRANSFERED));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,10 +46,10 @@ namespace RJW_Genes
 | 
			
		|||
		/// <returns></returns>
 | 
			
		||||
		public static Hediff GetOrgasmRushHediff(Pawn orgasmed)
 | 
			
		||||
		{
 | 
			
		||||
			Hediff orgasmRushHediff = orgasmed.health.hediffSet.GetFirstHediffOfDef(GeneDefOf.rjw_genes_orgasm_rush_hediff);
 | 
			
		||||
			Hediff orgasmRushHediff = orgasmed.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_orgasm_rush_hediff);
 | 
			
		||||
			if (orgasmRushHediff == null)
 | 
			
		||||
			{
 | 
			
		||||
				orgasmRushHediff = HediffMaker.MakeHediff(GeneDefOf.rjw_genes_orgasm_rush_hediff, orgasmed);
 | 
			
		||||
				orgasmRushHediff = HediffMaker.MakeHediff(HediffDefOf.rjw_genes_orgasm_rush_hediff, orgasmed);
 | 
			
		||||
				orgasmRushHediff.Severity = 0;
 | 
			
		||||
				orgasmed.health.AddHediff(orgasmRushHediff);
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,9 +13,11 @@ namespace RJW_Genes.Genes.Special
 | 
			
		|||
    {
 | 
			
		||||
 | 
			
		||||
        const long AGE_REDUCTION = 60000; // 60k == 1 day
 | 
			
		||||
        // 20 Years * 60 Days / Year * 60k Ticks/Day + 1 for safety
 | 
			
		||||
        const long MINIMUM_AGE = 20 * 60 * 60000 + 1;
 | 
			
		||||
 | 
			
		||||
        // Comment Below in for debugging
 | 
			
		||||
        //const long AGE_REDUCTION = 6000000; // 6000k == 100 days
 | 
			
		||||
        // const long AGE_REDUCTION = 6000000; // 6000k == 100 days
 | 
			
		||||
        public static void Postfix(SexProps props)
 | 
			
		||||
        {
 | 
			
		||||
            if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal())
 | 
			
		||||
| 
						 | 
				
			
			@ -25,12 +27,18 @@ namespace RJW_Genes.Genes.Special
 | 
			
		|||
            if (GeneUtility.IsYouthFountain(props.pawn))
 | 
			
		||||
            {
 | 
			
		||||
                var partnerAge = props.partner.ageTracker.AgeBiologicalTicks;
 | 
			
		||||
                var minAge = props.partner.ageTracker.AdultMinAgeTicks;
 | 
			
		||||
 | 
			
		||||
                props.partner.ageTracker.AgeBiologicalTicks = Math.Max(minAge, partnerAge - AGE_REDUCTION);
 | 
			
		||||
                //ModLog.Error($"Firing Youth Fountain \nMinimum Age is \t{MINIMUM_AGE}\t{ticksToYears(MINIMUM_AGE)}y\nPawn Age is \t{partnerAge}\t{ticksToYears(partnerAge)}y \nTransferred \t {AGE_REDUCTION}\t{ticksToYears(AGE_REDUCTION)}y\nResulting in \t{partnerAge - AGE_REDUCTION}\t{ticksToYears(partnerAge - AGE_REDUCTION)}y");
 | 
			
		||||
 | 
			
		||||
                props.partner.ageTracker.AgeBiologicalTicks = Math.Max(MINIMUM_AGE, partnerAge - AGE_REDUCTION);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static float ticksToYears(long ticks)
 | 
			
		||||
        {
 | 
			
		||||
            return (ticks / 60000f) / 60f;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue