Dungen

class DungeonGenerator(rng: 'random.Random', map_data: 'MapData', rooms_data: 'Dict[str, RoomConceptData]' = <factory>, actors_data: 'Dict[str, ActorData]' = <factory>, placed_rooms: 'List[RoomConcept]' = <factory>, map_of_categories: 'List[List[TileCategoryType]]' = <factory>, positions_in_rooms: 'List[Tuple[int, int]]' = <factory>, _passable_map: 'List[List[Literal[True]]]' = <factory>, _bools_map: 'List[List[bool]]' = <factory>, _tiles_map: 'List[List[Tile]]' = <factory>, is_dirty: 'bool' = False)[source]

Bases: object

property bools_map

Returns an array of bools by converting values from map_of_categories to bool. Floor == True, Wall == False.

count_adjacent_walls(x: int, y: int)int[source]

Get the number of walls in 4 directions.

count_neighbouring_walls(x: int, y: int)int[source]

Get the number of walls in 8 directions.

create_entities()[source]

Create all entities listed in rooms

get_actor_data(key: str)scripts.engine.internal.definition.ActorData[source]

Get the data for an actor based on key.

get_room(x: int, y: int)Optional[RoomConcept][source]

Returns the room at xy.

get_room_data(key: str)scripts.engine.internal.definition.RoomConceptData[source]

Get the data for a room based on key.

is_in_border(x: int, y: int)[source]

Check if a position is in the border of the map

is_in_bounds(x: int, y: int)[source]

Check if a position is in the bounds of the map

is_in_room(x: int, y: int)bool[source]

Check if a position is in a placed room.

is_only_accessible_diagonally(x: int, y: int)bool[source]

Checks if a tile is only accessible via a diagonal move.

property passable_map

2d array of True, matching map size

set_tile_category(x: int, y: int, category: TileCategoryType)[source]

Set the tile category at xy in map_of_categories. Marks map as dirty

property tiles_map

Returns an array of Tiles by converting values from map_of_categories to tiles.

class RoomConcept(tile_categories: List[List[TileCategoryType]], design: str, key: str, start_x: int = -1, start_y: int = -1, actors: Dict[str, Tuple[int, int]] = <factory>)[source]

Bases: object

Details of a room. Used for world generation.

property available_area

Number of unblocked tiles.

property generation_info

Return the generation information about the room

property height

Tallest height

property id

Return the id. Uses xy.

intersects(room: scripts.engine.core.dungen.RoomConcept)bool[source]

Check if this room intersects with another.

property total_area

Number of tiles in room.

property width

Widest width.

generate(map_name: str, rng: random.Random, player_data: Optional[ActorData] = None)Tuple[List[List[Tile]], str][source]

Generate the map using the specified details.

generate_steps(map_name: str)Iterator[source]

Generates a map, returning each step of the generation. Used for dev view.