From 6f2057c8fafbf846cc310fdcfb6c81646d1fb3ac Mon Sep 17 00:00:00 2001 From: ineed bots Date: Thu, 25 Apr 2024 14:21:38 -0600 Subject: [PATCH] connection events --- maps/mp/bots/_bot.gsc | 26 ++++++++++++++++++++++++++ maps/mp/bots/_bot_chat.gsc | 21 +++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/maps/mp/bots/_bot.gsc b/maps/mp/bots/_bot.gsc index 7ac2670..a8bb50e 100644 --- a/maps/mp/bots/_bot.gsc +++ b/maps/mp/bots/_bot.gsc @@ -218,8 +218,11 @@ init() if ( !isdefined( game[ "botWarfare" ] ) ) { game[ "botWarfare" ] = true; + game[ "botWarfareInitTime" ] = gettime(); } + level.bot_inittime = gettime(); + level.defuseobject = undefined; level.bots_smokelist = 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. */ @@ -613,6 +631,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(); diff --git a/maps/mp/bots/_bot_chat.gsc b/maps/mp/bots/_bot_chat.gsc index 13c375b..6429db1 100644 --- a/maps/mp/bots/_bot_chat.gsc +++ b/maps/mp/bots/_bot_chat.gsc @@ -312,10 +312,31 @@ start_chat_watch() case "vip": self thread bot_chat_vip_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 */