commit
7c3d065846
@ -82,7 +82,6 @@ Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist,
|
||||
float vectorMax(Vector i);
|
||||
Vector vectorAbs(Vector i);
|
||||
bool canReachVector(Vector loc, Vector dest = { 0, 0, 0 });
|
||||
bool isJumping(Vector vec);
|
||||
|
||||
bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax);
|
||||
|
||||
|
@ -173,6 +173,8 @@ float cur_proj_grav{ 0.0f };
|
||||
// If slow aimbot allows autoshoot
|
||||
bool slow_can_shoot = false;
|
||||
bool projectileAimbotRequired;
|
||||
// Keep track of our zoom time
|
||||
Timer zoomTime{};
|
||||
|
||||
// This array will store calculated projectile/hitscan predictions
|
||||
// for current frame, to avoid performing them again
|
||||
@ -253,13 +255,9 @@ void CreateMove()
|
||||
// Auto-Unzoom
|
||||
if (auto_unzoom)
|
||||
{
|
||||
if (g_pLocalPlayer->holding_sniper_rifle)
|
||||
if (g_pLocalPlayer->holding_sniper_rifle && g_pLocalPlayer->bZoomed && zoomTime.check(3000))
|
||||
{
|
||||
if (g_pLocalPlayer->bZoomed)
|
||||
{
|
||||
if (g_GlobalVars->curtime - g_pLocalPlayer->flZoomBegin > 5.0f)
|
||||
g_pUserCmd->buttons |= IN_ATTACK2;
|
||||
}
|
||||
}
|
||||
}
|
||||
// We do this as we need to pass whether the aimkey allows aiming to both
|
||||
@ -277,6 +275,7 @@ void CreateMove()
|
||||
{
|
||||
if (g_pLocalPlayer->holding_sniper_rifle)
|
||||
{
|
||||
zoomTime.update();
|
||||
if (not g_pLocalPlayer->bZoomed)
|
||||
{
|
||||
g_pUserCmd->buttons |= IN_ATTACK2;
|
||||
|
@ -9,10 +9,6 @@
|
||||
#include "hacks/Backtrack.hpp"
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <glez/draw.hpp>
|
||||
bool IsMelee()
|
||||
{
|
||||
return GetWeaponMode() == weapon_melee;
|
||||
}
|
||||
namespace hacks::shared::backtrack
|
||||
{
|
||||
CatVar enable(CV_SWITCH, "backtrack", "0", "Enable backtrack",
|
||||
@ -108,6 +104,7 @@ void Run()
|
||||
float bestFov = 99999;
|
||||
BestTick = 0;
|
||||
iBestTarget = -1;
|
||||
bool IsMelee = GetWeaponMode() == weapon_melee;
|
||||
|
||||
float prev_distance = 9999;
|
||||
|
||||
|
@ -64,9 +64,10 @@ static const int crumb_limit = 64; // limit
|
||||
|
||||
// Followed entity, externed for highlight color
|
||||
int follow_target = 0;
|
||||
bool inited;
|
||||
static bool inited;
|
||||
|
||||
Timer lastTaunt{}; // time since taunt was last executed, used to avoid kicks
|
||||
Timer lastJump{};
|
||||
std::array<Timer, 32> afkTicks; // for how many ms the player hasn't been moving
|
||||
|
||||
void checkAFK()
|
||||
@ -76,7 +77,7 @@ void checkAFK()
|
||||
auto entity = ENTITY(i);
|
||||
if (CE_BAD(entity))
|
||||
continue;
|
||||
if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(5.0f))
|
||||
if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(60.0f))
|
||||
{
|
||||
afkTicks[i].update();
|
||||
}
|
||||
@ -321,12 +322,6 @@ void WorldTick()
|
||||
}
|
||||
}
|
||||
|
||||
// if(!checkPath()) //wip do not merge if you see this
|
||||
// {
|
||||
// follow_target = 0;
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Update timer on new target
|
||||
static Timer idle_time{};
|
||||
if (breadcrumbs.empty())
|
||||
@ -346,7 +341,7 @@ void WorldTick()
|
||||
// New crumbs, we add one if its empty so we have something to follow
|
||||
if ((breadcrumbs.empty() ||
|
||||
tar_orig.DistTo(breadcrumbs.at(breadcrumbs.size() - 1)) > 40.0F) &&
|
||||
DistanceToGround(ENTITY(follow_target)) < 30)
|
||||
DistanceToGround(ENTITY(follow_target)) < 45)
|
||||
breadcrumbs.push_back(tar_orig);
|
||||
|
||||
// Prune old and close crumbs that we wont need anymore, update idle timer
|
||||
@ -372,14 +367,24 @@ void WorldTick()
|
||||
if (dist_to_target > (float) follow_distance)
|
||||
{
|
||||
// Check for jump
|
||||
if (autojump && (idle_time.check(2000) || isJumping(breadcrumbs[0])))
|
||||
if (autojump && lastJump.check(1000) && (idle_time.check(2000) || DistanceToGround({breadcrumbs[0].x,breadcrumbs[0].y,breadcrumbs[0].z + 5}) > 47))
|
||||
{
|
||||
g_pUserCmd->buttons |= IN_JUMP;
|
||||
// Check for idle
|
||||
lastJump.update();
|
||||
}
|
||||
// Check if still moving. 70 HU = Sniper Zoomed Speed
|
||||
if (idle_time.check(3000) && CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(60.0f))
|
||||
{
|
||||
follow_target = 0;
|
||||
return;
|
||||
}
|
||||
// Basic idle check
|
||||
if (idle_time.test_and_set(5000))
|
||||
{
|
||||
follow_target = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static float last_slot_check = 0.0f;
|
||||
if (g_GlobalVars->curtime < last_slot_check)
|
||||
last_slot_check = 0.0f;
|
||||
|
@ -192,17 +192,11 @@ bool canReachVector(Vector loc, Vector dest)
|
||||
int maxiterations = floor(dest.DistTo(loc)) / 40;
|
||||
for (int i = 0; i < maxiterations; i++)
|
||||
{
|
||||
// math to get the next vector 40.0f in the direction of dest
|
||||
Vector vec =
|
||||
loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1);
|
||||
|
||||
trace_t trace;
|
||||
Ray_t ray;
|
||||
Vector down = vec;
|
||||
down.z = down.z - 50;
|
||||
ray.Init(vec, down);
|
||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
|
||||
&trace);
|
||||
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
|
||||
if (DistanceToGround({vec.x,vec.y,vec.z + 5}) >= 40)
|
||||
return false;
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
@ -224,13 +218,13 @@ bool canReachVector(Vector loc, Vector dest)
|
||||
directionalLoc.y = directionalLoc.y - 40;
|
||||
break;
|
||||
}
|
||||
trace_t trace2;
|
||||
Ray_t ray2;
|
||||
ray2.Init(vec, directionalLoc);
|
||||
g_ITrace->TraceRay(ray2, 0x4200400B, &trace::filter_no_player,
|
||||
&trace2);
|
||||
trace_t trace;
|
||||
Ray_t ray;
|
||||
ray.Init(vec, directionalLoc);
|
||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
|
||||
&trace);
|
||||
// distance of trace < than 26
|
||||
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
|
||||
if (trace.startpos.DistTo(trace.endpos) < 26.0f)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -238,17 +232,11 @@ bool canReachVector(Vector loc, Vector dest)
|
||||
else
|
||||
{
|
||||
// check if the vector is too high above ground
|
||||
trace_t trace;
|
||||
Ray_t ray;
|
||||
Vector down = loc;
|
||||
down.z = down.z - 50;
|
||||
ray.Init(loc, down);
|
||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
|
||||
// higher to avoid small false positives, player can jump 42 hu
|
||||
// according to
|
||||
// higher to avoid small false positives, player can jump 42 hu according to
|
||||
// the tf2 wiki
|
||||
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
|
||||
if (DistanceToGround({loc.x,loc.y,loc.z + 5}) >= 40)
|
||||
return false;
|
||||
|
||||
// check if there is enough space arround the vector for a player to fit
|
||||
// for loop for all 4 directions
|
||||
for (int i = 0; i < 4; i++)
|
||||
@ -270,39 +258,18 @@ bool canReachVector(Vector loc, Vector dest)
|
||||
directionalLoc.y = directionalLoc.y - 40;
|
||||
break;
|
||||
}
|
||||
trace_t trace2;
|
||||
Ray_t ray2;
|
||||
ray2.Init(loc, directionalLoc);
|
||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
|
||||
&trace2);
|
||||
trace_t trace;
|
||||
Ray_t ray;
|
||||
ray.Init(loc, directionalLoc);
|
||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
|
||||
// distance of trace < than 26
|
||||
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
|
||||
if (trace.startpos.DistTo(trace.endpos) < 26.0f)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// returns if the player is currently jumping/falling.
|
||||
bool isJumping(Vector vec)
|
||||
{
|
||||
// check if the vector is too high above ground
|
||||
trace_t trace;
|
||||
Ray_t ray;
|
||||
Vector down = vec;
|
||||
Vector loc = vec;
|
||||
down.z = down.z - 50;
|
||||
loc.z = loc.z + 5;
|
||||
ray.Init(vec, down);
|
||||
// trace::filter_no_player.SetSelf(RAW_ENT(g_pLocalPlayer->entity));
|
||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
|
||||
// lower to avoid small false negatives, player can jump 42 hu according to
|
||||
// the tf2 wiki, higher because loc.z = loc.z + 5;
|
||||
if (trace.startpos.DistTo(trace.endpos) > 45)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string GetLevelName()
|
||||
{
|
||||
|
||||
@ -1245,8 +1212,7 @@ void PrintChat(const char *fmt, ...)
|
||||
va_end(list);
|
||||
std::unique_ptr<char> str(strfmt("\x07%06X[\x07%06XCAT\x07%06X]\x01 %s",
|
||||
0x5e3252, 0xba3d9a, 0x5e3252,
|
||||
buf.get())
|
||||
.get());
|
||||
buf.get()).release());
|
||||
// FIXME DEBUG LOG
|
||||
logging::Info("%s", str.get());
|
||||
chat->Printf(str.get());
|
||||
|
Reference in New Issue
Block a user