2022-12-01 14:29:26 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using RimWorld;
|
|
|
|
|
using Verse;
|
|
|
|
|
using rjw;
|
|
|
|
|
|
|
|
|
|
namespace RJW_BGS
|
|
|
|
|
{
|
|
|
|
|
[HarmonyPatch(typeof(Hediff_BasePregnancy), "Initialize")]
|
2023-01-22 08:06:28 +00:00
|
|
|
|
public static class Patch_RJW_BestialityPregnancyUtility
|
2022-12-01 14:29:26 +00:00
|
|
|
|
{
|
|
|
|
|
[HarmonyPostfix]
|
|
|
|
|
public static void AddGenes(Pawn mother, Pawn dad, ref Hediff_BasePregnancy __instance)
|
|
|
|
|
{
|
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
|
|
|
|
foreach (Pawn baby in __instance.babies)
|
|
|
|
|
{
|
|
|
|
|
if (baby.RaceProps.Humanlike)
|
|
|
|
|
{
|
|
|
|
|
if (baby.genes == null)
|
|
|
|
|
{
|
|
|
|
|
baby.genes = new Pawn_GeneTracker(baby);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 10:43:18 +00:00
|
|
|
|
|
2022-12-01 14:29:26 +00:00
|
|
|
|
//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]);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 10:43:18 +00:00
|
|
|
|
List<GeneDef> humangenes = PregnancyUtility.GetInheritedGenes(dad, mother);
|
2022-12-01 14:29:26 +00:00
|
|
|
|
List<GeneDef> beastgenes = InheritanceUtility.AnimalInheritedGenes(dad, mother);
|
|
|
|
|
InheritanceUtility.AddGenes(baby, beastgenes);
|
2023-01-06 10:43:18 +00:00
|
|
|
|
InheritanceUtility.AddGenes(baby, humangenes);
|
|
|
|
|
|
|
|
|
|
// The mix-breed babies should be labelled hybrids
|
|
|
|
|
baby.genes.hybrid = true;
|
|
|
|
|
baby.genes.xenotypeName = "Hybrid";
|
2022-12-01 14:29:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|