don't autoshoot with a knife

This commit is contained in:
nullifiedcat 2017-04-15 14:29:28 +03:00
parent 549d9b477a
commit daa4f25965

View File

@ -328,7 +328,17 @@ bool Aim(CachedEntity* entity, CUserCmd* cmd) {
if (zoomed_only && !CanHeadshot()) return true;
}
}
if ((g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFCompoundBow)) {
// Don't autoshoot with the knife!
static int forbiddenWeapons[] = { g_pClassID->CTFCompoundBow, g_pClassID->CTFKnife };
int weapon_class = g_pLocalPlayer->weapon()->m_iClassID;
bool attack = true;
for (int i = 0; i < 2; i++) {
if (weapon_class == forbiddenWeapons[i]) {
attack = false;
break;
}
}
if (attack) {
cmd->buttons |= IN_ATTACK;
}
}
@ -363,6 +373,7 @@ bool ShouldAim(CUserCmd* cmd) {
if (attack_only && !(cmd->buttons & IN_ATTACK)) {
return false;
}
if (g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFMinigun) {
if (!HasCondition(g_pLocalPlayer->entity, TFCond_Slowed)) {
return false;