diff --git a/SCHIZO/Items/Gymbag/Gymbag.cs b/SCHIZO/Items/Gymbag/Gymbag.cs index f99f1a2b..0a24a841 100644 --- a/SCHIZO/Items/Gymbag/Gymbag.cs +++ b/SCHIZO/Items/Gymbag/Gymbag.cs @@ -13,6 +13,7 @@ public sealed class Gymbag : ClonePrefab TechType.QuantumLocker; #endif + public static readonly string GymbagStorageLabel = IS_BELOWZERO ? "QUANTUM GYMBAG" : "GYMBAG"; [SetsRequiredMembers] // ReSharper disable once ConvertToPrimaryConstructor public Gymbag(ModItem modItem) : base(modItem, CLONE_TARGET) @@ -24,7 +25,6 @@ protected override void ModifyClone(GameObject prefab) StorageContainer container = prefab.GetComponentInChildren(); container.width = 4; container.height = 4; - container.storageLabel = IS_BELOWZERO ? "Quantum Gymbag" : "Gymbag"; // todo: check if this works Renderer[] renderers = prefab.GetComponentsInChildren(); renderers.ForEach(r => r.gameObject.SetActive(false)); diff --git a/SCHIZO/Items/Gymbag/GymbagManager.cs b/SCHIZO/Items/Gymbag/GymbagManager.cs index be6005d8..b6dc5619 100644 --- a/SCHIZO/Items/Gymbag/GymbagManager.cs +++ b/SCHIZO/Items/Gymbag/GymbagManager.cs @@ -28,7 +28,6 @@ public void OnOpen(InventoryItem item) OpeningGymbag = true; pda.Close(); pda.isInUse = false; - OpeningGymbag = false; StorageContainer container = item.item.gameObject.GetComponentInChildren().storageContainer; container.Open(container.transform); @@ -47,6 +46,7 @@ public void OnOpen(InventoryItem item) } CoroutineHost.StartCoroutine(ResetCursor(cursorPosition)); + OpeningGymbag = false; } public uGUI_ItemIcon GetItemIcon(InventoryItem item) diff --git a/SCHIZO/Items/Gymbag/GymbagPatches.cs b/SCHIZO/Items/Gymbag/GymbagPatches.cs index 54021b32..e8cb191b 100644 --- a/SCHIZO/Items/Gymbag/GymbagPatches.cs +++ b/SCHIZO/Items/Gymbag/GymbagPatches.cs @@ -54,7 +54,7 @@ public static void ClearLastOpenedOnPDAClose() if (!opener) return; - if (opener.CurrentOpenedRootGymbag != null && !opener.OpeningGymbag) + if (opener.CurrentOpenedRootGymbag is { } && !opener.OpeningGymbag) { opener.GetItemIcon(opener.CurrentOpenedRootGymbag)?.SetChroma(1f); opener.CurrentOpenedRootGymbag.isEnabled = true; @@ -69,4 +69,19 @@ public static bool PreventRemovingOpenedGymbag(ItemsContainer __instance, ref bo if (__instance != Inventory.main.container) return true; return __result = pickupable != GymbagManager.Instance.CurrentOpenedRootGymbag?.item; } + + [HarmonyPatch(typeof(uGUI_InventoryTab), nameof(uGUI_InventoryTab.OnOpenPDA))] + [HarmonyPostfix] + public static void ModifyStorageLabel(uGUI_InventoryTab __instance) + { + GymbagManager opener = GymbagManager.Instance; + + if (!opener) return; + + if (opener.OpeningGymbag) + { + __instance.storageLabelKey = Gymbag.GymbagStorageLabel; + __instance.UpdateStorageLabelText(); + } + } }