Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nitpick!
book/src/concepts/system.md
Outdated
### Getting entities that have some components, but not others | ||
|
||
There is a special type of `Storage` in specs called `AntiStorage`. | ||
You can invoke it using the "!" symbol when borrowing a normal `Storage`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about,
You can invoke it using the `!` operator when borrowing a normal `Storage`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbh, invoke sounds a bit odd here. Maybe something like "the not operator (!
) turns a Storage
into its AntiStorage
"?
book/src/concepts/system.md
Outdated
### Getting entities that have some components, but not others | ||
|
||
There is a special type of `Storage` in specs called `AntiStorage`. | ||
You can invoke it using the "!" symbol when borrowing a normal `Storage`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbh, invoke sounds a bit odd here. Maybe something like "the not operator (!
) turns a Storage
into its AntiStorage
"?
); | ||
|
||
fn run(&mut self, (mut transforms, falling): Self::SystemData) { | ||
for (mut transform, _) in (&mut transforms, !&falling).join() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not iterate over them unconditionally given the conditional write below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I understood what you meant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@torkleyy I don't believe there is a conditional write there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi
|
||
There is a special type of `Storage` in specs called `AntiStorage`. | ||
The not operator (!) turns a Storage into its AntiStorage counterpart. | ||
It is used like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a rewording:
"Sometimes, you may want to iterate over all the entities that do not have a specific component.
You can do this by joining over the AntiStorage
of your component: the joining will now happen on all entities that do not have the component.
To obtain an AntiStorage
, simply apply the not operator (!) on your component's normal storage, like so:"
|
||
fn run(&mut self, (mut transforms, falling): Self::SystemData) { | ||
for (mut transform, _) in (&mut transforms, !&falling).join() { | ||
// If they don't fall, why not make them go up! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
life pro tip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
bors r+ yeet |
Build succeeded |
Fixes #828
Fixes #945