Skip to content

Commit b322ba4

Browse files
authored
feat: add recipient for specific language (#250)
* feat: add recipient for specific language * fix: format the PR
1 parent f1af0b5 commit b322ba4

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

crates/bevy_mod_scripting_core/src/event.rs

+2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ pub enum Recipients {
122122
Script(ScriptId),
123123
/// The event is to be handled by all the scripts on the specified entity
124124
Entity(Entity),
125+
/// The event is to be handled by all the scripts of one language
126+
Language(crate::asset::Language),
125127
}
126128

127129
/// A callback event meant to trigger a callback in a subset/set of scripts in the world with the given arguments

crates/bevy_mod_scripting_core/src/handler.rs

+5
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ pub(crate) fn event_handler_internal<L: IntoCallbackLabel, P: IntoScriptPluginPa
129129
crate::event::Recipients::Entity(target_entity) if target_entity != entity => {
130130
continue
131131
}
132+
crate::event::Recipients::Language(target_language)
133+
if *target_language != P::LANGUAGE =>
134+
{
135+
continue
136+
}
132137
_ => (),
133138
}
134139
let script = match res_ctxt.scripts.scripts.get(script_id) {

0 commit comments

Comments
 (0)