mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
merge
This commit is contained in:
parent
951085ec59
commit
25008ce5dc
48 changed files with 2345 additions and 59 deletions
108
Source/Animal_Inheritance/Patches/BasePregnancyPatcher.cs
Normal file
108
Source/Animal_Inheritance/Patches/BasePregnancyPatcher.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
55
Source/Animal_Inheritance/Patches/PregnancyHelperPatcher.cs
Normal file
55
Source/Animal_Inheritance/Patches/PregnancyHelperPatcher.cs
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -30,6 +30,8 @@ namespace RJW_BGS
|
|||
listing_Standard.Gap(5f);
|
||||
listing_Standard.CheckboxLabeled("genes as xenogenes", ref rjw_bgs_animal_genes_as_xenogenes, "If toggled, animal genes will be added as xenogenes.", 0f, 1f);
|
||||
listing_Standard.Gap(5f);
|
||||
listing_Standard.CheckboxLabeled("enable VE genetics hybridation", ref rjw_bgs_VE_genetics, "If enabled and if you have VE genetics it will enable the hybridation system.", 0f, 1f);
|
||||
listing_Standard.Gap(5f);
|
||||
listing_Standard.CheckboxLabeled("detailed-debug", ref rjw_bgs_detailed_debug, "Adds detailed information to the log about pregnancies and genes.", 0f, 1f);
|
||||
listing_Standard.End();
|
||||
}
|
||||
|
@ -41,11 +43,13 @@ namespace RJW_BGS
|
|||
Scribe_Values.Look<float>(ref RJW_BGSSettings.rjw_bgs_global_gene_chance, "rjw_bgs_global_gene_chance", RJW_BGSSettings.rjw_bgs_global_gene_chance, true);
|
||||
Scribe_Values.Look<bool>(ref RJW_BGSSettings.rjw_bgs_animal_genes_as_xenogenes, "rjw_bgs_animal_genes_as_xenogenes", RJW_BGSSettings.rjw_bgs_animal_genes_as_xenogenes, true);
|
||||
Scribe_Values.Look<bool>(ref RJW_BGSSettings.rjw_bgs_detailed_debug, "rjw_bgs_detailed_debug", RJW_BGSSettings.rjw_bgs_detailed_debug, true);
|
||||
Scribe_Values.Look<bool>(ref RJW_BGSSettings.rjw_bgs_VE_genetics, "rjw_bgs_VE_genetics", RJW_BGSSettings.rjw_bgs_VE_genetics, true);
|
||||
}
|
||||
|
||||
public static float rjw_bgs_global_gene_chance = 1f;
|
||||
public static bool rjw_bgs_enabled = true;
|
||||
public static bool rjw_bgs_animal_genes_as_xenogenes = false;
|
||||
public static bool rjw_bgs_detailed_debug = false;
|
||||
public static bool rjw_bgs_VE_genetics = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue