using System; using System.Collections.Generic; using System.Reflection; using System.Linq; using HarmonyLib; using RimWorld; using Verse; namespace RJW_RBSE { [StaticConstructorOnStartup] internal static class Startup { //Quick check to see if an another mod is loaded. private static bool IsLoaded(string mod) { return LoadedModManager.RunningModsListForReading.Any(x => x.Name == mod); } private static void Fix_rjw_rbse_recipes() { //Log.Message("[RJW-RBSE] Startup::fix_recipes"); if (!IsLoaded("RimJobWorld")) { Log.Warning("[RJW-RBSE] RJW is not loaded!"); return; } if (!IsLoaded("Rah's Bionics and Surgery Expansion")) { Log.Warning("[RJW-RBSE] RBSE is not loaded!"); return; } //try //{ // //Vanilla bench // var fab_ben = DefDatabase.GetNamed("FabricationBench"); // //EPOE bench // var bio_ben = DefDatabase.GetNamed("TableBionics", false); // //RBSE benches // var rbse_bio = DefDatabase.GetNamed("BionicWorkbench", false); // var rbse_adv = DefDatabase.GetNamed("AdvancedMedicalStation", false); // // Remove existing Bionic recipes // (bio_ben ?? fab_ben).AllRecipes.Remove(DefDatabase.GetNamed("MakeBionicAnus")); // (bio_ben ?? fab_ben).AllRecipes.Remove(DefDatabase.GetNamed("MakeBionicBreasts")); // (bio_ben ?? fab_ben).AllRecipes.Remove(DefDatabase.GetNamed("MakeBionicPenis")); // (bio_ben ?? fab_ben).AllRecipes.Remove(DefDatabase.GetNamed("MakeBionicVagina")); // // Add recipes to RBSE bionics bench // rbse_bio.AllRecipes.Add(DefDatabase.GetNamed("MakeBionicAnus")); // rbse_bio.AllRecipes.Add(DefDatabase.GetNamed("MakeBionicBreasts")); // rbse_bio.AllRecipes.Add(DefDatabase.GetNamed("MakeBionicPenis")); // rbse_bio.AllRecipes.Add(DefDatabase.GetNamed("MakeBionicVagina")); // // Add recipes to RBSE Advanced Medical bench // // rbse_adv.AllRecipes.Add(DefDatabase.GetNamed("MakeAdvancedBionicJaw")); // // rbse_adv.AllRecipes.Add(DefDatabase.GetNamed("MakeSyntheticUterus")); // // rbse_adv.AllRecipes.Add(DefDatabase.GetNamed("MakeSyntheticTesticles")); // // rbse_adv.AllRecipes.Add(DefDatabase.GetNamed("MakeAdvancedBionicPenis")); // // rbse_adv.AllRecipes.Add(DefDatabase.GetNamed("MakeAdvancedBionicVagina")); // // rbse_adv.AllRecipes.Add(DefDatabase.GetNamed("MakeAdvancedBionicBreasts")); // // rbse_adv.AllRecipes.Add(DefDatabase.GetNamed("MakeAdvancedBionicAnus")); //} //catch //{ // Log.Warning("[RJW-RBSE] Unable to fix RJW/RBSE recipes."); //} } static Startup() { //Log.Message("[RJW-RBSE] Startup::Startup() called"); Fix_rjw_rbse_recipes(); var har = new Harmony("rjw-rbse"); har.PatchAll(Assembly.GetExecutingAssembly()); } } }