mirror of
				https://github.com/Shabakur/RJW_Animal_Gene_Inheritance.git
				synced 2024-08-14 22:46:41 +00:00 
			
		
		
		
	Fixed error in animal inheritance
This commit is contained in:
		
							parent
							
								
									3cc62ba818
								
							
						
					
					
						commit
						b8a5e64baf
					
				
					 13 changed files with 61 additions and 39 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<Defs>
 | 
			
		||||
	<RJW_BGS.RaceGeneDef>
 | 
			
		||||
	<RJW_BGS.RaceGeneDef Name = "Canine">
 | 
			
		||||
		<defName>Canine</defName> 
 | 
			
		||||
		<raceGroup>Canine_Group</raceGroup>
 | 
			
		||||
		<genes>
 | 
			
		||||
| 
						 | 
				
			
			@ -11,6 +11,19 @@
 | 
			
		|||
		</genechances> 
 | 
			
		||||
	</RJW_BGS.RaceGeneDef>
 | 
			
		||||
	
 | 
			
		||||
	<RJW_BGS.RaceGeneDef ParentName = "Canine">
 | 
			
		||||
		<defName>Warg</defName>
 | 
			
		||||
		<raceNames>
 | 
			
		||||
			<li>Warg</li>
 | 
			
		||||
		</raceNames>
 | 
			
		||||
		<genes>
 | 
			
		||||
			<li>DarkVision</li>
 | 
			
		||||
		</genes>
 | 
			
		||||
		<genechances> 
 | 
			
		||||
			<li>0.9</li>
 | 
			
		||||
		</genechances> 
 | 
			
		||||
	</RJW_BGS.RaceGeneDef>
 | 
			
		||||
	
 | 
			
		||||
	<RJW_BGS.RaceGeneDef>
 | 
			
		||||
		<defName>Insect</defName> 
 | 
			
		||||
		<raceGroup>Insect_Group</raceGroup>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -9,9 +9,9 @@ using RimWorld;
 | 
			
		|||
namespace RJW_BGS
 | 
			
		||||
{
 | 
			
		||||
    [StaticConstructorOnStartup]
 | 
			
		||||
    internal static class Class1
 | 
			
		||||
    internal static class First
 | 
			
		||||
    {
 | 
			
		||||
        static Class1()
 | 
			
		||||
        static First()
 | 
			
		||||
        {
 | 
			
		||||
            RJWcopy.Racegroupdictbuilder();
 | 
			
		||||
            //foreach (RaceGroupDef raceGroupDef2  in DefDatabase<RaceGroupDef>.AllDefs)      
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +57,7 @@
 | 
			
		|||
    </Reference>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Compile Include="Class1.cs" />
 | 
			
		||||
    <Compile Include="First.cs" />
 | 
			
		||||
    <Compile Include="Harmony_Init.cs" />
 | 
			
		||||
    <Compile Include="InheritanceUtility.cs" />
 | 
			
		||||
    <Compile Include="PatchRJWBestialityPregnancyUtility.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,6 +34,7 @@ namespace RJW_BGS
 | 
			
		|||
			return raceGroupDef != null;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//slightly modified code so it also works racegroupdefs
 | 
			
		||||
		public static RaceGroupDef GetRaceGroupDefInternal(PawnKindDef kindDef)
 | 
			
		||||
		{
 | 
			
		||||
			string raceName = kindDef.race.defName;
 | 
			
		||||
| 
						 | 
				
			
			@ -71,9 +72,14 @@ namespace RJW_BGS
 | 
			
		|||
 | 
			
		||||
		public static RaceGeneDef GetRaceGenDefInternal(PawnKindDef kindDef)
 | 
			
		||||
        {
 | 
			
		||||
			if (kindDef == null)
 | 
			
		||||
            {
 | 
			
		||||
				return null;
 | 
			
		||||
            }
 | 
			
		||||
			string raceName = kindDef.race.defName;
 | 
			
		||||
			string pawnKindName = kindDef.defName;
 | 
			
		||||
			string raceGroupName = GetRaceGroupDef(kindDef).defName;
 | 
			
		||||
			RaceGroupDef raceGroupDef = GetRaceGroupDef(kindDef);
 | 
			
		||||
			//string raceGroupName = GetRaceGroupDef(kindDef).defName;
 | 
			
		||||
			IEnumerable<RaceGeneDef> allDefs = DefDatabase<RaceGeneDef>.AllDefs;
 | 
			
		||||
			List<RaceGeneDef> list = allDefs.Where(delegate (RaceGeneDef group)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			@ -85,12 +91,15 @@ namespace RJW_BGS
 | 
			
		|||
				List<string> raceNames = group.raceNames;
 | 
			
		||||
				return raceNames != null && raceNames.Contains(raceName);
 | 
			
		||||
			}).ToList<RaceGeneDef>();
 | 
			
		||||
			List<RaceGeneDef> list3 = allDefs.Where(delegate (RaceGeneDef group)
 | 
			
		||||
			List<RaceGeneDef> list3 = new List<RaceGeneDef>();
 | 
			
		||||
			if (raceGroupDef != null)
 | 
			
		||||
			{
 | 
			
		||||
				String raceGroupDefName = group.raceGroup;
 | 
			
		||||
				return raceGroupDefName != null && raceGroupDefName == raceGroupName;
 | 
			
		||||
			}).ToList<RaceGeneDef>();
 | 
			
		||||
 | 
			
		||||
				list3 = allDefs.Where(delegate (RaceGeneDef group)
 | 
			
		||||
				{
 | 
			
		||||
					String raceGroupDefName = group.raceGroup;
 | 
			
		||||
					return raceGroupDefName != null && raceGroupDefName == raceGroupDef.defName;
 | 
			
		||||
				}).ToList<RaceGeneDef>();
 | 
			
		||||
			}
 | 
			
		||||
			RaceGeneDef result = null;
 | 
			
		||||
			//First check if there is a matching pawnkinddef then race, then racegroup
 | 
			
		||||
			if (list.Any())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
bbcef32adb57331bca8d9d64ae20e770e4ed1e71
 | 
			
		||||
0b0a8825bf7e783f74047adfd92c6a9898735e8c
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue