mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2026-06-20 21:48:02 +00:00
42 lines
No EOL
1.4 KiB
C#
42 lines
No EOL
1.4 KiB
C#
using System.Reflection;
|
|
using ABI_RC.Core.InteractionSystem;
|
|
using HarmonyLib;
|
|
using MelonLoader;
|
|
|
|
namespace NAK.CustomSpawnPoint;
|
|
|
|
public class CustomSpawnPointMod : MelonMod
|
|
{
|
|
internal static MelonLogger.Instance Logger;
|
|
|
|
public override void OnInitializeMelon()
|
|
{
|
|
Logger = LoggerInstance;
|
|
|
|
SpawnPointManager.Init();
|
|
|
|
HarmonyInstance.Patch(
|
|
typeof(ViewManager).GetMethod(nameof(ViewManager.Start),
|
|
BindingFlags.NonPublic | BindingFlags.Instance),
|
|
postfix: new HarmonyMethod(typeof(CustomSpawnPointMod).GetMethod(nameof(OnViewManagerStart),
|
|
BindingFlags.NonPublic | BindingFlags.Static))
|
|
);
|
|
|
|
HarmonyInstance.Patch( // listen for world details page request
|
|
typeof(ViewManager).GetMethod(nameof(ViewManager.RequestWorldDetailsPage),
|
|
BindingFlags.Public | BindingFlags.Instance),
|
|
postfix: new HarmonyMethod(typeof(CustomSpawnPointMod).GetMethod(nameof(OnRequestWorldDetailsPage),
|
|
BindingFlags.NonPublic | BindingFlags.Static))
|
|
);
|
|
}
|
|
|
|
private static void OnViewManagerStart()
|
|
{
|
|
SpawnPointManager.OnViewManagerStart();
|
|
}
|
|
|
|
private static void OnRequestWorldDetailsPage(string worldId)
|
|
{
|
|
SpawnPointManager.OnRequestWorldDetailsPage(worldId);
|
|
}
|
|
} |