|
|
|
@ -144,20 +144,7 @@ void System::distribute_loot(GameLevel &level, Position target_pos) { |
|
|
|
|
auto loot_entity = world.entity(); |
|
|
|
|
|
|
|
|
|
if(inventory_count > 0) { |
|
|
|
|
// this means the entity dropped loot, so make a lootable tombstone
|
|
|
|
|
ritual::JunkPile pile; |
|
|
|
|
auto& junk = config.rituals["junk"]; |
|
|
|
|
|
|
|
|
|
ritual::JunkPile select_from; |
|
|
|
|
for(auto& el : junk.items()) { |
|
|
|
|
select_from.contents.push_back(el.key()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for(int i = 0; i < inventory_count; i++) { |
|
|
|
|
size_t max_junk = select_from.contents.size(); |
|
|
|
|
auto& item = select_from.contents.at(Random::uniform(size_t(0), max_junk-1)); |
|
|
|
|
pile.contents.push_back(item); |
|
|
|
|
} |
|
|
|
|
auto pile = ritual::random_junk(config, inventory_count); |
|
|
|
|
|
|
|
|
|
auto entity_data = config.devices["GRAVE_STONE"]; |
|
|
|
|
components::configure_entity(world, loot_entity, entity_data["components"]); |
|
|
|
|