Skip to content

Commit

Permalink
Add IsSequencePlaying helper function and enable NolanBehaviour in th…
Browse files Browse the repository at this point in the history
…e lobby
  • Loading branch information
jadis0x committed Jun 23, 2024
1 parent 3601c50 commit af76512
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/private/ClientHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ bool IsInGame()
return false;
}

bool IsSequencePlaying()
{
app::Survival* survival = Object::FindObjectOfType<app::Survival>("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);
Expand Down
1 change: 1 addition & 0 deletions lib/public/ClientHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
12 changes: 11 additions & 1 deletion user/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "utils/utils.hpp"
#include "network/VersionControl.h"

#include "players/players.h"

#define CLIENT_VERSION "4.1"

Expand Down Expand Up @@ -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);
}

0 comments on commit af76512

Please sign in to comment.