From 4fc2b47834a6314967367f5b4e6b8e5e85d93690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Konik?= Date: Sat, 7 Mar 2026 12:22:06 +0000 Subject: [PATCH] Update for bevy 0.18 (#73) * Update for bevy 0.18 --- Cargo.toml | 4 ++-- README.md | 13 +++++++------ SECURITY.md | 2 +- book/src/bevy_support_matrix.md | 1 + book/src/introduction.md | 2 +- book/src/lua/installation.md | 4 ++-- book/src/rhai/installation.md | 4 ++-- book/src/ruby/installation.md | 6 +++--- book/src/workflow/live_reload.md | 2 +- src/assets.rs | 2 ++ src/lib.rs | 13 +++++++------ src/runtimes/lua.rs | 4 ++-- src/runtimes/rhai.rs | 2 +- src/runtimes/ruby.rs | 2 +- tests/tests.rs | 6 +++--- 15 files changed, 36 insertions(+), 31 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3d582ad..bf0bc7f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bevy_scriptum" authors = ["Jaroslaw Konik "] -version = "0.10.0" +version = "0.11.0" edition = "2024" license = "MIT OR Apache-2.0" readme = "README.md" @@ -16,7 +16,7 @@ rhai = ["dep:rhai"] ruby = ["dep:magnus", "dep:rb-sys"] [dependencies] -bevy = { default-features = false, version = "0.17", features = ["bevy_asset", "bevy_log"] } +bevy = { default-features = false, version = "0.18", features = ["bevy_asset", "bevy_log"] } serde = "1.0.162" rhai = { version = "1.14.0", features = [ "sync", diff --git a/README.md b/README.md index c73e4fb..89fb97f 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you to write some of your game or application logic in a scripting language. ### Supported scripting languages/runtimes -| language/runtime | cargo feature | documentation chapter | -| ------------------------------------------ | ------------- | --------------------------------------------------------------- | -| 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) | -| 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) | -| 💎 Ruby(currently only supported on Linux) | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) | +| language/runtime | cargo feature | documentation chapter | +| ---------------------------------------------------- | ------------- | --------------------------------------------------------------- | +| 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) | +| 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) | +| 💎 Ruby(currently only supported on Linux and MacOS) | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) | Documentation book is available [here](https://jarkonik.github.io/bevy_scriptum/) 📖 @@ -98,7 +98,7 @@ Add the following to your `Cargo.toml`: ```toml [dependencies] -bevy_scriptum = { version = "0.10", features = ["lua"] } +bevy_scriptum = { version = "0.11", features = ["lua"] } ``` or execute `cargo add bevy_scriptum --features lua` from your project directory. @@ -167,6 +167,7 @@ The examples live in `examples` directory and their corresponding scripts live i | bevy version | bevy_scriptum version | |--------------|-----------------------| +| 0.18 | 0.11 | | 0.17 | 0.10 | | 0.16 | 0.8-0.9 | | 0.15 | 0.7 | diff --git a/SECURITY.md b/SECURITY.md index 20010a1..f2b278f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -7,7 +7,7 @@ currently being supported with security updates. | Version | Supported | | ------- | ------------------ | -| 0.10 | :white_check_mark: | +| 0.11 | :white_check_mark: | ## Reporting a Vulnerability diff --git a/book/src/bevy_support_matrix.md b/book/src/bevy_support_matrix.md index aba205a..49dfd16 100644 --- a/book/src/bevy_support_matrix.md +++ b/book/src/bevy_support_matrix.md @@ -2,6 +2,7 @@ | bevy version | bevy_scriptum version | | ------------ | --------------------- | +| 0.18 | 0.11 | | 0.17 | 0.10 | | 0.16 | 0.8-0.9 | | 0.15 | 0.7 | diff --git a/book/src/introduction.md b/book/src/introduction.md index 6b0a529..c506102 100644 --- a/book/src/introduction.md +++ b/book/src/introduction.md @@ -120,7 +120,7 @@ Add the following to your `Cargo.toml`: ```toml [dependencies] -bevy_scriptum = { version = "0.10", features = ["lua"] } +bevy_scriptum = { version = "0.11", features = ["lua"] } ``` or execute `cargo add bevy_scriptum --features lua` from your project directory. diff --git a/book/src/lua/installation.md b/book/src/lua/installation.md index a031ab3..6f35b0c 100644 --- a/book/src/lua/installation.md +++ b/book/src/lua/installation.md @@ -4,8 +4,8 @@ Add the following to your `Cargo.toml`: ```toml [dependencies] -bevy = "0.17" -bevy_scriptum = { version = "0.10", features = ["lua"] } +bevy = "0.18" +bevy_scriptum = { version = "0.11", features = ["lua"] } ``` If you need a different version of bevy you need to use a matching bevy_scriptum diff --git a/book/src/rhai/installation.md b/book/src/rhai/installation.md index 023d6f4..c761643 100644 --- a/book/src/rhai/installation.md +++ b/book/src/rhai/installation.md @@ -4,8 +4,8 @@ Add the following to your `Cargo.toml`: ```toml [dependencies] -bevy = "0.17" -bevy_scriptum = { version = "0.10", features = ["rhai"] } +bevy = "0.18" +bevy_scriptum = { version = "0.11", features = ["rhai"] } ``` If you need a different version of bevy you need to use a matching bevy_scriptum diff --git a/book/src/ruby/installation.md b/book/src/ruby/installation.md index fe67f4a..a6fead8 100644 --- a/book/src/ruby/installation.md +++ b/book/src/ruby/installation.md @@ -1,6 +1,6 @@ # Installation -Ruby is currently only supported on Linux. +Ruby is currently only supported on Linux ana MacOS. ## Ruby @@ -45,8 +45,8 @@ Add the following to your `Cargo.toml`: ```toml [dependencies] -bevy = "0.17" -bevy_scriptum = { version = "0.10", features = ["ruby"] } +bevy = "0.18" +bevy_scriptum = { version = "0.11", features = ["ruby"] } ``` If you need a different version of bevy you need to use a matching bevy_scriptum diff --git a/book/src/workflow/live_reload.md b/book/src/workflow/live_reload.md index bbfe17d..84dcef2 100644 --- a/book/src/workflow/live_reload.md +++ b/book/src/workflow/live_reload.md @@ -6,7 +6,7 @@ To enable live reload it should be enough to enable `file-watcher` feature within bevy dependency in `Cargo.toml` ```toml -bevy = { version = "0.17", features = ["file_watcher"] } +bevy = { version = "0.18", features = ["file_watcher"] } ``` ## Init-teardown pattern diff --git a/src/assets.rs b/src/assets.rs index 7c8ed3d..83ea5fc 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -3,9 +3,11 @@ use std::marker::PhantomData; use bevy::{ asset::{io::Reader, Asset, AssetLoader, LoadContext}, tasks::ConditionalSendFuture, + reflect::TypePath, }; /// A loader for script assets. +#[derive(TypePath)] pub struct ScriptLoader> { _phantom_data: PhantomData, } diff --git a/src/lib.rs b/src/lib.rs index e535d09..560456b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,11 +4,11 @@ //! ## Supported scripting languages/runtimes //! -//! | language/runtime | cargo feature | documentation chapter | -//! | ------------------------------------------ | ------------- | --------------------------------------------------------------- | -//! | 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) | -//! | 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) | -//! | 💎 Ruby(currently only supported on Linux) | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) | +//! | language/runtime | cargo feature | documentation chapter | +//! | ---------------------------------------------------- | ------------- | --------------------------------------------------------------- | +//! | 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) | +//! | 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) | +//! | 💎 Ruby(currently only supported on Linux and MacOS) | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) | //! //! Documentation book is available [here](https://jarkonik.github.io/bevy_scriptum/) 📖 //! @@ -103,7 +103,7 @@ //! //! ```toml //! [dependencies] -//! bevy_scriptum = { version = "0.10", features = ["lua"] } +//! bevy_scriptum = { version = "0.11", features = ["lua"] } //! ``` //! //! or execute `cargo add bevy_scriptum --features lua` from your project directory. @@ -176,6 +176,7 @@ //! //! | bevy version | bevy_scriptum version | //! |--------------|-----------------------| +//! | 0.18 | 0.11 | //! | 0.17 | 0.10 | //! | 0.16 | 0.8-0.9 | //! | 0.15 | 0.7 | diff --git a/src/runtimes/lua.rs b/src/runtimes/lua.rs index a049fbb..5a3c190 100644 --- a/src/runtimes/lua.rs +++ b/src/runtimes/lua.rs @@ -43,7 +43,7 @@ pub struct BevyEntity(pub Entity); impl BevyEntity { pub fn index(&self) -> u32 { - self.0.index() + self.0.index_u32() } } @@ -104,7 +104,7 @@ impl Default for LuaRuntime { let engine = engine.lock().expect("Failed to lock engine"); engine .register_userdata_type::(|typ| { - typ.add_field_method_get("index", |_, entity| Ok(entity.0.index())); + typ.add_field_method_get("index", |_, entity| Ok(entity.index())); }) .expect("Failed to register BevyEntity userdata type"); diff --git a/src/runtimes/rhai.rs b/src/runtimes/rhai.rs index 57dd83a..8864b33 100644 --- a/src/runtimes/rhai.rs +++ b/src/runtimes/rhai.rs @@ -55,7 +55,7 @@ pub struct BevyEntity(pub Entity); impl BevyEntity { pub fn index(&self) -> u32 { - self.0.index() + self.0.index_u32() } } diff --git a/src/runtimes/ruby.rs b/src/runtimes/ruby.rs index 6ccd1d4..eb716d7 100644 --- a/src/runtimes/ruby.rs +++ b/src/runtimes/ruby.rs @@ -180,7 +180,7 @@ pub struct BevyEntity(pub Entity); impl BevyEntity { pub fn index(&self) -> u32 { - self.0.index() + self.0.index_u32() } } diff --git a/tests/tests.rs b/tests/tests.rs index cad660b..1445d95 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -441,7 +441,7 @@ macro_rules! scripting_tests { assert_eq!( app.world().get_resource::().unwrap().index, - entity.index() + entity.index_u32() ); } @@ -473,7 +473,7 @@ macro_rules! scripting_tests { assert_eq!( app.world().get_resource::().unwrap().index, - Some(entity.index()) + Some(entity.index_u32()) ); } @@ -505,7 +505,7 @@ macro_rules! scripting_tests { assert_eq!( app.world().get_resource::().unwrap().index, - Some(entity.index()) + Some(entity.index_u32()) ); }