Actually changed animal genes selection.

This commit is contained in:
Shabakur 2022-11-30 14:26:47 +01:00
parent 3d6c84f66f
commit 2cdde450a4
7 changed files with 24 additions and 39 deletions

Binary file not shown.

View File

@ -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.

View File

@ -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.