diff --git a/src/game/worldbuilder.cpp b/src/game/worldbuilder.cpp index b596ff2..777029e 100644 --- a/src/game/worldbuilder.cpp +++ b/src/game/worldbuilder.cpp @@ -190,11 +190,17 @@ void WorldBuilder::place_doors(DinkyECS::World& world, GameConfig& config) { } void WorldBuilder::place_stairs(DinkyECS::World& world, GameConfig& config) { + auto player = world.get_the(); + auto player_pos = world.get(player.entity); + auto& device_config = config.devices.json(); auto entity_data = device_config["STAIRS_DOWN"]; - auto at_end = $map.$dead_ends.back(); - configure_entity_in_map(world, entity_data, at_end); + // auto at_end = $map.$dead_ends.back(); + configure_entity_in_map(world, entity_data, { + player_pos.location.x+1, + player_pos.location.y + }); } void WorldBuilder::configure_starting_items(DinkyECS::World &world) { @@ -203,11 +209,11 @@ void WorldBuilder::configure_starting_items(DinkyECS::World &world) { auto healing = System::spawn_item(world, "REPAIR_KIT"); inventory.add("inv0", healing); + world.make_constant(healing); auto sword = System::spawn_item(world, "SWORD_1"); inventory.add("hand_main", sword); - - world.make_constant(healing); + world.make_constant(sword); } void WorldBuilder::place_entities(DinkyECS::World &world) { diff --git a/src/gui/fsm.cpp b/src/gui/fsm.cpp index 15872a3..298b091 100644 --- a/src/gui/fsm.cpp +++ b/src/gui/fsm.cpp @@ -431,7 +431,8 @@ namespace gui { event(Event::ATTACK, data); break; case eGUI::STAIRS_DOWN: - dbc::sentinel("make me!"); + next_level(); + state(State::IDLE); break; case eGUI::DEATH: { $status_ui.update(); diff --git a/src/gui/status_ui.cpp b/src/gui/status_ui.cpp index 87b6b39..b542d3b 100644 --- a/src/gui/status_ui.cpp +++ b/src/gui/status_ui.cpp @@ -66,16 +66,22 @@ namespace gui { $body_ui.update(); for(const auto& [slot, cell] : $gui.cells()) { - if(inventory.has(slot)) { auto gui_id = $gui.entity(slot); auto world_entity = inventory.get(slot); + dbc::check(world->has(world_entity), + fmt::format("inventory {} has missing sprite", slot)); + auto& sprite = world->get(world_entity); + $gui.set_init(gui_id, {sprite.name}); + guecs::GrabSource grabber{ world_entity, [&, gui_id]() { return remove_slot(gui_id); }}; + grabber.setSprite($gui, gui_id); + $gui.set(gui_id, grabber); } else { auto gui_id = $gui.entity(slot);