The player now has some starting items to craft a first weapon, and it is craftable in the UI.

This commit is contained in:
Zed A. Shaw 2025-04-26 13:18:43 -04:00
parent c8a8d2b1af
commit bc557652ba
11 changed files with 199 additions and 155 deletions

View file

@ -241,6 +241,16 @@ void WorldBuilder::place_stairs(DinkyECS::World& world, GameConfig& config) {
configure_entity_in_map(world, entity_data, last_room);
}
void WorldBuilder::configure_starting_items(DinkyECS::World &world) {
auto& blanket = world.get_the<ritual::Blanket>();
Config config("assets/rituals.json");
for(auto& el : config["starting_junk"]) {
ritual::JunkItem name = el;
blanket.add(name);
};
}
void WorldBuilder::place_entities(DinkyECS::World &world) {
auto &config = world.get_the<GameConfig>();
// configure a player as a fact of the world
@ -258,7 +268,9 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
// configure player in the world
Player player{player_ent};
world.set_the<Player>(player);
world.set<combat::RitualBelt>(player.entity, {});
world.set_the<ritual::Belt>({});
world.set_the<ritual::Blanket>({});
configure_starting_items(world);
world.set<Inventory>(player.entity, {5});
world.make_constant(player.entity);
}