Skip to content

Commit

Permalink
resolve skill issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Govorunb committed Apr 25, 2024
1 parent 050a170 commit baceedb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion SCHIZO/Items/Gymbag/Gymbag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -24,7 +25,6 @@ protected override void ModifyClone(GameObject prefab)
StorageContainer container = prefab.GetComponentInChildren<StorageContainer>();
container.width = 4;
container.height = 4;
container.storageLabel = IS_BELOWZERO ? "Quantum Gymbag" : "Gymbag"; // todo: check if this works

Renderer[] renderers = prefab.GetComponentsInChildren<Renderer>();
renderers.ForEach(r => r.gameObject.SetActive(false));
Expand Down
2 changes: 1 addition & 1 deletion SCHIZO/Items/Gymbag/GymbagManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public void OnOpen(InventoryItem item)
OpeningGymbag = true;
pda.Close();
pda.isInUse = false;
OpeningGymbag = false;

StorageContainer container = item.item.gameObject.GetComponentInChildren<PickupableStorage>().storageContainer;
container.Open(container.transform);
Expand All @@ -47,6 +46,7 @@ public void OnOpen(InventoryItem item)
}

CoroutineHost.StartCoroutine(ResetCursor(cursorPosition));
OpeningGymbag = false;
}

public uGUI_ItemIcon GetItemIcon(InventoryItem item)
Expand Down
17 changes: 16 additions & 1 deletion SCHIZO/Items/Gymbag/GymbagPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
}
}

0 comments on commit baceedb

Please sign in to comment.