QtCraft API C++ classes QML types Handbook

QcVillager Struct

A villager as it lives in the world: its record and what it is doing (not saved; a villager loaded from its chunk decides anew). More...

Header: #include <server/villages/QcVillager.h>
Inherits: QcVillagerRecord

Public Variables

QcVillagerActivity activity
bool arrived
int closeEnough
std::optional<QcBlockPos> crop
int cropLookIn
int decideIn
QcMobLegs::State legs
bool lookChanged
std::optional<QcBlockPos> openedDoor
double panickedAt
bool strolling
std::optional<QcBlockPos> target
std::optional<QcVec3> threat
quint32 trader
QcVec3 traderAt

Detailed Description

QcVillagerBehaviour moves it, QcServerVillagers carries out what it does to the world.

Member Variable Documentation

QcVillagerActivity QcVillager::activity

What it is doing.

bool QcVillager::arrived

At its target (QcVillagerBehaviour::arrive): it stands instead of walking on.

std::optional<QcBlockPos> QcVillager::crop

A ripe crop a farmer walks to.

int QcVillager::cropLookIn

Decisions until a farmer looks for ripe crops again after it found none (QcVillagerBehaviour::cropLookDecisions).

int QcVillager::decideIn

Ticks until it decides again what to do (QcVillagerBehaviour::decideTicks).

QcMobLegs::State QcVillager::legs

On a long walk: the road cell it walks to first, and in water without a path to its target the road cell on land it gets out to first (QcMobLegs along the roads of QcVillagerRoads).

bool QcVillager::lookChanged

Its look changed (a new profession): clients get it again.

std::optional<QcBlockPos> QcVillager::openedDoor

A door it opened on its way and closes once it is through.

double QcVillager::panickedAt

When it last panicked at a hostile creature nearby (world time, negative: not since it was loaded; not saved; decision E-470): a panicking villager among villagers that slept lately summons an iron golem (QcVillageGolems).

std::optional<QcVec3> QcVillager::threat

The place it runs from (a hostile creature) while the creature's fleeTimer runs.