Cleaned up the move operation more so that I can use it in the other places that I need it.

This commit is contained in:
Zed A. Shaw 2025-06-24 13:23:55 -04:00
parent f559b5a39d
commit 6ff1919587
5 changed files with 52 additions and 8 deletions

View file

@ -509,12 +509,14 @@ bool System::drop_item(GameLevel& level, Entity item) {
for(matrix::box it{map.walls(), player_pos.location.x, player_pos.location.y, 1}; it.next();)
{
Position pos{it.x, it.y};
if(map.can_move(pos.location) && !collision.occupied(pos.location)) {
world.set<Position>(item, pos);
collision.insert(pos.location, item);
// BUG: really there should be another system that handles loot->inv moves
if(player_inv.has(item)) player_inv.remove(item);
level.world->send<Events::GUI>(Events::GUI::ENEMY_SPAWN, item, {});
level.world->not_constant(item);
return true;
}
}