Feat: Add autoheal.look-at-path, fix some bad code, create a unified DoSlowAim
This commit is contained in:
parent
0b33495de1
commit
21a23d732d
@ -3,6 +3,7 @@
|
||||
<List width="160">
|
||||
<AutoVariable width="fill" target="autoheal.enable" label="Enable auto heal"/>
|
||||
<AutoVariable width="fill" target="autoheal.silent" label="Silent"/>
|
||||
<AutoVariable width="fill" target="autoheal.look-at-target" label="Look at target" tooltip="Autoheal will permanently look at the target."/>
|
||||
<AutoVariable width="fill" target="autoheal.steam-only" label="Heal SteamID only"/>
|
||||
<AutoVariable width="fill" target="autoheal.steamid" label="SteamID" tooltip="SteamID for the above."/>
|
||||
<AutoVariable width="fill" target="autoheal.uber.enable" label="Auto uber"/>
|
||||
@ -12,7 +13,7 @@
|
||||
<AutoVariable width="fill" target="autoheal.friends-only" label="Only heal friends"/>
|
||||
</List>
|
||||
</Box>
|
||||
<Box padding="12 6 6 6" width="content" height="content" name="Health priority" y="160">
|
||||
<Box padding="12 6 6 6" width="content" height="content" name="Health priority" y="170">
|
||||
<List width="160">
|
||||
<AutoVariable width="fill" target="autoheal.priority-scout" label="Scout weight"/>
|
||||
<AutoVariable width="fill" target="autoheal.priority-soldier" label="Soldier weight"/>
|
||||
|
@ -18,7 +18,6 @@ extern std::array<int, 32> bruteint;
|
||||
extern std::array<Timer, 32> timers;
|
||||
|
||||
extern Timer DelayTimer;
|
||||
extern Timer LookAtPathTimer;
|
||||
extern bool firstcm;
|
||||
extern bool ignoredc;
|
||||
|
||||
@ -49,10 +48,6 @@ extern bool freecam_is_toggled;
|
||||
typedef void (*CL_SendMove_t)();
|
||||
extern DetourHook cl_warp_sendmovedetour;
|
||||
extern DetourHook cl_nospread_sendmovedetour;
|
||||
namespace hacks::tf2::misc_aimbot
|
||||
{
|
||||
bool ShouldHitBuilding(CachedEntity *ent);
|
||||
}
|
||||
namespace hooked_methods
|
||||
{
|
||||
void sendAchievementKv(int value);
|
||||
|
@ -32,12 +32,6 @@ const Vector &PredictEntity(CachedEntity *entity);
|
||||
bool VischeckPredictedEntity(CachedEntity *entity);
|
||||
bool BacktrackVisCheck(CachedEntity *entity);
|
||||
|
||||
// Variable used to tell when the aimbot has found a target
|
||||
extern bool foundTarget;
|
||||
|
||||
// Used by esp to set their color
|
||||
extern int target_eid;
|
||||
|
||||
// Functions called by other functions for when certian game calls are run
|
||||
void Reset();
|
||||
|
||||
|
@ -3,4 +3,6 @@
|
||||
namespace hacks::tf2::misc_aimbot
|
||||
{
|
||||
std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check, float range = 1500.0f);
|
||||
}
|
||||
void DoSlowAim(Vector &input_angle, int speed = 5);
|
||||
bool ShouldHitBuilding(CachedEntity *ent);
|
||||
} // namespace hacks::tf2::misc_aimbot
|
||||
|
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.hpp"
|
||||
#include <array>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace hacks::tf2::NavBot
|
||||
{
|
||||
bool init(bool first_cm);
|
||||
|
@ -14,7 +14,6 @@ int spectator_target;
|
||||
CLC_VoiceData *voicecrash{};
|
||||
bool firstcm = false;
|
||||
Timer DelayTimer{};
|
||||
Timer LookAtPathTimer{};
|
||||
float prevflow = 0.0f;
|
||||
int prevflowticks = 0;
|
||||
int stored_buttons = 0;
|
||||
|
@ -218,10 +218,7 @@ static void doAutoZoom(bool target_found)
|
||||
}
|
||||
|
||||
// Current Entity
|
||||
int target_eid{ 0 };
|
||||
CachedEntity *target = 0;
|
||||
CachedEntity *target_last = 0;
|
||||
bool foundTarget = false;
|
||||
|
||||
// If slow aimbot allows autoshoot
|
||||
bool slow_can_shoot = false;
|
||||
@ -233,17 +230,20 @@ AimbotCalculatedData_s calculated_data_array[2048]{};
|
||||
// The main "loop" of the aimbot.
|
||||
static void CreateMove()
|
||||
{
|
||||
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
|
||||
return;
|
||||
|
||||
enable = *normal_enable;
|
||||
slow_aim = *normal_slow_aim;
|
||||
fov = *normal_fov;
|
||||
|
||||
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
|
||||
enable = false;
|
||||
|
||||
spectatorUpdate();
|
||||
|
||||
if (!enable)
|
||||
{
|
||||
target_last = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
doAutoZoom(false);
|
||||
|
||||
@ -276,7 +276,8 @@ static void CreateMove()
|
||||
}
|
||||
// Refresh our best target
|
||||
CachedEntity *target_entity = RetrieveBestTarget(aimkey_status);
|
||||
if (CE_BAD(target_entity) || !foundTarget)
|
||||
target_last = target_entity;
|
||||
if (CE_BAD(target_entity))
|
||||
return;
|
||||
|
||||
// Auto-zoom
|
||||
@ -304,7 +305,6 @@ static void CreateMove()
|
||||
// Attemt to auto-shoot
|
||||
|
||||
// flNextPrimaryAttack meme
|
||||
// target_eid = target_entity->m_IDX;
|
||||
if (only_can_shoot && g_pLocalPlayer->weapon()->m_iClassID() != CL_CLASS(CTFMinigun) && g_pLocalPlayer->weapon()->m_iClassID() != CL_CLASS(CTFLaserPointer))
|
||||
{
|
||||
// Handle Compound bow
|
||||
@ -497,7 +497,7 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
|
||||
{
|
||||
// If we have a previously chosen target, target lock is on, and the aimkey
|
||||
// is allowed, then attemt to keep the previous target
|
||||
if (target_lock && foundTarget && aimkey_state)
|
||||
if (target_lock && target_last && aimkey_state)
|
||||
{
|
||||
if (CE_GOOD(target_last))
|
||||
{
|
||||
@ -510,11 +510,6 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
|
||||
}
|
||||
}
|
||||
|
||||
// We dont have a target currently so we must find one, reset statuses
|
||||
foundTarget = false;
|
||||
target_last = nullptr;
|
||||
target_eid = -1;
|
||||
|
||||
float target_highest_score, scr = 0.0f;
|
||||
CachedEntity *ent;
|
||||
CachedEntity *target_highest_ent = 0;
|
||||
@ -556,19 +551,12 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
|
||||
// Compare the top score to our current ents score
|
||||
if (scr > target_highest_score)
|
||||
{
|
||||
foundTarget = true;
|
||||
target_highest_score = scr;
|
||||
target_highest_ent = ent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Save the ent for future use with target lock
|
||||
target_last = target_highest_ent;
|
||||
|
||||
if (CE_GOOD(target_last))
|
||||
target_eid = target_last->m_IDX;
|
||||
|
||||
return target_highest_ent;
|
||||
}
|
||||
|
||||
@ -1368,7 +1356,6 @@ static float slow_change_dist_y = 0;
|
||||
// angle, effectively slowing the aiming process
|
||||
void DoSlowAim(Vector &input_angle)
|
||||
{
|
||||
LookAtPathTimer.update();
|
||||
auto viewangles = current_user_cmd->viewangles;
|
||||
|
||||
// Yaw
|
||||
@ -1479,10 +1466,7 @@ float EffectiveTargetingRange()
|
||||
// A function used by gui elements to determine the current target
|
||||
CachedEntity *CurrentTarget()
|
||||
{
|
||||
if (foundTarget)
|
||||
return target; // Doesnt work for some reason
|
||||
|
||||
return nullptr;
|
||||
return target_last;
|
||||
}
|
||||
|
||||
// Used for when you join and leave maps to reset aimbot vars
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "hacks/FollowBot.hpp"
|
||||
#include "settings/Bool.hpp"
|
||||
#include "PlayerTools.hpp"
|
||||
#include "MiscAimbot.hpp"
|
||||
|
||||
namespace hacks::tf::autoheal
|
||||
{
|
||||
@ -16,6 +17,7 @@ std::vector<int> called_medic{};
|
||||
static settings::Boolean enable{ "autoheal.enable", "false" };
|
||||
static settings::Boolean steamid_only{ "autoheal.steam-only", "false" };
|
||||
static settings::Boolean silent{ "autoheal.silent", "true" };
|
||||
static settings::Boolean look_at_target{ "autoheal.look-at-target", "false" };
|
||||
static settings::Boolean friendsonly{ "autoheal.friends-only", "false" };
|
||||
static settings::Boolean pop_uber_auto{ "autoheal.uber.enable", "true" };
|
||||
static settings::Boolean pop_uber_voice{ "autoheal.popvoice", "true" };
|
||||
@ -661,17 +663,24 @@ void CreateMove()
|
||||
if (!CurrentHealingTargetIDX)
|
||||
return;
|
||||
|
||||
CachedEntity *target = ENTITY(CurrentHealingTargetIDX);
|
||||
CachedEntity *target = ENTITY(CurrentHealingTargetIDX);
|
||||
bool target_is_healing_target = HandleToIDX(CE_INT(LOCAL_W, netvar.m_hHealingTarget)) == CurrentHealingTargetIDX;
|
||||
|
||||
if (HandleToIDX(CE_INT(LOCAL_W, netvar.m_hHealingTarget)) != CurrentHealingTargetIDX)
|
||||
if (!target_is_healing_target || look_at_target)
|
||||
{
|
||||
auto out = target->hitboxes.GetHitbox(spine_2);
|
||||
if (out)
|
||||
{
|
||||
if (silent)
|
||||
g_pLocalPlayer->bUseSilentAngles = true;
|
||||
AimAt(g_pLocalPlayer->v_Eye, out->center, current_user_cmd);
|
||||
if ((g_GlobalVars->tickcount % 2) == 0)
|
||||
auto angles = GetAimAtAngles(g_pLocalPlayer->v_Eye, out->center);
|
||||
|
||||
// If we are already healing our target, then follow the target using slowaim
|
||||
if (target_is_healing_target)
|
||||
hacks::tf2::misc_aimbot::DoSlowAim(angles);
|
||||
|
||||
current_user_cmd->viewangles = angles;
|
||||
if (!target_is_healing_target && (g_GlobalVars->tickcount % 2) == 0)
|
||||
current_user_cmd->buttons |= IN_ATTACK;
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
|
||||
}
|
||||
static float slow_change_dist_y{};
|
||||
static float slow_change_dist_p{};
|
||||
void DoSlowAim(Vector &input_angle)
|
||||
void DoSlowAim(Vector &input_angle, int speed)
|
||||
{
|
||||
auto viewangles = current_user_cmd->viewangles;
|
||||
|
||||
@ -179,7 +179,7 @@ void DoSlowAim(Vector &input_angle)
|
||||
// opposing sides making the distance spike, so just cheap out and reuse
|
||||
// our last one.
|
||||
if (!slow_opposing)
|
||||
slow_change_dist_y = fminf(std::abs(viewangles.y - input_angle.y), flChargeYawCap);
|
||||
slow_change_dist_y = std::abs(viewangles.y - input_angle.y) / (int) speed;
|
||||
|
||||
// Move in the direction of the input angle
|
||||
if (slow_dir)
|
||||
@ -192,7 +192,7 @@ void DoSlowAim(Vector &input_angle)
|
||||
if (viewangles.x != input_angle.x)
|
||||
{
|
||||
// Get speed
|
||||
slow_change_dist_p = std::abs(viewangles.x - input_angle.x) / 5;
|
||||
slow_change_dist_p = std::abs(viewangles.x - input_angle.x) / speed;
|
||||
|
||||
// Move in the direction of the input angle
|
||||
if (viewangles.x > input_angle.x)
|
||||
|
@ -3,11 +3,9 @@
|
||||
#include "NavBot.hpp"
|
||||
#include "PlayerTools.hpp"
|
||||
#include "Aimbot.hpp"
|
||||
#include "FollowBot.hpp"
|
||||
#include "soundcache.hpp"
|
||||
#include "Misc.hpp"
|
||||
#include "MiscTemporary.hpp"
|
||||
#include "teamroundtimer.hpp"
|
||||
#include "MiscAimbot.hpp"
|
||||
|
||||
namespace hacks::tf2::NavBot
|
||||
{
|
||||
|
@ -6,9 +6,9 @@
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/container/flat_set.hpp>
|
||||
#include <chrono>
|
||||
#include "soundcache.hpp"
|
||||
#include "MiscTemporary.hpp"
|
||||
#include <CNavFile.h>
|
||||
#include "MiscAimbot.hpp"
|
||||
#include "Aimbot.hpp"
|
||||
|
||||
namespace nav
|
||||
{
|
||||
@ -48,7 +48,6 @@ enum ignore_status : uint8_t
|
||||
|
||||
void ResetPather();
|
||||
void repath();
|
||||
void DoSlowAim(Vector &input_angle);
|
||||
|
||||
struct ignoredata
|
||||
{
|
||||
@ -728,11 +727,11 @@ static void cm()
|
||||
crumb_vec = &endPoint;
|
||||
}
|
||||
}
|
||||
if (look && LookAtPathTimer.check(1000))
|
||||
if (look && !hacks::shared::aimbot::CurrentTarget())
|
||||
{
|
||||
Vector next{ crumb_vec->x, crumb_vec->y, g_pLocalPlayer->v_Eye.z };
|
||||
next = GetAimAtAngles(g_pLocalPlayer->v_Eye, next);
|
||||
DoSlowAim(next);
|
||||
hacks::tf2::misc_aimbot::DoSlowAim(next);
|
||||
current_user_cmd->viewangles = next;
|
||||
}
|
||||
// Detect when jumping is necessary
|
||||
@ -852,63 +851,6 @@ static CatCommand nav_path_no_local("nav_path_no_local", "Debug nav path", []()
|
||||
|
||||
static CatCommand nav_reset_ignores("nav_reset_ignores", "Reset all ignores.", []() { ignoremanager::reset(); });
|
||||
|
||||
void DoSlowAim(Vector &input_angle)
|
||||
{
|
||||
static float slow_change_dist_y{};
|
||||
static float slow_change_dist_p{};
|
||||
|
||||
auto viewangles = current_user_cmd->viewangles;
|
||||
|
||||
// Yaw
|
||||
if (viewangles.y != input_angle.y)
|
||||
{
|
||||
|
||||
// Check if input angle and user angle are on opposing sides of yaw so
|
||||
// we can correct for that
|
||||
bool slow_opposing = false;
|
||||
if ((input_angle.y < -90 && viewangles.y > 90) || (input_angle.y > 90 && viewangles.y < -90))
|
||||
slow_opposing = true;
|
||||
|
||||
// Direction
|
||||
bool slow_dir = false;
|
||||
if (slow_opposing)
|
||||
{
|
||||
if (input_angle.y > 90 && viewangles.y < -90)
|
||||
slow_dir = true;
|
||||
}
|
||||
else if (viewangles.y > input_angle.y)
|
||||
slow_dir = true;
|
||||
|
||||
// Speed, check if opposing. We dont get a new distance due to the
|
||||
// opposing sides making the distance spike, so just cheap out and reuse
|
||||
// our last one.
|
||||
if (!slow_opposing)
|
||||
slow_change_dist_y = std::abs(viewangles.y - input_angle.y) / 5;
|
||||
|
||||
// Move in the direction of the input angle
|
||||
if (slow_dir)
|
||||
input_angle.y = viewangles.y - slow_change_dist_y;
|
||||
else
|
||||
input_angle.y = viewangles.y + slow_change_dist_y;
|
||||
}
|
||||
|
||||
// Pitch
|
||||
if (viewangles.x != input_angle.x)
|
||||
{
|
||||
// Get speed
|
||||
slow_change_dist_p = std::abs(viewangles.x - input_angle.x) / 5;
|
||||
|
||||
// Move in the direction of the input angle
|
||||
if (viewangles.x > input_angle.x)
|
||||
input_angle.x = viewangles.x - slow_change_dist_p;
|
||||
else
|
||||
input_angle.x = viewangles.x + slow_change_dist_p;
|
||||
}
|
||||
|
||||
// Clamp as we changed angles
|
||||
fClampAngle(input_angle);
|
||||
}
|
||||
|
||||
void clearInstructions()
|
||||
{
|
||||
crumbs.clear();
|
||||
|
Reference in New Issue
Block a user