diff --git a/src/game/Render/Gui/gui.cpp b/src/game/Render/Gui/gui.cpp index 365e6c6..6ee2579 100644 --- a/src/game/Render/Gui/gui.cpp +++ b/src/game/Render/Gui/gui.cpp @@ -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"); diff --git a/src/game/cheat/features/MobVacuum.cpp b/src/game/cheat/features/MobVacuum.cpp index f5f7bd7..6752206 100644 --- a/src/game/cheat/features/MobVacuum.cpp +++ b/src/game/cheat/features/MobVacuum.cpp @@ -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)) @@ -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); + } } } }