From 0c128e472b1b49e32c313874eaeccc8c5f1b1202 Mon Sep 17 00:00:00 2001 From: Mica White Date: Mon, 26 Oct 2026 10:51:49 -0400 Subject: Finish engine --- src/script/lua.rs | 67 +------------------------------------------------------ 1 file changed, 1 insertion(+), 66 deletions(-) (limited to 'src/script/lua.rs') diff --git a/src/script/lua.rs b/src/script/lua.rs index a5c7f6a..92d455d 100644 --- a/src/script/lua.rs +++ b/src/script/lua.rs @@ -50,12 +50,7 @@ impl LuaModule { warn, error, exit, - is_scene_loaded, - preload_scene, switch_scene, - is_script_loaded, - preload_script, - unload_script, activate_script, deactivate_script, state, @@ -246,29 +241,6 @@ fn exit(lua: &Lua, _: ()) -> mlua::Result<()> { Ok(()) } -fn is_scene_loaded(lua: &Lua, scene: String) -> mlua::Result<()> { - puffin::profile_function!(); - let context = unsafe { context(lua) }; - let scene = scene_id_by_name(&context.manifest.scenes, &scene) - .ok_or(mlua::Error::runtime("No scene with the given name found"))?; - crate::scene::is_scene_loaded( - &context.manifest.scenes, - context.scripts, - &context.files, - scene, - ); - Ok(()) -} - -fn preload_scene(lua: &Lua, scene: String) -> mlua::Result<()> { - puffin::profile_function!(); - let context = unsafe { context(lua) }; - let scene = scene_id_by_name(&context.manifest.scenes, &scene) - .ok_or(mlua::Error::runtime("No scene with the given name found"))?; - context.operation_queue.push(Operation::PreloadScene(scene)); - Ok(()) -} - fn switch_scene(lua: &Lua, scene: String) -> mlua::Result<()> { puffin::profile_function!(); let context = unsafe { context(lua) }; @@ -278,43 +250,6 @@ fn switch_scene(lua: &Lua, scene: String) -> mlua::Result<()> { Ok(()) } -fn is_script_loaded(lua: &Lua, script: String) -> mlua::Result<()> { - puffin::profile_function!(); - let context = unsafe { context(lua) }; - let script = context - .scripts - .script_id_by_name(&script) - .ok_or(mlua::Error::runtime("No script with the given name found"))?; - context.scripts.is_script_loaded(script, &context.files); - Ok(()) -} - -fn preload_script(lua: &Lua, script: String) -> mlua::Result<()> { - puffin::profile_function!(); - let context = unsafe { context(lua) }; - let script = context - .scripts - .script_id_by_name(&script) - .ok_or(mlua::Error::runtime("No script with the given name found"))?; - context - .operation_queue - .push(Operation::PreloadScript(script)); - Ok(()) -} - -fn unload_script(lua: &Lua, script: String) -> mlua::Result<()> { - puffin::profile_function!(); - let context = unsafe { context(lua) }; - let script = context - .scripts - .script_id_by_name(&script) - .ok_or(mlua::Error::runtime("No script with the given name found"))?; - context - .operation_queue - .push(Operation::UnloadScript(script)); - Ok(()) -} - fn activate_script(lua: &Lua, script: String) -> mlua::Result<()> { puffin::profile_function!(); let context = unsafe { context(lua) }; @@ -436,7 +371,7 @@ fn storage(lua: &Lua, default: MyLuaValue) -> mlua::Result { let context = unsafe { context(lua) }; Ok(context .storage - .get() + .data() .map(|state| postcard::from_bytes(state).unwrap()) .unwrap_or(default)) } -- cgit v1.3.1