Fixes to worldbuilder to prevent door placement of items and enemies.
This commit is contained in:
parent
d1d7bf8d94
commit
d86617aa3a
1 changed files with 6 additions and 0 deletions
|
|
@ -118,6 +118,10 @@ DinkyECS::Entity WorldBuilder::configure_entity_in_room(DinkyECS::World &world,
|
|||
Point pos_out;
|
||||
bool placed = $map.place_entity(in_room, pos_out);
|
||||
dbc::check(placed, "failed to randomly place item in room");
|
||||
|
||||
// don't place anything inside a door
|
||||
if($map.$doors.contains(pos_out)) return DinkyECS::NONE;
|
||||
|
||||
auto entity = configure_entity_in_map(world, entity_data, pos_out);
|
||||
return entity;
|
||||
}
|
||||
|
|
@ -208,6 +212,7 @@ void WorldBuilder::configure_starting_items(DinkyECS::World &world) {
|
|||
blanket.add(name);
|
||||
};
|
||||
|
||||
// BUG: Starting items should be configured
|
||||
auto torch_id = System::spawn_item(world, "TORCH_BAD");
|
||||
|
||||
auto &inventory = world.get<inventory::Model>(player.entity);
|
||||
|
|
@ -239,6 +244,7 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
|
|||
} else {
|
||||
auto player_data = config.enemies["PLAYER_TILE"];
|
||||
auto player_ent = configure_entity_in_room(world, player_data, 0);
|
||||
dbc::check(player_ent != DinkyECS::NONE, "placed the player in a door!");
|
||||
|
||||
player_pos = world.get<Position>(player_ent);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue