Complete section 4.14
This commit is contained in:
parent
ee5e690180
commit
8249622a3e
@ -149,19 +149,60 @@ pub trait MetaMapBuilder {
|
||||
fn build_map(&mut self, rng: &mut RandomNumberGenerator, build_data: &mut BuilderMap);
|
||||
}
|
||||
|
||||
fn random_initial_builder(rng: &mut RandomNumberGenerator) -> (Box<dyn InitialMapBuilder>, bool) {
|
||||
match rng.roll_dice(1, 17) {
|
||||
1 => (BspDungeonBuilder::new(), true),
|
||||
2 => (BspInteriorBuilder::new(), true),
|
||||
3 => (CellularAutomataBuilder::new(), false),
|
||||
4 => (DrunkardsWalkBuilder::open_area(), false),
|
||||
5 => (DrunkardsWalkBuilder::open_halls(), false),
|
||||
6 => (DrunkardsWalkBuilder::winding_passages(), false),
|
||||
7 => (DrunkardsWalkBuilder::fat_passages(), false),
|
||||
8 => (DrunkardsWalkBuilder::fearful_symmetry(), false),
|
||||
9 => (MazeBuilder::new(), false),
|
||||
10 => (DLABuilder::walk_inwards(), false),
|
||||
11 => (DLABuilder::walk_outwards(), false),
|
||||
12 => (DLABuilder::central_attractor(), false),
|
||||
13 => (DLABuilder::insectoid(), false),
|
||||
14 => (VoronoiCellBuilder::pythagoras(), false),
|
||||
15 => (VoronoiCellBuilder::manhattan(), false),
|
||||
16 => (
|
||||
PrefabBuilder::constant(prefab_builder::prefab_levels::WFC_POPULATED),
|
||||
false,
|
||||
),
|
||||
_ => (SimpleMapBuilder::new(), true),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn random_builder(new_depth: i32, rng: &mut RandomNumberGenerator) -> BuilderChain {
|
||||
let mut builder = BuilderChain::new(new_depth);
|
||||
builder
|
||||
.start_with(VoronoiCellBuilder::pythagoras())
|
||||
.with(WaveformCollapseBuilder::new())
|
||||
.with(PrefabBuilder::vaults())
|
||||
.with(AreaStartingPosition::new(XStart::Center, YStart::Center))
|
||||
.with(CullUnreachable::new())
|
||||
.with(VoronoiSpawning::new())
|
||||
.with(PrefabBuilder::sectional(
|
||||
let (random_starter, has_rooms) = random_initial_builder(rng);
|
||||
builder.start_with(random_starter);
|
||||
|
||||
if has_rooms {
|
||||
builder
|
||||
.with(RoomBasedSpawner::new())
|
||||
.with(RoomBasedStairs::new())
|
||||
.with(RoomBasedStartingPosition::new());
|
||||
} else {
|
||||
builder
|
||||
.with(AreaStartingPosition::new(XStart::Center, YStart::Center))
|
||||
.with(CullUnreachable::new())
|
||||
.with(VoronoiSpawning::new())
|
||||
.with(DistantExit::new());
|
||||
}
|
||||
|
||||
if rng.roll_dice(1, 3) == 1 {
|
||||
builder.with(WaveformCollapseBuilder::new());
|
||||
}
|
||||
|
||||
if rng.roll_dice(1, 20) == 1 {
|
||||
builder.with(PrefabBuilder::sectional(
|
||||
prefab_builder::prefab_sections::UNDERGROUND_FORT,
|
||||
))
|
||||
.with(DistantExit::new());
|
||||
));
|
||||
}
|
||||
|
||||
builder.with(PrefabBuilder::vaults());
|
||||
|
||||
builder
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user