update roblox_emulator
This commit is contained in:
parent
c9c3bebd02
commit
a59d0fc11f
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -504,9 +504,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "roblox_emulator"
|
name = "roblox_emulator"
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
checksum = "f73c50802f947550642aaeb3da2993751c0e37024ac922dec99313068596321e"
|
checksum = "df647d25a9bc8871a838a830ae90776cd31c44d1a74268bd783d1cadcd8fcd93"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glam",
|
"glam",
|
||||||
"mlua",
|
"mlua",
|
||||||
|
@ -10,7 +10,7 @@ authors = ["Rhys Lloyd <krakow20@gmail.com>"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.89"
|
anyhow = "1.0.89"
|
||||||
clap = { version = "4.5.18", features = ["derive"] }
|
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_binary = { version = "0.7.4", registry = "strafesnet" }
|
||||||
rbx_dom_weak = { version = "2.9.0", registry = "strafesnet" }
|
rbx_dom_weak = { version = "2.9.0", registry = "strafesnet" }
|
||||||
rbx_xml = { version = "0.13.3", registry = "strafesnet" }
|
rbx_xml = { version = "0.13.3", registry = "strafesnet" }
|
||||||
|
@ -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 (mut context,script,services)=roblox_emulator::context::Context::script_singleton(source);
|
||||||
let runner=roblox_emulator::runner::Runner::new()?;
|
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)?;
|
runnable.run_script(script)?;
|
||||||
Ok(())
|
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<()>{
|
fn run_model(input_file:PathBuf)->anyhow::Result<()>{
|
||||||
let file=std::fs::File::open(input_file)?;
|
let file=std::fs::File::open(input_file)?;
|
||||||
let dom=read(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 mut context=roblox_emulator::context::Context::new(dom);
|
||||||
|
let services=context.convert_into_place();
|
||||||
let scripts=context.scripts();
|
let scripts=context.scripts();
|
||||||
let runner=roblox_emulator::runner::Runner::new()?;
|
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{
|
for script in scripts{
|
||||||
runnable.run_script(script)?;
|
runnable.run_script(script)?;
|
||||||
}
|
}
|
||||||
@ -96,11 +96,10 @@ fn run_model(input_file:PathBuf)->anyhow::Result<()>{
|
|||||||
fn run_place(input_file:PathBuf)->anyhow::Result<()>{
|
fn run_place(input_file:PathBuf)->anyhow::Result<()>{
|
||||||
let file=std::fs::File::open(input_file)?;
|
let file=std::fs::File::open(input_file)?;
|
||||||
let dom=read(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 mut context=roblox_emulator::context::Context::new(dom);
|
||||||
let scripts=context.scripts();
|
let scripts=context.scripts();
|
||||||
let runner=roblox_emulator::runner::Runner::new()?;
|
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{
|
for script in scripts{
|
||||||
runnable.run_script(script)?;
|
runnable.run_script(script)?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user