minor fixes to prevent stuck afk targets

This commit is contained in:
jenzur 2020-07-24 01:17:41 +02:00
parent 0e9b680342
commit 121301cd54
2 changed files with 9 additions and 6 deletions

View File

@ -38,7 +38,7 @@ def bot_process_keyinput(input_line):
dist_target = input_line[input_line.index("dist_target:") + len("dist_target:"):]
dist_target = float(dist_target)
strInput = ""
for _ in range(5):
for _ in range(2):
strInput += f"""{movement_input}; wait 5; """
strInput += "-jump; wait 5; -duck; wait 5;"
writeCfgInput(strInput)
@ -61,7 +61,8 @@ def bot_process_movement(input_line):
strInput = "-attack; wait 2; -use; wait 5; -jump; wait 5; -duck; wait 5; +attack; wait 5; cl_minmodels 1; wait 2; +use; "
if bot_stuck:
print('bot stuck')
strInput += "+jump; wait 15; +duck; wait 15; -jump; wait 15; -duck; wait 3;"
for _ in range(2):
strInput += "+jump; wait 15; +duck; wait 15; -jump; wait 15; -duck; wait 3;"
if dist_target > 2.5:
strInput += "use weapon_elite; wait 3; "
elif targeteam == 3:

View File

@ -254,7 +254,11 @@ public Action recursive_pressing(Handle timer, any data)
else
face_call(targethuman);
if (round_start_stuck)
{
bot_stuck = is_bot_stuck();
if (bot_stuck)
bot_mini_count_stucker = 0;
}
}
Format(message, sizeof(message), "dist_target: %f targethuman: %N bot_on_type: %i enemy_distance: %f bot_stuck: %i targeteam: %i", dist_target, targethuman, bot_on_type, enemy_distance, bot_stuck, targeteam);
send_socket_msg(message, strlen(message));
@ -265,13 +269,11 @@ public Action recursive_pressing(Handle timer, any data)
public bool is_bot_stuck()
{
float min_distance_cap = 2.5;
float min_distance_cap = 5.0;
int min_cap = 5;
float bot_own_distance = get_power_distance(present, bot_old_coords);
if (bot_own_distance < min_distance_cap)
bot_mini_count_stucker++;
else
bot_mini_count_stucker = 0;
return bot_mini_count_stucker > min_cap;
}
@ -306,7 +308,7 @@ stock bool IsValidClient(int client)
stock bool is_client_stuck_or_afk(int client)
{
float min_distance_cap = 2.0;
float min_distance_cap = 2.5;
int min_cap = 5;
float client_own_distance = get_power_distance(client, client_old_coords[client]);
if (client_own_distance < min_distance_cap)