forked from pseudorandomhk/MiniDebug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMiniDebugMod.cs
53 lines (43 loc) · 1.74 KB
/
MiniDebugMod.cs
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
using System.Collections;
using GlobalEnums;
using Modding;
namespace MiniDebug
{
public class MiniDebugMod : Mod
{
public static MiniDebugMod Instance { get; private set; }
public override string Version => "0.1.4";
public MiniDebugMod() : base("Mini Debug")
{
Instance = this;
_ = MiniDebug.Instance;
On.SceneManager.DrawBlackBorders += KillBlackBorders;
On.GameManager.PauseGameToggle += PatchSuperslides;
}
public override float BeforeAdditiveLoad(string scene)
=> MiniDebug.Instance.LoadAdder;
private IEnumerator PatchSuperslides(On.GameManager.orig_PauseGameToggle orig, GameManager self)
{
// Check if the player is in a valid state to superslide
if (!MiniDebug.Instance.Superslides
|| PlayerData.instance.disablePause
|| self.gameState != GameState.PLAYING
|| !self.GetField<GameManager, bool>("timeSlowed"))
{
yield return orig(self);
yield break;
}
// Remove the freezeframe lock on pausing, reset recoil to ensure max speed
self.SetField("timeSlowed", false);
HeroController.instance.SetField("recoilSteps", 0);
// Pause the game to cause a superslide
yield return orig(self);
// Setting timeSlowed back to true causes the pause menu to be uncloseable
// The freezeframe that slowed time is definitely over by now
// orig_PauseGameToggle contains a large delay
}
private void KillBlackBorders(On.SceneManager.orig_DrawBlackBorders orig, SceneManager self)
{
}
}
}