|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Text; |
| 5 | +using System.Threading.Tasks; |
| 6 | +using Harmony; |
| 7 | +using System.Reflection; |
| 8 | +using MelonLoader; |
| 9 | +using UnityEngine; |
| 10 | + |
| 11 | +namespace SuperliminalPracticeMod |
| 12 | +{ |
| 13 | + public class SLPMod_Patcher |
| 14 | + { |
| 15 | + public static void Patch() |
| 16 | + { |
| 17 | + var harmony = HarmonyInstance.Create("com.harmonypatch.test"); |
| 18 | + harmony.PatchAll(Assembly.GetExecutingAssembly()); |
| 19 | + } |
| 20 | + } |
| 21 | + |
| 22 | + [HarmonyPatch(typeof(VendingMachine))] |
| 23 | + [HarmonyPatch("Start")] |
| 24 | + class VendingMachinePatch |
| 25 | + { |
| 26 | + static void Prefix(VendingMachine __instance) |
| 27 | + { |
| 28 | + MelonLogger.Log("VendingMachine.Start()"); |
| 29 | + __instance.HasInfinite = true; |
| 30 | + } |
| 31 | + } |
| 32 | + |
| 33 | + [HarmonyPatch(typeof(MOSTTriggerEnterCollider))] |
| 34 | + [HarmonyPatch("Start")] |
| 35 | + class TriggerEnterColliderPatch |
| 36 | + { |
| 37 | + static void Prefix(MOSTTriggerEnterCollider __instance) |
| 38 | + { |
| 39 | + Bounds bounds = __instance.gameObject.GetComponent<Collider>().bounds; |
| 40 | + GameObject gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube); |
| 41 | + gameObject.transform.position = bounds.center; |
| 42 | + gameObject.transform.localScale = bounds.extents * 2f; |
| 43 | + gameObject.GetComponent<BoxCollider>().enabled = false; |
| 44 | + MeshRenderer component = gameObject.GetComponent<MeshRenderer>(); |
| 45 | + component.material.shader = Shader.Find("Transparent/Diffuse"); |
| 46 | + component.GetComponent<MeshRenderer>().material.color = new Color(1f, 1f, 1f, 0.3f); |
| 47 | + gameObject.SetActive(false); |
| 48 | + PracticeModManager.Instance.AddTriggerGO(gameObject); |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | +} |
0 commit comments