From 52ebe9961f110bd5a358038955da6148b7b0470a Mon Sep 17 00:00:00 2001 From: JezuzLizard Date: Sun, 30 Apr 2023 02:31:15 -0700 Subject: [PATCH] Hack fix for targets not being cleared. --- maps/bots/_bot_internal.gsc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/maps/bots/_bot_internal.gsc b/maps/bots/_bot_internal.gsc index d0b4a0b..5182235 100644 --- a/maps/bots/_bot_internal.gsc +++ b/maps/bots/_bot_internal.gsc @@ -270,12 +270,33 @@ spawned() self thread doBotMovement(); self thread walk(); self thread target(); + self thread target_cleanup(); self thread updateBones(); self thread aim(); self notify( "bot_spawned" ); } +target_cleanup() +{ + self endon( "disconnect" ); + self endon( "zombified" ); + while ( true ) + { + wait 10; + curTime = getTime(); + targetKeys = getArrayKeys( self.bot.targets ); + for ( i = 0; i < targetKeys.size; i++ ) + { + obj = self.bot.targets[ targetKeys[ i ] ]; + if ( ( curTime - obj.time ) > 30000 ) + { + self.bot.targets[ targetKeys[ i ] ] = undefined; + } + } + } +} + /* Bot moves towards the point */