From 37b9ba4034850778946d6097bca87b776c7296a9 Mon Sep 17 00:00:00 2001 From: Ed86 <email@email.com> Date: Mon, 24 Jun 2019 23:13:53 +0300 Subject: [PATCH] added operations support for all races, probably needs exclusion filters for mechanoids and stuff --- Source/Harmony/patch_races.cs | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Source/Harmony/patch_races.cs diff --git a/Source/Harmony/patch_races.cs b/Source/Harmony/patch_races.cs new file mode 100644 index 00000000..8bd1c71a --- /dev/null +++ b/Source/Harmony/patch_races.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using Harmony; +using RimWorld; +using Verse; +using System.Collections; + +namespace rjw +{ + /// <summary> + /// Patch all races into rjw genitals recipes + /// </summary> + + [StaticConstructorOnStartup] + public static class HarmonyPatches + { + static HarmonyPatches() + { + foreach (RecipeDef x in + DefDatabase<RecipeDef>.AllDefsListForReading.Where(x => x.IsSurgery && (x.targetsBodyPart || !x.appliedOnFixedBodyParts.NullOrEmpty()))) + { + try + { + if (x.appliedOnFixedBodyParts.Contains(DefDatabase<BodyPartDef>.GetNamed("Genitals")) + || x.appliedOnFixedBodyParts.Contains(DefDatabase<BodyPartDef>.GetNamed("Chest")) + || x.appliedOnFixedBodyParts.Contains(DefDatabase<BodyPartDef>.GetNamed("Anus")) + ) + + //Log.Message("2 " + x.defName); + foreach (ThingDef thingDef in DefDatabase<ThingDef>.AllDefs) + { + if (thingDef.race == null) + continue; + + //filter something? + //if (thingDef.race. == "Human") + // continue; + + if (!x.recipeUsers.Contains(thingDef)) + x.recipeUsers.Add(item: thingDef); + } + } + catch + { } + } + } + } +} -- GitLab