mirror of
				https://github.com/Shabakur/RJW_Animal_Gene_Inheritance.git
				synced 2024-08-14 22:46:41 +00:00 
			
		
		
		
	Actually changed animal genes selection.
This commit is contained in:
		
							parent
							
								
									3d6c84f66f
								
							
						
					
					
						commit
						2cdde450a4
					
				
					 7 changed files with 24 additions and 39 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -11,7 +11,7 @@
 | 
			
		|||
		<raceNames>
 | 
			
		||||
			<li> </li>
 | 
			
		||||
		</raceNames>
 | 
			
		||||
		For more direct control you can use raceNames directly. 
 | 
			
		||||
		For more direct control you can use raceNames directly. Use the defName of the animal. Can also use modded animals.
 | 
			
		||||
		
 | 
			
		||||
		<pawnKindNames>
 | 
			
		||||
			<li> </li>
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +25,7 @@
 | 
			
		|||
		<genes>
 | 
			
		||||
			<li>Ears_Floppy</li>
 | 
			
		||||
		</genes>
 | 
			
		||||
		The genes which may be inherited.
 | 
			
		||||
		The genes which may be inherited. Use the defName of the gene, you can also add modded genes. 
 | 
			
		||||
		
 | 
			
		||||
		<genechances> 
 | 
			
		||||
			<li>0.9</li>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -12,51 +12,36 @@ namespace RJW_BGS
 | 
			
		|||
    {
 | 
			
		||||
        public static List<GeneDef> AnimalInheritedGenes(Pawn father, Pawn mother)
 | 
			
		||||
        {
 | 
			
		||||
            //One parent must be an animal and the other must be human, so only one needs to return
 | 
			
		||||
            List<GeneDef> genelist = new List<GeneDef>();
 | 
			
		||||
            if (father != null && !father.RaceProps.Humanlike)
 | 
			
		||||
            {
 | 
			
		||||
                PawnKindDef pawnKindDef = father.kindDef;
 | 
			
		||||
                RaceGeneDef raceGeneDef = RJWcopy.GetRaceGenDefInternal(pawnKindDef);
 | 
			
		||||
                if (raceGeneDef != null)
 | 
			
		||||
                {
 | 
			
		||||
                    GeneDef gene = null;
 | 
			
		||||
                    //In case you hit a modded gene not currently active try again.
 | 
			
		||||
                    for (int i = 0; i < 50 || gene == null; i++)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (raceGeneDef.genes.Any())
 | 
			
		||||
                        {
 | 
			
		||||
                          gene = DefDatabase<GeneDef>.GetNamed(raceGeneDef.genes.RandomElement());
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (gene != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        genelist.Add(gene);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return SelectGenes(father);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (mother != null && !mother.RaceProps.Humanlike)
 | 
			
		||||
            {
 | 
			
		||||
                PawnKindDef pawnKindDef = mother.kindDef;
 | 
			
		||||
                RaceGeneDef raceGeneDef = RJWcopy.GetRaceGenDefInternal(pawnKindDef);
 | 
			
		||||
                if (raceGeneDef != null)
 | 
			
		||||
                {
 | 
			
		||||
                    GeneDef gene = null;
 | 
			
		||||
                return SelectGenes(mother);
 | 
			
		||||
                //PawnKindDef pawnKindDef = mother.kindDef;
 | 
			
		||||
                //RaceGeneDef raceGeneDef = RJWcopy.GetRaceGenDefInternal(pawnKindDef);
 | 
			
		||||
                //if (raceGeneDef != null)
 | 
			
		||||
                //{
 | 
			
		||||
                //    GeneDef gene = null;
 | 
			
		||||
                    //In case you hit a modded gene not currently active try again.
 | 
			
		||||
                    for (int i = 0; i < 50 || gene == null; i++)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (raceGeneDef.genes.Any())
 | 
			
		||||
                        {
 | 
			
		||||
                            gene = DefDatabase<GeneDef>.GetNamed(raceGeneDef.genes.RandomElement());
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (gene != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        genelist.Add(gene);
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                    
 | 
			
		||||
                }
 | 
			
		||||
                //    for (int i = 0; i < 50 || gene == null; i++)
 | 
			
		||||
                //    {
 | 
			
		||||
                //        if (raceGeneDef.genes.Any())
 | 
			
		||||
                //        {
 | 
			
		||||
                //            gene = DefDatabase<GeneDef>.GetNamed(raceGeneDef.genes.RandomElement());
 | 
			
		||||
                //        }
 | 
			
		||||
                //    }
 | 
			
		||||
                //    if (gene != null)
 | 
			
		||||
                //    {
 | 
			
		||||
                //        genelist.Add(gene);
 | 
			
		||||
//
 | 
			
		||||
  //                  }
 | 
			
		||||
    //                
 | 
			
		||||
      //          }
 | 
			
		||||
            }
 | 
			
		||||
            return genelist;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue