Prep for fixing the spatialmap to allow for entities without collision to still be in the space.

This commit is contained in:
Zed A. Shaw 2025-07-29 02:13:29 -04:00
parent d93bc1615c
commit fd53f92fe6
7 changed files with 27 additions and 53 deletions

View file

@ -106,24 +106,6 @@ void System::enemy_pathing(GameLevel &level) {
map.clear_target(player_position.location);
}
void System::init_positions(World &world, SpatialMap &collider) {
auto player = world.get_the<Player>();
auto& inv = world.get<inventory::Model>(player.entity);
world.query<Position>([&](auto ent, auto &pos) {
if(world.has<Combat>(ent)) {
const auto& combat = world.get<Combat>(ent);
if(!combat.dead) {
collider.insert(pos.location, ent);
}
} else {
dbc::check(!inv.has(ent),
fmt::format("!!! Entity {} is in player inventory and _also_ has a position in the world.", ent));
collider.insert(pos.location, ent);
}
});
}
inline void move_entity(SpatialMap &collider, Map &game_map, Position &position, Motion &motion, Entity ent) {
Point move_to = {