using HarmonyLib; using rjw; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Rules.PartKindUsageRules; using rjw.Modules.Shared.Logs; using System.Collections.Generic; using System.Reflection; using Verse; namespace RJW_Menstruation { [StaticConstructorOnStartup] internal static class First { static First() { Harmony har = new Harmony("RJW_Menstruation"); har.PatchAll(Assembly.GetExecutingAssembly()); if (ModsConfig.IsActive("erdelf.HumanoidAlienRaces")) // Don't use the cached in Configurations, it isn't initialized yet { har.Patch(GenTypes.GetTypeInAnyAssembly("AlienRace.HarmonyPatches").GetMethod(nameof(AlienRace.HarmonyPatches.BirthOutcomeMultiplier)), postfix: new HarmonyMethod(typeof(HAR_LitterSize_Undo).GetMethod(nameof(HAR_LitterSize_Undo.Postfix)))); } InjectIntoRjwInteractionServices(); } private static void InjectIntoRjwInteractionServices() { ILog log = LogManager.GetLogger("StaticConstructorOnStartup"); List partKindUsageRules = Unprivater.GetProtectedValue>("_partKindUsageRules", typeof(PartPreferenceDetectorService)); partKindUsageRules.Add(new Interactions.EstrusPartKindUsageRule()); log.Message("Added 1 rule to PartPreferenceDetectorService._partKindUsageRules"); } } }