should make autism bots join second ze server instead of gg

This commit is contained in:
christian 2021-12-09 22:49:52 +01:00
parent 7981416183
commit e84d9a8c46
3 changed files with 18 additions and 29 deletions

View File

@ -3,7 +3,6 @@
"chat_external_port": 48475, "chat_external_port": 48475,
"steam_port": 29074, "steam_port": 29074,
"server_ip_port_ze": "135.125.188.157:27015", "server_ip_port_ze": "135.125.188.157:27015",
"server_ip_port_gg": "135.125.188.157:27021", "server_ip_port_ze2": "135.125.188.157:27035"
"server_ip_port_zr": "135.125.188.157:27016"
} }

View File

@ -118,13 +118,11 @@ def launch_css_process():
def bot_connect(server, connected_to_other): def bot_connect(server, connected_to_other):
#use whatever ip you want here to connect with #use whatever ip you want here to connect with
str1 = "" str1 = ""
if "ze" in server: if "connect to ze" == server:
str1 = f"connect {data_ports['server_ip_port_ze']}" str1 = f"connect {data_ports['server_ip_port_ze']}"
connected_to_other = False connected_to_other = False
elif "gg" in server and not connected_to_other: elif "connect to ze2" == server and not connected_to_other:
str1 = f"connect {data_ports['server_ip_port_gg']}" str1 = f"connect {data_ports['server_ip_port_ze2']}"
elif not connected_to_other:
str1 = f"connect {data_ports['server_ip_port_zr']}"
writeCfgInput(str1) writeCfgInput(str1)
print('not yet connected') print('not yet connected')
@ -201,7 +199,8 @@ if __name__ == '__main__':
launch_css_process() launch_css_process()
connected_to_other = False connected_to_other = False
connection_issue_counter = -10 connection_issue_counter = -10
if not connected_to_other or "ze" in data: if not connected_to_other or "connect to ze" == data:
print('data: ', data)
connection_issue_counter += 1 connection_issue_counter += 1
print('connection_issue_counter: ', connection_issue_counter) print('connection_issue_counter: ', connection_issue_counter)
bot_connect(data, connected_to_other) bot_connect(data, connected_to_other)
@ -247,5 +246,3 @@ if [[ $DISPLAY ]]; then
steam steam
fi fi
""" """

View File

@ -19,7 +19,7 @@ int target_enemy[MAXPLAYERS + 1];
int buttons_old[MAXPLAYERS + 1]; int buttons_old[MAXPLAYERS + 1];
int flags_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 ports[7] = {48470, 48471, 48472, 48473, 48474, 48479, 48480}; //last three indexes are ports its sending udp from in plugin
int server_ports[3] = {27015, 27021, 27016}; //server ports: ze, gg, zr int server_ports[2] = {27015, 27035}; //server ports: ze, ze2
bool surf_cooldown = false; bool surf_cooldown = false;
int bot_avoid_edge[MAXPLAYERS + 1]; int bot_avoid_edge[MAXPLAYERS + 1];
float client_old_coords[MAXPLAYERS + 1][3]; float client_old_coords[MAXPLAYERS + 1][3];
@ -360,9 +360,8 @@ public Action bot_check_connect(Handle timer, any data)
found_bot2 = true; found_bot2 = true;
found_bot3 = true; found_bot3 = true;
found_bot4 = true; found_bot4 = true;
Format(msg, sizeof(msg), "connect to gg"); Format(msg, sizeof(msg), "connect to ze2");
send_socket_msg(msg, strlen(msg), ports[0]); send_socket_msg(msg, strlen(msg), ports[0]);
//Format(msg, sizeof(msg), "connect to zr");
send_socket_msg(msg, strlen(msg), ports[1]); send_socket_msg(msg, strlen(msg), ports[1]);
send_socket_msg(msg, strlen(msg), ports[2]); send_socket_msg(msg, strlen(msg), ports[2]);
send_socket_msg(msg, strlen(msg), ports[3]); send_socket_msg(msg, strlen(msg), ports[3]);
@ -371,18 +370,17 @@ public Action bot_check_connect(Handle timer, any data)
} }
else else
{ {
//respawning bot on the GG server because they dont respawn for whatever reason if (is_bot_player(i))
{
Format(msg, sizeof(msg), "connected to ze2");
}
if (is_autism_bot1(i)) if (is_autism_bot1(i))
{ {
Format(msg, sizeof(msg), "connected to gg");
send_socket_msg(msg, strlen(msg), ports[0]); send_socket_msg(msg, strlen(msg), ports[0]);
found_bot1 = true; found_bot1 = true;
CreateTimer(1.0, respawn_bot, i); CreateTimer(1.0, respawn_bot, i);
} }
else if (is_bot_player(i))
{
Format(msg, sizeof(msg), "connected to gg");
}
if (is_autism_bot2(i)) if (is_autism_bot2(i))
{ {
send_socket_msg(msg, strlen(msg), ports[1]); send_socket_msg(msg, strlen(msg), ports[1]);
@ -409,22 +407,22 @@ public Action bot_check_connect(Handle timer, any data)
Format(msg, sizeof(msg), "not connected"); Format(msg, sizeof(msg), "not connected");
if (!found_bot1 && i_port == server_ports[1]) if (!found_bot1 && i_port == server_ports[1])
{ {
//gg //ze2
send_socket_msg(msg, strlen(msg), ports[0]); send_socket_msg(msg, strlen(msg), ports[0]);
} }
if (!found_bot2 && i_port == server_ports[1]) if (!found_bot2 && i_port == server_ports[1])
{ {
//zr //ze2
send_socket_msg(msg, strlen(msg), ports[1]); send_socket_msg(msg, strlen(msg), ports[1]);
} }
if (!found_bot3 && i_port == server_ports[1]) if (!found_bot3 && i_port == server_ports[1])
{ {
//zr //ze2
send_socket_msg(msg, strlen(msg), ports[2]); send_socket_msg(msg, strlen(msg), ports[2]);
} }
if (!found_bot4 && i_port == server_ports[1]) if (!found_bot4 && i_port == server_ports[1])
{ {
//zr //ze2
send_socket_msg(msg, strlen(msg), ports[3]); send_socket_msg(msg, strlen(msg), ports[3]);
} }
} }
@ -1013,14 +1011,9 @@ stock void connect_socket()
int target_port = ports[4]; //default ze int target_port = ports[4]; //default ze
if (i_port == server_ports[1]) if (i_port == server_ports[1])
{ {
//gg //ze2
target_port = ports[5]; target_port = ports[5];
} }
else if (i_port == server_ports[2])
{
//zr
target_port = ports[6];
}
//socket otherwise declare in public OnConfigsExecuted(){} //socket otherwise declare in public OnConfigsExecuted(){}
global_socket = SocketCreate(SOCKET_UDP, OnSocketError); global_socket = SocketCreate(SOCKET_UDP, OnSocketError);
SocketSetOption(global_socket, SocketReuseAddr, 1); SocketSetOption(global_socket, SocketReuseAddr, 1);