From 64a319585a81e05dcf0a9e16ebcb9dff7d090209 Mon Sep 17 00:00:00 2001 From: Tetsu Date: Wed, 23 Mar 2022 02:18:32 -0400 Subject: [PATCH 1/2] Add option to clear last selected recipe from Crafting Interface --- CraftingGUI.cs | 2 +- MagicStorageConfig.cs | 7 +++++++ StoragePlayer.cs | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CraftingGUI.cs b/CraftingGUI.cs index 6cf092f5..d660012f 100644 --- a/CraftingGUI.cs +++ b/CraftingGUI.cs @@ -66,7 +66,7 @@ public static class CraftingGUI private static readonly Dictionary itemCounts = new Dictionary(); private static List recipes = new List(); private static List recipeAvailable = new List(); - private static Recipe selectedRecipe; + public static Recipe selectedRecipe; private static int numRows; private static int displayRows; private static bool slotFocus; diff --git a/MagicStorageConfig.cs b/MagicStorageConfig.cs index e0087d20..129beec0 100644 --- a/MagicStorageConfig.cs +++ b/MagicStorageConfig.cs @@ -35,6 +35,11 @@ public class MagicStorageConfig : ModConfig [DefaultValue(false)] public bool clearSearchText; + [Label("Clear selected item")] + [Tooltip("Enable to clear the last selected item when opening the UI")] + [DefaultValue(true)] + public bool clearSelectedItem; + [Label("Show estimated item dps")] [Tooltip("Enable to show the estimated dps of the item as a tooltip")] [DefaultValue(true)] @@ -52,6 +57,8 @@ public class MagicStorageConfig : ModConfig [JsonIgnore] public static bool ClearSearchText => Instance.clearSearchText; + [JsonIgnore] public static bool ClearSelectedItem => Instance.clearSelectedItem; + [JsonIgnore] public static bool ShowItemDps => Instance.showItemDps; public override ConfigScope Mode => ConfigScope.ClientSide; diff --git a/StoragePlayer.cs b/StoragePlayer.cs index a7e41cba..13bd3af2 100644 --- a/StoragePlayer.cs +++ b/StoragePlayer.cs @@ -138,6 +138,11 @@ public void OpenStorage(Point16 point, bool remote = false) CraftingGUI.searchBar?.Reset(); } + if (MagicStorageConfig.ClearSelectedItem) + { + CraftingGUI.selectedRecipe = null; + } + StorageGUI.RefreshItems(); } From 6e4bc5d34a8d250e46f17ec6be2f55ec147222f4 Mon Sep 17 00:00:00 2001 From: Tetsu Date: Wed, 23 Mar 2022 02:23:48 -0400 Subject: [PATCH 2/2] Add option to clear last selected recipe from Crafting Interface --- MagicStorageConfig.cs | 8 ++++---- StoragePlayer.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MagicStorageConfig.cs b/MagicStorageConfig.cs index 129beec0..d40188e4 100644 --- a/MagicStorageConfig.cs +++ b/MagicStorageConfig.cs @@ -35,10 +35,10 @@ public class MagicStorageConfig : ModConfig [DefaultValue(false)] public bool clearSearchText; - [Label("Clear selected item")] - [Tooltip("Enable to clear the last selected item when opening the UI")] + [Label("Clear selected recipe")] + [Tooltip("Enable to clear the last selected recipe when opening the Crafting Interface")] [DefaultValue(true)] - public bool clearSelectedItem; + public bool clearSelectedRecipe; [Label("Show estimated item dps")] [Tooltip("Enable to show the estimated dps of the item as a tooltip")] @@ -57,7 +57,7 @@ public class MagicStorageConfig : ModConfig [JsonIgnore] public static bool ClearSearchText => Instance.clearSearchText; - [JsonIgnore] public static bool ClearSelectedItem => Instance.clearSelectedItem; + [JsonIgnore] public static bool ClearSelectedRecipe => Instance.clearSelectedRecipe; [JsonIgnore] public static bool ShowItemDps => Instance.showItemDps; diff --git a/StoragePlayer.cs b/StoragePlayer.cs index 13bd3af2..8a65a662 100644 --- a/StoragePlayer.cs +++ b/StoragePlayer.cs @@ -138,7 +138,7 @@ public void OpenStorage(Point16 point, bool remote = false) CraftingGUI.searchBar?.Reset(); } - if (MagicStorageConfig.ClearSelectedItem) + if (MagicStorageConfig.ClearSelectedRecipe) { CraftingGUI.selectedRecipe = null; }