-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugMod.cs
More file actions
126 lines (113 loc) · 4.16 KB
/
DebugMod.cs
File metadata and controls
126 lines (113 loc) · 4.16 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
using Pepperoni;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace DebugMod
{
public class DebugMod : Mod
{
private const string _modVersion = "8.2";
private DebugHUD modHUD = null;
private static GameObject go = null;
private readonly Vector3 npcPos = new Vector3(926f, 44f, 364.7f);
private float npcDistance = 0.0f;
public DebugMod() : base("DebugMod")
{
}
public override string GetVersion() => _modVersion;
public override void Initialize()
{
go = new GameObject();
modHUD = go.AddComponent<DebugHUD>();
Object.DontDestroyOnLoad(go);
SceneManager.activeSceneChanged += OnSceneChange;
ModHooks.Instance.OnParseScriptHook += Instance_OnParseScriptHook;
On.PlayerMachine.Jump_SuperUpdate += PlayerMachine_Jump_SuperUpdate;
On.HiddenPlatform.Activate += HiddenPlatform_Activate;
}
private void HiddenPlatform_Activate(On.HiddenPlatform.orig_Activate orig, HiddenPlatform self)
{
bool temp = self.flag;
orig(self);
if (modHUD.CamEventReset && temp) self.flag = false;
}
//For noclip fun
private void PlayerMachine_Jump_SuperUpdate(On.PlayerMachine.orig_Jump_SuperUpdate orig, PlayerMachine self)
{
if (modHUD.NoClipActive)
{
self.Gravity = 0f;
orig(self);
self.VerticalVelocity = Vector3.zero;
if (Kueido.Input.Jump.Held)
{
self.transform.position += self.controller.up / 8;
}
else if (Input.GetKey(KeyCode.LeftControl))
{
self.transform.position -= self.controller.up / 8;
}
}
else
{
orig(self);
}
}
private void OnSceneChange(Scene oldScene, Scene newScene)
{
var playerMachine = Manager.Player.GetComponent<PlayerMachine>();
if (playerMachine)
{
modHUD.ToggleState(true, playerMachine);
}
else
{
if (modHUD) modHUD.ToggleState(false, null);
}
if (newScene.name == "void")
{
Basic_NPC spectralNpc = null;
var npcs = Object.FindObjectsOfType<Basic_NPC>();
foreach (var npc in npcs)
{
var textAsset = npc.GetComponentInChildren<TalkVolume>().Dialogue;
if (DialogueUtils.GetNPCName(textAsset.text) == "Oleia")
{
spectralNpc = npc;
var collider = npc.GetComponentInChildren<Collider>();
if (collider)
{
npcDistance = collider.bounds.size.x;
}
break;
}
}
if (spectralNpc != null)
{
LogDebug("Found Spectral!");
Object.Instantiate(spectralNpc, npcPos, Quaternion.identity);
}
}
}
private string Instance_OnParseScriptHook(string text)
{
string output = text;
switch (DialogueUtils.GetNPCName(text))
{
case "Oleia":
var playerPos = Manager.Player.GetComponent<PlayerMachine>().transform.position;
if (SceneManager.GetActiveScene().name == "void" &&
Vector3.Distance(npcPos, playerPos) <= npcDistance)
{
output =
"%n10%v0%\r\nSpectral\r\n" +
"%m1%Run%p11% %m0%%s.1%A%p8%l%p9%l %p10%%m1%N%p15%P%p16%Cs%p17%%sD%%p10%!\r\n\r\n%n\r\n";
}
break;
case "Denise":
output = text.Replace(@"%v14", @"%v6");
break;
}
return output;
}
}
}