connection events

This commit is contained in:
ineed bots 2024-04-25 14:07:35 -06:00
parent b3967606f4
commit 0ea6672804
2 changed files with 44 additions and 0 deletions

View File

@ -440,6 +440,21 @@ fixPerksAndScriptKick()
self.pers[ "isBot" ] = true;
}
/*
When a bot disconnects.
*/
onDisconnectPlayer()
{
self waittill( "disconnect" );
waittillframeend;
for ( i = 0; i < level.bots.size; i++ )
{
bot = level.bots[ i ];
bot BotNotifyBotEvent( "connection", "disconnected", self, self.name );
}
}
/*
When a bot disconnects.
*/
@ -457,6 +472,14 @@ connected()
{
self endon( "disconnect" );
for ( i = 0; i < level.bots.size; i++ )
{
bot = level.bots[ i ];
bot BotNotifyBotEvent( "connection", "connected", self, self.name );
}
self thread onDisconnectPlayer();
if ( !isdefined( self.pers[ "bot_host" ] ) )
{
self thread doHostCheck();

View File

@ -252,10 +252,31 @@ start_chat_watch()
case "sd":
self thread bot_chat_sd_watch( a, b, c, d, e, f, g );
break;
case "connection":
self thread bot_chat_connection_player_watch( a, b, c, d, e, f, g );
break;
}
}
}
/*
When a player connected
*/
bot_chat_connection_player_watch( conn, player, playername, d, e, f, g )
{
self endon( "disconnect" );
switch ( conn )
{
case "connected":
break;
case "disconnected":
break;
}
}
/*
start_startgame_watch
*/