added rtv feature and probably fixed reconnection to the other servers

This commit is contained in:
christian 2021-10-17 19:07:12 +02:00
parent a0c4c2aa6b
commit 76b336a657
2 changed files with 13 additions and 6 deletions

View File

@ -195,6 +195,8 @@ if __name__ == '__main__':
print('bot kicked server full: ', datetime.datetime.now().time()) print('bot kicked server full: ', datetime.datetime.now().time())
elif "connected to" in data: elif "connected to" in data:
connected_to_other = True connected_to_other = True
elif "not connected" in data:
connected_to_other = False
elif "connect to" in data: elif "connect to" in data:
if connection_issue_counter == 20: if connection_issue_counter == 20:
kill_owned_process("pidof hl2_linux") kill_owned_process("pidof hl2_linux")
@ -205,7 +207,7 @@ 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:
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)
@ -252,4 +254,3 @@ if [[ $DISPLAY ]]; then
fi fi
""" """

View File

@ -300,6 +300,7 @@ public void send_socket_msg(char[] query_msg, int len, int port)
public Action bot_check_connect(Handle timer, any data) public Action bot_check_connect(Handle timer, any data)
{ {
//this is designed for being ran from several css servers
int client_count = GetClientCount(false); int client_count = GetClientCount(false);
char msg[generic_length]; char msg[generic_length];
int i_port = GetConVarInt(FindConVar("hostport")); int i_port = GetConVarInt(FindConVar("hostport"));
@ -365,14 +366,11 @@ public Action bot_check_connect(Handle timer, any data)
} }
else else
{ {
found_bot1 = true;
found_bot2 = true;
found_bot3 = true;
found_bot4 = true;
if (is_autism_bot1(i)) if (is_autism_bot1(i))
{ {
Format(msg, sizeof(msg), "connected to gg"); 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;
} }
else if (is_bot_player(i)) else if (is_bot_player(i))
{ {
@ -381,17 +379,25 @@ public Action bot_check_connect(Handle timer, any data)
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]);
found_bot2 = true;
} }
if (is_autism_bot3(i)) if (is_autism_bot3(i))
{ {
send_socket_msg(msg, strlen(msg), ports[2]); send_socket_msg(msg, strlen(msg), ports[2]);
found_bot3 = true;
} }
if (is_autism_bot4(i)) if (is_autism_bot4(i))
{ {
send_socket_msg(msg, strlen(msg), ports[3]); send_socket_msg(msg, strlen(msg), ports[3]);
found_bot4 = true;
} }
} }
} }
//this check ensures servers dont overlap each other
if (!is_host_ze)
{
Format(msg, sizeof(msg), "not connected");
}
if (!found_bot1) if (!found_bot1)
{ {
send_socket_msg(msg, strlen(msg), ports[0]); send_socket_msg(msg, strlen(msg), ports[0]);