Fixed visuals (#1669)

* Fixed visuals

* Re-put in previous fixes
This commit is contained in:
Stephen Martin 2022-06-27 11:55:22 -04:00 committed by GitHub
parent 33f9146268
commit d09e882ef2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -563,12 +563,7 @@ bool smallBoxChecker(CachedEntity *target_entity)
{ {
if (CE_BAD(target_entity) || !g_IEntityList->GetClientEntity(target_entity->m_IDX)) if (CE_BAD(target_entity) || !g_IEntityList->GetClientEntity(target_entity->m_IDX))
return false; return false;
#if ENABLE_VISUALS
if (target_entity->m_Type() == ENTITY_PLAYER)
{
hacks::shared::esp::SetEntityColor(target_entity, colors::target);
}
#endif
return true; return true;
} }
// Just hold m1 if we were aiming at something before and are in rapidfire // Just hold m1 if we were aiming at something before and are in rapidfire
@ -753,13 +748,8 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
if (IsTargetStateGood(ent) && smallBoxChecker(ent) && Aim(ent)) if (IsTargetStateGood(ent) && smallBoxChecker(ent) && Aim(ent))
isTargetGood = true; isTargetGood = true;
} }
if (isTargetGood) if (isTargetGood) // Melee mode straight up won't swing if the target is too far away. No need to prioritize based on distance. Just use whatever the user chooses.
{ {
// Distance Priority, Uses this is melee is used
if (GetWeaponMode() == weaponmode::weapon_melee || (int) priority_mode == 2)
scr = 4096.0f - calculated_data_array[i].aim_position.DistTo(g_pLocalPlayer->v_Eye);
else
{
switch ((int) priority_mode) switch ((int) priority_mode)
{ {
case 0: // Smart Priority case 0: // Smart Priority
@ -790,7 +780,6 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
default: default:
break; break;
} }
}
// Crossbow logic // Crossbow logic
if (!ent->m_bEnemy() && ent->m_Type() == ENTITY_PLAYER && CE_GOOD(LOCAL_W) && LOCAL_W->m_iClassID() == CL_CLASS(CTFCrossbow)) if (!ent->m_bEnemy() && ent->m_Type() == ENTITY_PLAYER && CE_GOOD(LOCAL_W) && LOCAL_W->m_iClassID() == CL_CLASS(CTFCrossbow))
{ {
@ -843,7 +832,7 @@ bool IsTargetStateGood(CachedEntity *entity)
// Distance // Distance
float targeting_range = EffectiveTargetingRange(); float targeting_range = EffectiveTargetingRange();
if (entity->m_flDistance() > targeting_range && tickcount > hacks::shared::aimbot::last_target_ignore_timer) if (entity->m_flDistance()-40 > targeting_range && tickcount > hacks::shared::aimbot::last_target_ignore_timer) // m_flDistance includes the collision box. You have to subtract it (Should be the same for every model)
return false; return false;
// Rage only check // Rage only check
@ -948,7 +937,7 @@ bool IsTargetStateGood(CachedEntity *entity)
// Distance // Distance
else if (EffectiveTargetingRange()) else if (EffectiveTargetingRange())
{ {
if (entity->m_flDistance() > (int) EffectiveTargetingRange() && tickcount > hacks::shared::aimbot::last_target_ignore_timer) if (entity->m_flDistance()-40 > EffectiveTargetingRange() && tickcount > hacks::shared::aimbot::last_target_ignore_timer)
return false; return false;
} }
@ -993,7 +982,7 @@ bool IsTargetStateGood(CachedEntity *entity)
// Distance // Distance
float targeting_range = EffectiveTargetingRange(); float targeting_range = EffectiveTargetingRange();
if (entity->m_flDistance() > targeting_range && tickcount > hacks::shared::aimbot::last_target_ignore_timer) if (entity->m_flDistance()-40 > targeting_range && tickcount > hacks::shared::aimbot::last_target_ignore_timer)
return false; return false;
// Grab the prediction var // Grab the prediction var
@ -1073,6 +1062,12 @@ bool Aim(CachedEntity *entity)
if (slow_aim) if (slow_aim)
DoSlowAim(angles); DoSlowAim(angles);
#if ENABLE_VISUALS
if (entity->m_Type() == ENTITY_PLAYER)
{
hacks::shared::esp::SetEntityColor(entity, colors::target);
}
#endif
// Set angles // Set angles
current_user_cmd->viewangles = angles; current_user_cmd->viewangles = angles;
@ -1083,7 +1078,6 @@ bool Aim(CachedEntity *entity)
current_user_cmd->tick_count = TIME_TO_TICKS(CE_FLOAT(entity, netvar.m_flSimulationTime)); current_user_cmd->tick_count = TIME_TO_TICKS(CE_FLOAT(entity, netvar.m_flSimulationTime));
aimed_this_tick = true; aimed_this_tick = true;
viewangles_this_tick = angles; viewangles_this_tick = angles;
logging::Info("IT RAN");
// Finish function // Finish function
return true; return true;
} }
@ -1099,7 +1093,7 @@ void DoAutoshoot(CachedEntity *target_entity)
else if (IsPlayerDisguised(g_pLocalPlayer->entity) && !autoshoot_disguised) else if (IsPlayerDisguised(g_pLocalPlayer->entity) && !autoshoot_disguised)
return; return;
// Handle Huntsman/Loose cannon // Handle Huntsman/Loose cannon
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFCompoundBow) || g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFCannon)) else if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFCompoundBow) || g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFCannon))
{ {
if (!only_can_shoot) if (!only_can_shoot)
{ {
@ -1155,7 +1149,7 @@ void DoAutoshoot(CachedEntity *target_entity)
// Ambassador check // Ambassador check
if (IsAmbassador(g_pLocalPlayer->weapon())) else if (IsAmbassador(g_pLocalPlayer->weapon()))
{ {
// Check if ambasador can headshot // Check if ambasador can headshot
if (!AmbassadorCanHeadshot() && wait_for_charge) if (!AmbassadorCanHeadshot() && wait_for_charge)
@ -1164,11 +1158,11 @@ void DoAutoshoot(CachedEntity *target_entity)
// Autoshoot breaks with Slow aimbot, so use a workaround to detect when it // Autoshoot breaks with Slow aimbot, so use a workaround to detect when it
// can // can
if (slow_aim && !slow_can_shoot) else if (slow_aim && !slow_can_shoot)
attack = false; attack = false;
// Dont autoshoot without anything in clip // Dont autoshoot without anything in clip
if (CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) == 0) else if (CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) == 0)
attack = false; attack = false;
if (attack) if (attack)
@ -1277,7 +1271,7 @@ int notVisibleHitbox(CachedEntity *target, int preferred)
else else
return hitbox_t::spine_1; return hitbox_t::spine_1;
} }
int auto_hitbox(CachedEntity *target) int autoHitbox(CachedEntity *target)
{ {
int preferred = 3; int preferred = 3;
@ -1371,7 +1365,7 @@ int BestHitbox(CachedEntity *target)
{ {
case 0: case 0:
// AUTO priority // AUTO priority
return auto_hitbox(target); return autoHitbox(target);
break; break;
case 1: case 1:
{ // AUTO priority, return closest hitbox to crosshair { // AUTO priority, return closest hitbox to crosshair