Skip to content

chore: release #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.15.0](https://github.com/makspll/bevy_mod_scripting/compare/v0.14.0...v0.15.0) - 2025-08-14

### Added

- Use the Handles, Luke! ([#427](https://github.com/makspll/bevy_mod_scripting/pull/427))

### Fixed

- fix version
- fix version

### Other

- improve docs, fix issues
- update versions to currently released ones
- Merge remote-tracking branch 'origin/main' into staging
# Changelog

## [0.13.0](https://github.com/makspll/bevy_mod_scripting/compare/v0.12.0...v0.13.0) - 2025-07-05

### Added
Expand Down
15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_mod_scripting"
version = "0.14.0"
version = "0.15.0"
authors = ["Maksymilian Mozolewski <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -74,20 +74,21 @@ bevy = { workspace = true }
bevy_math = { workspace = true }
bevy_reflect = { workspace = true }
bevy_mod_scripting_core = { workspace = true }
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.14.0", optional = true }
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.14.0", optional = true }
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.15.0", optional = true }
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.15.0", optional = true }
# bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.9.0-alpha.2", optional = true }
bevy_mod_scripting_functions = { workspace = true }
bevy_mod_scripting_derive = { workspace = true }

[workspace.dependencies]
profiling = { version = "1.0" }

bevy = { version = "0.16.0", default-features = false }
bevy_math = { version = "0.16.0" }
bevy_reflect = { version = "0.16.0" }
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.14.0" }
bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.14.0", default-features = false }
bevy_mod_scripting_derive = { path = "crates/bevy_mod_scripting_derive", version = "0.14.0" }
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.15.0" }
bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.15.0", default-features = false }
bevy_mod_scripting_derive = { path = "crates/bevy_mod_scripting_derive", version = "0.15.0" }

# test utilities
script_integration_test_harness = { path = "crates/testing_crates/script_integration_test_harness" }
Expand All @@ -98,7 +99,7 @@ bevy = { workspace = true, default-features = true, features = ["std"] }
clap = { version = "4.1", features = ["derive"] }
rand = "0.9.1"
criterion = { version = "0.5" }
ladfile_builder = { path = "crates/ladfile_builder", version = "0.4.0" }
ladfile_builder = { path = "crates/ladfile_builder", version = "0.4.1" }
script_integration_test_harness = { workspace = true }
test_utils = { workspace = true }
libtest-mimic = "0.8"
Expand Down
22 changes: 22 additions & 0 deletions assets/reload.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- reload.lua
--
-- An example of the script reload feature. Exercise with this command:
-- ```sh
-- cargo run --features lua54,bevy/file_watcher,bevy/multi_threaded --example run-script -- reload.lua
-- ```
function on_script_loaded()
world.info("Hello world")
end

function on_script_unloaded()
world.info("Goodbye world")
return "house"
end

function on_script_reloaded(value)
if value then
world.info("I'm back. Thanks for the "..value.." keys!")
else
world.info('I have not saved any state before unloading')
end
end
54 changes: 27 additions & 27 deletions assets/tests/add_system/added_systems_run_in_parallel.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@

function on_test()
local post_update_schedule = world.get_schedule_by_name("PostUpdate")

local test_system = post_update_schedule:get_system_by_name("on_test_post_update")

local system_a = world.add_system(
post_update_schedule,
system_builder("custom_system_a", script_id)
:after(test_system)
)

local system_b = world.add_system(
post_update_schedule,
system_builder("custom_system_b", script_id)
:after(test_system)
)
local post_update_schedule = world.get_schedule_by_name("PostUpdate")

local test_system = post_update_schedule:get_system_by_name("on_test_post_update")

local script_attachment = ScriptAttachment.new_entity_script(entity, script_asset)

-- generate a schedule graph and verify it's what we expect
local dot_graph = post_update_schedule:render_dot()
local system_a = world.add_system(
post_update_schedule,
system_builder("custom_system_a", script_attachment)
:after(test_system)
)

local expected_dot_graph = [[
local system_b = world.add_system(
post_update_schedule,
system_builder("custom_system_b", script_attachment)
:after(test_system)
)

-- generate a schedule graph and verify it's what we expect
local dot_graph = post_update_schedule:render_dot()

local expected_dot_graph = [[
digraph {
node_0 [label="bevy_asset::assets::Assets<bevy_asset::folder::LoadedFolder>::asset_events"];
node_1 [label="bevy_asset::assets::Assets<bevy_asset::assets::LoadedUntypedAsset>::asset_events"];
node_2 [label="bevy_asset::assets::Assets<()>::asset_events"];
node_3 [label="bevy_asset::assets::Assets<bevy_mod_scripting_core::asset::ScriptAsset>::asset_events"];
node_4 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
node_5 [label="on_test_post_update"];
node_6 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_7 [label="script_integration_test_harness::dummy_post_update_system"];
node_5 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_6 [label="script_integration_test_harness::dummy_post_update_system"];
node_7 [label="on_test_post_update"];
node_8 [label="custom_system_a"];
node_9 [label="custom_system_b"];
node_10 [label="SystemSet AssetEvents"];
Expand All @@ -42,11 +43,10 @@ digraph {
node_4 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_8 -> node_12 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_13 [color=red, label="child of", arrowhead=diamond];
node_5 -> node_8 [color=blue, label="runs before", arrowhead=normal];
node_5 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_6 -> node_7 [color=blue, label="runs before", arrowhead=normal];
node_5 -> node_6 [color=blue, label="runs before", arrowhead=normal];
node_7 -> node_8 [color=blue, label="runs before", arrowhead=normal];
node_7 -> node_9 [color=blue, label="runs before", arrowhead=normal];
}
]]

assert_str_eq(dot_graph, expected_dot_graph, "Expected the schedule graph to match the expected graph")
assert_str_eq(dot_graph, expected_dot_graph, "Expected the schedule graph to match the expected graph")
end
17 changes: 9 additions & 8 deletions assets/tests/add_system/added_systems_run_in_parallel.rhai
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
fn on_test() {
let post_update_schedule = world.get_schedule_by_name.call("PostUpdate");

let script_attachment = ScriptAttachment.new_entity_script.call(entity, script_asset);
let test_system = post_update_schedule.get_system_by_name.call("on_test_post_update");

let system_a = world.add_system.call(
post_update_schedule,
system_builder.call("custom_system_a", script_id)
system_builder.call("custom_system_a", script_attachment)
.after.call(test_system)
);

let system_b = world.add_system.call(
post_update_schedule,
system_builder.call("custom_system_b", script_id)
system_builder.call("custom_system_b", script_attachment)
.after.call(test_system)
);

Expand All @@ -25,9 +26,9 @@ digraph {
node_2 [label="bevy_asset::assets::Assets<()>::asset_events"];
node_3 [label="bevy_asset::assets::Assets<bevy_mod_scripting_core::asset::ScriptAsset>::asset_events"];
node_4 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
node_5 [label="on_test_post_update"];
node_6 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_7 [label="script_integration_test_harness::dummy_post_update_system"];
node_5 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_6 [label="script_integration_test_harness::dummy_post_update_system"];
node_7 [label="on_test_post_update"];
node_8 [label="custom_system_a"];
node_9 [label="custom_system_b"];
node_10 [label="SystemSet AssetEvents"];
Expand All @@ -41,9 +42,9 @@ digraph {
node_4 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_8 -> node_12 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_13 [color=red, label="child of", arrowhead=diamond];
node_5 -> node_8 [color=blue, label="runs before", arrowhead=normal];
node_5 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_6 -> node_7 [color=blue, label="runs before", arrowhead=normal];
node_5 -> node_6 [color=blue, label="runs before", arrowhead=normal];
node_7 -> node_8 [color=blue, label="runs before", arrowhead=normal];
node_7 -> node_9 [color=blue, label="runs before", arrowhead=normal];
}`;

assert_str_eq.call(dot_graph, expected_dot_graph, "Expected the schedule graph to match the expected graph");
Expand Down
33 changes: 17 additions & 16 deletions assets/tests/add_system/adds_system_in_correct_order.lua
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
-- add two systems, one before and one after the existing `on_test_post_update` callback, then assert all systems have run
-- in the `on_test_last` callback

local runs = {}
local runs = {}

-- runs on `Update`
function on_test()
local post_update_schedule = world.get_schedule_by_name("PostUpdate")

local test_system = post_update_schedule:get_system_by_name("on_test_post_update")

local script_attachment = ScriptAttachment.new_entity_script(entity, script_asset)

local system_after = world.add_system(
post_update_schedule,
system_builder("custom_system_after", script_id)
:after(test_system)
system_builder("custom_system_after", script_attachment)
:after(test_system)
)

local system_before = world.add_system(
post_update_schedule,
system_builder("custom_system_before", script_id)
:before(test_system)
)
system_builder("custom_system_before", script_attachment)
:before(test_system)
)

local script_system_between = world.add_system(
post_update_schedule,
system_builder("custom_system_between", script_id)
:after(test_system)
:before(system_after)
system_builder("custom_system_between", script_attachment)
:after(test_system)
:before(system_after)
)
end


function custom_system_before()
print("custom_system_before")
runs[#runs + 1] = "custom_system_before"
end

-- runs on post_update
-- runs on post_update
function on_test_post_update()
print("on_test_post_update")
runs[#runs + 1] = "on_test_post_update"
Expand All @@ -53,9 +53,10 @@ end

-- runs in the `Last` bevy schedule
function on_test_last()
assert(#runs == 4, "Expected 4 runs, got: " .. #runs)
local string_table = table.concat(runs, ", ")
assert(#runs == 4, "Expected 4 runs, got: " .. tostring(string_table))
assert(runs[1] == "custom_system_before", "Expected custom_system_before to run first, got: " .. runs[1])
assert(runs[2] == "on_test_post_update", "Expected on_test_post_update to run second, got: " .. runs[2])
assert(runs[3] == "custom_system_between", "Expected custom_system_between to run third, got: " .. runs[3])
assert(runs[4] == "custom_system_after", "Expected custom_system_after to run second, got: " .. runs[4])
end
end
7 changes: 4 additions & 3 deletions assets/tests/add_system/adds_system_in_correct_order.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ let runs = [];
fn on_test() {
let post_update_schedule = world.get_schedule_by_name.call("PostUpdate");
let test_system = post_update_schedule.get_system_by_name.call("on_test_post_update");
let script_attachment = ScriptAttachment.new_entity_script.call(entity, script_asset);

let builder_after = system_builder.call("custom_system_after", script_id)
let builder_after = system_builder.call("custom_system_after", script_attachment)
.after.call(test_system);
let system_after = world.add_system.call(post_update_schedule, builder_after);

let builder_before = system_builder.call("custom_system_before", script_id)
let builder_before = system_builder.call("custom_system_before", script_attachment)
.before.call(test_system);
let system_before = world.add_system.call(post_update_schedule, builder_before);

let builder_between = system_builder.call("custom_system_between", script_id)
let builder_between = system_builder.call("custom_system_between", script_attachment)
.after.call(test_system)
.before.call(system_after);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

runs = {}

function on_test()
local post_update_schedule = world.get_schedule_by_name("PostUpdate")

local script_attachment = ScriptAttachment.new_entity_script(entity, script_asset)
world.add_system(
post_update_schedule,
system_builder("my_exclusive_system", script_id):exclusive()
system_builder("my_exclusive_system", script_attachment):exclusive()
)

return true
Expand All @@ -21,12 +20,11 @@ function my_exclusive_system()
assert(res ~= nil, "Expected to get resource but got nil")
end


function on_test_post_update()
return true
end

function on_test_last()
assert(#runs == 1, "Expected 1 runs, got: " .. #runs)
return true
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ let runs = [];

fn on_test() {
let post_update_schedule = world.get_schedule_by_name.call("PostUpdate");

let script_attachment = ScriptAttachment.new_entity_script.call(entity, script_asset);

world.add_system.call(
post_update_schedule,
system_builder.call("my_exclusive_system", script_id).exclusive.call()
system_builder.call("my_exclusive_system", script_attachment).exclusive.call()
);

return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

runs = {}

function on_test()
local post_update_schedule = world.get_schedule_by_name("PostUpdate")

local script_attachment = ScriptAttachment.new_entity_script(entity, script_asset)

world.add_system(
post_update_schedule,
system_builder("my_non_exclusive_system", script_id)
system_builder("my_non_exclusive_system", script_attachment)
)

return true
Expand All @@ -23,12 +23,11 @@ function my_non_exclusive_system()
end, ".*annot claim access to.*")
end


function on_test_post_update()
return true
end

function on_test_last()
assert(#runs == 1, "Expected 1 runs, got: " .. #runs)
return true
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ let runs = [];

fn on_test() {
let post_update_schedule = world.get_schedule_by_name.call("PostUpdate");
world.add_system.call(post_update_schedule, system_builder.call("my_non_exclusive_system", script_id));
let script_attachment = ScriptAttachment.new_entity_script.call(entity, script_asset);
world.add_system.call(post_update_schedule, system_builder.call("my_non_exclusive_system", script_attachment));
return true;
}

Expand Down
Loading
Loading