-
Автор темы
- #1
canshootn:
bool c_aim_bot::can_shoot(
bool skip_r8, const int shift_amount, const bool what
) const {
if (!g_local_player->self()
|| !g_local_player->self()->alive())
return false;
auto weapon = g_local_player->self()->weapon();
if (!weapon)
return false;
auto weapon_data = weapon->info();
if (!weapon_data)
return false;
if (g_local_player->self()->flags() & valve::e_ent_flags::frozen)
return false;
if (g_local_player->self()->wait_for_no_attack())
return false;
if (g_local_player->self()->defusing())
return false;
auto anim_layer = g_local_player->self()->anim_layers().at(1u);
if (anim_layer.m_owner) {
if (g_local_player->self()->lookup_seq_act(anim_layer.m_seq) == crypt_int(967)
&& anim_layer.m_weight != 0.f)
return false;
}
if (weapon_data->m_type >= valve::e_weapon_type::pistol && weapon_data->m_type <= valve::e_weapon_type::machine_gun && weapon->clip1() < crypt_int(1))
return false;
float curtime = valve::to_time(g_local_player->self()->tick_base() - shift_amount);
if (curtime < g_local_player->self()->next_attack())
return false;
if ((weapon->item_index() == valve::e_item_index::glock || weapon->item_index() == valve::e_item_index::famas) && weapon->burst_shots_remaining() > crypt_int(0)) {
if (curtime >= weapon->next_burst_shot())
return true;
}
if (curtime < weapon->next_primary_attack())
return false;
if (weapon->item_index() != valve::e_item_index::revolver)
return true;
if (skip_r8)
return true;
return curtime >= weapon->postpone_fire_ready_time();
}