diff --git a/clippy.toml b/clippy.toml index cbc4ecce..aca2b0af 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1,2 @@ -type-complexity-threshold=1000 \ No newline at end of file +type-complexity-threshold = 1000 +too-many-arguments-threshold = 999 diff --git a/crates/bevy_mod_scripting_core/src/hosts.rs b/crates/bevy_mod_scripting_core/src/hosts.rs index 9e8ff585..1225782a 100644 --- a/crates/bevy_mod_scripting_core/src/hosts.rs +++ b/crates/bevy_mod_scripting_core/src/hosts.rs @@ -12,6 +12,7 @@ use crate::{ error::ScriptError, event::{ScriptEvent, ScriptLoaded}, world::WorldPointer, + ScriptErrorEvent, }; /// Describes the target set of scripts this event should @@ -358,6 +359,7 @@ impl Script { providers: &mut APIProviders, contexts: &mut ScriptContexts, event_writer: &mut EventWriter, + error_writer: &mut EventWriter, ) { debug!("reloading script {}", script.id); @@ -374,6 +376,7 @@ impl Script { providers, contexts, event_writer, + error_writer, ); } else { // remove old context @@ -392,6 +395,7 @@ impl Script { providers: &mut APIProviders, contexts: &mut ScriptContexts, event_writer: &mut EventWriter, + error_writer: &mut EventWriter, ) { let fd = ScriptData { sid: new_script.id(), @@ -424,6 +428,7 @@ impl Script { // 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 }); } } } diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 1ce4f340..d7512a41 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -33,6 +33,7 @@ pub fn script_add_synchronizer( script_assets: Res>, mut contexts: ResMut>, mut event_writer: EventWriter, + mut error_writer: EventWriter, ) { debug!("Handling addition/modification of scripts"); @@ -47,6 +48,7 @@ pub fn script_add_synchronizer( &mut providers, &mut contexts, &mut event_writer, + &mut error_writer, ) }) } else { @@ -84,6 +86,7 @@ pub fn script_add_synchronizer( &mut providers, &mut contexts, &mut event_writer, + &mut error_writer, ) } } @@ -120,6 +123,7 @@ pub fn script_hot_reload_handler( mut providers: ResMut>, mut contexts: ResMut>, mut event_writer: EventWriter, + mut error_writer: EventWriter, ) { for e in events.read() { let (handle, created) = match e { @@ -147,6 +151,7 @@ pub fn script_hot_reload_handler( &mut providers, &mut contexts, &mut event_writer, + &mut error_writer, ); } }