Skip to content

Commit

Permalink
Merge branch 'main' into dynamic-queries-example
Browse files Browse the repository at this point in the history
  • Loading branch information
makspll authored Sep 8, 2024
2 parents 5d775dc + 26f9869 commit 9c954ee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
type-complexity-threshold=1000
type-complexity-threshold = 1000
too-many-arguments-threshold = 999
5 changes: 5 additions & 0 deletions crates/bevy_mod_scripting_core/src/hosts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{
error::ScriptError,
event::{ScriptEvent, ScriptLoaded},
world::WorldPointer,
ScriptErrorEvent,
};

/// Describes the target set of scripts this event should
Expand Down Expand Up @@ -358,6 +359,7 @@ impl<T: Asset> Script<T> {
providers: &mut APIProviders<H>,
contexts: &mut ScriptContexts<H::ScriptContext>,
event_writer: &mut EventWriter<ScriptLoaded>,
error_writer: &mut EventWriter<ScriptErrorEvent>,
) {
debug!("reloading script {}", script.id);

Expand All @@ -374,6 +376,7 @@ impl<T: Asset> Script<T> {
providers,
contexts,
event_writer,
error_writer,
);
} else {
// remove old context
Expand All @@ -392,6 +395,7 @@ impl<T: Asset> Script<T> {
providers: &mut APIProviders<H>,
contexts: &mut ScriptContexts<H::ScriptContext>,
event_writer: &mut EventWriter<ScriptLoaded>,
error_writer: &mut EventWriter<ScriptErrorEvent>,
) {
let fd = ScriptData {
sid: new_script.id(),
Expand Down Expand Up @@ -424,6 +428,7 @@ impl<T: Asset> Script<T> {
// this script will now never execute, unless manually reloaded
// but contexts are left in a valid state
contexts.insert_context(fd, None);
error_writer.send(ScriptErrorEvent { error: e });
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions crates/bevy_mod_scripting_core/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub fn script_add_synchronizer<H: ScriptHost + 'static>(
script_assets: Res<Assets<H::ScriptAsset>>,
mut contexts: ResMut<ScriptContexts<H::ScriptContext>>,
mut event_writer: EventWriter<ScriptLoaded>,
mut error_writer: EventWriter<ScriptErrorEvent>,
) {
debug!("Handling addition/modification of scripts");

Expand All @@ -47,6 +48,7 @@ pub fn script_add_synchronizer<H: ScriptHost + 'static>(
&mut providers,
&mut contexts,
&mut event_writer,
&mut error_writer,
)
})
} else {
Expand Down Expand Up @@ -84,6 +86,7 @@ pub fn script_add_synchronizer<H: ScriptHost + 'static>(
&mut providers,
&mut contexts,
&mut event_writer,
&mut error_writer,
)
}
}
Expand Down Expand Up @@ -120,6 +123,7 @@ pub fn script_hot_reload_handler<H: ScriptHost>(
mut providers: ResMut<APIProviders<H>>,
mut contexts: ResMut<ScriptContexts<H::ScriptContext>>,
mut event_writer: EventWriter<ScriptLoaded>,
mut error_writer: EventWriter<ScriptErrorEvent>,
) {
for e in events.read() {
let (handle, created) = match e {
Expand Down Expand Up @@ -147,6 +151,7 @@ pub fn script_hot_reload_handler<H: ScriptHost>(
&mut providers,
&mut contexts,
&mut event_writer,
&mut error_writer,
);
}
}
Expand Down

0 comments on commit 9c954ee

Please sign in to comment.