Merge pull request #350 from BenCat07/patch-15

Make useable while cloaked (only works with cat_se_cloak 1)
This commit is contained in:
nullifiedcat 2018-02-10 14:44:11 +03:00 committed by GitHub
commit 7febcc3627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@ namespace tf2
{
namespace autobackstab
{
static CatVar enabled(CV_SWITCH, "autobackstab", "0", "Auto Backstab",
"Does not depend on triggerbot!");
// TODO improve
@ -31,6 +31,37 @@ void CreateMove()
{
g_pUserCmd->buttons |= IN_ATTACK;
}
else if (HasCondition<TFCond_Cloaked>(LOCAL_E)) {
CachedEntity* ent;
for (int i; i < 32; i++) {
float scr = 0;
float scr_best = 0;
CachedEntity* pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
continue;
if (!pEnt->m_Type == ENTITY_PLAYER)
continue;
if (pEnt == LOCAL_E)
continue;
if (LOCAL_E->m_iTeam == pEnt->m_iTeam)
continue;
scr = 4096.0f
- pEnt->m_vecOrigin.DistTo(
LOCAL_E->m_vecOrigin);
if (scr > scr_best) {
scr_best = scr;
ent = pEnt;
}
}
if (!CE_GOOD(ent))
return;
if (CE_FLOAT(LOCAL_E, netvar.angEyeAngles + 4) + 35.0f >= CE_FLOAT(ent, netvar.angEyeAngles + 4) || CE_FLOAT(LOCAL_E, netvar.angEyeAngles + 4) - 35.0f <= CE_FLOAT(ent, netvar.angEyeAngles + 4))
{
if (LOCAL_E->m_vecOrigin.DistTo(ent->m_vecOrigin) <= 67) {
g_pUserCmd->buttons |= IN_ATTACK;
}
}
}
}
}
}