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/Healing/MainMenuControllerPatch.cs

45 lines
1.3 KiB
C#
Raw Normal View History

2024-05-21 19:10:17 +01:00
using SPT.Reflection.Patching;
using EFT.HealthSystem;
2023-03-03 18:52:31 +00:00
using System.Reflection;
using HarmonyLib;
2023-03-03 18:52:31 +00:00
2024-05-21 19:10:17 +01:00
namespace SPT.SinglePlayer.Patches.Healing
2023-03-03 18:52:31 +00:00
{
public class MainMenuControllerPatch : ModulePatch
{
static MainMenuControllerPatch()
{
_ = nameof(IHealthController.HydrationChangedEvent);
_ = nameof(MainMenuController.HealthController);
}
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_1));
2023-03-03 18:52:31 +00:00
}
[PatchPostfix]
private static void PatchPostfix(MainMenuController __instance)
{
var healthController = __instance.HealthController;
var listener = Utils.Healing.HealthListener.Instance;
if (healthController == null)
{
Logger.LogInfo("MainMenuControllerPatch() - healthController is null");
}
if (listener == null)
{
Logger.LogInfo("MainMenuControllerPatch() - listener is null");
}
if (healthController != null && listener != null)
{
listener.Init(healthController, false);
}
}
}
}