Skip to content

Commit

Permalink
changing handle_events in the ScriptHost trait to be a mut method (#72)
Browse files Browse the repository at this point in the history
changing handle_events in the ScriptHost trait to be a mut method, for flexibility in custom hosts.
  • Loading branch information
LaserWitch committed Sep 3, 2023
1 parent 2296bb9 commit 4133152
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bevy_mod_scripting_core/src/hosts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub trait ScriptHost: Send + Sync + 'static + Default + Resource {
/// the main point of contact with the bevy world.
/// Scripts are called with appropriate events in the event order
fn handle_events<'a>(
&self,
&mut self,
world_ptr: &mut World,
events: &[Self::ScriptEvent],
ctxs: impl Iterator<Item = (ScriptData<'a>, &'a mut Self::ScriptContext)>,
Expand Down
2 changes: 1 addition & 1 deletion bevy_mod_scripting_core/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub fn script_event_handler<H: ScriptHost, const MAX: u32, const MIN: u32>(world

let mut ctxts: ScriptContexts<H::ScriptContext> = world.remove_resource().unwrap();

let host: H = world.remove_resource().unwrap();
let mut host: H = world.remove_resource().unwrap();
let mut providers: APIProviders<H> = world.remove_resource().unwrap();

// we need a resource scope to be able to simultaneously access the contexts as well
Expand Down
2 changes: 1 addition & 1 deletion languages/bevy_mod_scripting_lua/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl<A: LuaArg> ScriptHost for LuaScriptHost<A> {
}

fn handle_events<'a>(
&self,
&mut self,
world: &mut World,
events: &[Self::ScriptEvent],
ctxs: impl Iterator<Item = (ScriptData<'a>, &'a mut Self::ScriptContext)>,
Expand Down
2 changes: 1 addition & 1 deletion languages/bevy_mod_scripting_rhai/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl<A: FuncArgs + Send + Clone + Sync + 'static> ScriptHost for RhaiScriptHost<
}

fn handle_events<'a>(
&self,
&mut self,
world: &mut World,
events: &[Self::ScriptEvent],
ctxs: impl Iterator<Item = (ScriptData<'a>, &'a mut Self::ScriptContext)>,
Expand Down

0 comments on commit 4133152

Please sign in to comment.