mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Expose of ResizingGenes, fixing #34
This commit is contained in:
		
							parent
							
								
									59412ae330
								
							
						
					
					
						commit
						d00834049b
					
				
					 2 changed files with 35 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -1,16 +1,34 @@
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Parent Gene for Genitalia Resizing. All Resizing genes should inherit for this class. 
 | 
			
		||||
    /// There is a companion-patch `Patch_ResizingOnAdulthood`.
 | 
			
		||||
    /// 
 | 
			
		||||
    /// 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)
 | 
			
		||||
    /// 
 | 
			
		||||
    /// 
 | 
			
		||||
    /// There was an Issue (#34) that re-sized the genitalia over multiple birthdays. 
 | 
			
		||||
    /// Before the addition of `ExposeData`, it lost track whether the resizing was already run, 
 | 
			
		||||
    /// leading to a change with every birthday over multiple game starts. 
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public abstract class Gene_GenitaliaResizingGene : RJW_Gene
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public const int RESIZING_AGE = 20;
 | 
			
		||||
        public bool WasApplied { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The age (in years) at which the Pawns Genes will take effect, resizing their genitalia. 
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public const int RESIZING_AGE = 20; 
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Whether or not the gene was already applied. 
 | 
			
		||||
        /// If not, it is checked on every birthday and will be applied accordingly.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        private bool resizingWasApplied = false;
 | 
			
		||||
        public bool ResizingWasApplied { get => resizingWasApplied; set => resizingWasApplied = value; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public override void PostMake()
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +36,7 @@
 | 
			
		|||
            if (pawn.ageTracker.AgeBiologicalYears >= RESIZING_AGE)
 | 
			
		||||
            {
 | 
			
		||||
                Resize();
 | 
			
		||||
                WasApplied = true;
 | 
			
		||||
                ResizingWasApplied = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -28,19 +46,25 @@
 | 
			
		|||
            if (pawn.ageTracker.AgeBiologicalYears >= RESIZING_AGE)
 | 
			
		||||
            {
 | 
			
		||||
                Resize();
 | 
			
		||||
                WasApplied = true;
 | 
			
		||||
                ResizingWasApplied = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public override void ExposeData()
 | 
			
		||||
        {
 | 
			
		||||
            base.ExposeData();
 | 
			
		||||
            Scribe_Values.Look(ref resizingWasApplied, "wasApplied");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Used to resize the pawns genitalia. 
 | 
			
		||||
        /// All Logic should be put here: 
 | 
			
		||||
        /// 1. Filters for Gender
 | 
			
		||||
        /// 2. Filters for Genitalia Existance
 | 
			
		||||
        /// 2. Filters for Genitalia Existence
 | 
			
		||||
        /// 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, 
 | 
			
		||||
        /// I kept it intentionally broad, so that e.g. the Penis Resize can resize multiple penises and or futas, 
 | 
			
		||||
        /// while the breast-gene is female only. 
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public abstract void Resize();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,8 @@ namespace RJW_Genes
 | 
			
		|||
    /// 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). 
 | 
			
		||||
    /// 
 | 
			
		||||
    /// See `Gene_GenitaliaResizingGene` for a short summary of Issue #34. 
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [HarmonyPatch(typeof(Pawn_AgeTracker), "BirthdayBiological")]
 | 
			
		||||
    public class Patch_ResizingOnAdulthood
 | 
			
		||||
| 
						 | 
				
			
			@ -18,10 +20,10 @@ namespace RJW_Genes
 | 
			
		|||
            {
 | 
			
		||||
                foreach(Gene_GenitaliaResizingGene gene in GeneUtility.GetGenitaliaResizingGenes(___pawn))
 | 
			
		||||
                {
 | 
			
		||||
                    if (!gene.WasApplied)
 | 
			
		||||
                    if (!gene.ResizingWasApplied)
 | 
			
		||||
                    {
 | 
			
		||||
                        gene.Resize();
 | 
			
		||||
                        gene.WasApplied = true;
 | 
			
		||||
                        gene.ResizingWasApplied = true;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue