2024-06-04 11:08:37 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Verse;
|
|
|
|
|
using RJW_BGS;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using rjw;
|
|
|
|
|
using static rjw.Hediff_BasePregnancy;
|
|
|
|
|
|
|
|
|
|
namespace RJW_BGS
|
|
|
|
|
{
|
|
|
|
|
[HarmonyPatch(typeof(PregnancyHelper))]
|
|
|
|
|
public class PregnancyHelperPatcher
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
[HarmonyPrefix]
|
|
|
|
|
[HarmonyPatch("AddPregnancyHediff")]
|
|
|
|
|
public static bool AddPregnancyHediffPrefix(Pawn mother, Pawn father)
|
|
|
|
|
{
|
|
|
|
|
if (!RJW_BGSSettings.rjw_bgs_VE_genetics) return true;
|
|
|
|
|
if (mother == null || father == null) return true;
|
2024-06-04 15:01:30 +00:00
|
|
|
|
bool humanMotherAndSupportedAnimal = mother.IsHuman() && BasePregnancyPatcher.supportedInitialAnimalRaces.Contains(father.kindDef.race.defName);
|
|
|
|
|
bool humanMotherAndSupportedHybrid = mother.IsHuman() && BasePregnancyPatcher.supportedHybridRaces.Contains(father.kindDef.race.defName);
|
|
|
|
|
bool humanFatherAndSupportedAnimal = father.IsHuman() && BasePregnancyPatcher.supportedInitialAnimalRaces.Contains(mother.kindDef.race.defName);
|
|
|
|
|
bool humanFatherAndSupportedHybrid = father.IsHuman() && BasePregnancyPatcher.supportedHybridRaces.Contains(mother.kindDef.race.defName);
|
2024-06-04 11:08:37 +00:00
|
|
|
|
|
2024-06-04 14:44:50 +00:00
|
|
|
|
if (!(humanMotherAndSupportedAnimal || humanMotherAndSupportedHybrid||humanFatherAndSupportedAnimal|| humanFatherAndSupportedHybrid)) return true;
|
|
|
|
|
if (humanMotherAndSupportedAnimal)
|
2024-06-04 11:08:37 +00:00
|
|
|
|
{
|
|
|
|
|
Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, DnaGivingParent.Father);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2024-06-04 14:44:50 +00:00
|
|
|
|
else if (humanMotherAndSupportedHybrid)
|
2024-06-04 11:08:37 +00:00
|
|
|
|
{
|
|
|
|
|
ModLog.Message("preg hediffdefof PregnantHuman " + RimWorld.HediffDefOf.PregnantHuman);
|
|
|
|
|
PregnancyHelper.StartVanillaPregnancy(mother, father);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2024-06-04 14:44:50 +00:00
|
|
|
|
else if (humanFatherAndSupportedAnimal)
|
2024-06-04 11:08:37 +00:00
|
|
|
|
{
|
|
|
|
|
Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, DnaGivingParent.Mother);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2024-06-04 14:44:50 +00:00
|
|
|
|
else if (humanFatherAndSupportedHybrid)
|
2024-06-04 11:08:37 +00:00
|
|
|
|
{
|
|
|
|
|
Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, DnaGivingParent.Father);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|