From c2f7bca490627af99d96a5513b6fb40657e5c0e9 Mon Sep 17 00:00:00 2001 From: jenzur Date: Tue, 21 Jul 2020 01:20:28 +0200 Subject: [PATCH] ensuring no tripping on the ladder --- AutismBotIngame/scripting/autism_bot_info.sp | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index 4f266cbe..bad19b7a 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -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)); }