Readd removed checks for aimbot

This commit is contained in:
BenCat07 2022-07-14 01:08:34 +02:00
parent 6530e72b2b
commit d2cb483124
2 changed files with 61 additions and 2 deletions

View File

@ -38,6 +38,7 @@ void Reset();
// Stuff to make storing functions easy
bool isAiming();
CachedEntity *CurrentTarget();
bool ShouldAim();
CachedEntity *RetrieveBestTarget(bool aimkey_state);
bool IsTargetStateGood(CachedEntity *entity);
bool Aim(CachedEntity *entity);

View File

@ -442,9 +442,8 @@ static void CreateMove()
target_last = nullptr;
return;
}
else if (!aimkey_status)
else if (!aimkey_status || !ShouldAim())
{
target_last = nullptr;
return;
}
@ -519,6 +518,7 @@ static void CreateMove()
}
}
}
bool projectileSpecialCases(CachedEntity *target_entity, int weapon_case)
{
@ -654,6 +654,64 @@ bool MouseMoving()
return false;
}
#endif
// The first check to see if the player should aim in the first place
bool ShouldAim()
{
// Checks should be in order: cheap -> expensive
// Check for +use
if (current_user_cmd->buttons & IN_USE)
return false;
// Check if using action slot item
else if (g_pLocalPlayer->using_action_slot_item)
return false;
// Using a forbidden weapon?
else if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFKnife) || CE_INT(LOCAL_W, netvar.iItemDefinitionIndex) == 237 || CE_INT(LOCAL_W, netvar.iItemDefinitionIndex) == 265)
return false;
// Carrying A building?
else if (CE_BYTE(g_pLocalPlayer->entity, netvar.m_bCarryingObject))
return false;
// Deadringer out?
else if (CE_BYTE(g_pLocalPlayer->entity, netvar.m_bFeignDeathReady))
return false;
else if (g_pLocalPlayer->holding_sapper)
return false;
// Is bonked?
else if (HasCondition<TFCond_Bonked>(g_pLocalPlayer->entity))
return false;
// Is taunting?
else if (HasCondition<TFCond_Taunting>(g_pLocalPlayer->entity))
return false;
// Is cloaked
else if (IsPlayerInvisible(g_pLocalPlayer->entity))
return false;
else if (LOCAL_W->m_iClassID() == CL_CLASS(CTFMinigun) && CE_INT(LOCAL_E, netvar.m_iAmmo + 4) == 0)
return false;
#if ENABLE_VISUALS
if (assistance_only && !MouseMoving())
return false;
#endif
switch (GetWeaponMode())
{
case weapon_hitscan:
break;
case weapon_melee:
break;
// Check we need to run projectile Aimbot code
case weapon_projectile:
if (!projectileAimbotRequired)
return false;
break;
// Check if player doesnt have a weapon usable by aimbot
default:
return false;
};
return true;
}
// Function to find a suitable target
CachedEntity *RetrieveBestTarget(bool aimkey_state)
{