This commit is contained in:
Jaaldabaoth 2024-06-04 13:08:37 +02:00
parent 951085ec59
commit 25008ce5dc
48 changed files with 2345 additions and 59 deletions

View file

@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using UnityEngine;
using HarmonyLib;
using rjw;
namespace RJW_BGS
{
[HarmonyPatch(typeof(Hediff_BasePregnancy))]
public class BasePregnancyPatcher
{
public static List<string> racesgen1 = new List<string>()
{
"GR_Manbear",
"GR_Bearman",
"GR_Manalope",
"GR_Booman",
"GR_Manchicken",
"GR_Turkeyman",
"GR_Manffalo",
"GR_Muffaloman",
"GR_Manwolf",
"GR_Dogman",
"GR_Mancat",
"GR_Catman",
"GR_Mansquirrel",
"GR_Moleman",
"GR_Thrumboman",
"GR_Hurseman",
"GR_Manscarab",
"GR_Lizardman"
};
public static List<string> racesgen0 = new List<string>()
{
"Bear_Grizzly",
"Bear_Polar",
"Boomalope",
"Chicken",
"Duck",
"Turkey",
"Goose",
"Ostrich",
"Emu",
"Cassowary",
"Cow",
"Muffalo",
"Bison",
"Yak",
"Warg",
"Wolf_Timber",
"Wolf_Arctic",
"Fox_Fennec",
"Fox_Red",
"Fox_Arctic",
"Husky",
"LabradorRetriever",
"YorkshireTerrier",
"Cougar",
"Panther",
"Lynx",
"Cat",
"GuineaPig",
"Hare",
"Snowhare",
"Squirrel",
"Rat",
"Raccoon",
"Thrumbo",
"Dromedary",
"Elk",
"Horse",
"Caribou",
"Donkey",
"Megascarab",
"Spelopede",
"Megaspider",
"Iguana",
"Cobra",
"Tortoise"
};
public static HediffDef controler = DefDatabase<HediffDef>.GetNamed("RJWGenes_AnimalControlHediff", true);
[HarmonyPostfix]
[HarmonyPatch("GenerateBabies")]
public static void addHedif (Hediff_BasePregnancy __instance)
{
if (controler == null) return;
foreach (Pawn p in __instance.babies)
{
if(p != null)
{
if (racesgen1.Contains(p.kindDef.race.defName))
{
p.health.AddHediff(controler);
}
}
}
}
}
}

View file

@ -0,0 +1,55 @@
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;
bool a = mother.IsHuman() && BasePregnancyPatcher.racesgen0.Contains(father.kindDef.race.defName);
bool b = mother.IsHuman() && BasePregnancyPatcher.racesgen1.Contains(father.kindDef.race.defName);
bool c = father.IsHuman() && BasePregnancyPatcher.racesgen0.Contains(mother.kindDef.race.defName);
bool d = father.IsHuman() && BasePregnancyPatcher.racesgen1.Contains(mother.kindDef.race.defName);
if (!(a || b||c|| d)) return true;
if (a)
{
Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, DnaGivingParent.Father);
return false;
}
else if (b)
{
ModLog.Message("preg hediffdefof PregnantHuman " + RimWorld.HediffDefOf.PregnantHuman);
PregnancyHelper.StartVanillaPregnancy(mother, father);
return false;
}
else if (c)
{
Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, DnaGivingParent.Mother);
return false;
}
else if (d)
{
Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, DnaGivingParent.Father);
return false;
}
return true;
}
}
}