From c014244b4b32054d4bdbdae1fbdedff708094d35 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 4 Oct 2024 15:50:40 -0700 Subject: [PATCH] update roblox_emulator --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/main.rs | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e1f68ca..920bfc4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -504,9 +504,9 @@ dependencies = [ [[package]] name = "roblox_emulator" -version = "0.3.2" +version = "0.4.0" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "f73c50802f947550642aaeb3da2993751c0e37024ac922dec99313068596321e" +checksum = "df647d25a9bc8871a838a830ae90776cd31c44d1a74268bd783d1cadcd8fcd93" dependencies = [ "glam", "mlua", diff --git a/Cargo.toml b/Cargo.toml index ccab40a..db82907 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ authors = ["Rhys Lloyd "] [dependencies] anyhow = "1.0.89" clap = { version = "4.5.18", features = ["derive"] } -roblox_emulator = { version = "0.3.2", registry = "strafesnet" } +roblox_emulator = { version = "0.4.0", registry = "strafesnet" } rbx_binary = { version = "0.7.4", registry = "strafesnet" } rbx_dom_weak = { version = "2.9.0", registry = "strafesnet" } rbx_xml = { version = "0.13.3", registry = "strafesnet" } diff --git a/src/main.rs b/src/main.rs index 98d5d78..5119c20 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,7 +50,7 @@ fn run_script(input_file:PathBuf)->anyhow::Result<()>{ }; let (mut context,script,services)=roblox_emulator::context::Context::script_singleton(source); let runner=roblox_emulator::runner::Runner::new()?; - let runnable=runner.runnable_context(&mut context,&services)?; + let runnable=runner.runnable_context_with_services(&mut context,&services)?; runnable.run_script(script)?; Ok(()) } @@ -82,11 +82,11 @@ pub fn read(input:R)->Result{ fn run_model(input_file:PathBuf)->anyhow::Result<()>{ let file=std::fs::File::open(input_file)?; let dom=read(file)?; - let (dom,services)=roblox_emulator::place::new_place_with_instances_in_workspace(dom); let mut context=roblox_emulator::context::Context::new(dom); + let services=context.convert_into_place(); let scripts=context.scripts(); let runner=roblox_emulator::runner::Runner::new()?; - let runnable=runner.runnable_context(&mut context,&services)?; + let runnable=runner.runnable_context_with_services(&mut context,&services)?; for script in scripts{ runnable.run_script(script)?; } @@ -96,11 +96,10 @@ fn run_model(input_file:PathBuf)->anyhow::Result<()>{ fn run_place(input_file:PathBuf)->anyhow::Result<()>{ let file=std::fs::File::open(input_file)?; let dom=read(file)?; - let services=roblox_emulator::place::Services::find_in(&dom).ok_or(anyhow::Error::msg("Could not find Workspace"))?; let mut context=roblox_emulator::context::Context::new(dom); let scripts=context.scripts(); let runner=roblox_emulator::runner::Runner::new()?; - let runnable=runner.runnable_context(&mut context,&services)?; + let runnable=runner.runnable_context(&mut context)?; for script in scripts{ runnable.run_script(script)?; }