This is the cause of the bug where going to the next level caused things to disappear. What happened is that on next level this code was adding the player but _not_ adding them to collision. Then when the player moved the spatialmap would remove them, see they're technically 'no collision' and then add them back in without collision.
This commit is contained in:
parent
e51fb8627c
commit
569d04725a
2 changed files with 6 additions and 1 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.something_there(test)) {
|
||||
pos_out = test;
|
||||
return true;
|
||||
}
|
||||
|
@ -210,6 +210,7 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
|
|||
dbc::check(placed, "WorldBuild.find_open_spot also failed to position player");
|
||||
|
||||
world.set<Position>(player.entity, player_pos);
|
||||
$collision.insert(player_pos.location, player.entity, true);
|
||||
} else {
|
||||
auto player_data = config.enemies["PLAYER_TILE"];
|
||||
auto player_ent = configure_entity_in_room(world, player_data, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue