2022-12-01 14:29:26 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using RimWorld;
|
|
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace RJW_BGS
|
|
|
|
|
{
|
2023-01-15 16:48:11 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// This Patch is applied to change the normal pregnancy to add animal-inheritance.
|
|
|
|
|
/// If the settings allow animal gene inheritance,
|
|
|
|
|
/// the genes are determined and "simply added".
|
|
|
|
|
/// </summary>
|
2022-12-01 14:29:26 +00:00
|
|
|
|
[HarmonyPatch(typeof(PregnancyUtility), "GetInheritedGeneSet", new Type[]
|
|
|
|
|
{
|
|
|
|
|
typeof(Pawn),
|
|
|
|
|
typeof(Pawn),
|
|
|
|
|
//typeof(bool)
|
|
|
|
|
}
|
|
|
|
|
)]
|
|
|
|
|
public static class PatchVanillaPregnancyUtility
|
|
|
|
|
{
|
|
|
|
|
[HarmonyPostfix]
|
|
|
|
|
public static void AnimalInheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)
|
|
|
|
|
{
|
2023-01-15 16:48:11 +00:00
|
|
|
|
if (!RJW_BGSSettings.rjw_bgs_enabled)
|
2022-12-25 11:38:05 +00:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-12-01 14:29:26 +00:00
|
|
|
|
List<GeneDef> genes = InheritanceUtility.AnimalInheritedGenes(father, mother);
|
|
|
|
|
if (genes.Any())
|
|
|
|
|
{
|
|
|
|
|
foreach (GeneDef gene in genes)
|
|
|
|
|
{
|
|
|
|
|
__result.AddGene(gene);
|
|
|
|
|
}
|
2023-01-06 12:52:04 +00:00
|
|
|
|
}
|
2022-12-01 14:29:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|