QtCraft API C++ classes QML types Handbook

QcVillagerSettings Struct

The settings of one villager species (villagers/<name>.json, decision E-411, E-421; server side only): a creature kind with "villager": "<name>" lives by them. More...

Header: #include <common/content/villages/QcVillagerDefinitions.h>

Public Functions

QcVillagerActivity activityAt(double phase, const QString &professionName) const
QcVillagerActivity activityAt(double phase, const QcVillagerProfession *profession = nullptr) const
const QcVillagerProfession *forWorkstation(const QString &kind) const
const QcVillagerProfession *profession(const QString &professionName) const

Public Variables

QcVillagerBreedingSettings breeding
double fleeDistance
QcVillagerLook look
QString name
QList<QcVillagerProfession> professions
QList<QcVillagerRoutineStep> routine
bool shelterFromRain
QcTradingSettings trading
QString unemployed

Static Public Members

const int maxRoutineSteps

Detailed Description

They hold the daily routine, the default look of styles without their own, how villagers keep away from danger, how they trade and breed. professions are all professions of the content (QcContentRegistry::finish fills them in), shared by every species.

Member Function Documentation

QcVillagerActivity QcVillagerSettings::activityAt(double phase, const QString &professionName) const

Returns the activity of a villager of profession professionName at phase.

QcVillagerActivity QcVillagerSettings::activityAt(double phase, const QcVillagerProfession *profession = nullptr) const

Returns the activity at phase (QcDayCycle::phase) by the routine of profession or, when it has none, of the species; Wander without a routine.

const QcVillagerProfession *QcVillagerSettings::forWorkstation(const QString &kind) const

Returns the profession that works at workstations of kind; none for an unknown kind.

const QcVillagerProfession *QcVillagerSettings::profession(const QString &professionName) const

Returns the profession professionName, or nullptr if there is none.

Member Variable Documentation

QcVillagerBreedingSettings QcVillagerSettings::breeding

How its villagers breed ("breeding").

double QcVillagerSettings::fleeDistance

Villagers flee home from hostile creatures within this many blocks.

QcVillagerLook QcVillagerSettings::look

The default look of styles without their own ("look").

const int QcVillagerSettings::maxRoutineSteps

Most steps of a routine.

QString QcVillagerSettings::name

Content name of the species ("name").

QList<QcVillagerProfession> QcVillagerSettings::professions

All professions of the content, filled in by QcContentRegistry::finish.

QList<QcVillagerRoutineStep> QcVillagerSettings::routine

Sorted by from; the last step lasts until the first of the next day.

bool QcVillagerSettings::shelterFromRain

Villagers go home when it rains in the village (at its meeting point's column).

QcTradingSettings QcVillagerSettings::trading

How its villagers trade ("trading").

QString QcVillagerSettings::unemployed

The profession of villagers without a workstation.