Compare commits

...

2 Commits

Author SHA1 Message Date
4bede23085 v0.1.3 update roblox_emulator 2024-10-04 19:42:00 -07:00
030a128e23 update roblox_emulator 2024-10-04 19:42:00 -07:00
3 changed files with 9 additions and 10 deletions

6
Cargo.lock generated
View File

@ -504,9 +504,9 @@ dependencies = [
[[package]] [[package]]
name = "roblox_emulator" name = "roblox_emulator"
version = "0.3.2" version = "0.4.1"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "f73c50802f947550642aaeb3da2993751c0e37024ac922dec99313068596321e" checksum = "6935943e8d473c8d19b52623877bee18421743072e2675730886d13592008266"
dependencies = [ dependencies = [
"glam", "glam",
"mlua", "mlua",
@ -518,7 +518,7 @@ dependencies = [
[[package]] [[package]]
name = "roblox_emulator_cli" name = "roblox_emulator_cli"
version = "0.1.2" version = "0.1.3"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "roblox_emulator_cli" name = "roblox_emulator_cli"
version = "0.1.2" version = "0.1.3"
edition = "2021" edition = "2021"
repository = "https://git.itzana.me/StrafesNET/roblox_emulator_cli" repository = "https://git.itzana.me/StrafesNET/roblox_emulator_cli"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
@ -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.1", 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" }

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 (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)?;
} }