Skip to content

Commit

Permalink
more funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
ineed bots committed Jan 15, 2025
1 parent 232938d commit 9cbff65
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 5 deletions.
20 changes: 20 additions & 0 deletions maps/mp/bots/_bot_utility.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ BotBuiltinPrintConsole( s )
}
}

/*
*/
BotBuiltinReplaceFunc( s, b )
{
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "replacefunc" ] ) )
{
return [[ level.bot_builtins[ "replacefunc" ] ]]( s, b );
}
}

/*
*/
BotBuiltinGetFunction( s, b )
{
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "getfunction" ] ) )
{
return [[ level.bot_builtins[ "getfunction" ] ]]( s, b );
}
}

/*
*/
BotBuiltinClearOverride( a )
Expand Down
28 changes: 24 additions & 4 deletions maps/mp/gametypes/_bot.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,40 @@
#include maps\mp\gametypes\_hud_util;
#include maps\mp\bots\_bot_utility;

/*
*/
main()
{
level.bw_version = "1.2.0";

if ( getdvar( "bots_main" ) == "" )
{
setdvar( "bots_main", true );
}

if ( !getdvarint( "bots_main" ) )
{
return;
}

if ( !wait_for_builtins() )
{
println( "FATAL: NO BUILT-INS FOR BOTS" );
}
}

/*
Entry point to the bots
*/
init()
{
level.bw_version = "1.2.0";

level.bot_offline = false;


if ( getdvar( "bots_main" ) == "" )
{
setdvar( "bots_main", true );
}

if ( !getdvarint( "bots_main" ) )
{
return;
Expand Down
15 changes: 14 additions & 1 deletion scripts/mp/bots_adapter_pt5.gsc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
init()
main()
{
level.bot_builtins[ "printconsole" ] = ::do_printconsole;
level.bot_builtins[ "botmovementoverride" ] = ::do_botmovementoverride;
Expand All @@ -8,6 +8,19 @@ init()
level.bot_builtins[ "botweaponoverride" ] = ::do_botweaponoverride;
level.bot_builtins[ "botaimoverride" ] = ::do_botaimoverride;
level.bot_builtins[ "botmeleeparamsoverride" ] = ::do_botmeleeparamsoverride;
level.bot_builtins[ "replacefunc" ] = ::do_replacefunc;
level.bot_builtins[ "getfunction" ] = ::do_getfunction;
maps\mp\gametypes\_bot::main();
}

do_replacefunc( a, b )
{
return replacefunc( a, b );
}

do_getfunction( a, b )
{
return getfunction( a, b );
}

do_printconsole( s )
Expand Down

0 comments on commit 9cbff65

Please sign in to comment.