The rituals can now craft from items taken from dead enemies and they go into the blanket right away.

master
Zed A. Shaw 11 months ago
parent 1a9e068d02
commit 9d55b2954a
  1. 2
      combat_ui.cpp
  2. 3
      ritual_ui.cpp
  3. 6
      rituals.cpp
  4. 3
      rituals.hpp

@ -39,7 +39,7 @@ namespace gui {
$gui.world().set_the<Background>({$gui.$parser, ColorValue::DARK_MID}); $gui.world().set_the<Background>({$gui.$parser, ColorValue::DARK_MID});
auto& the_belt = $level.world->get_the<ritual::Belt>(); auto& the_belt = $level.world->get_the<ritual::Belt>();
for(int slot = 0; slot < 4; slot++) { for(int slot = 0; slot < the_belt.max_slots; slot++) {
if(the_belt.has(slot)) { if(the_belt.has(slot)) {
std::string name = fmt::format("button_{}", slot); std::string name = fmt::format("button_{}", slot);
auto& ritual = the_belt.get(slot); auto& ritual = the_belt.get(slot);

@ -105,7 +105,8 @@ namespace gui {
// remove the items from the blanket now // remove the items from the blanket now
auto& the_belt = $level.world->get_the<ritual::Belt>(); auto& the_belt = $level.world->get_the<ritual::Belt>();
the_belt.equip(0, ritual);
the_belt.equip(the_belt.next(), ritual);
$level.world->send<Events::GUI>(Events::GUI::NEW_RITUAL, $level.player, {}); $level.world->send<Events::GUI>(Events::GUI::NEW_RITUAL, $level.player, {});
reset_inv_positions(); reset_inv_positions();

@ -130,6 +130,12 @@ namespace ritual {
equipped.erase(index); equipped.erase(index);
} }
int Belt::next() {
int slot = next_slot % max_slots;
next_slot++;
return slot;
}
DinkyECS::Entity Blanket::add(JunkItem name) { DinkyECS::Entity Blanket::add(JunkItem name) {
auto ent = contents.entity(); auto ent = contents.entity();
contents.set(ent, name); contents.set(ent, name);

@ -62,12 +62,15 @@ namespace ritual {
}; };
struct Belt { struct Belt {
int next_slot = 0;
int max_slots = 6;
std::unordered_map<int, Action> equipped; std::unordered_map<int, Action> equipped;
Action& get(int index); Action& get(int index);
void equip(int index, Action& action); void equip(int index, Action& action);
bool has(int index); bool has(int index);
void unequip(int index); void unequip(int index);
int next();
}; };
using JunkItem = std::string; using JunkItem = std::string;