make stack sort optional

This commit is contained in:
Tyfon
2024-07-14 21:42:22 -07:00
parent a295795198
commit 8d173b9f11
2 changed files with 15 additions and 0 deletions

View File

@@ -74,6 +74,11 @@ public static class SortPatches
[PatchPrefix] [PatchPrefix]
public static bool Prefix(GridSortPanel __instance, LootItemClass ___lootItemClass, InventoryControllerClass ___inventoryControllerClass) public static bool Prefix(GridSortPanel __instance, LootItemClass ___lootItemClass, InventoryControllerClass ___inventoryControllerClass)
{ {
if (!Settings.StackBeforeSort.Value)
{
return true;
}
Sort(__instance, ___lootItemClass, ___inventoryControllerClass).HandleExceptions(); Sort(__instance, ___lootItemClass, ___inventoryControllerClass).HandleExceptions();
return false; return false;
} }

View File

@@ -85,6 +85,7 @@ internal class Settings
public static ConfigEntry<bool> ReorderGrids { get; set; } public static ConfigEntry<bool> ReorderGrids { get; set; }
public static ConfigEntry<bool> SynchronizeStashScrolling { get; set; } public static ConfigEntry<bool> SynchronizeStashScrolling { get; set; }
public static ConfigEntry<bool> GreedyStackMove { get; set; } public static ConfigEntry<bool> GreedyStackMove { get; set; }
public static ConfigEntry<bool> StackBeforeSort { get; set; }
public static ConfigEntry<bool> MergeFIRMoney { get; set; } public static ConfigEntry<bool> MergeFIRMoney { get; set; }
public static ConfigEntry<bool> MergeFIRAmmo { get; set; } public static ConfigEntry<bool> MergeFIRAmmo { get; set; }
public static ConfigEntry<bool> MergeFIROther { get; set; } public static ConfigEntry<bool> MergeFIROther { get; set; }
@@ -433,6 +434,15 @@ internal class Settings
null, null,
new ConfigurationManagerAttributes { }))); new ConfigurationManagerAttributes { })));
configEntries.Add(StackBeforeSort = config.Bind(
InventorySection,
"Combine Stacks Before Sorting",
true,
new ConfigDescription(
"When sorting containers, first combine stacks of the same type. This will not be undone if the sorting fails.",
null,
new ConfigurationManagerAttributes { })));
configEntries.Add(MergeFIRMoney = config.Bind( configEntries.Add(MergeFIRMoney = config.Bind(
InventorySection, InventorySection,
"Autostack Money with FiR Money", "Autostack Money with FiR Money",