QtCraft API C++ classes QML types Handbook

QcServerProjectiles Class

Projectiles in the server tick (decision E-425): the shots of the creatures' brains of this tick (QcMobManager::takeLaunches) become projectiles, then every projectile flies against the blocks and the bodies of creatures and players. More...

Header: #include <server/projectiles/QcServerProjectiles.h>

Public Functions

QcPlayerFishing &fishing()
bool launch(const QcProjectileManager::Launch &shot)
QcPlayerLaunchers &launchers()
void setBlockHit(std::function<void (const QcProjectileManager::BlockHit &)> blockHit)
QcPlayerThrows &throws()
void tick()
void useHeld(QcServerClient &client)

Detailed Description

A hit hurts like a blow (armour, the short invulnerability, knockback along the flight, loot and experience when a player shot); stuck projectiles go to the players that touch them. Players shoot through QcPlayerLaunchers and throw through QcPlayerThrows; what a hit does comes from the kind's onHit (QcHitEffects, E-427). Creatures that dodge projectiles teleport away unhurt, and a projectile that teleports its thrower (a shade pearl) brings them where it breaks (decision E-460); a splash (a splash potion, decision E-624) reaches every living body around the place it breaks. Fishing rods cast and reel in their bobbers through QcPlayerFishing (decision E-503); a projectile without hit effects (a bobber) bounces off bodies unhurt.

Member Function Documentation

QcPlayerFishing &QcServerProjectiles::fishing()

Returns the players' fishing.

bool QcServerProjectiles::launch(const QcProjectileManager::Launch &shot)

Adds shot with a new id; returns false beyond the limit or for an unknown kind.

QcPlayerLaunchers &QcServerProjectiles::launchers()

Returns the players' launchers (bows, crossbows).

void QcServerProjectiles::setBlockHit(std::function<void (const QcProjectileManager::BlockHit &)> blockHit)

Sets blockHit, what a projectile meeting a block does to it (a target block gives a signal; the server wires QcServerCircuits::hitTarget).

QcPlayerThrows &QcServerProjectiles::throws()

Returns the players' throws.

void QcServerProjectiles::tick()

Ends draws whose launcher left the hand, then moves every projectile.

void QcServerProjectiles::useHeld(QcServerClient &client)

The player of client used the use button with an item of QcMsg::ThrowItem in the hand: a fishing rod fishes, anything else is thrown (QcPlayerThrows).