Make the player's inventory just a regular entity attached to the player.entity.
This commit is contained in:
parent
2421a33bb0
commit
970905fcd5
3 changed files with 20 additions and 10 deletions
|
@ -167,8 +167,9 @@ void WorldBuilder::place_stairs(DinkyECS::World& world, GameConfig& config) {
|
|||
}
|
||||
|
||||
void WorldBuilder::configure_starting_items(DinkyECS::World &world) {
|
||||
auto& player = world.get_the<Player>();
|
||||
auto& blanket = world.get_the<ritual::Blanket>();
|
||||
auto& config = world.get_the<components::GameConfig>().rituals;
|
||||
auto& config = world.get_the<GameConfig>().rituals;
|
||||
|
||||
for(auto& el : config["starting_junk"]) {
|
||||
ritual::JunkItem name = el;
|
||||
|
@ -177,7 +178,7 @@ void WorldBuilder::configure_starting_items(DinkyECS::World &world) {
|
|||
|
||||
auto torch_id = System::spawn_item(world, "TORCH_BAD");
|
||||
|
||||
auto &inventory = world.get_the<inventory::Model>();
|
||||
auto &inventory = world.get<inventory::Model>(player.entity);
|
||||
inventory.add("hand_r", torch_id);
|
||||
world.make_constant(torch_id);
|
||||
|
||||
|
@ -214,7 +215,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>({});
|
||||
world.set<inventory::Model>(player_ent, {});
|
||||
configure_starting_items(world);
|
||||
world.make_constant(player.entity);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue