rjw-rbse/Source/Main.cs

85 lines
3.5 KiB
C#

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<ThingDef>.GetNamed("FabricationBench");
// //EPOE bench
// var bio_ben = DefDatabase<ThingDef>.GetNamed("TableBionics", false);
// //RBSE benches
// var rbse_bio = DefDatabase<ThingDef>.GetNamed("BionicWorkbench", false);
// var rbse_adv = DefDatabase<ThingDef>.GetNamed("AdvancedMedicalStation", false);
// // Remove existing Bionic recipes
// (bio_ben ?? fab_ben).AllRecipes.Remove(DefDatabase<RecipeDef>.GetNamed("MakeBionicAnus"));
// (bio_ben ?? fab_ben).AllRecipes.Remove(DefDatabase<RecipeDef>.GetNamed("MakeBionicBreasts"));
// (bio_ben ?? fab_ben).AllRecipes.Remove(DefDatabase<RecipeDef>.GetNamed("MakeBionicPenis"));
// (bio_ben ?? fab_ben).AllRecipes.Remove(DefDatabase<RecipeDef>.GetNamed("MakeBionicVagina"));
// // Add recipes to RBSE bionics bench
// rbse_bio.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeBionicAnus"));
// rbse_bio.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeBionicBreasts"));
// rbse_bio.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeBionicPenis"));
// rbse_bio.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeBionicVagina"));
// // Add recipes to RBSE Advanced Medical bench
// // rbse_adv.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeAdvancedBionicJaw"));
// // rbse_adv.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeSyntheticUterus"));
// // rbse_adv.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeSyntheticTesticles"));
// // rbse_adv.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeAdvancedBionicPenis"));
// // rbse_adv.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeAdvancedBionicVagina"));
// // rbse_adv.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeAdvancedBionicBreasts"));
// // rbse_adv.AllRecipes.Add(DefDatabase<RecipeDef>.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());
}
}
}