pub trait DungeonFloorGeneration {
    type EntityGenerator: DungeonEntityGeneration;
    type LayoutGenerator: ?Sized;

    // Required methods
    fn generate_floor(
        &mut self,
        width: usize,
        height: usize,
        properties: &floor_properties
    ) -> &mut Self;
    fn generate_layout(
        &mut self,
        layout: &mut Self::LayoutGenerator,
        properties: &floor_properties
    ) -> &mut Self;
    fn entities<F: FnOnce(&mut Self::EntityGenerator)>(
        &mut self,
        cb: F
    ) -> &mut Self;
    fn generate(self, global_dungeon: &mut GlobalDungeonData<'_>);
}
Expand description

High-level trait for generating new dungeons and replacing the current global dungeon.

Required Associated Types§

Required Methods§

source

fn generate_floor( &mut self, width: usize, height: usize, properties: &floor_properties ) -> &mut Self

Generates a floor using the specified floor properties. This will create a fully working layout, including entities.

Whether a fixed floor or a floor using a layout is generated is taken from the properties.

source

fn generate_layout( &mut self, layout: &mut Self::LayoutGenerator, properties: &floor_properties ) -> &mut Self

Generates a floor using the specified layout. This will create a fully working layout.

Entities are not spawned.

source

fn entities<F: FnOnce(&mut Self::EntityGenerator)>( &mut self, cb: F ) -> &mut Self

Generate entities, the callback will receive Self::EntityGenerator to generate them.

Implementors

Implementations must call cb.

source

fn generate(self, global_dungeon: &mut GlobalDungeonData<'_>)

Write the finished generated dungeon to the global dungeon struct.

Important: For the builtin generator, see the note at game_builtin::GlobalDungeonStructureGenerator::generate.

Implementors§