Trouv / bevy_ecs_ldtk

ECS-friendly ldtk plugin for bevy, leveraging bevy_ecs_tilemap
Other
641 stars 73 forks source link

feat: add LevelIid component and spawn it on every level #215

Closed Trouv closed 11 months ago

Trouv commented 11 months ago

Works towards #205.

Handle<LdtkLevel> is no longer going to be the main query-able component on level entities, because "level assets" won't exist in the internal level case. So instead, LevelIid will be the main component on level entities. There will be a convenient API for retrieving raw/loaded level data using this LevelIid as well. The only part of this plan that this PR implements is adding the LevelIid component and spawning it on every level.

This is based on the existing EntityIid component, but it simplifies things a little bit. In particular, anything that cloned implicitly before is gone, and the iid isn't stored as a Cow since it won't be mutable anyway. I'm not against bringing the convenient copying APIs back if users want them, just thought that that would be a good place to trim it up a little bit. EntityIid might be updated to match in a future PR.