minor changes for later refactoring

This commit is contained in:
jenz 2022-07-27 00:05:08 +02:00
parent efaba98b0e
commit ea757c3c32

View File

@ -22,7 +22,6 @@ int buttons_old[MAXPLAYERS + 1];
int flags_old[MAXPLAYERS + 1];
int ports[7] = {48470, 48471, 48472, 48473, 48474, 48479, 48480}; //last three indexes are ports its sending udp from in plugin
int server_ports[2] = {27015, 27035}; //server ports: ze, ze2
int bot_avoid_edge[MAXPLAYERS + 1];
float client_old_coords[MAXPLAYERS + 1][3];
float targetfriend_prev_coords[MAXPLAYERS + 1][3];
bool chat_cooldown = false;
@ -85,7 +84,6 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast
{
if (is_bot_player(i))
{
bot_avoid_edge[i] = -1;
target_friend[i] = -1;
target_enemy[i] = -1;
human_too_close[i] = false;
@ -310,6 +308,7 @@ public Action bot_check_connect(Handle timer, any data)
return Plugin_Continue;
}
/*
public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon, int subtype,
int cmdnum, int tickcount, int seed, const int mouse[2])
{
@ -367,6 +366,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
flags_old[client] = flags;
}
}
*/
//this was for turning around to prevent falling off edges
void ApplyBoost(int client, float amount){
@ -387,13 +387,17 @@ public bool is_bot_player(int client)
public Action recursive_pressing(Handle timer, any data)
{
bool found_valid_ct = false;
bool found_enemy = false;
for (int client = 1; client <= MaxClients; client++)
{
if (!IsValidClient(client)) continue;
if (GetClientTeam(client) == 2 && IsPlayerAlive(client))
{
found_enemy = true;
}
if (!is_bot_player(client) && GetClientTeam(client) > 1)
{
found_valid_ct = true;
break;
}
}
for (int client = 1; client <= MaxClients; client++)
@ -412,13 +416,6 @@ public Action recursive_pressing(Handle timer, any data)
ChangeClientTeam(client, 2);
continue;
}
if (bot_avoid_edge[client] >= 3)
bot_avoid_edge[client] = -1;
if (bot_avoid_edge[client] > -1)
{
bot_avoid_edge[client]++;
continue;
}
if (IsPlayerAlive(client))
{
int targeteam = 0;
@ -518,13 +515,14 @@ public Action recursive_pressing(Handle timer, any data)
state = 0;
}
//if bot is ct: if bot is not close enough to friend follow him, //dist_target being larger than max_range_dist means a friend was found to follow
else if (targeteam == 3 && dist_target > max_range_dist)
//we also check if zm already spawned, if not then stay close to friend
else if ((targeteam == 3 && dist_target > max_range_dist) || !found_enemy)
{
human_too_close[client] = false;
face_call(target_friend[client], client);
state = 1;
}
//if bot is ct and close enough to friend then just do nothing in case of there being no enemy to shoot at
//if bot is ct and close enough to friend then just do nothing in case of there being no enemy to shoot at.
else if (targeteam == 3)
{
human_too_close[client] = true;
@ -908,7 +906,6 @@ public void OnClientPostAdminCheck(int client)
targetfriend_prev_coords[client][2] = 0.0;
human_too_close[client] = false;
bot_follow_tp[client] = false;
bot_avoid_edge[client] = -1;
char auth[64];
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
if (is_autism_bot1(client))
@ -960,7 +957,6 @@ stock void connect_socket()
public void OnClientDisconnect(int client)
{
bot_avoid_edge[client] = -1;
client_old_coords[client][0] = 0.0;
client_old_coords[client][1] = 0.0;
client_old_coords[client][2] = 0.0;