connection events

This commit is contained in:
ineed bots 2024-04-25 14:21:38 -06:00
parent 473013dfb3
commit 6f2057c8fa
2 changed files with 47 additions and 0 deletions

View File

@ -218,8 +218,11 @@ init()
if ( !isdefined( game[ "botWarfare" ] ) ) if ( !isdefined( game[ "botWarfare" ] ) )
{ {
game[ "botWarfare" ] = true; game[ "botWarfare" ] = true;
game[ "botWarfareInitTime" ] = gettime();
} }
level.bot_inittime = gettime();
level.defuseobject = undefined; level.defuseobject = undefined;
level.bots_smokelist = List(); level.bots_smokelist = List();
level.bots_fraglist = List(); level.bots_fraglist = List();
@ -596,6 +599,21 @@ watchScrabler()
} }
} }
/*
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. When a bot disconnects.
*/ */
@ -613,6 +631,14 @@ connected()
{ {
self endon( "disconnect" ); 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" ] ) ) if ( !isdefined( self.pers[ "bot_host" ] ) )
{ {
self thread doHostCheck(); self thread doHostCheck();

View File

@ -312,10 +312,31 @@ start_chat_watch()
case "vip": case "vip":
self thread bot_chat_vip_watch( a, b, c, d, e, f, g ); self thread bot_chat_vip_watch( a, b, c, d, e, f, g );
break; 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 start_startgame_watch
*/ */