rbx_loader: report script errors

This commit is contained in:
2025-05-15 20:00:37 -07:00
parent dcc91db6f7
commit f896e6cfff

View File

@@ -5,6 +5,7 @@ use strafesnet_common::map::CompleteMap;
use strafesnet_deferred_loader::deferred_loader::{LoadFailureMode,MeshDeferredLoader,RenderConfigDeferredLoader};
pub use error::RecoverableErrors;
pub use roblox_emulator::runner::Error as RunnerError;
mod rbx;
mod mesh;
@@ -52,16 +53,18 @@ impl Place{
context,
})
}
pub fn run_scripts(&mut self){
pub fn run_scripts(&mut self)->Result<Vec<RunnerError>,RunnerError>{
let Place{context}=self;
let runner=roblox_emulator::runner::Runner::new().unwrap();
let runner=roblox_emulator::runner::Runner::new()?;
let scripts=context.scripts();
let runnable=runner.runnable_context(context).unwrap();
let runnable=runner.runnable_context(context)?;
let mut errors=Vec::new();
for script in scripts{
if let Err(e)=runnable.run_script(script){
println!("runner error: {e}");
errors.push(e);
}
}
Ok(errors)
}
pub fn to_snf(&self,failure_mode:LoadFailureMode)->Result<(CompleteMap,RecoverableErrors),LoadError>{
to_snf(self,failure_mode)