Make the player's inventory just a regular entity attached to the player.entity.

This commit is contained in:
Zed A. Shaw 2025-07-02 23:55:06 -04:00
parent 2421a33bb0
commit 970905fcd5
3 changed files with 20 additions and 10 deletions

View file

@ -102,7 +102,8 @@ void System::enemy_pathing(GameLevel &level) {
}
void System::init_positions(World &world, SpatialMap &collider) {
auto& inv = world.get_the<inventory::Model>();
auto player = world.get_the<Player>();
auto& inv = world.get<inventory::Model>(player.entity);
world.query<Position>([&](auto ent, auto &pos) {
if(world.has<Combat>(ent)) {
@ -507,7 +508,7 @@ bool System::drop_item(GameLevel& level, Entity item) {
auto player = world.get_the<Player>();
auto player_pos = world.get<Position>(player.entity);
auto& player_inv = world.get_the<inventory::Model>();
auto& player_inv = world.get<inventory::Model>(player.entity);
// doesn't compass already avoid walls?
for(matrix::box it{map.walls(), player_pos.location.x, player_pos.location.y, 1}; it.next();)