Started working on the loot system which will eventually become the inventory/improved collision system.

This commit is contained in:
Zed A. Shaw 2024-11-07 00:29:06 -05:00
parent c1d43694b0
commit 0a268591c2
5 changed files with 55 additions and 29 deletions

View file

@ -74,6 +74,13 @@ namespace DinkyECS {
return std::any_cast<Comp&>(res);
}
template <typename Comp>
bool has(Entity ent) {
EntityMap &map = entity_map_for<Comp>();
// use .at for bounds checking
return map.contains(ent);
}
template<typename Comp>
void query(std::function<void(const Entity&, Comp&)> cb) {
EntityMap &map = entity_map_for<Comp>();