Support EntityTemplate variable in relationship target component In BSN syntax
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
Currently, the BSN syntax is ambiguous and rust expressions in a relationship target component are parsed as a scene list in the bsn macro.
## What solution would you like?
Instead, I would like the BSN syntax to support rust expressions as an `EntityTemplate`, a scene, or a scene list within a relationship target component.
I think the syntax can be disambiguated by requiring parenthesis and commas.
## What alternative(s) have you considered?
I have considered using the relationship component instead of the relationship target component.
## Additional context
My bsn code:
```rust
pub fn user(item_inventory_for: EntityTemplate) -> impl Scene {
bsn! {
color_balls_lib::items::components::InventoryFor [
item_inventory_for
]
}
}
```
The compiler error:
```
the trait bound `EntityTemplate: bevy::prelude::Scene` is not satisfied
the following other types implement trait `bevy::prelude::Scene`:
()
(P0, P1)
(P0, P1, P2)
(P0, P1, P2, P3)
(P0, P1, P2, P3, P4)
(P0, P1, P2, P3, P4, P5)
(P0, P1, P2, P3, P4, P5, P6)
(P0, P1, P2, P3, P4, P5, P6, P7)
and 16 others
required for `EntityScene` to implement `SceneList`
```
Contributor guide
Research direction
Start at the bsn! macro parsing for relationship target components and reproduce the issue with the provided EntityTemplate example. Trace how rust expressions are currently interpreted as scene lists, then define and implement the parenthesis-and-comma disambiguation so targets accept an EntityTemplate, scene, or scene list. Done means the example compiles and each supported target form is covered by parsing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100