This commit is contained in:
ineed bots 2023-11-27 19:57:59 -06:00
parent 3498bd096c
commit 091b54fc98
3 changed files with 23 additions and 7 deletions

View File

@ -23,6 +23,9 @@ init()
if ( !getDvarInt( "bots_main" ) ) if ( !getDvarInt( "bots_main" ) )
return; return;
if ( !wait_for_builtins() )
PrintLn( "FATAL: NO BUILT-INS FOR BOTS" );
thread load_waypoints(); thread load_waypoints();
thread hook_callbacks(); thread hook_callbacks();

View File

@ -6,6 +6,7 @@
Notes for engine Notes for engine
obv the old bot behavior should be changed to use gsc built-ins to control bots obv the old bot behavior should be changed to use gsc built-ins to control bots
bots using objects needs to be fixed
setSpawnWeapon and switchToWeapon should be modified to work for testclients setSpawnWeapon and switchToWeapon should be modified to work for testclients
*/ */
@ -13,6 +14,25 @@
#include maps\mp\_utility; #include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util; #include maps\mp\gametypes\_hud_util;
/*
Waits for the built-ins to be defined
*/
wait_for_builtins()
{
for ( i = 0; i < 20; i++ )
{
if ( isDefined( level.bot_builtins ) )
return true;
if ( i < 18 )
waittillframeend;
else
wait 0.05;
}
return false;
}
/* /*
Prints to console without dev script on Prints to console without dev script on
*/ */

View File

@ -1,12 +1,5 @@
init() init()
{ {
thread setup_builtins();
}
setup_builtins()
{
waittillframeend;
level.bot_builtins["printconsole"] = ::do_printconsole; level.bot_builtins["printconsole"] = ::do_printconsole;
level.bot_builtins["filewrite"] = ::do_filewrite; level.bot_builtins["filewrite"] = ::do_filewrite;
level.bot_builtins["fileread"] = ::do_fileread; level.bot_builtins["fileread"] = ::do_fileread;