Add support for spawning robots in locations #123
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New feature implementation
Implemented feature
Spawn a robot visual in locations with a
spawn_robot_name
andspawn_robot_type
propertyImplementation description
The implementation is quite naive and currently just spawns a single static model in spawning locations, there is a TODO in place for future plans when robot behavior is added to the site editor, including making it non static and / or adding other components to distinguish models from robots.
While working on it I noticed that querying for whether a Location has a
SpawnRobot
tag is not terribly ergonomic since all tags are contained in aLocationTags
component that is aVec<LocationTag>
, so each system dealing with location behavior will need to query for components withLocationTags
, iterate over the whole vector and verify whether the location has the tag it needs (as is done here forSpawnRobot
).On the other hand, if each tag was a different component it would be possible to filter relevant entities at the query level, improving both performance and code simplicity.
Still, I kept this out of this PR since it would be quite a large refactor and didn't want to get into it in case it's not a good idea.