mirror of
https://github.com/ineedbots/iw3_bot_warfare.git
synced 2025-05-10 14:24:49 +00:00
add cod4x io builtins
This commit is contained in:
parent
21949a47da
commit
dc58bf328a
@ -129,6 +129,54 @@ BotBuiltinIsBot()
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Opens the file
|
||||
*/
|
||||
BotBuiltinFileOpen( file, mode )
|
||||
{
|
||||
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["fs_fopen"] ) )
|
||||
{
|
||||
return [[ level.bot_builtins["fs_fopen" ]]]( file, mode );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Closes the file
|
||||
*/
|
||||
BotBuiltinFileClose( fh )
|
||||
{
|
||||
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["fs_fclose"] ) )
|
||||
{
|
||||
[[ level.bot_builtins["fs_fclose" ]]]( fh );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Closes the file
|
||||
*/
|
||||
BotBuiltinReadLine( fh )
|
||||
{
|
||||
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["fs_readline"] ) )
|
||||
{
|
||||
return [[ level.bot_builtins["fs_readline" ]]]( fh );
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/*
|
||||
Closes the file
|
||||
*/
|
||||
BotBuiltinWriteLine( fh, contents )
|
||||
{
|
||||
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["fs_writeline"] ) )
|
||||
{
|
||||
[[ level.bot_builtins["fs_writeline" ]]]( fh, contents );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Returns if player is the host
|
||||
*/
|
||||
|
@ -9,6 +9,10 @@ init()
|
||||
level.bot_builtins["botmovement"] = ::do_botmovement;
|
||||
level.bot_builtins["botmoveto"] = ::do_botmoveto;
|
||||
level.bot_builtins["isbot"] = ::do_isbot;
|
||||
level.bot_builtins["fs_fopen"] = ::do_fs_fopen;
|
||||
level.bot_builtins["fs_fclose"] = ::do_fs_fclose;
|
||||
level.bot_builtins["fs_readline"] = ::do_fs_readline;
|
||||
level.bot_builtins["fs_writeline"] = ::do_fs_writeline;
|
||||
}
|
||||
|
||||
do_printconsole( s )
|
||||
@ -79,3 +83,25 @@ do_isbot()
|
||||
{
|
||||
return self.isbot;
|
||||
}
|
||||
|
||||
do_fs_fopen( file, mode )
|
||||
{
|
||||
file = "scriptdata/" + file;
|
||||
return FS_FOpen( file, mode );
|
||||
}
|
||||
|
||||
do_fs_fclose( file )
|
||||
{
|
||||
file = "scriptdata/" + file;
|
||||
FS_FClose( file );
|
||||
}
|
||||
|
||||
do_fs_readline( fh )
|
||||
{
|
||||
return FS_ReadLine( fh );
|
||||
}
|
||||
|
||||
do_fs_writeline( fh, contents )
|
||||
{
|
||||
FS_WriteLine( fh, contents );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user