mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Documenting Fertilin-Backup-Inheritance and minor cleanups
This commit is contained in:
		
							parent
							
								
									94a51be2f7
								
							
						
					
					
						commit
						0261ec87f8
					
				
					 4 changed files with 40 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -10,7 +10,7 @@
 | 
			
		|||
		<stages>
 | 
			
		||||
			<li>
 | 
			
		||||
				<label>cock eaten</label>
 | 
			
		||||
				<description>My cock was eaten directly of my body, I am devestated.</description>
 | 
			
		||||
				<description>My cock was eaten directly of my body, I am devestated. This is not what good head feels like. </description>
 | 
			
		||||
				<baseMoodEffect>-30</baseMoodEffect>
 | 
			
		||||
			</li>
 | 
			
		||||
		</stages>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -87,6 +87,7 @@ namespace RJW_Genes
 | 
			
		|||
		public static readonly GeneDef rjw_genes_drainer;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_seduce;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_paralysingkiss;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_cockeater;
 | 
			
		||||
 | 
			
		||||
		// Cosmetic
 | 
			
		||||
		public static readonly GeneDef rjw_genes_succubus_tail;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ namespace RJW_Genes
 | 
			
		|||
 | 
			
		||||
		protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
 | 
			
		||||
		{
 | 
			
		||||
			if (GeneUtility.HasLifeForce(pawn) && GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_cum_eater))
 | 
			
		||||
			if (GeneUtility.HasLifeForce(pawn) && GeneUtility.IsCumEater(pawn))
 | 
			
		||||
            {
 | 
			
		||||
				float num = ingested.stackCount * FERTILIN_PER_UNIT / 100;
 | 
			
		||||
				GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(pawn), num);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,15 +11,16 @@ namespace RJW_Genes
 | 
			
		|||
    /// This Patch is applied to add a absorption gene for fertilin if it has none, but it does have the fertilin gene
 | 
			
		||||
    /// First tries to get one from the parents else chooses one of them at random
 | 
			
		||||
    /// the genes are determined and "simply added". 
 | 
			
		||||
    /// 
 | 
			
		||||
    /// This fixes the potential problem that Pawns could inherit Fertilin, but no gene to gain Fertilin.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [HarmonyPatch(typeof(PregnancyUtility), "GetInheritedGeneSet", new Type[]
 | 
			
		||||
    {
 | 
			
		||||
        typeof(Pawn),
 | 
			
		||||
        typeof(Pawn),
 | 
			
		||||
        //typeof(bool)
 | 
			
		||||
        typeof(Pawn)
 | 
			
		||||
    }
 | 
			
		||||
    )]
 | 
			
		||||
    public static class PatchVanillaPregnancyFertilin
 | 
			
		||||
    public static class Patch_Vanilla_Inheritance_Fertilin
 | 
			
		||||
    {
 | 
			
		||||
        [HarmonyPostfix]
 | 
			
		||||
        public static void InheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)
 | 
			
		||||
| 
						 | 
				
			
			@ -27,36 +28,53 @@ namespace RJW_Genes
 | 
			
		|||
            //Also make a setting for this
 | 
			
		||||
            if (__result.GenesListForReading.Contains(GeneDefOf.rjw_genes_lifeforce))
 | 
			
		||||
            {
 | 
			
		||||
                List<GeneDef> gene_list = __result.GenesListForReading;
 | 
			
		||||
                List<GeneDef> babies_genes = __result.GenesListForReading;
 | 
			
		||||
 | 
			
		||||
                //If no absorption gene get one from the parents, else a random one
 | 
			
		||||
                if(!(gene_list.Contains(GeneDefOf.rjw_genes_drainer) || gene_list.Contains(GeneDefOf.rjw_genes_cum_eater) 
 | 
			
		||||
                    || gene_list.Contains(GeneDefOf.rjw_genes_vaginal_absorber) || gene_list.Contains(GeneDefOf.rjw_genes_anal_absorber)))
 | 
			
		||||
                //If there is no absorption gene get one from the parents, else a random one
 | 
			
		||||
                if(!Has_Fertilin_Source_Gene(babies_genes))
 | 
			
		||||
                {
 | 
			
		||||
                    List<GeneDef> absorption_genes_list = new List<GeneDef> { GeneDefOf.rjw_genes_drainer, GeneDefOf.rjw_genes_cum_eater
 | 
			
		||||
                        , GeneDefOf.rjw_genes_vaginal_absorber, GeneDefOf.rjw_genes_anal_absorber };
 | 
			
		||||
                    if (RJW_Genes_Settings.rjw_genes_detailed_debug)
 | 
			
		||||
                        ModLog.Message($"Child of ({father.Name};{mother.Name}) has Genes with LifeForce-Resource but no Source-Gene, adding one of parents random if possible or any random otherwise.");
 | 
			
		||||
                    // Gather Parents Source-Genes
 | 
			
		||||
                    List<GeneDef> absorption_genes_parents = new List<GeneDef>();
 | 
			
		||||
                    foreach (GeneDef geneDef in absorption_genes_list)
 | 
			
		||||
                    foreach (GeneDef geneDef in FertilinSourceGenes)
 | 
			
		||||
                    {
 | 
			
		||||
                        if(mother.genes != null && mother.genes.HasGene(geneDef))
 | 
			
		||||
                        {
 | 
			
		||||
                            absorption_genes_parents.Add(geneDef);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (father.genes != null && father.genes.HasGene(geneDef))
 | 
			
		||||
                        {
 | 
			
		||||
                            absorption_genes_parents.Add(geneDef);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    // Parents had Genes - Pick a random one of them 
 | 
			
		||||
                    if (!absorption_genes_parents.NullOrEmpty())
 | 
			
		||||
                    {
 | 
			
		||||
                        __result.AddGene(absorption_genes_parents.RandomElement());
 | 
			
		||||
                    }
 | 
			
		||||
                    // Create a fully random one for your little Cumfueled missbreed
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        __result.AddGene(absorption_genes_list.RandomElement());
 | 
			
		||||
                    }
 | 
			
		||||
                        __result.AddGene(FertilinSourceGenes.RandomElement());
 | 
			
		||||
                }
 | 
			
		||||
            }       
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static List<GeneDef> FertilinSourceGenes = new List<GeneDef>() {
 | 
			
		||||
            GeneDefOf.rjw_genes_drainer, 
 | 
			
		||||
            GeneDefOf.rjw_genes_cum_eater, 
 | 
			
		||||
            GeneDefOf.rjw_genes_vaginal_absorber,
 | 
			
		||||
            GeneDefOf.rjw_genes_anal_absorber, 
 | 
			
		||||
            GeneDefOf.rjw_genes_cockeater 
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        private static bool Has_Fertilin_Source_Gene(List<GeneDef> genes)
 | 
			
		||||
        {
 | 
			
		||||
            foreach (GeneDef gene in genes)
 | 
			
		||||
            {
 | 
			
		||||
                if (FertilinSourceGenes.Contains(gene))
 | 
			
		||||
                {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue