Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NameOrEntity::get_from_query method #17077

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Olle-Lukowski
Copy link
Contributor

Objective

Fixes #17061.

Solution

Implemented a method to easily get the NameOrEntity from an Entity, and add some docs for it.

Testing

All tests pass, doctests work fine too.

@Olle-Lukowski Olle-Lukowski added A-ECS Entities, components, systems, and events D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 1, 2025
Copy link
Contributor

@andriyDev andriyDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this up so quickly!!

/// Get a [`NameOrEntity`] from a [`Query`].
/// This is a convenience wrapper around [`Query::get`],
/// which uses the fact that a [`NameOrEntity`] can always be obtained,
/// even if the entity does not have a [`Name`].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line isn't quite right. The problem is not whether the entity has a name, but whether the entity is still "alive" (not despawned). Getting an entity without a name works already!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, probably messed that up in my "quick writing" xD, will fix this!

@BenjaminBrienen BenjaminBrienen added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged C-Feature A new feature, making something new possible and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NameOrEntity is difficult to Query::get
3 participants