mirror of
https://github.com/ineedbots/t4_bot_warfare.git
synced 2025-09-22 22:56:40 +00:00
t4 refactor
This commit is contained in:
@@ -36,7 +36,7 @@ init()
|
|||||||
|
|
||||||
if ( getdvar( "bots_main_firstIsHost" ) == "" )
|
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" ) == "" )
|
if ( getdvar( "bots_main_waitForHostTime" ) == "" )
|
||||||
|
@@ -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
|
Returns if player is the host
|
||||||
*/
|
*/
|
||||||
@@ -222,7 +255,7 @@ doHostCheck()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !result )
|
if ( !self BotBuiltinIsHost() && !result )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -25,10 +25,10 @@ init()
|
|||||||
if ( !getdvarint( "developer" ) )
|
if ( !getdvarint( "developer" ) )
|
||||||
{
|
{
|
||||||
setdvar( "developer_script", 1 );
|
setdvar( "developer_script", 1 );
|
||||||
setdvar( "developer", 1 );
|
setdvar( "developer", 2 );
|
||||||
|
|
||||||
setdvar( "sv_mapRotation", "map " + getdvar( "mapname" ) );
|
BotBuiltinCmdExec( "devmap " + getdvar( "mapname" ) );
|
||||||
exitlevel( false );
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setdvar( "bots_main", 0 );
|
setdvar( "bots_main", 0 );
|
||||||
|
@@ -12,6 +12,24 @@ init()
|
|||||||
level.bot_builtins[ "fs_fclose" ] = ::do_fs_fclose;
|
level.bot_builtins[ "fs_fclose" ] = ::do_fs_fclose;
|
||||||
level.bot_builtins[ "fs_readline" ] = ::do_fs_readline;
|
level.bot_builtins[ "fs_readline" ] = ::do_fs_readline;
|
||||||
level.bot_builtins[ "fs_writeline" ] = ::do_fs_writeline;
|
level.bot_builtins[ "fs_writeline" ] = ::do_fs_writeline;
|
||||||
|
level.bot_builtins[ "notifyonplayercommand" ] = ::do_notifyonplayercommand;
|
||||||
|
level.bot_builtins[ "cmdexec" ] = ::do_cmdexec;
|
||||||
|
level.bot_builtins[ "ishost" ] = ::do_ishost;
|
||||||
|
}
|
||||||
|
|
||||||
|
do_notifyonplayercommand( a, b )
|
||||||
|
{
|
||||||
|
self notifyonplayercommand( a, b );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_cmdexec( a )
|
||||||
|
{
|
||||||
|
cmdexec( a );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_ishost()
|
||||||
|
{
|
||||||
|
return self ishost();
|
||||||
}
|
}
|
||||||
|
|
||||||
do_printconsole( s )
|
do_printconsole( s )
|
||||||
|
Reference in New Issue
Block a user