QtCraft API C++ classes QML types Handbook

QcLauncherDefinition Struct

What an item that shoots projectiles does (a bow, decision E-425): held with the use button down, it draws for up to drawSeconds; released, it shoots the first ammunition of the inventory it takes (decision E-427) at speed times the power of the draw, if the power reached minPower. More...

Header: #include <common/content/items/QcProjectileDefinition.h>

Public Functions

double powerAfter(double seconds) const
bool takes(const QString &name, const QStringList &tags) const

Public Variables

QStringList ammunition
double drawSeconds
bool emptyAmmunitionList
double minPower
double speed

Static Public Members

double shareOf(double power)

Detailed Description

Member Function Documentation

double QcLauncherDefinition::powerAfter(double seconds) const

Returns the power (0..1) of a draw of seconds: the reference's curve (f² + 2f) / 3 of the share f of drawSeconds. Server and client (the animation) use the same.

[static] double QcLauncherDefinition::shareOf(double power)

Returns the share of drawSeconds (0..1) after which a draw reaches power: the inverse of powerAfter's curve, for the view's zoom while drawing (decision E-984).

bool QcLauncherDefinition::takes(const QString &name, const QStringList &tags) const

Returns whether the launcher takes the item name with tags as ammunition, by its list; an empty list takes everything (the caller leaves out throwable items).

Member Variable Documentation

QStringList QcLauncherDefinition::ammunition

What it shoots (decision E-427): item names and item tags as "#tag" (the bow: "#qtcraft:arrows"); empty for every ammunition item that is not throwable (QcThrowableDefinition).

double QcLauncherDefinition::drawSeconds

Seconds of drawing to full power ("drawSeconds", 0.05 to 10).

bool QcLauncherDefinition::emptyAmmunitionList

The file wrote an empty list ("ammunition": []), which means the same as none; the content's finish warns and clears it (QcItemDefinition::settleProjectileUses()).

double QcLauncherDefinition::minPower

Least power a draw needs to shoot ("minPower", 0 to 1).

double QcLauncherDefinition::speed

Launch speed at full power, in m/s ("speed", 1 to QcProjectileDefinition::maxSpeed).