From ea423b7346652202fb060273286a1ce370fd67d1 Mon Sep 17 00:00:00 2001 From: Sn1p3rr3c0n Date: Thu, 25 Jul 2024 20:14:48 +0200 Subject: [PATCH] #757 added support for Research Tree (Continued) --- .../Common/PRF_CustomizeDefs.cs | 34 ++++++++++--------- .../Common/ProjectRimFactory_ModComponent.cs | 15 ++++++++ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs b/Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs index eeb68b2f..f04ca4fc 100644 --- a/Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs +++ b/Source/ProjectRimFactory/Common/PRF_CustomizeDefs.cs @@ -116,19 +116,28 @@ public static void ToggleLiteMode(bool remove = true) ArchitectMenu_ClearCache(); - if (ProjectRimFactory_ModComponent.ModSupport_ReserchPal) - { - ProjectRimFactory_ModComponent.ModSupport_ReserchPal_ResetLayout.Invoke(null, null); - } - else if (ProjectRimFactory_ModComponent.ModSupport_ReserchPowl) - { - ProjectRimFactory_ModComponent.ModSupport_ReserchPowl_ResetLayout.Invoke(null, null); - } + ModSupportResetLayout(); } + } + + private static void ModSupportResetLayout() + { + if (ProjectRimFactory_ModComponent.ModSupport_ReserchPal) + { + ProjectRimFactory_ModComponent.ModSupport_ReserchPal_ResetLayout.Invoke(null, null); + } + else if (ProjectRimFactory_ModComponent.ModSupport_ReserchPowl) + { + ProjectRimFactory_ModComponent.ModSupport_ReserchPowl_ResetLayout.Invoke(null, null); + } + else if (ProjectRimFactory_ModComponent.ModSupport_ResearchTreeContinued) + { + ProjectRimFactory_ModComponent.ModSupport_ResearchTreeContinued_ResetLayout.Invoke(null, [true]); + } } private static void clearRecipesCache() @@ -226,14 +235,7 @@ private static void resetResearchManager_progress() } if (Current.Game?.researchManager != null) SAL3.ReflectionUtility.ResearchManager_progress.SetValue(Current.Game.researchManager, progress); - if (ProjectRimFactory_ModComponent.ModSupport_ReserchPal) - { - ProjectRimFactory_ModComponent.ModSupport_ReserchPal_ResetLayout.Invoke(null, null); - } - else if (ProjectRimFactory_ModComponent.ModSupport_ReserchPowl) - { - ProjectRimFactory_ModComponent.ModSupport_ReserchPowl_ResetLayout.Invoke(null, null); - } + ModSupportResetLayout(); } diff --git a/Source/ProjectRimFactory/Common/ProjectRimFactory_ModComponent.cs b/Source/ProjectRimFactory/Common/ProjectRimFactory_ModComponent.cs index 5210f923..18ab387e 100644 --- a/Source/ProjectRimFactory/Common/ProjectRimFactory_ModComponent.cs +++ b/Source/ProjectRimFactory/Common/ProjectRimFactory_ModComponent.cs @@ -50,8 +50,10 @@ public ProjectRimFactory_ModComponent(ModContentPack content) : base(content) public static System.Reflection.MethodInfo ModSupport_ReserchPal_ResetLayout = null; public static System.Reflection.MethodInfo ModSupport_ReserchPowl_ResetLayout = null; + public static System.Reflection.MethodInfo ModSupport_ResearchTreeContinued_ResetLayout = null; public static bool ModSupport_ReserchPal = false; public static bool ModSupport_ReserchPowl = false; + public static bool ModSupport_ResearchTreeContinued = false; public static bool ModSupport_SeedsPlease = false; public static bool ModSupport_SeedsPleaseLite = false; @@ -141,7 +143,20 @@ private void LoadModSupport() { Log.Warning("Project Rimfactory - Failed to added Support for ResearchPowl when using Lite Mode"); } + }else if (ModLister.HasActiveModWithName("Research Tree (Continued)")) + { + ModSupport_ResearchTreeContinued_ResetLayout = AccessTools.Method("FluffyResearchTree.Tree:Reset"); + if (ModSupport_ResearchTreeContinued_ResetLayout != null) + { + Log.Message("Project Rimfactory - added Support for Research Tree (Continued) when using Lite Mode"); + ModSupport_ResearchTreeContinued = true; + } + else + { + Log.Warning("Project Rimfactory - Failed to added Support for Research Tree (Continued) when using Lite Mode"); + } } + if (ModLister.HasActiveModWithName("[KV] Save Storage, Outfit, Crafting, Drug, & Operation Settings [1.4]")) { //Get the Local Transpilers