fix: add file handling functions for bot built-ins

Loading all waypoint data at once crashes on real hardware on various maps, narrowed it down to those maps with bigger waypoint files. Using a streamed file reader seems to work better but there might be a "better" fix to look at in the future.
This commit is contained in:
Michael Oliver
2026-06-13 11:12:45 +01:00
committed by mo
parent c00572ddba
commit e7f1a90440
2 changed files with 77 additions and 7 deletions
+19
View File
@@ -4,6 +4,9 @@ init()
level.bot_builtins[ "filewrite" ] = ::do_filewrite;
level.bot_builtins[ "fileread" ] = ::do_fileread;
level.bot_builtins[ "fileexists" ] = ::do_fileexists;
level.bot_builtins[ "openfile" ] = ::do_openfile;
level.bot_builtins[ "readstream" ] = ::do_readstream;
level.bot_builtins[ "closefile" ] = ::do_closefile;
level.bot_builtins[ "botaction" ] = ::do_botaction;
level.bot_builtins[ "botstop" ] = ::do_botstop;
level.bot_builtins[ "botmovement" ] = ::do_botmovement;
@@ -35,6 +38,22 @@ do_fileexists( file )
return fileexists( file );
}
do_openfile( file, mode )
{
file = "scriptdata/" + file;
return openfile( file, mode );
}
do_readstream()
{
return readstream();
}
do_closefile()
{
return closefile();
}
do_botaction( action )
{
self botaction( action );