QcCoastalTowerPlanner Class
Plans the coastal tower of a region (decision E-605) from the seed and the terrain noise: whether the region has one (chance), which structure by weight, and a site on land at the coast. More...
| Header: | #include <worldgen/towers/QcCoastalTowerPlanner.h> |
Public Functions
| QcCoastalTowerPlanner(const QcTerrainGenerator &terrain, const QcContentRegistry &content, quint64 seed) | |
| std::optional<int> | coastTop(int x, int z) const |
| bool | enabled() const |
| QcBlockId | foundation() const |
| bool | isOcean(int x, int z) const |
| std::shared_ptr<const QcCoastalTowerPlan> | plan(int regionX, int regionZ) const |
| double | priority(int regionX, int regionZ) const |
| const QcCoastalTowerSettings & | settings() const |
| const QStringList & | warnings() const |
Detailed Description
Sites are the columns of a grid over the region whose ground lies at a tower's height, tried in a random order: the ground under the whole footprint lies at that height without caves and level enough, the door opens onto ground at most one block below or above the floor, the open sea lies within coastDistance blocks, and no village, mine shaft entrance or surface structure (QcSurfaceStructures) lies within clearance blocks. The tower stays inside its region. Thread-safe: plan() only reads immutable state.
Member Function Documentation
QcCoastalTowerPlanner::QcCoastalTowerPlanner(const QcTerrainGenerator &terrain, const QcContentRegistry &content, quint64 seed)
Plans with the settings of content (coastalTowers) over the noise of terrain, seeded from seed. Unresolvable structures or blocks are left out with a warning (warnings()); without a structure or the foundation block, towers are off.
std::optional<int> QcCoastalTowerPlanner::coastTop(int x, int z) const
Returns the ground's top at the column x, z where it lies at a tower's height (from sea level up to maxRise above it, no overhang, no cave at the top, not in a river delta's biome); std::nullopt elsewhere.
bool QcCoastalTowerPlanner::enabled() const
Returns whether towers are planned: enabled in the settings with a known foundation block and at least one structure that fits the region.
QcBlockId QcCoastalTowerPlanner::foundation() const
Returns the block state that fills the ground under a tower.
bool QcCoastalTowerPlanner::isOcean(int x, int z) const
Returns whether the column x, z belongs to the open sea: land factor below one half, the ground at least oceanDepth blocks below the water's surface.
std::shared_ptr<const QcCoastalTowerPlan> QcCoastalTowerPlanner::plan(int regionX, int regionZ) const
Returns the tower of the region regionX, regionZ before the spacing to the neighbouring regions' (QcCoastalTowerGenerator applies minDistance); null without one.
double QcCoastalTowerPlanner::priority(int regionX, int regionZ) const
Returns the rank of the region regionX, regionZ when two towers come closer than minDistance (decision E-857): the one of the region with the higher priority stays.
const QcCoastalTowerSettings &QcCoastalTowerPlanner::settings() const
Returns the coastal tower settings of the content.
const QStringList &QcCoastalTowerPlanner::warnings() const
Returns the problems found while resolving the settings' structures and blocks.