From af76512cf497efd13df8849fda3ef86a897adfbb Mon Sep 17 00:00:00 2001 From: Jadis0x <49281043+jadis0x@users.noreply.github.com> Date: Sun, 23 Jun 2024 22:35:02 +0300 Subject: [PATCH] Add IsSequencePlaying helper function and enable NolanBehaviour in the lobby --- lib/private/ClientHelper.cpp | 15 +++++++++++++++ lib/public/ClientHelper.h | 1 + user/main.cpp | 12 +++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/private/ClientHelper.cpp b/lib/private/ClientHelper.cpp index 0c3adee..6014198 100644 --- a/lib/private/ClientHelper.cpp +++ b/lib/private/ClientHelper.cpp @@ -67,6 +67,21 @@ bool IsInGame() return false; } +bool IsSequencePlaying() +{ + app::Survival* survival = Object::FindObjectOfType("Survival"); + + // Return false if the object was not found. + if (survival == nullptr) return false; + + bool isEndingPlaying = app::Survival_IsEndingPlaying(survival, nullptr); + bool isJumpScarePlaying = app::Survival_IsJumpScarePlaying(survival, nullptr); + bool isStartingToPlayFailEnding = app::Survival_StartingToPlayFailEnding(survival, nullptr); + + // Return true if any sequence is playing. + return isEndingPlaying || isJumpScarePlaying || isStartingToPlayFailEnding; +} + app::GameObject* GetAzazel(app::Survival* survival) { app::GameObject* ai = app::Survival_GetAzazel(survival, nullptr); diff --git a/lib/public/ClientHelper.h b/lib/public/ClientHelper.h index 653c061..5b368d3 100644 --- a/lib/public/ClientHelper.h +++ b/lib/public/ClientHelper.h @@ -8,6 +8,7 @@ bool IsLocalPlayer(app::NolanBehaviour* player); bool IsPlayerCrawling(); bool IsPlayerCrawling(app::GameObject* go); bool IsInGame(); +bool IsSequencePlaying(); app::GameObject* GetAzazel(app::Survival* survival); diff --git a/user/main.cpp b/user/main.cpp index 8c5da4c..5a4a7ad 100644 --- a/user/main.cpp +++ b/user/main.cpp @@ -21,6 +21,7 @@ #include "utils/utils.hpp" #include "network/VersionControl.h" +#include "players/players.h" #define CLIENT_VERSION "4.1" @@ -146,8 +147,17 @@ void Run() if (GetAsyncKeyState(VK_END) & 0x8000 || should_unhook) break; + // enable "NolanBehaviour" in the lobby so the client can use fly mode + if (SceneName() == std::string("Menu")) { + if (Player::GetLocalPlayer() != nullptr) { + app::NolanBehaviour* nolan = Player::GetNolan(); + if (nolan != nullptr) { + if (!Object::Enabled(nolan)) Object::Enabled(nolan, true); + } + } + } - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + std::this_thread::sleep_for(std::chrono::milliseconds(3000)); } CreateThread(0, 0, EjectThread, 0, 0, 0); } \ No newline at end of file