update roblox_emulator
This commit is contained in:
parent
14cc0776a6
commit
7e09494146
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -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",
|
||||
|
@ -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" }
|
||||
|
15
src/lib.rs
15
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<WeakDom> for Model{
|
||||
|
||||
pub struct Place{
|
||||
dom:WeakDom,
|
||||
services:roblox_emulator::place::Services,
|
||||
services:roblox_emulator::context::Services,
|
||||
}
|
||||
impl Place{
|
||||
fn new(dom:WeakDom)->Option<Self>{
|
||||
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}");
|
||||
|
Loading…
Reference in New Issue
Block a user