0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/SPT.SinglePlayer/Patches/MainMenu/RemoveStashUpgradeLabelPatch.cs
Lacyway d4c10c4765 Rework RemoveStashUpgradeLabelPatch (!162)
The `InventoryScreen` is part of the `CommonUI` which lives throughout the lifetime of the application. It should be safe to only delete this on `Awake()` rather than use `Find()` on a transform that has a fair bit of children every time the inventory screen is opened.
![image](/attachments/937a3954-210c-4fc7-a869-75458ae19d8d)
I cannot extract on 3.10 currently so need someone to just verify that it sticks after an extract where the menu is reloaded.

Co-authored-by: Lacyway <20912169+Lacyway@users.noreply.github.com>
Reviewed-on: SPT/Modules#162
Co-authored-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com>
Co-committed-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com>
2024-08-24 09:12:03 +00:00

28 lines
789 B
C#

using System.Reflection;
using EFT.UI;
using HarmonyLib;
using SPT.Reflection.Patching;
using UnityEngine;
namespace SPT.SinglePlayer.Patches.MainMenu;
/// <summary>
/// Remove Tooltip and image from stash screen explaining to visit external site for more stash - EFT thing
/// </summary>
public class RemoveStashUpgradeLabelPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(InventoryScreen).GetMethod(nameof(InventoryScreen.Awake));
}
[PatchPostfix]
public static void Postfix(SimpleStashPanel __instance)
{
GameObject externalObtain = __instance.transform.Find("Items Panel/Stash Panel/Simple Panel/Header/ExternalObtain").gameObject;
if (externalObtain != null)
{
Object.Destroy(externalObtain);
}
}
}