Some documentation

This commit is contained in:
Vegapnk 2024-06-04 16:44:50 +02:00
parent 70f7ce1f7d
commit 710efc7d85
2 changed files with 20 additions and 46 deletions

View file

@ -14,7 +14,10 @@ namespace RJW_BGS
[HarmonyPatch(typeof(Hediff_BasePregnancy))]
public class BasePregnancyPatcher
{
public static List<string> racesgen1 = new List<string>()
/// <summary>
/// The supported races that are produced by Vanilla Genetics Expanded, that can lead to different offsprings when in Human - Animal Sex
/// </summary>
public static List<string> firstGenerationOffspringRaces = new List<string>()
{
"GR_Manbear",
"GR_Bearman",
@ -36,7 +39,10 @@ namespace RJW_BGS
"GR_Lizardman"
};
public static List<string> racesgen0 = new List<string>()
/// <summary>
/// The supported races that can produce Vanilla Genetics hybrids as Human - Animal Sex results.
/// </summary>
public static List<string> parentGenerationOffspringRaces = new List<string>()
{
"Bear_Grizzly",
"Bear_Polar",
@ -85,50 +91,18 @@ namespace RJW_BGS
"Tortoise"
};
//public static HediffDef controler = DefDatabase<HediffDef>.GetNamed("RJWGenes_AnimalControlHediff", true);
[HarmonyPostfix]
[HarmonyPatch("GenerateBabies")]
public static void AddComfortableWithHumansHediff (Hediff_BasePregnancy __instance)
{
//if (controler == null) return;
foreach (Pawn p in __instance.babies)
foreach (Pawn baby in __instance.babies)
{
if(p != null)
if (baby != null && firstGenerationOffspringRaces.Contains(baby.kindDef.race.defName))
{
if (racesgen1.Contains(p.kindDef.race.defName))
{
p.health.AddHediff(RJW_Genes.HediffDefOf.rjw_genes_animal_control_hediff);
}
baby.health.AddHediff(RJW_Genes.HediffDefOf.rjw_genes_animal_control_hediff);
}
}
}
}
}
/*
* Error Received on 04.06.2024
* Failed to find Verse.HediffDef named RJWGenes_AnimalControlHediff. There are 446 defs of this type loaded.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Log.Error_Patch1 (string)
Verse.DefDatabase`1<Verse.HediffDef>:GetNamed (string,bool)
RJW_BGS.BasePregnancyPatcher:.cctor ()
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:rjw.PregnancyHelper.AddPregnancyHediff_Patch1 (Verse.Pawn,Verse.Pawn)
rjw.PregnancyHelper:DoImpregnate (Verse.Pawn,Verse.Pawn)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:rjw.PregnancyHelper.impregnate_Patch1 (rjw.SexProps)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:rjw.JobDriver_Sex.Orgasm_Patch1 (rjw.JobDriver_Sex)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:rjw.JobDriver_Sex.SexTick_Patch2 (rjw.JobDriver_Sex,Verse.Pawn,Verse.Thing,bool,bool)
rjw.JobDriver_Mating/<>c__DisplayClass1_0:<MakeNewToils>b__5 ()
Verse.AI.JobDriver:DriverTick ()
Verse.AI.Pawn_JobTracker:JobTrackerTick ()
Verse.Pawn:Tick ()
Verse.TickList:Tick ()
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.TickManager.DoSingleTick_Patch2 (Verse.TickManager)
Verse.TickManager:TickManagerUpdate ()
Verse.Game:UpdatePlay ()
Verse.Root_Play:Update ()
*/

View file

@ -21,29 +21,29 @@ namespace RJW_BGS
{
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);
bool humanMotherAndSupportedAnimal = mother.IsHuman() && BasePregnancyPatcher.parentGenerationOffspringRaces.Contains(father.kindDef.race.defName);
bool humanMotherAndSupportedHybrid = mother.IsHuman() && BasePregnancyPatcher.firstGenerationOffspringRaces.Contains(father.kindDef.race.defName);
bool humanFatherAndSupportedAnimal = father.IsHuman() && BasePregnancyPatcher.parentGenerationOffspringRaces.Contains(mother.kindDef.race.defName);
bool humanFatherAndSupportedHybrid = father.IsHuman() && BasePregnancyPatcher.firstGenerationOffspringRaces.Contains(mother.kindDef.race.defName);
if (!(a || b||c|| d)) return true;
if (a)
if (!(humanMotherAndSupportedAnimal || humanMotherAndSupportedHybrid||humanFatherAndSupportedAnimal|| humanFatherAndSupportedHybrid)) return true;
if (humanMotherAndSupportedAnimal)
{
Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, DnaGivingParent.Father);
return false;
}
else if (b)
else if (humanMotherAndSupportedHybrid)
{
ModLog.Message("preg hediffdefof PregnantHuman " + RimWorld.HediffDefOf.PregnantHuman);
PregnancyHelper.StartVanillaPregnancy(mother, father);
return false;
}
else if (c)
else if (humanFatherAndSupportedAnimal)
{
Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, DnaGivingParent.Mother);
return false;
}
else if (d)
else if (humanFatherAndSupportedHybrid)
{
Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, DnaGivingParent.Father);
return false;