Prep for fixing the spatialmap to allow for entities without collision to still be in the space.
This commit is contained in:
parent
d93bc1615c
commit
fd53f92fe6
7 changed files with 27 additions and 53 deletions
|
@ -69,7 +69,7 @@ bool WorldBuilder::find_open_spot(Point& pos_out) {
|
|||
for(matrix::rando_box it{$map.walls(), pos_out.x, pos_out.y, i}; it.next();) {
|
||||
Point test{size_t(it.x), size_t(it.y)};
|
||||
|
||||
if($map.can_move(test) && !$collision.occupied(test)) {
|
||||
if($map.can_move(test) && !$collision->occupied(test)) {
|
||||
pos_out = test;
|
||||
return true;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ DinkyECS::Entity WorldBuilder::configure_entity_in_map(DinkyECS::World &world, j
|
|||
components::configure_entity(world, item, entity_data["components"]);
|
||||
}
|
||||
|
||||
$collision.insert(pos, item);
|
||||
$collision->insert(pos, item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
@ -224,14 +224,6 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
|
|||
dbc::check(player_pos.location.x != 0 && player_pos.location.y != 0,
|
||||
"failed to place the player correctly");
|
||||
|
||||
// make a dead zone around the player
|
||||
auto& player = world.get_the<Player>();
|
||||
for(matrix::box it{$map.walls(), player_pos.location.x, player_pos.location.y, 2};
|
||||
it.next();)
|
||||
{
|
||||
$collision.insert({it.x, it.y}, player.entity);
|
||||
}
|
||||
|
||||
randomize_entities(world, config);
|
||||
place_stairs(world, config);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue