Skip to content

Commit b29d762

Browse files
Updated Cam Event Toggle behavior
1 parent 376d9dd commit b29d762

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

DebugHUD.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public NPCCache(string npc, TextAsset asset)
5050
// Noclip mode
5151
LayerMask origMask;
5252
float origGrav;
53-
public static bool NoClipActive { get; private set; } = false;
53+
public bool NoClipActive { get; private set; } = false;
5454

5555
// UI constants
5656
static readonly string[] costumeNames = { "Noid", "Green", "Sanic", "Cappy" };
@@ -69,6 +69,7 @@ public NPCCache(string npc, TextAsset asset)
6969
bool deathPlaneStatus = true;
7070
bool collisionRenderFlag = false;
7171
bool talkVolumeRenderFlag = false;
72+
public bool CamEventReset { get; private set; } = false;
7273

7374
public void Awake()
7475
{
@@ -456,10 +457,7 @@ public void Update()
456457

457458
if (Input.GetKeyDown(KeyCode.F8) || Input.GetKeyDown(KeyCode.Keypad8))
458459
{
459-
foreach (var e in FindObjectsOfType<HiddenPlatform>())
460-
{
461-
if (!e.cameraActive) e.flag = false;
462-
}
460+
CamEventReset = !CamEventReset;
463461
}
464462

465463
deltaTime += (Time.unscaledDeltaTime - deltaTime) * 0.1f;
@@ -474,11 +472,11 @@ public void Update()
474472
textBuilder.Append("<F5>: Text Storage/Warp\n");
475473
textBuilder.AppendFormat("<F6>: VSync Count :{0}\n", QualitySettings.vSyncCount);
476474
textBuilder.AppendFormat("<F7><L>: Level Load: {0}\n", !inVoid ? "void" : levelNames[currentLvlIdx]);
477-
textBuilder.Append("<F8>: Reset Camera Events\n");
478-
textBuilder.Append("<K>: Get All Keys\n");
475+
textBuilder.AppendFormat("<F8>: Repeat Cam Events: {0}\n", OnOffStr(CamEventReset));
479476
textBuilder.Append("<V>: Render Death Planes: ").AppendLine(OnOffStr(collisionRenderFlag));
480477
textBuilder.Append("<M>: Active Death Planes: ").AppendLine(OnOffStr(deathPlaneStatus));
481478
textBuilder.Append("<G>: Show NPC Talk Zone: ").AppendLine(OnOffStr(talkVolumeRenderFlag));
479+
textBuilder.Append("<K>: Get All Keys\n");
482480
textBuilder.Append("<R><noparse><B></noparse>: Warp Cam Move/Toggle\n");
483481
textBuilder.Append("<N>: Set Obj Transparent\n");
484482
textBuilder.Append("<T>: NoClip: ").AppendLine(OnOffStr(NoClipActive));

DebugMod.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ namespace DebugMod
66
{
77
public class DebugMod : Mod
88
{
9-
private const string _modVersion = "8.0";
10-
private DebugHUD counter = null;
9+
private const string _modVersion = "8.2";
10+
private DebugHUD modHUD = null;
1111
private static GameObject go = null;
1212
private readonly Vector3 npcPos = new Vector3(926f, 44f, 364.7f);
1313
private float npcDistance = 0.0f;
@@ -19,19 +19,27 @@ public DebugMod() : base("DebugMod")
1919

2020
public override void Initialize()
2121
{
22+
go = new GameObject();
23+
modHUD = go.AddComponent<DebugHUD>();
24+
Object.DontDestroyOnLoad(go);
25+
2226
SceneManager.activeSceneChanged += OnSceneChange;
2327
ModHooks.Instance.OnParseScriptHook += Instance_OnParseScriptHook;
2428
On.PlayerMachine.Jump_SuperUpdate += PlayerMachine_Jump_SuperUpdate;
29+
On.HiddenPlatform.Activate += HiddenPlatform_Activate;
30+
}
2531

26-
go = new GameObject();
27-
counter = go.AddComponent<DebugHUD>();
28-
Object.DontDestroyOnLoad(go);
32+
private void HiddenPlatform_Activate(On.HiddenPlatform.orig_Activate orig, HiddenPlatform self)
33+
{
34+
bool temp = self.flag;
35+
orig(self);
36+
if (modHUD.CamEventReset && temp) self.flag = false;
2937
}
3038

3139
//For noclip fun
3240
private void PlayerMachine_Jump_SuperUpdate(On.PlayerMachine.orig_Jump_SuperUpdate orig, PlayerMachine self)
3341
{
34-
if(DebugHUD.NoClipActive)
42+
if (modHUD.NoClipActive)
3543
{
3644
self.Gravity = 0f;
3745
orig(self);
@@ -47,7 +55,7 @@ private void PlayerMachine_Jump_SuperUpdate(On.PlayerMachine.orig_Jump_SuperUpda
4755
}
4856
else
4957
{
50-
orig(self);
58+
orig(self);
5159
}
5260
}
5361

@@ -58,11 +66,11 @@ private void OnSceneChange(Scene oldScene, Scene newScene)
5866
var playerMachine = Manager.Player.GetComponent<PlayerMachine>();
5967
if (playerMachine)
6068
{
61-
counter.ToggleState(true, playerMachine);
69+
modHUD.ToggleState(true, playerMachine);
6270
}
6371
else
6472
{
65-
if (counter) counter.ToggleState(false, null);
73+
if (modHUD) modHUD.ToggleState(false, null);
6674
}
6775

6876
if (newScene.name == "void")

0 commit comments

Comments
 (0)