Big BIG refactor to make inventory use a model that's placed into the world, following a more sane MVC style.

This commit is contained in:
Zed A. Shaw 2025-06-20 13:17:12 -04:00
parent 119b3ed11d
commit a0eff927b6
21 changed files with 270 additions and 123 deletions

View file

@ -6,6 +6,8 @@
#include "rituals.hpp"
#include "maze.hpp"
#include "textures.hpp"
#include "inventory.hpp"
#include "systems.hpp"
using namespace fmt;
using namespace components;
@ -172,6 +174,11 @@ void WorldBuilder::configure_starting_items(DinkyECS::World &world) {
ritual::JunkItem name = el;
blanket.add(name);
};
auto torch_id = System::spawn_item(world, "TORCH_BAD");
auto &inventory = world.get_the<inventory::Model>();
inventory.add("hand_r", torch_id);
}
void WorldBuilder::place_entities(DinkyECS::World &world) {
@ -202,6 +209,7 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
world.set_the<Player>(player);
world.set_the<ritual::Belt>({});
world.set_the<ritual::Blanket>({});
world.set_the<inventory::Model>({});
configure_starting_items(world);
world.make_constant(player.entity);
}