QtCraft API C++ classes QML types Handbook

QcServerAnimals Class

Players feeding animals and the births that follow (decision E-293): food from the hand makes an animal fall in love or a young one grow faster, two animals in love in sight of each other get a young one (QcMobBreeding), which is kept with the world. More...

Header: #include <server/animals/QcServerAnimals.h>

Public Types

enum class Feeding { NotItsFood, Refused, Fed }

Public Functions

QcServerAnimals::Feeding feed(QcServerClient &client, quint32 mobId)
bool milk(QcServerClient &client, quint32 mobId)
bool tend(QcServerClient &client, quint32 mobId)
void tick()

Static Public Members

bool mayRelease(QcServerState &state, const QcItemDefinition &item, const QcVec3 &position)
void release(QcServerState &state, const QcItemDefinition &item, const QcVec3 &position)
QcVec3 releasePoint(QcBlockPos cell)
QcAabb shownBox(const QcMobDefinition &definition, const QcCreature &mob)
quint32 spawnYoung(QcServerState &state, QcCreatureKindId type, const QcVec3 &position)

Detailed Description

Member Type Documentation

enum class QcServerAnimals::Feeding

What came of feeding a creature.

ConstantValueDescription
QcServerAnimals::Feeding::NotItsFood0The creature does not eat the held item at all.
QcServerAnimals::Feeding::Refused1It eats it, but not now (in love, resting) or is out of reach or hidden: nothing happens.
QcServerAnimals::Feeding::Fed2It ate the item.

Member Function Documentation

QcServerAnimals::Feeding QcServerAnimals::feed(QcServerClient &client, quint32 mobId)

Feeds the creature mobId with the item held by the player of client when it eats that (in love or growing up) and returns what came of it.

[static] bool QcServerAnimals::mayRelease(QcServerState &state, const QcItemDefinition &item, const QcVec3 &position)

Returns whether the creature a fish bucket item holds (QcItemDefinition::releasesMob, decision E-501) may come out in state at position, within the same limits as births; true for an item that holds none. A bucket whose creature may not come out stays full.

bool QcServerAnimals::milk(QcServerClient &client, quint32 mobId)

Milks the grown creature mobId with the milking item held by the player of client (a cow and a bucket, decision E-500): one of the items becomes QcMobDefinition::milkItem. Returns false when the held item does not milk it.

[static] void QcServerAnimals::release(QcServerState &state, const QcItemDefinition &item, const QcVec3 &position)

Lets the creature of item out in state at position, kept with the world and counted as bred.

[static] QcVec3 QcServerAnimals::releasePoint(QcBlockPos cell)

Returns where the creature of a bucket poured into the cell cell comes out.

[static] QcAabb QcServerAnimals::shownBox(const QcMobDefinition &definition, const QcCreature &mob)

Returns the box players see and aim at of mob of the kind definition: young animals at QcMsg::youngScale (collision stays adult).

[static] quint32 QcServerAnimals::spawnYoung(QcServerState &state, QcCreatureKindId type, const QcVec3 &position)

Spawns in state a young one of type at position that is kept with the world (an egg's chick, decision E-450), within the same limits as births (QcServerLimits breedingCrowd, bredPerKind); returns its id, 0 when there is no room.

bool QcServerAnimals::tend(QcServerClient &client, quint32 mobId)

Taming, sitting, healing and collars of the tameable creature mobId by the player of client (QcPetCare, decision E-480); returns false when the use is none of these.

void QcServerAnimals::tick()

Breeding timers, births and laid eggs of one simulated tick.