preventing stuckness measures and focusing as zm changes

This commit is contained in:
jenzur 2020-07-21 02:09:41 +02:00
parent c2f7bca490
commit 84a2fc318f

View File

@ -14,6 +14,7 @@
int present = 0;
int targethuman = 0;
int client_out_balancer[MAXPLAYERS + 1];
int bot_mini_count_stucker = 0;
//admins & vips
bool admins[MAXPLAYERS + 1];
@ -197,12 +198,14 @@ public Action recursive_pressing(Handle timer, any data)
if (IsValidClient(target_enemy))
{
enemy_distance = get_power_distance(target_enemy, pos);
if (targeteam == 2)
enemy_cap = enemy_cap * 5;
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);
bot_stuck = is_bot_stuck();
}
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));
@ -211,6 +214,21 @@ public Action recursive_pressing(Handle timer, any data)
return Plugin_Continue;
}
public bool is_bot_stuck()
{
float flVel[3];
GetEntPropVector(present, Prop_Data, "m_vecAbsVelocity", flVel);
if (flVel[0] < 10.0 && flVel[1] < 10.0)
bot_mini_count_stucker++;
else
bot_mini_count_stucker = bot_mini_count_stucker - 3;
if (bot_mini_count_stucker > 10)
bot_mini_count_stucker = 0;
if (bot_mini_count_stucker < 0)
bot_mini_count_stucker = 0;
return bot_mini_count_stucker > 9;
}
public void faceclient(int target_human)
{
float TargetPos[3];