diff --git a/include/helpers.hpp b/include/helpers.hpp index ffa5c5a2..3a1aba5a 100755 --- a/include/helpers.hpp +++ b/include/helpers.hpp @@ -77,6 +77,7 @@ bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos); bool VisCheckEntFromEnt(CachedEntity *startEnt, CachedEntity *endEnt); bool VisCheckEntFromEntVector(Vector startVector, CachedEntity *startEnt, CachedEntity *endEnt); +Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist); bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax); diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index fa130ac3..5d107224 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -54,6 +54,8 @@ static CatVar afk(CV_SWITCH, "fb_afk", "1", "Switch target if AFK", static CatVar afktime( CV_INT, "fb_afk_time", "15000", "Max AFK Time", "Max time in ms spent standing still before player gets declared afk"); +static CatVar corneractivate(CV_SWITCH, "fb_activation_corners", "1", "Activate arround corners", + "Try to find an activation path to an entity behind a corner."); // Something to store breadcrumbs created by followed players static std::vector breadcrumbs; @@ -173,8 +175,6 @@ void WorldTick() if (follow_activation && entity->m_flDistance() > (float) follow_activation) continue; - if (!VisCheckEntFromEnt(LOCAL_E, entity)) - continue; const model_t *model = ENTITY(follow_target)->InternalEntity()->GetModel(); if (followcart && model && @@ -189,6 +189,19 @@ void WorldTick() follow_target = entity->m_IDX; if (entity->m_Type() != ENTITY_PLAYER) continue; + if (corneractivate) + { + Vector indirectOrigin = VischeckWall(LOCAL_E, entity, 600); + if (!indirectOrigin.x || !indirectOrigin.y) + continue; + breadcrumbs.clear(); + breadcrumbs.push_back(indirectOrigin); + } + else + { + if (!VisCheckEntFromEnt(LOCAL_E, entity)) + continue; + } if (follow_target && ENTITY(follow_target)->m_flDistance() > entity->m_flDistance()) // favor closer entitys @@ -266,7 +279,7 @@ void WorldTick() if (dist_to_target > (float) follow_distance) { // Check for idle - if (autojump && idle_time.check(3000)) + if (autojump && idle_time.check(2000)) g_pUserCmd->buttons |= IN_JUMP; if (idle_time.test_and_set(5000)) { diff --git a/src/helpers.cpp b/src/helpers.cpp index 731a75ba..0dbf84cd 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -106,6 +106,44 @@ void WalkTo(const Vector &vector) g_pUserCmd->sidemove = result.second; } +// Function to get the corner location that a vischeck to an entity is possible +// from +Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist) +{ + int maxiterations = maxdist / 40; + Vector origin = player->m_vecOrigin(); + + if (VisCheckEntFromEnt(player, target)) + return origin; + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < maxiterations; j++) + { + Vector virtualOrigin = origin; + switch (i) + { + case 0: + virtualOrigin.x = virtualOrigin.x + 40 * (j + 1); + break; + case 1: + virtualOrigin.x = virtualOrigin.x - 40 * (j + 1); + break; + case 2: + virtualOrigin.y = virtualOrigin.y + 40 * (j + 1); + break; + case 3: + virtualOrigin.y = virtualOrigin.y - 40 * (j + 1); + break; + } + if (!IsVectorVisible(origin, virtualOrigin)) + continue; + if (VisCheckEntFromEntVector(virtualOrigin, player, target)) + return virtualOrigin; + } + } + return { 0, 0, 0 }; +} + std::string GetLevelName() { diff --git a/src/visual/menu/ncc/Menu.cpp b/src/visual/menu/ncc/Menu.cpp index 2a323d68..b614341b 100644 --- a/src/visual/menu/ncc/Menu.cpp +++ b/src/visual/menu/ncc/Menu.cpp @@ -697,6 +697,8 @@ static const std::string list_tf2 = R"( "fb_always_medigun" "fb_roaming" "fb_draw" + "fb_afk" + "fb_afk_time" ] "Catbot Utilities"[ "Catbot Utilities Menu"