From 13b52670ed83b92ce316a846c3644f0db6780de2 Mon Sep 17 00:00:00 2001 From: ineed bots Date: Tue, 12 Mar 2024 14:54:39 -0600 Subject: [PATCH] waittillframeend event --- maps/mp/bots/_bot.gsc | 2 +- maps/mp/bots/_bot_utility.gsc | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/maps/mp/bots/_bot.gsc b/maps/mp/bots/_bot.gsc index d56df29..d4a277b 100644 --- a/maps/mp/bots/_bot.gsc +++ b/maps/mp/bots/_bot.gsc @@ -6,7 +6,7 @@ */ init() { - level.bw_version = "2.1.0"; + level.bw_version = "2.2.0 PR 1"; if ( getcvar( "bots_main" ) == "" ) { diff --git a/maps/mp/bots/_bot_utility.gsc b/maps/mp/bots/_bot_utility.gsc index 3a8cbd9..05efbc1 100644 --- a/maps/mp/bots/_bot_utility.gsc +++ b/maps/mp/bots/_bot_utility.gsc @@ -296,12 +296,22 @@ BotStopMoving( what ) } } +/* + Waits till frame end so that if two notifies happen in the same frame, the other will not be missed. +*/ +BotNotifyBotEvent_( msg, a, b, c, d, e, f, g ) +{ + self endon( "disconnect" ); + waittillframeend; // wait for the waittills to setup again + self notify( "bot_event", msg, a, b, c, d, e, f, g ); +} + /* Notify the bot chat message */ BotNotifyBotEvent( msg, a, b, c, d, e, f, g ) { - self notify( "bot_event", msg, a, b, c, d, e, f, g ); + self thread BotNotifyBotEvent_( msg, a, b, c, d, e, f, g ); } /*