remove recreated items from reordered list
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using EFT.UI.DragAndDrop;
|
||||
using EFT.InventoryLogic;
|
||||
using EFT.UI.DragAndDrop;
|
||||
using HarmonyLib;
|
||||
using SPT.Reflection.Patching;
|
||||
using System;
|
||||
@@ -9,6 +10,16 @@ using UnityEngine;
|
||||
|
||||
namespace UIFixes
|
||||
{
|
||||
public static class ReorderGridsPatches
|
||||
{
|
||||
private static readonly HashSet<string> ReorderedItems = [];
|
||||
|
||||
public static void Enable()
|
||||
{
|
||||
new ReorderGridsPatch().Enable();
|
||||
new ItemCreationPatch().Enable();
|
||||
}
|
||||
|
||||
/* There are 3 cases to handle in TemplatedGridsView.Show
|
||||
* 1. An item is shown for the first time
|
||||
* - It renders on its own, and the UI is correct
|
||||
@@ -20,7 +31,6 @@ namespace UIFixes
|
||||
*/
|
||||
public class ReorderGridsPatch : ModulePatch
|
||||
{
|
||||
private static readonly HashSet<string> ReorderedItems = [];
|
||||
private static readonly Dictionary<string, int[]> GridMaps = [];
|
||||
|
||||
protected override MethodBase GetTargetMethod()
|
||||
@@ -162,4 +172,19 @@ namespace UIFixes
|
||||
|
||||
public class SortedMarker : MonoBehaviour { }
|
||||
}
|
||||
|
||||
public class ItemCreationPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Constructor(typeof(Item), [typeof(string), typeof(ItemTemplate)]);
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
public static void Postfix(string id)
|
||||
{
|
||||
ReorderedItems.Remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user