-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSLPMod_Patcher.cs
More file actions
52 lines (48 loc) · 1.47 KB
/
SLPMod_Patcher.cs
File metadata and controls
52 lines (48 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Harmony;
using System.Reflection;
using MelonLoader;
using UnityEngine;
namespace SuperliminalPracticeMod
{
public class SLPMod_Patcher
{
public static void Patch()
{
var harmony = HarmonyInstance.Create("com.superliminalpracticemod.patch");
harmony.PatchAll(Assembly.GetExecutingAssembly());
}
}
[HarmonyPatch(typeof(VendingMachine))]
[HarmonyPatch("Start")]
class VendingMachinePatch
{
static void Prefix(VendingMachine __instance)
{
__instance.HasInfinite = true;
}
}
[HarmonyPatch(typeof(MOSTTriggerEnterCollider))]
[HarmonyPatch("Start")]
class TriggerEnterColliderPatch
{
static void Prefix(MOSTTriggerEnterCollider __instance)
{
Bounds bounds = __instance.gameObject.GetComponent<Collider>().bounds;
GameObject gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
gameObject.transform.position = bounds.center;
gameObject.transform.localScale = bounds.extents * 2f;
gameObject.transform.parent = __instance.gameObject.transform;
gameObject.GetComponent<BoxCollider>().enabled = false;
MeshRenderer component = gameObject.GetComponent<MeshRenderer>();
component.material.shader = Shader.Find("Transparent/Diffuse");
component.GetComponent<MeshRenderer>().material.color = new Color(1f, 1f, 1f, 0.3f);
gameObject.SetActive(false);
PracticeModManager.Instance.AddTriggerGO(gameObject);
}
}
}