|
|
@ -146,22 +146,19 @@ void System::distribute_loot(GameLevel &level, Position target_pos) { |
|
|
|
if(inventory_count > 0) { |
|
|
|
if(inventory_count > 0) { |
|
|
|
auto pile = ritual::random_junk(config, inventory_count); |
|
|
|
auto pile = ritual::random_junk(config, inventory_count); |
|
|
|
|
|
|
|
|
|
|
|
auto entity_data = config.devices["GRAVE_STONE"]; |
|
|
|
auto entity_data = config.devices["DEAD_BODY_LOOTABLE"]; |
|
|
|
components::configure_entity(world, loot_entity, entity_data["components"]); |
|
|
|
components::configure_entity(world, loot_entity, entity_data["components"]); |
|
|
|
world.set<ritual::JunkPile>(loot_entity, pile); |
|
|
|
world.set<ritual::JunkPile>(loot_entity, pile); |
|
|
|
// BUG: inventory_count here isn't really used to remove it
|
|
|
|
// BUG: inventory_count here isn't really used to remove it
|
|
|
|
world.set<InventoryItem>(loot_entity, {inventory_count, entity_data}); |
|
|
|
world.set<InventoryItem>(loot_entity, {inventory_count, entity_data}); |
|
|
|
|
|
|
|
|
|
|
|
set_position(world, *level.collision, loot_entity, target_pos); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
level.world->send<Events::GUI>(Events::GUI::ENTITY_SPAWN, loot_entity, {}); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// this creates a dead body on the ground
|
|
|
|
// this creates a dead body on the ground
|
|
|
|
auto entity_data = config.devices["DEAD_BODY"]; |
|
|
|
auto entity_data = config.devices["DEAD_BODY"]; |
|
|
|
components::configure_entity(world, loot_entity, entity_data["components"]); |
|
|
|
components::configure_entity(world, loot_entity, entity_data["components"]); |
|
|
|
set_position(world, *level.collision, loot_entity, target_pos); |
|
|
|
|
|
|
|
level.world->send<Events::GUI>(Events::GUI::ENTITY_SPAWN, loot_entity, {}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_position(world, *level.collision, loot_entity, target_pos); |
|
|
|
|
|
|
|
level.world->send<Events::GUI>(Events::GUI::ENTITY_SPAWN, loot_entity, {}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void System::death(GameLevel &level) { |
|
|
|
void System::death(GameLevel &level) { |
|
|
|