Skip to content

Commit

Permalink
fix: Forgotten bool check #46
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiga74164 committed Apr 4, 2024
1 parent 649e910 commit 15c79fd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
3 changes: 3 additions & 0 deletions src/game/Render/Gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ void Gui::Render()

ImGui::CheckboxFill("Dumb Enemies", &vars.DumbEnemies.value()); HELPMAKER("This will prevent enemies from attacking or moving towards you");

// TODO:
// Add distance check.
// Add offset to the player position.
ImGui::CheckboxFill("Mob Vacuum", &vars.MobVacuum.value()); HELPMAKER("You have to go to the checkpoint before killing them");

ImGui::CheckboxFill("Mission Time", &vars.MissionTime.value()); HELPMAKER("Make sure this is enabled before starting a mission");
Expand Down
41 changes: 24 additions & 17 deletions src/game/cheat/features/MobVacuum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ namespace Cheat::Features
if (m_pPlayer == nullptr || m_pPlayerGO == nullptr)
return;

auto& vars = Vars::GetInstance();

for (auto& enemy : m_pEnemiesVec)
{
if (!app::PCILGJOEPJM_PPAKPBOJLIP(enemy, nullptr))
Expand All @@ -49,28 +51,33 @@ namespace Cheat::Features
continue;
}

auto someBaseClass = enemy->fields.NKONPDBOBAG;
if (someBaseClass == nullptr)
continue;
if (vars.MobVacuum.value())
{
auto someBaseClass = enemy->fields.NKONPDBOBAG;
if (someBaseClass == nullptr)
continue;

auto enemyObj = someBaseClass->fields.IALANALADIL->fields.HOAFECEANLC;
if (enemyObj == nullptr)
continue;
auto enemyObj = someBaseClass->fields.IALANALADIL->fields.HOAFECEANLC;
if (enemyObj == nullptr)
continue;

auto enemyTransform = app::GameObject_get_transform(enemyObj, nullptr);
if (enemyTransform == nullptr)
continue;
auto enemyTransform = app::GameObject_get_transform(enemyObj, nullptr);
if (enemyTransform == nullptr)
continue;

auto enemyPosition = app::Transform_get_position(enemyTransform, nullptr);
auto playerTransform = app::GameObject_get_transform(m_pPlayerGO, nullptr);
auto playerPosition = app::Transform_get_position(playerTransform, nullptr);
auto playerForward = app::Transform_get_forward(playerTransform, nullptr);
auto enemyPosition = app::Transform_get_position(enemyTransform, nullptr);
auto playerTransform = app::GameObject_get_transform(m_pPlayerGO, nullptr);
auto playerPosition = app::Transform_get_position(playerTransform, nullptr);
auto playerForward = app::Transform_get_forward(playerTransform, nullptr);

// TODO: Add distance check later.
auto distance = app::Vector3_Distance(enemyPosition, playerPosition, nullptr);
// TODO:
// Add distance check.
// Add offset to the player position.
auto distance = app::Vector3_Distance(enemyPosition, playerPosition, nullptr);

// Set the enemy position to the player position + the forward vector
app::Transform_set_position(enemyTransform, playerPosition + (playerForward * 1.5f), nullptr);
// Set the enemy position to the player position + the forward vector
app::Transform_set_position(enemyTransform, playerPosition + (playerForward * 1.5f), nullptr);
}
}
}
}

0 comments on commit 15c79fd

Please sign in to comment.