From 9cbff651ce49e15763f5c8c653795aa278551203 Mon Sep 17 00:00:00 2001 From: ineed bots Date: Wed, 15 Jan 2025 00:58:51 -0600 Subject: [PATCH] more funcs --- maps/mp/bots/_bot_utility.gsc | 20 ++++++++++++++++++++ maps/mp/gametypes/_bot.gsc | 30 +++++++++++++++++++++++++----- scripts/mp/bots_adapter_pt5.gsc | 15 ++++++++++++++- 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/maps/mp/bots/_bot_utility.gsc b/maps/mp/bots/_bot_utility.gsc index 42b707a..58c4c31 100644 --- a/maps/mp/bots/_bot_utility.gsc +++ b/maps/mp/bots/_bot_utility.gsc @@ -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 ) diff --git a/maps/mp/gametypes/_bot.gsc b/maps/mp/gametypes/_bot.gsc index 239f22a..4a525ad 100644 --- a/maps/mp/gametypes/_bot.gsc +++ b/maps/mp/gametypes/_bot.gsc @@ -11,19 +11,39 @@ #include maps\mp\bots\_bot_utility; /* - Entry point to the bots */ -init() +main() { level.bw_version = "1.2.0"; - - level.bot_offline = false; - + 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"; + + if ( getdvar( "bots_main" ) == "" ) + { + setdvar( "bots_main", true ); + } + if ( !getdvarint( "bots_main" ) ) { return; diff --git a/scripts/mp/bots_adapter_pt5.gsc b/scripts/mp/bots_adapter_pt5.gsc index 853af8b..f248e80 100644 --- a/scripts/mp/bots_adapter_pt5.gsc +++ b/scripts/mp/bots_adapter_pt5.gsc @@ -1,4 +1,4 @@ -init() +main() { level.bot_builtins[ "printconsole" ] = ::do_printconsole; level.bot_builtins[ "botmovementoverride" ] = ::do_botmovementoverride; @@ -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 )