minor updates to bot movement

This commit is contained in:
christian 2021-04-19 22:35:02 +02:00
parent 17b39a8fe5
commit 637c3afbda

View File

@ -410,11 +410,13 @@ public Action recursive_pressing(Handle timer, any data)
}
if ((0 < enemy_distance && targeteam == 2) || dist_target < 0 < enemy_distance)
{
/*
float feet_origin[3], enemy_feet_origin[3];
GetClientAbsOrigin(client, feet_origin);
GetClientAbsOrigin(target_enemy[client], enemy_feet_origin);
if (feet_origin[2] + 100 > enemy_feet_origin[2])
face_call(target_enemy[client], client);
*/
face_call(target_enemy[client], client);
}
else if (0 < dist_target)
face_call(targethuman[client], client);
@ -565,7 +567,7 @@ public void trace_hulling_bot(int client)
}
//currently detects when two walls meet and create a corner
float move_angles[3];
if (GetEntityMoveType(client) != MOVETYPE_LADDER)
if (GetEntityMoveType(client) != MOVETYPE_LADDER && GetEntProp(client, Prop_Data, "m_nWaterLevel") == 0)
{
GetClientEyeAngles(client, move_angles);
move_angles[0] = 0.0;
@ -693,7 +695,7 @@ public int GetClosestClient_option1(int targeteam, int client)
break;
}
for (int i = 1; i <= MaxClients; i++)
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == targeteam && i != client)
if (IsValidClient(i) && IsPlayerAlive(i) && i != client && GetClientTeam(i) == targeteam)
{
if (!IsAbleToSee(client, i))
continue;
@ -716,15 +718,20 @@ public int GetClosestClient_option1(int targeteam, int client)
float pos[3];
GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
float dist_target = get_power_distance(client, pos);
if (GetClientTeam(client) == 3 && IsValidClient(target_enemy[client]) && targeteam == 3)
{
float enemey_cap = 1500.0;
float enemy_dist = get_power_distance(target_enemy[client], pos);
if (enemy_dist < enemey_cap)
dist_target += enemey_cap;
}
if (admins[i] || vips[i] || i == target_enemy[client])
dist_target /= 5;
if (GetClientTeam(client) == 3 && targeteam == 3)
{
for (int j = 1; j <= MaxClients; j++)
if (IsValidClient(j) && IsPlayerAlive(j) && GetClientTeam(j) == 2)
{
if (!IsAbleToSee(i, j))
continue;
if (is_client_stuck_or_afk(j))
continue;
dist_target += 250.0;
}
}
if (nearestdistance < 0 || dist_target < nearestdistance)
{
nearest = i;