Skip to content

Commit

Permalink
Add dynamic reference methods
Browse files Browse the repository at this point in the history
  • Loading branch information
james-j-obrien committed Sep 12, 2023
1 parent 91c48d1 commit ebdec5c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/bevy_ecs/src/term_query/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ impl<'w, Q: QueryTermGroup> QueryBuilder<'w, Q> {
self
}

pub fn ref_id(&mut self, id: ComponentId) -> &mut Self {
self.terms.push(Term::Component(ComponentTerm::read_id(id)));
self
}

pub fn mut_id(&mut self, id: ComponentId) -> &mut Self {
self.terms
.push(Term::Component(ComponentTerm::write_id(id)));
self
}

pub fn set<T: Component>(&mut self) -> &mut Self {
let id = self.world.init_component::<T>();
self.set_id(id);
Expand Down

0 comments on commit ebdec5c

Please sign in to comment.