QtCraft API C++ classes QML types Handbook

QcMobFear Namespace

What frightens a creature away (decision E-480): a shy one (QcMobDefinition::shy, the ocelot) flees from players who come close unless they hold its food and move slowly; one scared of cats (QcMobDefinition::scaredOfCats) flees from creatures that frighten (cats). More...

Header: #include <server/mobbrains/QcMobFear.h>

Variables

const double catDistance

Functions

std::optional<QcVec3> away(const QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context)
bool calms(const QcMobManager::PlayerView &player, const QcShyDefinition &shy, const QcContentRegistry &content)

Detailed Description

Variable Documentation

const double QcMobFear::catDistance

How close a creature that frightens (a cat) scares one that is scared of cats, in metres.

Function Documentation

std::optional<QcVec3> QcMobFear::away(const QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context)

Returns the horizontal direction away from the nearest thing that frightens mob of the kind definition now in the tick of context (normalized); none when nothing does.

bool QcMobFear::calms(const QcMobManager::PlayerView &player, const QcShyDefinition &shy, const QcContentRegistry &content)

Returns whether player calms a shy creature of shy: holding one of its calm items (item names in content) and moving no faster than its calm speed.