diff --git a/Cargo.lock b/Cargo.lock index ae44c7e..59593fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -571,9 +571,9 @@ dependencies = [ [[package]] name = "roblox_emulator" -version = "0.3.1" +version = "0.4.0" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "b58d7bb42d458984e629a012757474710fd0e429c2c824a2529574be5e7c2fd6" +checksum = "df647d25a9bc8871a838a830ae90776cd31c44d1a74268bd783d1cadcd8fcd93" dependencies = [ "glam", "mlua", diff --git a/Cargo.toml b/Cargo.toml index 140ae91..c7c6411 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,5 +18,5 @@ rbx_dom_weak = { version = "2.7.0", registry = "strafesnet" } rbx_mesh = "0.1.2" rbx_reflection_database = { version = "0.2.10", registry = "strafesnet" } rbx_xml = { version = "0.13.3", registry = "strafesnet" } -roblox_emulator = { version = "0.3.1", registry = "strafesnet" } +roblox_emulator = { version = "0.4.0", registry = "strafesnet" } strafesnet_common = { version = "0.5.1", registry = "strafesnet" } diff --git a/src/lib.rs b/src/lib.rs index 0fec914..06fbb07 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,9 @@ impl Model{ Self{dom} } pub fn into_place(self)->Place{ - let (dom,services)=roblox_emulator::place::new_place_with_instances_in_workspace(self.dom); + let Self{mut dom}=self; + let context=roblox_emulator::context::Context::from_mut(&mut dom); + let services=context.convert_into_place(); Place{dom,services} } } @@ -37,15 +39,22 @@ impl AsRef for Model{ pub struct Place{ dom:WeakDom, - services:roblox_emulator::place::Services, + services:roblox_emulator::context::Services, } impl Place{ + fn new(dom:WeakDom)->Option{ + let context=roblox_emulator::context::Context::from_ref(&dom); + Some(Self{ + services:context.find_services()?, + dom, + }) + } pub fn run_scripts(&mut self){ let Place{dom,services}=self; let runner=roblox_emulator::runner::Runner::new().unwrap(); let context=roblox_emulator::context::Context::from_mut(dom); let scripts=context.scripts(); - let runnable=runner.runnable_context(context,services).unwrap(); + let runnable=runner.runnable_context_with_services(context,services).unwrap(); for script in scripts{ if let Err(e)=runnable.run_script(script){ println!("runner error: {e}");