1
0
Fork 0

Restore randomness, and complete section 4.17

This commit is contained in:
Timothy Warren 2021-12-17 11:33:21 -05:00
parent 75d9af0562
commit 2b91cbcc8f
2 changed files with 19 additions and 2 deletions

View File

@ -208,11 +208,18 @@ fn random_room_builder(rng: &mut RandomNumberGenerator, builder: &mut BuilderCha
builder.with(RoomDrawer::new());
// Pick a corridor type
match rng.roll_dice(1, 2) {
match rng.roll_dice(1, 4) {
1 => builder.with(DoglegCorridors::new()),
2 => builder.with(NearestCorridors::new()),
3 => builder.with(StraightLineCorridors::new()),
_ => builder.with(BspCorridors::new()),
};
// Maybe spawn stuff in the corridor
if rng.roll_dice(1, 2) == 1 {
builder.with(CorridorSpawner::new());
}
// Add additional modifier
match rng.roll_dice(1, 6) {
1 => {
@ -300,5 +307,15 @@ pub fn random_builder(new_depth: i32, rng: &mut RandomNumberGenerator) -> Builde
builder.with(PrefabBuilder::vaults());
// builder
// .start_with(SimpleMapBuilder::new())
// .with(RoomDrawer::new())
// .with(RoomSorter::new(RoomSort::LeftMost))
// .with(StraightLineCorridors::new())
// .with(RoomBasedSpawner::new())
// .with(CorridorSpawner::new())
// .with(RoomBasedStairs::new())
// .with(RoomBasedStartingPosition::new());
builder
}

View File

@ -21,7 +21,7 @@ impl CorridorSpawner {
if let Some(corridors) = &build_data.corridors {
for c in corridors.iter() {
let depth = build_data.map.depth;
spawner::spawn_region(&build_data.map, rng, &c, depth, &mut build_data.spawn_list);
spawner::spawn_region(&build_data.map, rng, c, depth, &mut build_data.spawn_list);
}
} else {
panic!("Corridor Based Spawning only works after corridors have been created.");