mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Hardened Extra-Genitalia addition to check for existing items, should fix #19
This commit is contained in:
		
							parent
							
								
									c187765400
								
							
						
					
					
						commit
						87c7bad919
					
				
					 4 changed files with 103 additions and 0 deletions
				
			
		| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
using rjw;
 | 
					using rjw;
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJW_Genes
 | 
					namespace RJW_Genes
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -13,6 +14,13 @@ namespace RJW_Genes
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostMake();
 | 
					            base.PostMake();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Some sources add Genes before they fire, e.g. Character Editor
 | 
				
			||||||
 | 
					            // This should harden the gene, to solve #19
 | 
				
			||||||
 | 
					            if (HasAlreadyTwoAnus())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (additional_anus == null)
 | 
					            if (additional_anus == null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                CreateAndAddAnus();
 | 
					                CreateAndAddAnus();
 | 
				
			||||||
| 
						 | 
					@ -23,6 +31,13 @@ namespace RJW_Genes
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostAdd();
 | 
					            base.PostAdd();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Some sources add Genes before they fire, e.g. Character Editor
 | 
				
			||||||
 | 
					            // This should harden the gene, to solve #19
 | 
				
			||||||
 | 
					            if (HasAlreadyTwoAnus())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (additional_anus == null)
 | 
					            if (additional_anus == null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                CreateAndAddAnus();
 | 
					                CreateAndAddAnus();
 | 
				
			||||||
| 
						 | 
					@ -53,5 +68,15 @@ namespace RJW_Genes
 | 
				
			||||||
            pawn.health.AddHediff(additional_anus, partBPR);
 | 
					            pawn.health.AddHediff(additional_anus, partBPR);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        internal bool HasAlreadyTwoAnus()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (pawn == null)
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var possible_breasts =
 | 
				
			||||||
 | 
					                Genital_Helper.get_AllPartsHediffList(pawn).Where(t => Genital_Helper.is_anus(t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return possible_breasts.Count() >= 2;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
using rjw;
 | 
					using rjw;
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJW_Genes
 | 
					namespace RJW_Genes
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -13,6 +14,13 @@ namespace RJW_Genes
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostMake();
 | 
					            base.PostMake();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Some sources add Genes before they fire, e.g. Character Editor
 | 
				
			||||||
 | 
					            // This should harden the gene, to solve #19
 | 
				
			||||||
 | 
					            if (HasAlreadyTwoBreasts())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Tits are only added for female pawns!
 | 
					            // Tits are only added for female pawns!
 | 
				
			||||||
            if (GenderUtility.IsFemale(pawn) && additional_breasts == null)
 | 
					            if (GenderUtility.IsFemale(pawn) && additional_breasts == null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -24,6 +32,13 @@ namespace RJW_Genes
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostAdd();
 | 
					            base.PostAdd();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Some sources add Genes before they fire, e.g. Character Editor
 | 
				
			||||||
 | 
					            // This should harden the gene, to solve #19
 | 
				
			||||||
 | 
					            if (HasAlreadyTwoBreasts())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Tits are only added for female pawns!
 | 
					            // Tits are only added for female pawns!
 | 
				
			||||||
            if (GenderUtility.IsFemale(pawn) && additional_breasts == null)
 | 
					            if (GenderUtility.IsFemale(pawn) && additional_breasts == null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -55,5 +70,16 @@ namespace RJW_Genes
 | 
				
			||||||
            pawn.health.AddHediff(additional_breasts, partBPR);
 | 
					            pawn.health.AddHediff(additional_breasts, partBPR);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        internal bool HasAlreadyTwoBreasts()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (pawn == null)
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var possible_breasts = 
 | 
				
			||||||
 | 
					                Genital_Helper.get_AllPartsHediffList(pawn).Where(t => t.def.defName.Contains("breast"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return possible_breasts.Count() >= 2;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
using rjw;
 | 
					using rjw;
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJW_Genes
 | 
					namespace RJW_Genes
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -13,6 +14,13 @@ namespace RJW_Genes
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostMake();
 | 
					            base.PostMake();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Some sources add Genes before they fire, e.g. Character Editor
 | 
				
			||||||
 | 
					            // This should harden the gene, to solve #19
 | 
				
			||||||
 | 
					            if (HasAlreadyTwoPenis())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Penis are only added for male pawns!
 | 
					            // Penis are only added for male pawns!
 | 
				
			||||||
            if (GenderUtility.IsMale(pawn) && additional_penis == null)
 | 
					            if (GenderUtility.IsMale(pawn) && additional_penis == null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -24,6 +32,13 @@ namespace RJW_Genes
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostAdd();
 | 
					            base.PostAdd();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Some sources add Genes before they fire, e.g. Character Editor
 | 
				
			||||||
 | 
					            // This should harden the gene, to solve #19
 | 
				
			||||||
 | 
					            if (HasAlreadyTwoPenis())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Penis are only added for male pawns!
 | 
					            // Penis are only added for male pawns!
 | 
				
			||||||
            if (GenderUtility.IsMale(pawn) && additional_penis == null)
 | 
					            if (GenderUtility.IsMale(pawn) && additional_penis == null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -55,5 +70,17 @@ namespace RJW_Genes
 | 
				
			||||||
            pawn.health.AddHediff(additional_penis, partBPR);
 | 
					            pawn.health.AddHediff(additional_penis, partBPR);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        internal bool HasAlreadyTwoPenis()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (pawn == null)
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var possible_breasts =
 | 
				
			||||||
 | 
					                Genital_Helper.get_AllPartsHediffList(pawn).Where(t => Genital_Helper.is_penis(t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return possible_breasts.Count() >= 2;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
using rjw;
 | 
					using rjw;
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJW_Genes
 | 
					namespace RJW_Genes
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -18,6 +19,13 @@ namespace RJW_Genes
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostMake();
 | 
					            base.PostMake();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Some sources add Genes before they fire, e.g. Character Editor
 | 
				
			||||||
 | 
					            // This should harden the gene, to solve #19
 | 
				
			||||||
 | 
					            if (HasAlreadyTwoVaginas())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Vaginas are only added for female pawns!
 | 
					            // Vaginas are only added for female pawns!
 | 
				
			||||||
            if (GenderUtility.IsFemale(pawn) && additional_vagina == null)
 | 
					            if (GenderUtility.IsFemale(pawn) && additional_vagina == null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -29,6 +37,13 @@ namespace RJW_Genes
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostAdd();
 | 
					            base.PostAdd();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Some sources add Genes before they fire, e.g. Character Editor
 | 
				
			||||||
 | 
					            // This should harden the gene, to solve #19
 | 
				
			||||||
 | 
					            if (HasAlreadyTwoVaginas())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Vaginas are only added for female pawns!
 | 
					            // Vaginas are only added for female pawns!
 | 
				
			||||||
            if (GenderUtility.IsFemale(pawn) && additional_vagina == null)
 | 
					            if (GenderUtility.IsFemale(pawn) && additional_vagina == null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -60,5 +75,15 @@ namespace RJW_Genes
 | 
				
			||||||
            pawn.health.AddHediff(additional_vagina, partBPR);
 | 
					            pawn.health.AddHediff(additional_vagina, partBPR);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        internal bool HasAlreadyTwoVaginas()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (pawn == null)
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var possible_breasts =
 | 
				
			||||||
 | 
					                Genital_Helper.get_AllPartsHediffList(pawn).Where(t => Genital_Helper.is_vagina(t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return possible_breasts.Count() >= 2;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue