QtCraft API C++ classes QML types Handbook

QcDungeonPlan Struct

One dungeon as the terrain generator builds it (decision E-522): a pure function of the seed, the region and the content, planned from the terrain noise alone (never from generated chunks), so every chunk writes its own cells of it and a dungeon spanning chunks comes out the same in any generation order (QcDungeonGenerator::build). More...

Header: #include <worldgen/dungeons/QcDungeonPlan.h>

Public Types

struct Corridor

Public Functions

void bound()
int distanceToArea(QcBlockPos pos) const
bool inRoom(QcBlockPos pos) const
bool touches(int x0, int z0, int x1, int z1) const

Public Variables

QcBlockPos areaHigh
QcBlockPos areaLow
QList<QcPlacedBlock> chests
QList<QcDungeonPlan::Corridor> corridors
QList<QcPlacedBlock> lights
QList<QcBlockPos> lining
int maxX
int maxZ
int minX
int minZ
QString mob
QcBlockPos origin
int regionX
int regionZ
int sizeX
int sizeY
int sizeZ
QcBlockPos spawner

Detailed Description

Member Function Documentation

void QcDungeonPlan::bound()

Sets the columns the plan touches from its room, its corridors and their lining, and one column more around every corridor cell, where liquid beside the path is sealed (the cave end has no lining; a pool across a chunk edge from it is sealed by the neighbouring chunk, which must run the plan too).

int QcDungeonPlan::distanceToArea(QcBlockPos pos) const

Returns the taxicab distance from pos to the nearest cell of the spawn area.

bool QcDungeonPlan::inRoom(QcBlockPos pos) const

Returns whether pos lies in the room (walls included).

bool QcDungeonPlan::touches(int x0, int z0, int x1, int z1) const

Returns whether the columns x0 to x1, z0 to z1 (inclusive) share a column with the plan's bounds (bound()).

Member Variable Documentation

QList<QcPlacedBlock> QcDungeonPlan::chests

The chests against the room's walls, facing into the room.

QList<QcDungeonPlan::Corridor> QcDungeonPlan::corridors

The corridors from the room to caves.

QList<QcPlacedBlock> QcDungeonPlan::lights

The lights on the corridors' walls.

QList<QcBlockPos> QcDungeonPlan::lining

Cells next to the corridors (floor, ceiling, sides) that get a wall block where they are not rock; none of them lies in the room or in a corridor.

QString QcDungeonPlan::mob

The creature the spawner brings forth, drawn by the settings' weights.

int QcDungeonPlan::regionX

The x of the region it was planned for.

int QcDungeonPlan::regionZ

The z of the region it was planned for.

QcBlockPos QcDungeonPlan::spawner

The spawner's cell: the middle of the room, one above its floor layer.