Patch_PlayerScript_Interact.cs 557 B

12345678910111213141516171819202122232425262728
  1. using GadgetCore.API;
  2. using GadgetCore.Util;
  3. using HarmonyLib;
  4. using System;
  5. using System.Reflection;
  6. namespace LoopPortal.Patches
  7. {
  8. [HarmonyPatch(typeof(PlayerScript))]
  9. [HarmonyPatch("Interact")]
  10. [HarmonyGadget("LoopPortal")]
  11. public static class Patch_PlayerScript_Interact
  12. {
  13. [HarmonyPrefix]
  14. public static void Prefix(PlayerScript __instance, int id)
  15. {
  16. try
  17. {
  18. if (id == Core.npcId)
  19. {
  20. __instance.Portal(4);
  21. }
  22. }
  23. catch (Exception e) { Core.logger.LogConsole(e); }
  24. }
  25. }
  26. }