|
|
|
@ -24,6 +24,8 @@ using namespace DinkyECS; |
|
|
|
|
using lighting::LightSource; |
|
|
|
|
|
|
|
|
|
void System::set_position(World& world, SpatialMap& collision, Entity entity, Position pos) { |
|
|
|
|
dbc::check(world.has<Tile>(entity), "entity doesn't have tile"); |
|
|
|
|
|
|
|
|
|
world.set<Position>(entity, pos); |
|
|
|
|
bool has_collision = world.has<Collision>(entity); |
|
|
|
|
collision.insert(pos.location, entity, has_collision); |
|
|
|
@ -146,14 +148,14 @@ void System::distribute_loot(GameLevel &level, Position target_pos) { |
|
|
|
|
if(inventory_count > 0) { |
|
|
|
|
auto pile = ritual::random_junk(config, inventory_count); |
|
|
|
|
|
|
|
|
|
auto entity_data = config.devices["DEAD_BODY_LOOTABLE"]; |
|
|
|
|
auto& entity_data = config.devices["DEAD_BODY_LOOTABLE"]; |
|
|
|
|
components::configure_entity(world, loot_entity, entity_data["components"]); |
|
|
|
|
world.set<ritual::JunkPile>(loot_entity, pile); |
|
|
|
|
// BUG: inventory_count here isn't really used to remove it
|
|
|
|
|
world.set<InventoryItem>(loot_entity, {inventory_count, entity_data}); |
|
|
|
|
} else { |
|
|
|
|
// 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"]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -309,7 +311,7 @@ void System::collision(GameLevel &level) { |
|
|
|
|
void System::remove_from_world(GameLevel &level, Entity entity) { |
|
|
|
|
auto& item_pos = level.world->get<Position>(entity); |
|
|
|
|
level.collision->remove(item_pos.location, entity); |
|
|
|
|
level.world->remove<Tile>(entity); |
|
|
|
|
// level.world->remove<Tile>(entity);
|
|
|
|
|
// if you don't do this you get the bug that you can pickup
|
|
|
|
|
// an item and it'll also be in your inventory
|
|
|
|
|
level.world->remove<Position>(entity); |
|
|
|
|