Have a plan for the new inventory and looting system, now have to implement it. Temporarily you can't pick anything up, but it will go away.
This commit is contained in:
parent
b8d2d1870d
commit
ab391aaa97
9 changed files with 23 additions and 261 deletions
|
@ -1,5 +1,4 @@
|
|||
#include "autowalker.hpp"
|
||||
#include "inventory.hpp"
|
||||
#include "ai_debug.hpp"
|
||||
#include "gui/ritual_ui.hpp"
|
||||
|
||||
|
@ -344,31 +343,12 @@ bool Autowalker::player_health_good() {
|
|||
}
|
||||
|
||||
InventoryStats Autowalker::player_item_count() {
|
||||
auto& inventory = fsm.$level.world->get<components::Inventory>(fsm.$level.player);
|
||||
InventoryStats stats;
|
||||
|
||||
for(auto& item : inventory.items) {
|
||||
if(item.data["id"] == "POTION_HEALING_SMALL") {
|
||||
stats.healing += item.count;
|
||||
} else {
|
||||
stats.other += item.count;
|
||||
}
|
||||
}
|
||||
|
||||
stats.healing = 0;
|
||||
return stats;
|
||||
}
|
||||
|
||||
void Autowalker::player_use_healing() {
|
||||
auto& inventory = fsm.$level.world->get<components::Inventory>(fsm.$level.player);
|
||||
// find the healing slot
|
||||
for(size_t slot = 0; slot < inventory.count(); slot++) {
|
||||
auto& item = inventory.get(slot);
|
||||
if(item.data["id"] == "POTION_HEALING_SMALL") {
|
||||
inventory.use(fsm.$level, slot);
|
||||
fsm.$status_ui.update();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Autowalker::start_autowalk() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue