Skip to content

Commit a66af3a

Browse files
committed
Actually call finish on script plugins and add appropriate docs
1 parent 2d796fd commit a66af3a

File tree

3 files changed

+16
-0
lines changed
  • crates
    • bevy_mod_scripting_core/src
    • languages
      • bevy_mod_scripting_lua/src
      • bevy_mod_scripting_rhai/src

3 files changed

+16
-0
lines changed

crates/bevy_mod_scripting_core/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ pub enum ScriptingSystemSet {
5555

5656
/// Types which act like scripting plugins, by selecting a context and runtime
5757
/// Each individual combination of context and runtime has specific infrastructure built for it and does not interact with other scripting plugins
58+
///
59+
/// When implementing a new scripting plugin, also ensure the following implementations exist:
60+
/// - [`Plugin`] for the plugin, both [`Plugin::build`] and [`Plugin::finish`] methods need to be dispatched to the underlying [`ScriptingPlugin`] struct
61+
/// - [`AsMut<ScriptingPlugin<Self>`] for the plugin struct
5862
pub trait IntoScriptPluginParams: 'static {
5963
/// The language of the scripts
6064
const LANGUAGE: Language;
@@ -222,6 +226,10 @@ fn once_per_app_finalize(app: &mut App) {
222226
.supported_extensions;
223227

224228
// convert extensions to static array
229+
bevy::log::info!(
230+
"Initializing BMS with Supported extensions: {:?}",
231+
asset_settings_extensions
232+
);
225233

226234
app.register_asset_loader(ScriptAssetLoader {
227235
extensions: asset_settings_extensions,

crates/languages/bevy_mod_scripting_lua/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ impl Plugin for LuaScriptingPlugin {
151151
fn build(&self, app: &mut bevy::prelude::App) {
152152
self.scripting_plugin.build(app);
153153
}
154+
155+
fn finish(&self, app: &mut bevy::app::App) {
156+
self.scripting_plugin.finish(app);
157+
}
154158
}
155159
#[profiling::function]
156160
/// Load a lua context from a script

crates/languages/bevy_mod_scripting_rhai/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ impl Plugin for RhaiScriptingPlugin {
172172
fn build(&self, app: &mut bevy::prelude::App) {
173173
self.scripting_plugin.build(app);
174174
}
175+
176+
fn finish(&self, app: &mut bevy::app::App) {
177+
self.scripting_plugin.finish(app);
178+
}
175179
}
176180

177181
/// Load a rhai context from a script.

0 commit comments

Comments
 (0)