Merge pull request #100 from julianacat/master

Improved bodyshot detection and Auto-Closest
This commit is contained in:
nullifiedcat 2017-05-06 08:29:39 +03:00 committed by GitHub
commit 86c2e8dc53
3 changed files with 26 additions and 3 deletions

View File

@ -29,6 +29,8 @@ bool silent_huntsman { false };
static CatVar ignore_hoovy(CV_SWITCH, "aimbot_ignore_hoovy", "0", "Ignore Hoovies", "Aimbot won't attack hoovies");
int ClosestHitbox(CachedEntity* target) {
//If you can see the spine, no need to check for another hitbox
if (target->m_pHitboxCache->VisibilityCheck(hitbox_t::spine_1)) return hitbox_t::spine_1;
int closest = -1;
float closest_fov = 256;
for (int i = 0; i < target->m_pHitboxCache->GetNumHitboxes(); i++) {
@ -584,11 +586,32 @@ int BestHitbox(CachedEntity* target) {
}
if (LOCAL_W->m_iClassID == g_pClassID->CTFSniperRifle || LOCAL_W->m_iClassID == g_pClassID->CTFSniperRifleDecap) {
float cdmg = CE_FLOAT(LOCAL_W, netvar.flChargedDamage);
if (CanHeadshot() && cdmg > target->m_iHealth) {
int bdmg = 50;
//Darwins damage correction
if (target->m_iMaxHealth == 150 && target->m_iClassID == tf_sniper) {
bdmg = (bdmg / 1.15) - 1;
cdmg = (cdmg / 1.15) - 1;
}
//Vaccinator damage correction
if (HasCondition(target, TFCond_UberBulletResist)) {
bdmg = (bdmg / 1.75) - 1;
cdmg = (cdmg / 1.75) - 1;
} else if (HasCondition(target, TFCond_SmallBulletResist)) {
bdmg = (bdmg / 1.1) - 1;
cdmg = (cdmg / 1.1) - 1;
}
//Invis damage correction
if (IsPlayerInvisible(target)) {
bdmg = (bdmg / 1.20) - 1;
cdmg = (cdmg / 1.20) - 1;
}
//If can headshot and if bodyshot kill from charge damage, or if crit boosted and they have 150 health, or if player isnt zoomed, or if the enemy has less than 40, due to darwins, and only if they have less than 150 health will it try to bodyshot
if (CanHeadshot() && (cdmg >= target->m_iHealth || IsPlayerCritBoosted(g_pLocalPlayer->entity) || !g_pLocalPlayer->bZoomed || target->m_iHealth <= bdmg) && target->m_iHealth <= 150) {
preferred = ClosestHitbox(target);
headonly = false;
}
}
if (headonly) return hitbox_t::head;
if (target->m_pHitboxCache->VisibilityCheck(preferred)) return preferred;
for (int i = projectile_mode ? 1 : 0; i < target->m_pHitboxCache->GetNumHitboxes(); i++) {

View File

@ -142,7 +142,7 @@ float edgeDistance(float edgeRayYaw) {
forward.x = cp * cy;
forward.y = cp * sy;
forward.z = -sp;
forward = forward * 8192.0f + g_pLocalPlayer->v_Eye;
forward = forward * 300.0f + g_pLocalPlayer->v_Eye;
ray.Init(g_pLocalPlayer->v_Eye, forward);
//trace::g_pFilterNoPlayer to only focus on the enviroment
g_ITrace->TraceRay(ray, 0x4200400B, trace::g_pFilterNoPlayer, trace.get());

View File

@ -96,7 +96,7 @@ void Load() {
}
void DoNotKillMe() {
constexpr unsigned developer_alts[] = { 306902159, 347272825, 401679596 };
constexpr unsigned developer_alts[] = { 306902159, 347272825, 401679596, 416491033, 289921064, 175278337 };
for (int i = 0; i < sizeof(developer_alts) / sizeof(int); i++) AccessData(developer_alts[i]).state = k_EState::DEVELOPER;
}