update roblox_emulator

This commit is contained in:
Quaternions 2024-10-04 15:50:40 -07:00
parent c9c3bebd02
commit c014244b4b
3 changed files with 7 additions and 8 deletions

4
Cargo.lock generated
View File

@ -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",

View File

@ -10,7 +10,7 @@ authors = ["Rhys Lloyd <krakow20@gmail.com>"]
[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" }

View File

@ -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<R:Read>(input:R)->Result<rbx_dom_weak::WeakDom,ReadError>{
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)?;
}