bevy_mod_scripting
bevy_mod_scripting copied to clipboard
feat!: Update to Bevy 0.16
Summary
This introduces Bevy 0.16 compatibility.
We should probably in a follow up move to the bevy::platform::collections instead of using std to try and align as closely as possible with the no std approach bevy is taking but i didn't want to do it in this one.
Need to quickly restore the ordering where my ide aligned them with the interface order, but thought it would be good to get visibility on the changes.
Notes
bevy_console is pointing at a branch - there is https://github.com/RichoDemus/bevy-console/pull/88/files awaiting review which would allow us to change this.
- [x] bevy console 0.14.0 released
Is there anything holding this up? Formatting needs to be fixed up, anything else to do?
I'm curious too about the fate of this PR.
Bump on getting this landed?
I'm anxious for this PR to land, and I inadvertently did a big overhaul with PR #427 to use handles rather than script IDs, so to make amends I handled the merge conflicts to create #431 which contains both handles and 0.16 support.
Looking at this now, it looks like there is still some work left on the codegen side which is currently failing. Did you update the generated bindings manually 👀
Bencher Report
| Branch | bevy_0.16 |
| Testbed | linux-gha |
⚠️ WARNING: No Threshold found!
Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
The good news is it seems the new rustup version didn't break the codegen crate (i.e. it does not require a rustc_plugin version bump, which is always the most painful bit)
Codegen seems to need a few small adjustments and we should be good to go
I've had my yearly fight with rust analyzer now, a few little changes to go, unwraps etc...
EDIT: looks like some tests are failing
FYI to those who have been using this branch, bevy shuffled around many types, which will be reflected in the new codegen (including the bindings features), things that used to live in bevy_core, and bevy_hierarchy like Name seem to have been moved to bevy_ecs
I found a weird error trying to migrate to this and made a repo that reproduces it. it basically boils down to this binding not working under certain conditions resulting in a ERROR bevy_mod_scripting_core::commands: Lua: Cannot apply callback test command, as script does not exist: test1.lua. Ignoring.:
pub fn trigger_lua_event(
ctx: FunctionCallContext,
label: String,
script_id: String,
) -> Result<(), InteropError> {
Ok(ctx.world()?.with_global_access(|world| {
println!("trigger_lua_event {:?} {:?}", label, script_id);
let command = RunScriptCallback::<LuaScriptingPlugin>::new(
script_id.into(),
Entity::from_raw(0),
label.clone().into(),
Default::default(),
false,
);
world.commands().queue(command);
})?)
}
-- this works
function start()
trigger_event("test", "test1.lua")
end
-- does not work
function start()
trigger_event("test", "test1.lua")
local entity = world.spawn()
end
Project that reproduces this: https://github.com/Peepo-Juice/bevy_mod_min_repro
See: https://github.com/bevyengine/bevy/issues/20395#issuecomment-3180870538 for the above, TL;DR the bevy update causes unrelated commands to flush when world entities or components are modified