Skip to content

Commit 873154c

Browse files
committed
more docs
1 parent 1a5051f commit 873154c

File tree

3 files changed

+76
-1
lines changed

3 files changed

+76
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Migrating to 0.16.0
2+
3+
## https://github.com/makspll/bevy_mod_scripting/pull/455
4+
Replace all usages of `CallbackSettings<P>.callback_handler` with `P::handler()(..)` and `P::handle(..)`
5+
6+
## https://github.com/makspll/bevy_mod_scripting/pull/456
7+
Replace all usages of `CallbackBuilder<P>.load` and `CallbackBuilder<P>.reload` with `P::load(..)` and `P::reload(..)` or `P::context_loader()(..)` and `P::context_reloader()(..)`
8+
9+
## https://github.com/makspll/bevy_mod_scripting/pull/463
10+
If you were relying on BMS enabling some features in Bevy crates, your builds might be pulling in less features than you expect. Ensure you explicitly select all features you need from bevy. BMS will now only pull in strictly necessary features and crates from bevy
11+
12+
## https://github.com/makspll/bevy_mod_scripting/pull/470
13+
Switch all references of `ContextLoadingSettings` to `P::readonly_config(world.id())`.
14+
15+
## https://github.com/makspll/bevy_mod_scripting/pull/471
16+
`RuntimeSettings` and `RuntimeContainer` are removed, replace usages with `P::readonly_settings(world.id()).runtime)` access to initializers is no longer possible outside the plugin setup phase
17+
18+
## https://github.com/makspll/bevy_mod_scripting/pull/472
19+
if you implemented a scripting plugin you will need to correct your function signatures for the above aliases, and fetch the config yourself to access callbacks via `Plugin::readonly_configuration(world_id)` using the world id you will now receive.
20+
21+
## https://github.com/makspll/bevy_mod_scripting/pull/473
22+
references to `StaticScripts` should be replaced with appropriate resident calls on `ScriptContext` filtered by the attachment kind
23+
24+
## https://github.com/makspll/bevy_mod_scripting/pull/474
25+
- **ScriptContext Access**: Use `.read()` and `.write()` to access ScriptContext (now wrapped in `Arc<RwLock<>>`); replace `get()` with `get_context()`
26+
- **HandlerContext**: Replace with direct ScriptContext access; remove any `with_handler_system_state()` calls
27+
- **Script Callbacks**: Use new `call_context_dynamic()` or `call_context()` methods from the CallContext trait
28+
- **Custom Context Types**: Implement the new `GetPluginFor` trait to provide mapping from context to plugin type
29+
- **Lua Interaction**: Replace `mlua::Lua` with `LuaContext` wrapper type in all Lua code on BMS side
30+
- **Script Callback Running**: Replace `run_with_handler()` calls with `run_with_context()` or `run_with_contexts()`
31+
32+
## https://github.com/makspll/bevy_mod_scripting/pull/475
33+
- References previously resident in `bevy_mod_scripting_core::asset`/`bevy_mod_scripting::core::asset` will now need to come from `bevy_mod_scripting_asset` or `bevy_mod_scripting::asset`
34+
- Adding supported extensions will now need to be done via `scripting_plugin.add_supported_extension("extension")` rather than via the app directly
35+
- Plugin implementors will need to add the new crate as a dependency and should not directly rely on the top workspace crate
36+
37+
## https://github.com/makspll/bevy_mod_scripting/pull/477
38+
- Update imports to new crates (`bevy_mod_scripting_bindings`, `bevy_mod_scripting_display`, `bevy_mod_scripting_asset`) where appropriate, if you rely on the workspace these will be re-exported under `bindings`, `display` and `asset` respectively
39+
- Replace `DisplayWithWorld` usage with `DisplayWithTypeInfo` / `DebugWithTypeInfo` and use `WithTypeInfo::new(value)` in format strings. Ensure that the WorldGuard is in scope when printing using these utilities, or you might see raw type id's

docs/src/ReleaseNotes/0.16.0.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# 0.16.0
2+
3+
# Improved printing and error ergonomics
4+
Printing has been extracted into its own `bevy_mod_scripting_display` crate, and brand new traits including the reflectable `DisplayWithTypeInfo` were written.
5+
6+
There are now Debug and Display equivalent traits which receive type information from semi-static thread local objects in order to print things like `TypeId`'s with full information.
7+
8+
You can now also register `ReflectDisplayWithTypeInfo` against your types in the reflect registry, to customize printing.
9+
10+
# A great re-slicing
11+
Bindings have been split out into individual crates, for example `bevy_reflect` has a corresponding `bevy_reflect_bms_bindings` crate which contain's its bindings. This is possible thanks to a brand new tool which allows us to calculate crate dependencies across a workspace during codegen (see `bevy_mod_scripting_codegen`)
12+
13+
At the same time more bindings are now being generated after fixing some bugs in type discovery.
14+
15+
Other refactorings include `bevy_mod_scripting_bindings`, `bevy_mod_scripting_display` and `bevy_mod_scripting_asset` being pulled out into their own crates.
16+
17+
This has significantly improved compile times allowing us to pack more bindings!
18+
19+
# Getting rid of `HandlerCtxt`
20+
`HandlerCtxt` has been removed and all of its containing resources have been put in `P::readonly_configuration`, which is a semi-static, `WorldId` parameterised static.
21+
22+
At the same time `ScriptContext<P>` has been wrapped in an `Arc` allowing us to run callbacks within callbacks, as long as they don't modify the same contexts!
23+
24+
# The great bevy minification
25+
BMS has historically pointed at the top level bevy crate, this was handy but fairly clunky as it brought way more dependencies than necessary.
26+
27+
From now on all BMS crates point at bevy subcrates directly, with default features disabled, this means we pull in the minimum amount of dependencies possible (in theory, as long as we didn't miss a feature)
28+
29+
# Brand new scripting pipeline
30+
31+
A shiny new overhauled loading/unloading script pipeline which:
32+
- Is much more customizable (want custom callbacks, or don't like how we named our core callbacks? Just disable them and add your own!)
33+
- More scalable, allowing you to load thousands of scripts, without hogging your framerate (by abstracting loading into tickable state machines)
34+
35+
See the new docs section for details.

docs/src/Summary/managing-scripts.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ This will not evaluate any code yet.
3535
## Evaluating
3636
A script does not participate in any callbacks until it is evaluated, to evaluate a script you must first attach it to an entity, or to a static script entry.
3737

38-
To evaluate a script, add it to a `ScriptComponent` or to `StaticScripts`.
38+
To evaluate a script, add it to a `ScriptComponent` manually attach it.
39+
3940
### Load File via `AssetServer`
4041
```rust
4142
# extern crate bevy;

0 commit comments

Comments
 (0)