FertilinGeneInheritance Patch
Made patch the make it so babies will always have atleast one gene to absorb fertilin with,
This commit is contained in:
parent
49cdc09e5f
commit
90072b4036
Binary file not shown.
|
@ -28,7 +28,6 @@
|
|||
<li>rjw_genes_female_only</li>
|
||||
<li>rjw_genes_lifeforce</li>
|
||||
<li>rjw_genes_lifeforce_drain</li>
|
||||
<li>rjw_genes_cum_eater</li>
|
||||
<li>rjw_genes_vaginal_absorber</li>
|
||||
<li>rjw_genes_anal_absorber</li>
|
||||
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
/// <summary>
|
||||
/// This Patch is applied to add a absorption gene for fertilin if it has none, but it does have the fertilin gene
|
||||
/// First tries to get one from the parents else chooses one of them at random
|
||||
/// the genes are determined and "simply added".
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(PregnancyUtility), "GetInheritedGeneSet", new Type[]
|
||||
{
|
||||
typeof(Pawn),
|
||||
typeof(Pawn),
|
||||
//typeof(bool)
|
||||
}
|
||||
)]
|
||||
public static class PatchVanillaPregnancyFertilin
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
public static void InheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)
|
||||
{
|
||||
//Also make a setting for this
|
||||
if (__result.GenesListForReading.Contains(GeneDefOf.rjw_genes_lifeforce))
|
||||
{
|
||||
List<GeneDef> gene_list = __result.GenesListForReading;
|
||||
|
||||
//If no absorption gene get one from the parents, else a random one
|
||||
if(!(gene_list.Contains(GeneDefOf.rjw_genes_drainer) || gene_list.Contains(GeneDefOf.rjw_genes_cum_eater)
|
||||
|| gene_list.Contains(GeneDefOf.rjw_genes_vaginal_absorber) || gene_list.Contains(GeneDefOf.rjw_genes_anal_absorber)))
|
||||
{
|
||||
List<GeneDef> absorption_genes_list = new List<GeneDef> { GeneDefOf.rjw_genes_drainer, GeneDefOf.rjw_genes_cum_eater
|
||||
, GeneDefOf.rjw_genes_vaginal_absorber, GeneDefOf.rjw_genes_anal_absorber };
|
||||
List<GeneDef> absorption_genes_parents = new List<GeneDef>();
|
||||
foreach (GeneDef geneDef in absorption_genes_list)
|
||||
{
|
||||
if(mother.genes != null && mother.genes.HasGene(geneDef))
|
||||
{
|
||||
absorption_genes_parents.Add(geneDef);
|
||||
}
|
||||
if (father.genes != null && father.genes.HasGene(geneDef))
|
||||
{
|
||||
absorption_genes_parents.Add(geneDef);
|
||||
}
|
||||
}
|
||||
if (!absorption_genes_parents.NullOrEmpty())
|
||||
{
|
||||
__result.AddGene(absorption_genes_parents.RandomElement());
|
||||
}
|
||||
else
|
||||
{
|
||||
__result.AddGene(absorption_genes_list.RandomElement());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -141,6 +141,7 @@
|
|||
<Compile Include="Genes\Life_Force\LordJob_SuccubusVisit.cs" />
|
||||
<Compile Include="Genes\Life_Force\LordToil_Flirt.cs" />
|
||||
<Compile Include="Genes\Life_Force\Patch_SexTicks_ChangePsyfocus.cs" />
|
||||
<Compile Include="Genes\Life_Force\Patch_Vanilla_Inheritance_Fertilin.cs" />
|
||||
<Compile Include="Genes\Life_Force\ThinkNode_ConditionalCannotInteract.cs" />
|
||||
<Compile Include="Genes\Life_Force\ThinkNode_ConditionalLowLifeForce.cs" />
|
||||
<Compile Include="Genes\Life_Force\ThinkNode_ConditionalCritcalLifeForce.cs" />
|
||||
|
|
Loading…
Reference in New Issue