Minor cleanups in Animal Inheritance, Bestiality Babies are now Hybrids

This commit is contained in:
Vegapnk 2023-01-06 11:43:18 +01:00
parent aad8efa04e
commit 75891ca0b3
3 changed files with 25 additions and 44 deletions

View File

@ -1,38 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using rjw;
using Verse;
using RimWorld;
namespace RJW_BGS
{
[StaticConstructorOnStartup]
internal static class First
{
static First()
{
//RJWcopy.Racegroupdictbuilder();
//Prints all found race dicts (debugging only)
//logAllFoundRaceGroupGenes
}
private static void logAllFoundRaceGroupGenes()
{
foreach (RaceGroupDef def in DefDatabase<RaceGroupDef>.AllDefs)
{
Log.Message("defName = " + def.defName);
if (def.raceNames != null)
{
foreach (string race in def.raceNames)
{
Log.Message(race);
}
}
}
}
}
}

View File

@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using rjw;
namespace RJW_BGS
{
@ -115,5 +116,22 @@ namespace RJW_BGS
}
}
/// <summary>
/// Used only for debugging, to see what you loaded and how it looks.
/// </summary>
private static void logAllFoundRaceGroupGenes()
{
foreach (RaceGroupDef def in DefDatabase<RaceGroupDef>.AllDefs)
{
Log.Message("defName = " + def.defName);
if (def.raceNames != null)
{
foreach (string race in def.raceNames)
{
Log.Message(race);
}
}
}
}
}
}

View File

@ -25,20 +25,21 @@ namespace RJW_BGS
baby.genes = new Pawn_GeneTracker(baby);
}
//Remove the hair and skin genes pawns always start with, should get correct ones from human parent anyway.
for (int i = baby.genes.Endogenes.Count - 1; i >= 0; i--)
{
baby.genes.RemoveGene(baby.genes.Endogenes[i]);
}
List<GeneDef> genes = PregnancyUtility.GetInheritedGenes(dad, mother);
List<GeneDef> humangenes = PregnancyUtility.GetInheritedGenes(dad, mother);
List<GeneDef> beastgenes = InheritanceUtility.AnimalInheritedGenes(dad, mother);
InheritanceUtility.AddGenes(baby, beastgenes);
InheritanceUtility.AddGenes(baby, genes);
//foreach (GeneDef gene in genes)
//{
// baby.genes.AddGene(gene, false);
//}
InheritanceUtility.AddGenes(baby, humangenes);
// The mix-breed babies should be labelled hybrids
baby.genes.hybrid = true;
baby.genes.xenotypeName = "Hybrid";
}
}
}