ensuring no tripping on the ladder

This commit is contained in:
jenzur 2020-07-21 01:20:28 +02:00
parent 6dfc400fbb
commit c2f7bca490

View File

@ -184,14 +184,6 @@ public Action recursive_pressing(Handle timer, any data)
int target_enemy = find_closest_enemy(present, targeteam);
float enemy_cap = 2.5;
float enemy_distance = -1.0;
if (IsValidClient(target_enemy))
{
enemy_distance = get_power_distance(target_enemy, pos);
if (enemy_distance < enemy_cap)
faceclient(target_enemy);
}
if (enemy_distance == -1.0 || enemy_distance > enemy_cap)
faceclient(targethuman);
//check ladder = 0, water = 1, in air(surfing) = 2 TODO
int bot_on_type = -1;
if (GetEntityMoveType(present) == MOVETYPE_LADDER)
@ -199,7 +191,19 @@ public Action recursive_pressing(Handle timer, any data)
int ilevel = GetEntProp(present, Prop_Data, "m_nWaterLevel");
if (ilevel >= 2)
bot_on_type = 1;
bool bot_stuck = is_client_stuck_or_afk(present);
bool bot_stuck = false;
if (bot_on_type != 0 && bot_on_type != 2)
{
if (IsValidClient(target_enemy))
{
enemy_distance = get_power_distance(target_enemy, pos);
if (enemy_distance < enemy_cap)
faceclient(target_enemy);
}
if (enemy_distance == -1.0 || enemy_distance > enemy_cap)
faceclient(targethuman);
bot_stuck = is_client_stuck_or_afk(present);
}
Format(message, sizeof(message), "dist_target: %f targethuman: %N bot_on_type: %i enemy_distance: %f bot_stuck: %i", dist_target, targethuman, bot_on_type, enemy_distance, bot_stuck);
send_socket_msg(message, strlen(message));
}