t4 refactor

This commit is contained in:
ineed bots
2025-05-22 18:51:26 -06:00
parent 3e08ac900d
commit b8597ee810
4 changed files with 56 additions and 5 deletions

View File

@@ -36,7 +36,7 @@ init()
if ( getdvar( "bots_main_firstIsHost" ) == "" )
{
setdvar( "bots_main_firstIsHost", true ); // first player to connect is a host
setdvar( "bots_main_firstIsHost", false ); // first player to connect is a host
}
if ( getdvar( "bots_main_waitForHostTime" ) == "" )

View File

@@ -170,6 +170,39 @@ BotBuiltinWriteLine( fh, contents )
}
}
/*
*/
BotBuiltinCmdExec( what )
{
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "cmdexec" ] ) )
{
[[ level.bot_builtins[ "cmdexec" ] ]]( what );
}
}
/*
*/
BotBuiltinNotifyOnPlayerCommand( cmd, notif )
{
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "notifyonplayercommand" ] ) )
{
self [[ level.bot_builtins[ "notifyonplayercommand" ] ]]( cmd, notif );
}
}
/*
waw doesnt have
*/
BotBuiltinIsHost()
{
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "ishost" ] ) )
{
return self [[ level.bot_builtins[ "ishost" ] ]]();
}
return false;
}
/*
Returns if player is the host
*/
@@ -222,7 +255,7 @@ doHostCheck()
}
}
if ( !result )
if ( !self BotBuiltinIsHost() && !result )
{
return;
}

View File

@@ -25,10 +25,10 @@ init()
if ( !getdvarint( "developer" ) )
{
setdvar( "developer_script", 1 );
setdvar( "developer", 1 );
setdvar( "developer", 2 );
setdvar( "sv_mapRotation", "map " + getdvar( "mapname" ) );
exitlevel( false );
BotBuiltinCmdExec( "devmap " + getdvar( "mapname" ) );
return;
}
setdvar( "bots_main", 0 );